1515 w-full
1616 rounded-none
1717 border-none
18- bg-theme-editor-input-background
19- hover:bg-theme-editor-input-background-hover
20- active:bg-theme-editor-input-background-active
21- text-theme-editor-input-text
18+ bg-theme-editor-input-background
19+ hover:bg-theme-editor-input-background-hover
20+ active:bg-theme-editor-input-background-active
21+ text-theme-editor-input-text
2222 placeholder-theme-editor-input-placeholder
23- hover:theme-editor-input-text-hover
23+ hover:theme-editor-input-text-hover
2424 active:theme-editor-input-text-active
25- px-4 md:px-14
25+ px-4
26+ md:px-14
2627 "
2728 :style =" { minHeight: '50px' }"
2829 :class =" [
2930 EDITOR.styles.input.fontSize,
3031 EDITOR.styles.input.fontFamily,
3132 EDITOR.styles.input.fontColor,
3233 ]"
33- :placeholder =" t('editor.text.placeholder.base', { prefix: EDITOR.configuration.commands.prefix })"
34+ :placeholder ="
35+ t('editor.text.placeholder.base', {
36+ prefix: EDITOR.configuration.commands.prefix,
37+ })
38+ "
3439 @input =" onInput"
3540 @keypress.enter.prevent =" enterHandler"
3641 @keydown =" onKeyboard"
4853 import { useInput } from ' @/use/input'
4954 import { useScroll } from ' @/use/scroll'
5055 import useEmitter from ' @/use/emitter'
51- import { ref , computed , watch , onMounted , nextTick } from ' vue' ;
56+ import { ref , computed , watch , onMounted , nextTick } from ' vue'
5257 import { useI18n } from ' vue-i18n'
5358 import { useToast } from ' vue-toastification'
5459 import { useEnv } from ' @/use/env'
5560 import { useFactory } from ' @/use/factory'
5661 import { useEditorStore } from ' @/store/editor'
5762 import { useContextStore } from ' @/store/context'
5863 import usePlugin from ' @/use/plugin/core'
59- import { useUtils } from ' @/use/utils'
64+ import { useUtils } from ' @/use/utils'
6065
6166 const toast = useToast ()
6267 const { t } = useI18n ()
@@ -112,43 +117,58 @@ import { useUtils } from '@/use/utils'
112117 watch (cmp , (_cmp : string ) => {
113118 plugin .emit (' plugin-input-watch-initial' , {
114119 data: _cmp ,
115- index: CONTEXT .entities .length
116- })
120+ index: CONTEXT .entities .length ,
121+ })
117122
118123 if (paste .value ) {
119124 cmp .value = ' '
120125
121126 paste .value = false
122127 }
123128
124- if (_cmp .startsWith (EDITOR .configuration .commands .prefix ) && _cmp .length <= 2 ) {
129+ if (
130+ _cmp .startsWith (EDITOR .configuration .commands .prefix ) &&
131+ _cmp .length <= 2
132+ ) {
125133 commands .value = true
126134 } else {
127135 commands .value = false
128136 }
129137
130- if (entity .utils ().entry (_cmp , EDITOR .configuration .commands .paragraph .prefix )) {
138+ if (
139+ entity .utils ().entry (_cmp , EDITOR .configuration .commands .paragraph .prefix )
140+ ) {
131141 type .value = ' paragraph'
132142 cmp .value = ' '
133143 input .value .placeholder = t (' editor.text.placeholder.paragraph' )
134144 return
135145 }
136146
137- if (entity .utils ().entry (_cmp , EDITOR .configuration .commands .headingTwo .prefix )) {
147+ if (
148+ entity
149+ .utils ()
150+ .entry (_cmp , EDITOR .configuration .commands .headingTwo .prefix )
151+ ) {
138152 type .value = ' heading-two'
139153 cmp .value = ' '
140154 input .value .placeholder = t (' editor.text.placeholder.headingtwo' )
141155 return
142156 }
143157
144- if (entity .utils ().entry (_cmp , EDITOR .configuration .commands .headingThree .prefix )) {
158+ if (
159+ entity
160+ .utils ()
161+ .entry (_cmp , EDITOR .configuration .commands .headingThree .prefix )
162+ ) {
145163 type .value = ' heading-three'
146164 cmp .value = ' '
147165 input .value .placeholder = t (' editor.text.placeholder.headingthree' )
148166 return
149167 }
150168
151- if (entity .utils ().entry (_cmp , EDITOR .configuration .commands .pageBreak .prefix )) {
169+ if (
170+ entity .utils ().entry (_cmp , EDITOR .configuration .commands .pageBreak .prefix )
171+ ) {
152172 cmp .value = ' '
153173
154174 const content = {
@@ -166,7 +186,9 @@ import { useUtils } from '@/use/utils'
166186 return
167187 }
168188
169- if (entity .utils ().entry (_cmp , EDITOR .configuration .commands .lineBreak .prefix )) {
189+ if (
190+ entity .utils ().entry (_cmp , EDITOR .configuration .commands .lineBreak .prefix )
191+ ) {
170192 cmp .value = ' '
171193
172194 const content = {
@@ -184,26 +206,36 @@ import { useUtils } from '@/use/utils'
184206 return
185207 }
186208
187- if (entity .utils ().entry (_cmp , EDITOR .configuration .commands .image .prefix )) {
209+ if (
210+ entity .utils ().entry (_cmp , EDITOR .configuration .commands .image .prefix )
211+ ) {
188212 cmp .value = ' '
189213
190- factory .simulate ().file ((content : Entity ) => {
191- type .value = ' paragraph'
192- input .value .placeholder = t (' editor.text.placeholder.paragraph' )
214+ factory .simulate ().file (
215+ (content : Entity ) => {
216+ type .value = ' paragraph'
217+ input .value .placeholder = t (' editor.text.placeholder.paragraph' )
193218
194- emit (' enter' , content )
219+ emit (' enter' , content )
195220
196- return
197- }, () => {
198- toast .error (t (' toast.generics.error' ))
199- })
221+ return
222+ },
223+ () => {
224+ toast .error (t (' toast.generics.error' ))
225+ }
226+ )
200227 }
201228
202- const dialogue = EDITOR .configuration .commands .prefix + EDITOR .configuration .commands .dialogue .prefix
229+ const dialogue =
230+ EDITOR .configuration .commands .prefix +
231+ EDITOR .configuration .commands .dialogue .prefix
203232
204233 if (_cmp .includes (dialogue )) {
205234 const offset = _cmp .indexOf (dialogue ) + dialogue .length
206- const sub = _cmp .replace (dialogue , EDITOR .configuration .commands .dialogue .value )
235+ const sub = _cmp .replace (
236+ dialogue ,
237+ EDITOR .configuration .commands .dialogue .value
238+ )
207239
208240 input .value .setSelectionRange (offset , offset )
209241
@@ -215,7 +247,7 @@ import { useUtils } from '@/use/utils'
215247 })
216248
217249 const enterHandler = () => {
218- if (! cmp .value ) return
250+ if (! cmp .value ) return
219251
220252 const content = {
221253 type: type .value ,
@@ -246,7 +278,7 @@ import { useUtils } from '@/use/utils'
246278 data .forEach (async (raw : string ) => {
247279 const normalize = raw .replace (/ \s + / g , ' ' ).trim ()
248280
249- if (! normalize ) return
281+ if (! normalize ) return
250282
251283 const content = {
252284 type: type .value ,
@@ -262,12 +294,12 @@ import { useUtils } from '@/use/utils'
262294
263295 plugin .emit (' plugin-entity-paste-in-page' , {
264296 index: CONTEXT .entities .length ,
265- quantity: _plugin_quantity
297+ quantity: _plugin_quantity ,
266298 })
267299 }
268300
269301 const onKeyboard = async (e : KeyboardEvent ) => {
270- if (e .ctrlKey ) {
302+ if (e .ctrlKey ) {
271303 // italic entity
272304 if (e .key === ' i' ) {
273305 const content = entity
@@ -317,23 +349,21 @@ import { useUtils } from '@/use/utils'
317349 return
318350 }
319351
320- if (e .key === ' ArrowUp' ) {
352+ if (e .key === ' ArrowUp' ) {
321353 emitter .emit (' entity-open-last' )
322354 return
323355 }
324356
325- if ((e .key === ' Delete' || e .key === ' Backspace' ) && cmp .value === ' ' ) {
357+ if ((e .key === ' Delete' || e .key === ' Backspace' ) && cmp .value === ' ' ) {
326358 e .preventDefault ()
327359 e .stopPropagation ()
328-
360+
329361 emitter .emit (' entity-open-last' )
330362 return
331363 }
332364 }
333365
334- const onInput = () => {
335-
336- }
366+ const onInput = () => {}
337367
338368 const onClick = () => {
339369 emitter .emit (' entity-focus' )
0 commit comments