@@ -31,16 +31,17 @@ import Underline from '@editorjs/underline'
3131import Warning from ' @editorjs/warning'
3232import Hyperlink from ' editorjs-hyperlink'
3333import Style from ' editorjs-style'
34- import Undo from ' editorjs-undo'
3534
3635import Media from ' ../../classes/media'
3736
3837export default {
39- mixins: [ Field ],
40- data () { return {
41- editor: null ,
42- data: this .value || {}
43- }},
38+ mixins: [Field],
39+ data () {
40+ return {
41+ editor: null ,
42+ data: this .value || {}
43+ }
44+ },
4445 created () {
4546 const self = this
4647
@@ -49,8 +50,11 @@ export default {
4950 holder: self .name + ' _' + self .locale ,
5051 data: self .data ,
5152 onReady () {
52- const undo = new Undo ({ editor })
53- undo .initialize (self .data )
53+ Event .$on (' editor-content-updated' , function (data ) {
54+ editor .save ().then (savedData => {
55+ self .$emit (' input' , savedData)
56+ })
57+ })
5458 },
5559 onChange () {
5660 editor .save ().then (savedData => {
@@ -120,67 +124,69 @@ export default {
120124 hyperlink: Hyperlink,
121125 style: Style
122126 },
123- i18n: { messages: {
124- toolNames: {
125- ' Text' : self .$root .trans .get (' foundation::general.e_text' ),
126- ' Heading' : self .$root .trans .get (' foundation::general.e_heading' ),
127- ' Quote' : self .$root .trans .get (' foundation::general.e_quote' ),
128- ' List' : self .$root .trans .get (' foundation::general.e_list' ),
129- ' Checklist' : self .$root .trans .get (' foundation::general.e_checklist' ),
130- ' Delimiter' : self .$root .trans .get (' foundation::general.e_delimiter' ),
131- ' Media' : self .$root .trans .get (' foundation::general.e_media' ),
132- ' Image' : self .$root .trans .get (' foundation::general.e_image' ),
133- ' Embed' : self .$root .trans .get (' foundation::general.e_embed' ),
134- ' Table' : self .$root .trans .get (' foundation::general.e_table' ),
135- ' Warning' : self .$root .trans .get (' foundation::general.e_warning' ),
136- ' Code' : self .$root .trans .get (' foundation::general.e_code' ),
137- ' Raw HTML' : self .$root .trans .get (' foundation::general.e_raw' ),
138- ' InlineCode' : self .$root .trans .get (' foundation::general.e_inlinecode' ),
139- ' Marker' : self .$root .trans .get (' foundation::general.e_marker' ),
140- ' Underline' : self .$root .trans .get (' foundation::general.e_underline' ),
141- ' Hyperlink' : self .$root .trans .get (' foundation::general.e_hyperlink' ),
142- ' Style' : self .$root .trans .get (' foundation::general.e_style' ),
143- ' Bold' : self .$root .trans .get (' foundation::general.e_bold' ),
144- ' Italic' : self .$root .trans .get (' foundation::general.e_italic' )
145- },
146- ui: {
147- ' blockTunes' : {
148- ' toggler' : {
149- ' Click to tune' : self .$root .trans .get (' foundation::general.e_click_to_tune' ),
150- ' Move up' : self .$root .trans .get (' foundation::general.e_moveup' ),
151- ' Move down' : self .$root .trans .get (' foundation::general.e_movedown' ),
152- }
127+ i18n: {
128+ messages: {
129+ toolNames: {
130+ ' Text' : self .$root .trans .get (' foundation::general.e_text' ),
131+ ' Heading' : self .$root .trans .get (' foundation::general.e_heading' ),
132+ ' Quote' : self .$root .trans .get (' foundation::general.e_quote' ),
133+ ' List' : self .$root .trans .get (' foundation::general.e_list' ),
134+ ' Checklist' : self .$root .trans .get (' foundation::general.e_checklist' ),
135+ ' Delimiter' : self .$root .trans .get (' foundation::general.e_delimiter' ),
136+ ' Media' : self .$root .trans .get (' foundation::general.e_media' ),
137+ ' Image' : self .$root .trans .get (' foundation::general.e_image' ),
138+ ' Embed' : self .$root .trans .get (' foundation::general.e_embed' ),
139+ ' Table' : self .$root .trans .get (' foundation::general.e_table' ),
140+ ' Warning' : self .$root .trans .get (' foundation::general.e_warning' ),
141+ ' Code' : self .$root .trans .get (' foundation::general.e_code' ),
142+ ' Raw HTML' : self .$root .trans .get (' foundation::general.e_raw' ),
143+ ' InlineCode' : self .$root .trans .get (' foundation::general.e_inlinecode' ),
144+ ' Marker' : self .$root .trans .get (' foundation::general.e_marker' ),
145+ ' Underline' : self .$root .trans .get (' foundation::general.e_underline' ),
146+ ' Hyperlink' : self .$root .trans .get (' foundation::general.e_hyperlink' ),
147+ ' Style' : self .$root .trans .get (' foundation::general.e_style' ),
148+ ' Bold' : self .$root .trans .get (' foundation::general.e_bold' ),
149+ ' Italic' : self .$root .trans .get (' foundation::general.e_italic' )
153150 },
154- ' inlineToolbar' : {
155- ' converter' : {
156- ' Convert to' : self .$root .trans .get (' foundation::general.e_convert_to' )
151+ ui: {
152+ ' blockTunes' : {
153+ ' toggler' : {
154+ ' Click to tune' : self .$root .trans .get (' foundation::general.e_click_to_tune' ),
155+ ' Move up' : self .$root .trans .get (' foundation::general.e_moveup' ),
156+ ' Move down' : self .$root .trans .get (' foundation::general.e_movedown' ),
157+ }
158+ },
159+ ' inlineToolbar' : {
160+ ' converter' : {
161+ ' Convert to' : self .$root .trans .get (' foundation::general.e_convert_to' )
162+ }
163+ },
164+ ' toolbar' : {
165+ ' toolbox' : {
166+ ' Add' : self .$root .trans .get (' foundation::general.add' )
167+ }
157168 }
158169 },
159- ' toolbar' : {
160- ' toolbox' : {
161- ' Add' : self .$root .trans .get (' foundation::general.add' )
170+ blockTunes: {
171+ ' delete' : {
172+ ' Delete' : self .$root .trans .get (' foundation::general.delete' )
173+ },
174+ ' moveUp' : {
175+ ' Move up' : self .$root .trans .get (' foundation::general.e_moveup' )
176+ },
177+ ' moveDown' : {
178+ ' Move down' : self .$root .trans .get (' foundation::general.e_movedown' )
162179 }
163- }
164- },
165- blockTunes: {
166- ' delete' : {
167- ' Delete' : self .$root .trans .get (' foundation::general.delete' )
168- },
169- ' moveUp' : {
170- ' Move up' : self .$root .trans .get (' foundation::general.e_moveup' )
171180 },
172- ' moveDown' : {
173- ' Move down' : self .$root .trans .get (' foundation::general.e_movedown' )
174- }
175- },
176- tools: {
177- ' hyperlink' : {
178- ' Save' : self .$root .trans .get (' foundation::general.save' ),
179- ' Select target' : self .$root .trans .get (' foundation::general.e_select_target' ),
180- ' Select rel' : self .$root .trans .get (' foundation::general.e_select_rel' )
181+ tools: {
182+ ' hyperlink' : {
183+ ' Save' : self .$root .trans .get (' foundation::general.save' ),
184+ ' Select target' : self .$root .trans .get (' foundation::general.e_select_target' ),
185+ ' Select rel' : self .$root .trans .get (' foundation::general.e_select_rel' )
186+ }
181187 }
182188 }
183- }}
189+ }
184190 })
185191
186192 self .editor = editor
@@ -190,13 +196,13 @@ export default {
190196 methods: {
191197 refreshValue (data ) {
192198 this .editor .clear ()
193- this .data = (data || {blocks: [] })
199+ this .data = (data || { blocks: [] })
194200 this .editor .render (this .data )
195201 this .editor .focus (true )
196202 },
197203 listenerTexteditor (data ) {
198- if (data[this .name ] != undefined ) {
199- if (this .locale != ' ' && this .locale != undefined ) {
204+ if (data[this .name ] != undefined ) {
205+ if (this .locale != ' ' && this .locale != undefined ) {
200206 this .refreshValue (data[this .name ][this .locale ])
201207 } else {
202208 this .refreshValue (data[this .name ])
0 commit comments