File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -514,6 +514,10 @@ export default {
514514 session,
515515 onCreate : ({ editor }) => {
516516 this .$syncService .startSync ()
517+ const proseMirrorMarkdown = this .$syncService .serialize (editor .state .doc )
518+ this .emit (' create:content' , {
519+ markdown: proseMirrorMarkdown,
520+ })
517521 },
518522 onUpdate : ({ editor }) => {
519523 // this.debugContent(editor)
Original file line number Diff line number Diff line change @@ -36,6 +36,13 @@ class TextEditorEmbed {
3636 return this . #vm. $children [ 0 ]
3737 }
3838
39+ onCreate ( onCreateCallback = ( ) => { } ) {
40+ this . #vm. $on ( 'create:content' , ( content ) => {
41+ onCreateCallback ( content )
42+ } )
43+ return this
44+ }
45+
3946 onLoaded ( onLoadedCallback = ( ) => { } ) {
4047 this . #vm. $on ( 'ready' , ( ) => {
4148 onLoadedCallback ( )
@@ -153,6 +160,7 @@ window.OCA.Text.createEditor = async function({
153160 props : null ,
154161 } ,
155162
163+ onCreate = ( { markdown } ) => { } ,
156164 onLoaded = ( ) => { } ,
157165 onUpdate = ( { markdown } ) => { } ,
158166 onOutlineToggle = ( visible ) => { } ,
@@ -231,6 +239,7 @@ window.OCA.Text.createEditor = async function({
231239 store,
232240 } )
233241 return new TextEditorEmbed ( vm , data )
242+ . onCreate ( onCreate )
234243 . onLoaded ( onLoaded )
235244 . onUpdate ( onUpdate )
236245 . onOutlineToggle ( onOutlineToggle )
You can’t perform that action at this time.
0 commit comments