fix: fix global registration error with rich-text-editor (#602)

This commit is contained in:
ajaxzheng 2023-10-19 01:24:30 -07:00 committed by GitHub
parent 0a712382de
commit c65fe2ee9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 23 additions and 9 deletions

View File

@ -3,7 +3,11 @@
<div class="tiny-rich-text-editor__toolbar">
<!-- starter-kit功能区 -->
<template v-for="item in toolBar">
<button v-if="(item.name ?? item) === 'font-size'" :title="t('ui.richTextEditor.fontSize')" class="font-size-box">
<button
v-if="(item.name ?? item) === 'font-size'"
:title="t('ui.richTextEditor.fontSize')"
class="font-size-box"
>
<TinyIconRichTextFontSize></TinyIconRichTextFontSize>
<div class="font-size-options">
<button @click="state.editor.chain().focus().setSize({ size: 12 }).run()">12px</button>
@ -15,8 +19,11 @@
<button @click="state.editor.chain().focus().setSize({ size: 30 }).run()">30px</button>
</div>
</button>
<button v-else-if="(item.name ?? item) === 'line-height'" class="line-height-button"
:title="t('ui.richTextEditor.lineHeight')">
<button
v-else-if="(item.name ?? item) === 'line-height'"
class="line-height-button"
:title="t('ui.richTextEditor.lineHeight')"
>
<div class="line-height-icon">
<TinyIconRichTextLineHeight></TinyIconRichTextLineHeight>
</div>
@ -78,13 +85,19 @@
:value="state.editor?.getAttributes('textStyle').color"
/>
</button>
<button v-else-if="(item.name ?? item) === 'backgroundColor'" :title="t('ui.richTextEditor.backgroundColor')"
class="color-button">
<button
v-else-if="(item.name ?? item) === 'backgroundColor'"
:title="t('ui.richTextEditor.backgroundColor')"
class="color-button"
>
<label for="tiny--back-color">
<TinyIconRichTextColor></TinyIconRichTextColor>
</label>
<input id="tiny-back-color" type="color"
@input="state.editor.chain().focus().setBackColor({ bgColor: $event.target.value }).run()" />
<input
id="tiny-back-color"
type="color"
@input="state.editor.chain().focus().setBackColor({ bgColor: $event.target.value }).run()"
/>
</button>
<button v-else-if="(item.name ?? item) === 'table'" :title="t('ui.richTextEditor.table')" class="table-button">
<div class="table-box" @click="handleClick">
@ -324,12 +337,13 @@ import Collaboration from '@tiptap/extension-collaboration'
import * as Y from 'yjs'
import { WebrtcProvider } from 'y-webrtc'
import { props, setup, defineComponent } from '@opentiny/vue-common'
import { props, setup, defineComponent, $prefix } from '@opentiny/vue-common'
import { t } from '@opentiny/vue-locale'
import '@opentiny/vue-theme/rich-text-editor/index.less'
import Codehighlight from './code-highlight'
export default defineComponent({
name: $prefix + 'RichTextEditor',
emits: [
'beforeCreate',
'create',
@ -429,7 +443,7 @@ export default defineComponent({
nodeViewProps,
NodeViewWrapper,
Placeholder,
codeHighlight,
codeHighlight
}
})
}