@fastkit/vui 0.12.8 → 0.12.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/dist/vui.css +2522 -2723
- package/dist/vui.css.map +1 -0
- package/dist/vui.d.ts +8760 -10172
- package/dist/vui.mjs +1704 -2490
- package/dist/vui.mjs.map +1 -0
- package/package.json +69 -61
- package/src/components/VApp/VApp.tsx +3 -1
- package/src/components/VAvatar/VAvatar.scss +62 -60
- package/src/components/VAvatar/VAvatar.tsx +6 -1
- package/src/components/VBreadcrumbs/VBreadcrumbs.scss +53 -51
- package/src/components/VBusyImage/VBusyImage.scss +50 -51
- package/src/components/VButton/VButton.scss +120 -118
- package/src/components/VButton/VButton.tsx +6 -1
- package/src/components/VButton/VButtonGroup.scss +21 -19
- package/src/components/VCard/VCard.scss +41 -42
- package/src/components/VCard/VCard.tsx +5 -0
- package/src/components/VCard/VCardActions.scss +9 -7
- package/src/components/VCard/VCardContent.scss +4 -2
- package/src/components/VCheckable/VCheckable.scss +79 -80
- package/src/components/VCheckable/VCheckable.tsx +1 -1
- package/src/components/VCheckbox/VCheckbox.scss +50 -48
- package/src/components/VCheckbox/VCheckbox.tsx +2 -2
- package/src/components/VChip/VChip.scss +61 -59
- package/src/components/VChip/VChip.tsx +6 -1
- package/src/components/VContentSwitcher/VContentSwitcher.scss +52 -50
- package/src/components/VControlField/VControlField.scss +148 -146
- package/src/components/VControlField/VControlField.tsx +3 -3
- package/src/components/VDataTable/VDataTable.scss +167 -168
- package/src/components/VDrawerLayout/VDrawerLayout.scss +27 -25
- package/src/components/VForm/VForm.tsx +3 -4
- package/src/components/VFormControl/VFormControl.scss +84 -82
- package/src/components/VFormControl/VFormControl.tsx +2 -3
- package/src/components/VGrid/VGridContainer.scss +5 -3
- package/src/components/VGrid/VGridItem.scss +4 -2
- package/src/components/VHero/VHero.scss +23 -21
- package/src/components/VIcon/VIcon.scss +19 -17
- package/src/components/VListTile/VListTile.scss +60 -58
- package/src/components/VListTile/VListTile.tsx +5 -0
- package/src/components/VNavigation/VNavigation.scss +12 -10
- package/src/components/VNavigation/VNavigationItem.scss +21 -19
- package/src/components/VNavigation/VNavigationItem.tsx +5 -0
- package/src/components/VOption/VOption.scss +55 -56
- package/src/components/VOption/VOption.tsx +2 -2
- package/src/components/VOptionGroup/VOptionGroup.scss +14 -12
- package/src/components/VOptionGroup/VOptionGroup.tsx +3 -1
- package/src/components/VPagination/VPagination.scss +81 -79
- package/src/components/VPagination/VPagination.tsx +1 -1
- package/src/components/VPaper/VPaper.scss +43 -41
- package/src/components/VRadio/VRadio.scss +52 -53
- package/src/components/VRadio/VRadio.tsx +2 -2
- package/src/components/VSelect/VSelect.scss +77 -75
- package/src/components/VSelect/VSelect.tsx +5 -2
- package/src/components/VSkeltonLoader/VSkeltonLoaderBone.scss +24 -22
- package/src/components/VSwitch/VSwitch.scss +96 -94
- package/src/components/VSwitch/VSwitch.tsx +2 -2
- package/src/components/VTabs/VTab.scss +59 -57
- package/src/components/VTabs/VTabs.scss +41 -39
- package/src/components/VTabs/VTabs.tsx +5 -2
- package/src/components/VTextCounter/VTextCounter.scss +4 -2
- package/src/components/VTextField/VTextField.scss +37 -35
- package/src/components/VTextField/VTextField.tsx +2 -2
- package/src/components/VTextarea/VTextarea.scss +33 -31
- package/src/components/VTextarea/VTextarea.tsx +2 -2
- package/src/components/VToolbar/VToolbar.scss +19 -17
- package/src/components/VToolbar/VToolbarEdge.scss +21 -19
- package/src/components/VToolbar/VToolbarMenu.scss +6 -4
- package/src/components/VToolbar/VToolbarMenu.tsx +5 -0
- package/src/components/VToolbar/VToolbarTitle.scss +19 -17
- package/src/components/index.ts +3 -1
- package/src/components/kits.ts +1 -1
- package/src/composables/control.ts +1 -1
- package/src/composables/form-selector.scss +20 -18
- package/src/composables/form-selector.tsx +5 -3
- package/src/index.ts +13 -2
- package/src/injections.ts +1 -1
- package/src/plugin.tsx +4 -4
- package/src/schemes/control.ts +2 -2
- package/src/service.tsx +5 -5
- package/src/styles/core/functions.scss +2 -2
- package/src/styles/index.scss +23 -9
- package/dist/tool/index.d.ts +0 -2
- package/dist/tool/index.d.ts.map +0 -1
- package/dist/tool/index.mjs +0 -193
- package/dist/tool/vite-plugin.d.ts +0 -25
- package/dist/tool/vite-plugin.d.ts.map +0 -1
- package/src/.DS_Store +0 -0
- package/src/assets/builtins/color-scheme.ts +0 -9
- package/src/assets/builtins/media-match.ts +0 -3
- package/src/components/.DS_Store +0 -0
- package/src/components/VAvatar/.DS_Store +0 -0
- package/src/components/VChip/.DS_Store +0 -0
- package/src/components/VSkeltonLoader/.DS_Store +0 -0
- package/src/components/VTextField/.DS_Store +0 -0
- package/src/components/VWysiwygEditor/.DS_Store +0 -0
- package/src/components/VWysiwygEditor/VWysiwygEditor.scss +0 -66
- package/src/components/VWysiwygEditor/VWysiwygEditor.tsx +0 -354
- package/src/components/VWysiwygEditor/extensions/.DS_Store +0 -0
- package/src/components/VWysiwygEditor/extensions/color.ts +0 -72
- package/src/components/VWysiwygEditor/extensions/index.ts +0 -2
- package/src/components/VWysiwygEditor/extensions/linter/.DS_Store +0 -0
- package/src/components/VWysiwygEditor/extensions/linter/Linter.scss +0 -140
- package/src/components/VWysiwygEditor/extensions/linter/Linter.tsx +0 -210
- package/src/components/VWysiwygEditor/extensions/linter/LinterPlugin.ts +0 -65
- package/src/components/VWysiwygEditor/extensions/linter/index.ts +0 -5
- package/src/components/VWysiwygEditor/extensions/linter/plugins/BadWords.tsx +0 -50
- package/src/components/VWysiwygEditor/extensions/linter/plugins/HeadingLevel.ts +0 -39
- package/src/components/VWysiwygEditor/extensions/linter/plugins/Punctuation.ts +0 -49
- package/src/components/VWysiwygEditor/extensions/linter/plugins/index.ts +0 -3
- package/src/components/VWysiwygEditor/extensions/linter/utils.ts +0 -28
- package/src/components/VWysiwygEditor/index.ts +0 -4
- package/src/components/VWysiwygEditor/schemes.ts +0 -251
- package/src/components/VWysiwygEditor/tools/bullet-list.ts +0 -18
- package/src/components/VWysiwygEditor/tools/color.scss +0 -140
- package/src/components/VWysiwygEditor/tools/color.tsx +0 -90
- package/src/components/VWysiwygEditor/tools/format-bold.ts +0 -19
- package/src/components/VWysiwygEditor/tools/format-italic.ts +0 -18
- package/src/components/VWysiwygEditor/tools/format-underline.ts +0 -18
- package/src/components/VWysiwygEditor/tools/history.ts +0 -26
- package/src/components/VWysiwygEditor/tools/index.ts +0 -8
- package/src/components/VWysiwygEditor/tools/link.ts +0 -57
- package/src/components/VWysiwygEditor/tools/ordered-list.ts +0 -21
- package/src/tool/index.ts +0 -2
- package/src/tool/vite-plugin.ts +0 -266
- /package/{src/styles → dist}/after-effects/display-flow.scss +0 -0
- /package/{src/styles → dist}/after-effects/spacing.scss +0 -0
- /package/{src/styles → dist}/after-effects/text.scss +0 -0
- /package/{src/styles → dist}/after-effects.scss +0 -0
- /package/dist/{assets/builtins → builtins}/color-scheme.ts +0 -0
- /package/dist/{assets/builtins → builtins}/media-match.ts +0 -0
package/src/components/.DS_Store
DELETED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
@use '../../styles/core.scss';
|
|
2
|
-
|
|
3
|
-
.v-wysiwyg-editor {
|
|
4
|
-
&--sm {
|
|
5
|
-
--min-height: var(--wysiwyg-min-height-sm);
|
|
6
|
-
--max-height: var(--wysiwyg-max-height-sm);
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
&--md {
|
|
10
|
-
--min-height: var(--wysiwyg-min-height-md);
|
|
11
|
-
--max-height: var(--wysiwyg-max-height-md);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
&--lg {
|
|
15
|
-
--min-height: var(--wysiwyg-min-height-lg);
|
|
16
|
-
--max-height: var(--wysiwyg-max-height-lg);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
&__wrapper {
|
|
20
|
-
position: relative;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.v-control-field__body {
|
|
24
|
-
width: 100%;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
&__floating-toolbar {
|
|
28
|
-
position: absolute;
|
|
29
|
-
right: 0;
|
|
30
|
-
bottom: 100%;
|
|
31
|
-
z-index: 1;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
&__body {
|
|
35
|
-
position: relative;
|
|
36
|
-
width: 100%;
|
|
37
|
-
max-height: var(--max-height);
|
|
38
|
-
// max-height: 200px;
|
|
39
|
-
overflow: auto;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
&__input {
|
|
43
|
-
cursor: text;
|
|
44
|
-
|
|
45
|
-
&__element {
|
|
46
|
-
width: 100%;
|
|
47
|
-
min-width: 0;
|
|
48
|
-
padding: 8px 0;
|
|
49
|
-
margin: 0;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
&__prose {
|
|
53
|
-
width: 100%;
|
|
54
|
-
min-height: var(--min-height);
|
|
55
|
-
outline: none;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
&--disabled-min-heihgt &__input__prose {
|
|
60
|
-
min-height: 0;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
&--disabled-max-heihgt &__body {
|
|
64
|
-
max-height: none;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
@@ -1,354 +0,0 @@
|
|
|
1
|
-
import './VWysiwygEditor.scss';
|
|
2
|
-
import {
|
|
3
|
-
defineComponent,
|
|
4
|
-
PropType,
|
|
5
|
-
computed,
|
|
6
|
-
ref,
|
|
7
|
-
watch,
|
|
8
|
-
onBeforeUnmount,
|
|
9
|
-
VNodeChild,
|
|
10
|
-
} from 'vue';
|
|
11
|
-
import {
|
|
12
|
-
createFormControlProps,
|
|
13
|
-
FormControlSlots,
|
|
14
|
-
defineSlotsProps,
|
|
15
|
-
} from '@fastkit/vue-kit';
|
|
16
|
-
import { VFormControl } from '../VFormControl';
|
|
17
|
-
import {
|
|
18
|
-
VControlField,
|
|
19
|
-
createControlFieldProps,
|
|
20
|
-
InputBoxSlots,
|
|
21
|
-
} from '../VControlField';
|
|
22
|
-
import { IconName } from '../VIcon';
|
|
23
|
-
import {
|
|
24
|
-
createTextableProps,
|
|
25
|
-
createTextableEmits,
|
|
26
|
-
TextableControl,
|
|
27
|
-
} from '@fastkit/vue-form-control';
|
|
28
|
-
import {
|
|
29
|
-
createControlProps,
|
|
30
|
-
useControl,
|
|
31
|
-
createControlFieldProviderProps,
|
|
32
|
-
useControlField,
|
|
33
|
-
} from '../../composables';
|
|
34
|
-
import { VTextCounter } from '../VTextCounter';
|
|
35
|
-
import { VUI_WYSIWYG_EDITOR_SYMBOL, useVui } from '../../injections';
|
|
36
|
-
import {
|
|
37
|
-
EditorContent,
|
|
38
|
-
useEditor,
|
|
39
|
-
BubbleMenu,
|
|
40
|
-
FocusPosition,
|
|
41
|
-
} from '@tiptap/vue-3';
|
|
42
|
-
import { StarterKit } from '@tiptap/starter-kit';
|
|
43
|
-
import { VButton, VButtonGroup } from '../VButton';
|
|
44
|
-
import {
|
|
45
|
-
RawWysiwygExtension,
|
|
46
|
-
resolveRawWysiwygExtensions,
|
|
47
|
-
RawWysiwygEditorTool,
|
|
48
|
-
resolveRawWysiwygEditorTools,
|
|
49
|
-
WysiwygEditorContext,
|
|
50
|
-
// EditorEventsOptions,
|
|
51
|
-
WysiwygEditorInitializeContext,
|
|
52
|
-
} from './schemes';
|
|
53
|
-
|
|
54
|
-
export const VWysiwygEditor = defineComponent({
|
|
55
|
-
name: 'VWysiwygEditor',
|
|
56
|
-
props: {
|
|
57
|
-
// ...props,
|
|
58
|
-
...createTextableProps(),
|
|
59
|
-
...createFormControlProps(),
|
|
60
|
-
...createControlFieldProps(),
|
|
61
|
-
...createControlFieldProviderProps(),
|
|
62
|
-
...createControlProps(),
|
|
63
|
-
...defineSlotsProps<FormControlSlots & InputBoxSlots>(),
|
|
64
|
-
extensions: {
|
|
65
|
-
type: Array as PropType<RawWysiwygExtension[]>,
|
|
66
|
-
default: () => [],
|
|
67
|
-
},
|
|
68
|
-
tools: {
|
|
69
|
-
type: Array as PropType<RawWysiwygEditorTool[]>,
|
|
70
|
-
default: () => [],
|
|
71
|
-
},
|
|
72
|
-
floatingToolbar: Boolean,
|
|
73
|
-
disabledMinHeight: Boolean,
|
|
74
|
-
disabledMaxHeight: Boolean,
|
|
75
|
-
},
|
|
76
|
-
emits: {
|
|
77
|
-
...createTextableEmits(),
|
|
78
|
-
},
|
|
79
|
-
setup(props, ctx) {
|
|
80
|
-
const vui = useVui();
|
|
81
|
-
|
|
82
|
-
const textRef = ref('');
|
|
83
|
-
const toolButtonActiveColor = vui.setting('primaryScope');
|
|
84
|
-
|
|
85
|
-
const wysiwygSettings = computed(() =>
|
|
86
|
-
resolveRawWysiwygEditorTools(props.tools, vui),
|
|
87
|
-
);
|
|
88
|
-
|
|
89
|
-
const control = useControl(props);
|
|
90
|
-
useControlField(props);
|
|
91
|
-
|
|
92
|
-
const inputControl = new TextableControl(props, ctx as any, {
|
|
93
|
-
nodeType: VUI_WYSIWYG_EDITOR_SYMBOL,
|
|
94
|
-
validationValue: () => textRef.value,
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
const initializeCtx = new WysiwygEditorInitializeContext(() => vui, {
|
|
98
|
-
onCreate: ({ editor }) => {
|
|
99
|
-
textRef.value = editor.getText();
|
|
100
|
-
updateEditable();
|
|
101
|
-
},
|
|
102
|
-
onFocus: ({ event }) => {
|
|
103
|
-
inputControl.focusHandler(event);
|
|
104
|
-
},
|
|
105
|
-
onBlur: ({ event }) => {
|
|
106
|
-
inputControl.blurHandler(event);
|
|
107
|
-
},
|
|
108
|
-
onUpdate: ({ editor }) => {
|
|
109
|
-
inputControl.value = editor.getHTML();
|
|
110
|
-
textRef.value = editor.getText();
|
|
111
|
-
},
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
const extensions = [
|
|
115
|
-
StarterKit.configure({
|
|
116
|
-
bold: false,
|
|
117
|
-
bulletList: false,
|
|
118
|
-
orderedList: false,
|
|
119
|
-
history: false,
|
|
120
|
-
italic: false,
|
|
121
|
-
}),
|
|
122
|
-
// Linter.configure({
|
|
123
|
-
// plugins: [BadWords(['abc', 'evidently']), Punctuation, HeadingLevel],
|
|
124
|
-
// }),
|
|
125
|
-
...resolveRawWysiwygExtensions(props.extensions, initializeCtx),
|
|
126
|
-
...wysiwygSettings.value.extensions,
|
|
127
|
-
];
|
|
128
|
-
|
|
129
|
-
const updateEditable = () => {
|
|
130
|
-
if (!editor.value) return;
|
|
131
|
-
editor.value.setEditable(inputControl.canOperation);
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
watch(() => inputControl.canOperation, updateEditable);
|
|
135
|
-
|
|
136
|
-
watch(
|
|
137
|
-
() => props.modelValue,
|
|
138
|
-
(modelValue) => {
|
|
139
|
-
const $editor = editor.value;
|
|
140
|
-
if (!$editor || $editor.getHTML() === modelValue) return;
|
|
141
|
-
|
|
142
|
-
$editor.commands.setContent(
|
|
143
|
-
modelValue == null ? '' : modelValue,
|
|
144
|
-
false,
|
|
145
|
-
);
|
|
146
|
-
textRef.value = $editor.getText();
|
|
147
|
-
},
|
|
148
|
-
);
|
|
149
|
-
|
|
150
|
-
initializeCtx.on('create', ({ editor }) => {
|
|
151
|
-
textRef.value = editor.getText();
|
|
152
|
-
updateEditable();
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
const editor = useEditor({
|
|
156
|
-
...initializeCtx.editorOptions(),
|
|
157
|
-
autofocus: props.autofocus,
|
|
158
|
-
content: props.modelValue,
|
|
159
|
-
extensions,
|
|
160
|
-
editorProps: {
|
|
161
|
-
attributes: {
|
|
162
|
-
class: 'v-wysiwyg-editor__input__prose',
|
|
163
|
-
},
|
|
164
|
-
},
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
// editor.value.state.doc.content
|
|
168
|
-
|
|
169
|
-
const focus = (
|
|
170
|
-
position?: FocusPosition,
|
|
171
|
-
options?: {
|
|
172
|
-
scrollIntoView?: boolean | undefined;
|
|
173
|
-
},
|
|
174
|
-
) => {
|
|
175
|
-
if (!editor.value) return;
|
|
176
|
-
return editor.value.chain().focus(position, options);
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
const blur = () => {
|
|
180
|
-
if (!editor.value) return;
|
|
181
|
-
return editor.value.chain().blur();
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
const wysiwygContext = computed<WysiwygEditorContext>(() => {
|
|
185
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
186
|
-
const _editor = editor.value!;
|
|
187
|
-
// if (!_editor) {
|
|
188
|
-
// throw new Error('missing editor value');
|
|
189
|
-
// }
|
|
190
|
-
return {
|
|
191
|
-
vui,
|
|
192
|
-
editor: _editor,
|
|
193
|
-
};
|
|
194
|
-
});
|
|
195
|
-
|
|
196
|
-
const createTools = (bubbleMenu = false) => {
|
|
197
|
-
const { value: settings } = wysiwygSettings;
|
|
198
|
-
const { value: context } = wysiwygContext;
|
|
199
|
-
const tools = bubbleMenu
|
|
200
|
-
? settings.tools.filter((t) => !!t.floating)
|
|
201
|
-
: settings.tools;
|
|
202
|
-
const _editor = editor.value;
|
|
203
|
-
const variant = vui.setting(
|
|
204
|
-
bubbleMenu ? 'containedVariant' : 'plainVariant',
|
|
205
|
-
);
|
|
206
|
-
|
|
207
|
-
return (
|
|
208
|
-
<VButtonGroup
|
|
209
|
-
class={[
|
|
210
|
-
'v-wysiwyg-editor__toolbar',
|
|
211
|
-
{
|
|
212
|
-
'v-wysiwyg-editor__floating-toolbar': props.floatingToolbar,
|
|
213
|
-
},
|
|
214
|
-
]}
|
|
215
|
-
variant={variant}>
|
|
216
|
-
{tools.map(({ key, icon, onClick, disabled, active }) => {
|
|
217
|
-
const isActive =
|
|
218
|
-
!!_editor && resolveContextableValue(context, active);
|
|
219
|
-
const isDisabled =
|
|
220
|
-
!inputControl.canOperation ||
|
|
221
|
-
(!!_editor && resolveContextableValue(context, disabled));
|
|
222
|
-
let iconName: IconName | undefined;
|
|
223
|
-
let child: VNodeChild;
|
|
224
|
-
|
|
225
|
-
if (typeof icon === 'function') {
|
|
226
|
-
if (_editor) {
|
|
227
|
-
const _child = icon(context);
|
|
228
|
-
if (typeof _child === 'function') {
|
|
229
|
-
child = _child();
|
|
230
|
-
} else {
|
|
231
|
-
iconName = _child as any;
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
} else {
|
|
235
|
-
iconName = icon;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
if (!iconName && child == null) return;
|
|
239
|
-
|
|
240
|
-
return (
|
|
241
|
-
<VButton
|
|
242
|
-
tabindex={-1}
|
|
243
|
-
key={key}
|
|
244
|
-
icon={iconName}
|
|
245
|
-
onClick={(ev) => onClick(context, ev)}
|
|
246
|
-
color={isActive ? toolButtonActiveColor : undefined}
|
|
247
|
-
disabled={isDisabled}>
|
|
248
|
-
{child}
|
|
249
|
-
</VButton>
|
|
250
|
-
);
|
|
251
|
-
})}
|
|
252
|
-
</VButtonGroup>
|
|
253
|
-
);
|
|
254
|
-
};
|
|
255
|
-
|
|
256
|
-
onBeforeUnmount(() => {
|
|
257
|
-
editor.value && editor.value.destroy();
|
|
258
|
-
});
|
|
259
|
-
|
|
260
|
-
return {
|
|
261
|
-
editor,
|
|
262
|
-
...inputControl.expose(),
|
|
263
|
-
...control,
|
|
264
|
-
focus,
|
|
265
|
-
blur,
|
|
266
|
-
createTools,
|
|
267
|
-
};
|
|
268
|
-
},
|
|
269
|
-
render() {
|
|
270
|
-
return (
|
|
271
|
-
<VFormControl
|
|
272
|
-
nodeControl={this.nodeControl}
|
|
273
|
-
focused={this.nodeControl.focused}
|
|
274
|
-
class={[
|
|
275
|
-
'v-wysiwyg-editor',
|
|
276
|
-
this.classes,
|
|
277
|
-
`v-wysiwyg-editor--${this.size}`,
|
|
278
|
-
{
|
|
279
|
-
'v-wysiwyg-editor--disabled-min-heihgt': this.disabledMinHeight,
|
|
280
|
-
'v-wysiwyg-editor--disabled-max-heihgt': this.disabledMaxHeight,
|
|
281
|
-
},
|
|
282
|
-
]}
|
|
283
|
-
label={this.label}
|
|
284
|
-
hint={this.hint}
|
|
285
|
-
hinttip={this.hinttip}
|
|
286
|
-
hiddenInfo={this.hiddenInfo}
|
|
287
|
-
requiredChip={this.requiredChip}
|
|
288
|
-
onClickLabel={(ev) => {
|
|
289
|
-
this.focus('start', { scrollIntoView: true });
|
|
290
|
-
}}
|
|
291
|
-
v-slots={{
|
|
292
|
-
...this.$slots,
|
|
293
|
-
default: () => {
|
|
294
|
-
const { editor } = this;
|
|
295
|
-
|
|
296
|
-
return (
|
|
297
|
-
<div class="v-wysiwyg-editor__wrapper">
|
|
298
|
-
{!this.isReadonly && this.createTools()}
|
|
299
|
-
<VControlField
|
|
300
|
-
class="v-wysiwyg-editor__input"
|
|
301
|
-
autoHeight
|
|
302
|
-
startAdornment={this.startAdornment}
|
|
303
|
-
endAdornment={this.endAdornment}
|
|
304
|
-
size={this.size}
|
|
305
|
-
// onClickHost={(ev) => {
|
|
306
|
-
// this.focus();
|
|
307
|
-
// }}
|
|
308
|
-
v-slots={{
|
|
309
|
-
...this.$slots,
|
|
310
|
-
default: () => {
|
|
311
|
-
return (
|
|
312
|
-
<div class="v-wysiwyg-editor__body">
|
|
313
|
-
<EditorContent
|
|
314
|
-
{...({
|
|
315
|
-
class: 'v-wysiwyg-editor__input__element wysiwyg',
|
|
316
|
-
} as any)}
|
|
317
|
-
editor={editor}
|
|
318
|
-
/>
|
|
319
|
-
{!this.floatingToolbar &&
|
|
320
|
-
!!editor &&
|
|
321
|
-
!this.isReadonly && (
|
|
322
|
-
<BubbleMenu
|
|
323
|
-
{...({
|
|
324
|
-
class: 'v-wysiwyg-editor__bubble-menu',
|
|
325
|
-
} as any)}
|
|
326
|
-
editor={editor}>
|
|
327
|
-
{this.createTools(true)}
|
|
328
|
-
</BubbleMenu>
|
|
329
|
-
)}
|
|
330
|
-
</div>
|
|
331
|
-
);
|
|
332
|
-
},
|
|
333
|
-
}}
|
|
334
|
-
/>
|
|
335
|
-
</div>
|
|
336
|
-
);
|
|
337
|
-
},
|
|
338
|
-
infoAppends: () => {
|
|
339
|
-
const { counterResult } = this;
|
|
340
|
-
if (!counterResult) return;
|
|
341
|
-
return <VTextCounter {...counterResult} />;
|
|
342
|
-
},
|
|
343
|
-
}}
|
|
344
|
-
/>
|
|
345
|
-
);
|
|
346
|
-
},
|
|
347
|
-
});
|
|
348
|
-
|
|
349
|
-
function resolveContextableValue(
|
|
350
|
-
ctx: WysiwygEditorContext,
|
|
351
|
-
source?: boolean | ((ctx: WysiwygEditorContext) => boolean),
|
|
352
|
-
) {
|
|
353
|
-
return typeof source === 'function' ? source(ctx) : source;
|
|
354
|
-
}
|
|
Binary file
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { Extension } from '@tiptap/core';
|
|
2
|
-
import '@tiptap/extension-text-style';
|
|
3
|
-
|
|
4
|
-
export type WysiwygColorOptions = {
|
|
5
|
-
types: string[];
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
declare module '@tiptap/core' {
|
|
9
|
-
interface Commands<ReturnType> {
|
|
10
|
-
color: {
|
|
11
|
-
/**
|
|
12
|
-
* Set the text color
|
|
13
|
-
*/
|
|
14
|
-
setColor: (color: string) => ReturnType;
|
|
15
|
-
/**
|
|
16
|
-
* Unset the text color
|
|
17
|
-
*/
|
|
18
|
-
unsetColor: () => ReturnType;
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export const WysiwygColorExtension = Extension.create<WysiwygColorOptions>({
|
|
24
|
-
name: 'color',
|
|
25
|
-
|
|
26
|
-
addOptions() {
|
|
27
|
-
return {
|
|
28
|
-
types: ['textStyle'],
|
|
29
|
-
};
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
addGlobalAttributes() {
|
|
33
|
-
return [
|
|
34
|
-
{
|
|
35
|
-
types: this.options.types,
|
|
36
|
-
attributes: {
|
|
37
|
-
color: {
|
|
38
|
-
default: null,
|
|
39
|
-
parseHTML: (element) => element.style.color.replace(/['"]+/g, ''),
|
|
40
|
-
renderHTML: (attributes) => {
|
|
41
|
-
if (!attributes.color) {
|
|
42
|
-
return {};
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
return {
|
|
46
|
-
style: `color: ${attributes.color}`,
|
|
47
|
-
};
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
];
|
|
53
|
-
},
|
|
54
|
-
|
|
55
|
-
addCommands() {
|
|
56
|
-
return {
|
|
57
|
-
setColor:
|
|
58
|
-
(color) =>
|
|
59
|
-
({ chain }) => {
|
|
60
|
-
return chain().setMark('textStyle', { color }).run();
|
|
61
|
-
},
|
|
62
|
-
unsetColor:
|
|
63
|
-
() =>
|
|
64
|
-
({ chain }) => {
|
|
65
|
-
return chain()
|
|
66
|
-
.setMark('textStyle', { color: null })
|
|
67
|
-
.removeEmptyTextStyle()
|
|
68
|
-
.run();
|
|
69
|
-
},
|
|
70
|
-
};
|
|
71
|
-
},
|
|
72
|
-
});
|
|
Binary file
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
.v-linter {
|
|
2
|
-
&__problem {
|
|
3
|
-
margin-bottom: -1px;
|
|
4
|
-
cursor: help;
|
|
5
|
-
background: var(--deep-color);
|
|
6
|
-
border-bottom: 1px solid var(--main-color);
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
&__issue-icon {
|
|
10
|
-
position: absolute;
|
|
11
|
-
right: 2px;
|
|
12
|
-
display: inline-flex;
|
|
13
|
-
align-items: center;
|
|
14
|
-
justify-content: center;
|
|
15
|
-
width: 1.2em;
|
|
16
|
-
height: 1.2em;
|
|
17
|
-
margin-top: 0.2em;
|
|
18
|
-
// padding-left: 0.5px;
|
|
19
|
-
font-family: times, georgia, serif;
|
|
20
|
-
font-size: 15px;
|
|
21
|
-
font-weight: 700;
|
|
22
|
-
line-height: 1;
|
|
23
|
-
color: var(--text-color);
|
|
24
|
-
text-align: center;
|
|
25
|
-
cursor: pointer;
|
|
26
|
-
background: var(--main-color);
|
|
27
|
-
border-radius: 100px;
|
|
28
|
-
|
|
29
|
-
&::before {
|
|
30
|
-
content: '!';
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
&__issue-menu-wrapper {
|
|
35
|
-
position: relative;
|
|
36
|
-
display: inline-block;
|
|
37
|
-
width: 0px;
|
|
38
|
-
height: 1em;
|
|
39
|
-
overflow: visible;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
&__issue-menu {
|
|
43
|
-
font-size: 87.5%;
|
|
44
|
-
// font-size: 12px;
|
|
45
|
-
line-height: 1.5;
|
|
46
|
-
|
|
47
|
-
.v-dialog__body {
|
|
48
|
-
padding: 0;
|
|
49
|
-
font-size: inherit;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
&__message {
|
|
53
|
-
padding: 8px;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
&__fixers {
|
|
57
|
-
position: relative;
|
|
58
|
-
padding: 4px 0;
|
|
59
|
-
// padding: 8px;
|
|
60
|
-
// border-top: solid 1px var(--divider-color);
|
|
61
|
-
&::before {
|
|
62
|
-
position: absolute;
|
|
63
|
-
top: 0;
|
|
64
|
-
right: 0;
|
|
65
|
-
left: 0;
|
|
66
|
-
display: block;
|
|
67
|
-
height: 1px;
|
|
68
|
-
content: '';
|
|
69
|
-
background: currentColor;
|
|
70
|
-
opacity: 0.5;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
&__fixer {
|
|
75
|
-
&__button {
|
|
76
|
-
position: relative;
|
|
77
|
-
display: block;
|
|
78
|
-
width: 100%;
|
|
79
|
-
padding: 8px;
|
|
80
|
-
font: inherit;
|
|
81
|
-
font-size: 12px;
|
|
82
|
-
// margin-top: 8px;
|
|
83
|
-
// color: var(--palette-link);
|
|
84
|
-
text-align: left;
|
|
85
|
-
// text-decoration: underline;
|
|
86
|
-
cursor: pointer;
|
|
87
|
-
background: transparent;
|
|
88
|
-
border: 0;
|
|
89
|
-
outline: 0;
|
|
90
|
-
appearance: none;
|
|
91
|
-
|
|
92
|
-
&::before {
|
|
93
|
-
position: absolute;
|
|
94
|
-
top: 0;
|
|
95
|
-
right: 0;
|
|
96
|
-
bottom: 0;
|
|
97
|
-
left: 0;
|
|
98
|
-
display: block;
|
|
99
|
-
content: '';
|
|
100
|
-
background: currentColor;
|
|
101
|
-
opacity: 0;
|
|
102
|
-
transition: 0.15s;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
&:hover,
|
|
106
|
-
&:focus {
|
|
107
|
-
&::before {
|
|
108
|
-
opacity: 0.1;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
&__message {
|
|
113
|
-
position: relative;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
// pointer-events: none;
|
|
118
|
-
// background: #fff;
|
|
119
|
-
// border-radius: 4px;
|
|
120
|
-
// opacity: 0;
|
|
121
|
-
// transition: opacity 0.15s;
|
|
122
|
-
|
|
123
|
-
// &--active {
|
|
124
|
-
// pointer-events: auto;
|
|
125
|
-
// opacity: 1;
|
|
126
|
-
// }
|
|
127
|
-
|
|
128
|
-
&__fix {
|
|
129
|
-
display: inline;
|
|
130
|
-
margin-top: 8px;
|
|
131
|
-
color: var(--palette-link);
|
|
132
|
-
text-decoration: underline;
|
|
133
|
-
cursor: pointer;
|
|
134
|
-
background: transparent;
|
|
135
|
-
border: 0;
|
|
136
|
-
outline: 0;
|
|
137
|
-
appearance: none;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|