@onereach/ui-components 2.70.0-beta.2164.0 → 2.70.0-beta.2167.0
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/dist/bundled/v2/{OrRichTextEditor-9e2535da.js → OrRichTextEditor-eb28a309.js} +15 -5
- package/dist/bundled/v2/components/index.js +1 -1
- package/dist/bundled/v2/components/or-rich-text-editor-v3/index.js +2 -2
- package/dist/bundled/v2/components/or-rich-text-editor-v3/styles.d.ts +1 -0
- package/dist/bundled/v2/index.js +2 -2
- package/dist/bundled/v3/{OrRichTextEditor.vue_vue_type_script_lang-1aa9ad53.js → OrRichTextEditor.vue_vue_type_script_lang-067e56ab.js} +14 -4
- package/dist/bundled/v3/components/index.js +1 -1
- package/dist/bundled/v3/components/or-rich-text-editor-v3/index.js +2 -2
- package/dist/bundled/v3/components/or-rich-text-editor-v3/styles.d.ts +1 -0
- package/dist/bundled/v3/index.js +3 -3
- package/dist/esm/v2/{OrRichTextEditor-ed356c5b.js → OrRichTextEditor-3a2ba021.js} +15 -6
- package/dist/esm/v2/components/index.js +1 -1
- package/dist/esm/v2/components/or-rich-text-editor-v3/index.js +1 -1
- package/dist/esm/v2/components/or-rich-text-editor-v3/styles.d.ts +1 -0
- package/dist/esm/v2/index.js +1 -1
- package/dist/esm/v3/{OrRichTextEditor-f710fc9d.js → OrRichTextEditor-91a94381.js} +14 -5
- package/dist/esm/v3/components/index.js +1 -1
- package/dist/esm/v3/components/or-rich-text-editor-v3/index.js +1 -1
- package/dist/esm/v3/components/or-rich-text-editor-v3/styles.d.ts +1 -0
- package/dist/esm/v3/index.js +1 -1
- package/package.json +1 -1
- package/src/components/or-rich-text-editor-v3/OrRichTextEditor.vue +12 -3
- package/src/components/or-rich-text-editor-v3/styles.ts +6 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent, ref, onMounted, onBeforeUnmount, computed, watch } from 'vue-demi';
|
|
2
2
|
import { u as useClassAttribute } from './useClassAttribute-47fdb016.js';
|
|
3
|
-
import '@vueuse/core';
|
|
3
|
+
import { onClickOutside } from '@vueuse/core';
|
|
4
4
|
import { defaultMarkdownSerializer, MarkdownSerializer } from 'prosemirror-markdown';
|
|
5
5
|
import { DOMParser as DOMParser$1 } from 'prosemirror-model';
|
|
6
6
|
import { marked } from 'marked';
|
|
@@ -127,7 +127,10 @@ const Toolbar = [
|
|
|
127
127
|
'last-of-type:border-none'];
|
|
128
128
|
const ToolbarButton = [
|
|
129
129
|
// Typography
|
|
130
|
-
'text-on-disabled', 'dark:text-
|
|
130
|
+
'text-on-disabled', 'dark:text-on-disabled-dark'];
|
|
131
|
+
const ToolbarButtonFocused = [
|
|
132
|
+
// Typography
|
|
133
|
+
'text-outline', 'dark:text-outline-dark'];
|
|
131
134
|
const ToolbarButtonActive = [
|
|
132
135
|
// Typography
|
|
133
136
|
'text-on-background', 'dark:text-on-background-dark'];
|
|
@@ -228,6 +231,7 @@ var script = defineComponent({
|
|
|
228
231
|
const toolbarButtonRef = ref();
|
|
229
232
|
const menuRef = ref();
|
|
230
233
|
const isActive = ref({});
|
|
234
|
+
const isFocused = ref(props.autofocus);
|
|
231
235
|
const headingLevels = [1, 2, 3, 4];
|
|
232
236
|
const previousHeadingLevel = ref();
|
|
233
237
|
const activeHeadingLevel = ref(0);
|
|
@@ -270,6 +274,7 @@ var script = defineComponent({
|
|
|
270
274
|
onUpdate: ({
|
|
271
275
|
editor
|
|
272
276
|
}) => {
|
|
277
|
+
isFocused.value = true;
|
|
273
278
|
setActiveFormats();
|
|
274
279
|
const html = editor.getHTML();
|
|
275
280
|
const text = editor.getText();
|
|
@@ -331,7 +336,10 @@ var script = defineComponent({
|
|
|
331
336
|
onBeforeUnmount(() => {
|
|
332
337
|
editor === null || editor === void 0 ? void 0 : editor.destroy();
|
|
333
338
|
});
|
|
334
|
-
|
|
339
|
+
onClickOutside(root, () => {
|
|
340
|
+
isFocused.value = false;
|
|
341
|
+
// trap.deactivate();
|
|
342
|
+
});
|
|
335
343
|
// Computed
|
|
336
344
|
const proxyModelValue = computed({
|
|
337
345
|
get: () => {
|
|
@@ -356,6 +364,7 @@ var script = defineComponent({
|
|
|
356
364
|
//Methods
|
|
357
365
|
const handleEditorClick = () => {
|
|
358
366
|
setActiveFormats();
|
|
367
|
+
isFocused.value = true;
|
|
359
368
|
editor === null || editor === void 0 ? void 0 : editor.commands.focus();
|
|
360
369
|
};
|
|
361
370
|
const handleToolbarClick = (item, level) => {
|
|
@@ -428,7 +437,7 @@ var script = defineComponent({
|
|
|
428
437
|
return [...ToolbarContainer];
|
|
429
438
|
});
|
|
430
439
|
const toolbarStyles = computed(() => {
|
|
431
|
-
return [...Toolbar];
|
|
440
|
+
return [...Toolbar, ...(isFocused.value ? ToolbarButtonFocused : ToolbarButton)];
|
|
432
441
|
});
|
|
433
442
|
const editorInputStyles = computed(() => {
|
|
434
443
|
return ['tiptap-editor', ...(props.fullHeight ? ['h-full'] : []), ...EditorInput];
|
|
@@ -438,7 +447,7 @@ var script = defineComponent({
|
|
|
438
447
|
// Layout
|
|
439
448
|
'flex',
|
|
440
449
|
// Spacing
|
|
441
|
-
'gap-md', ...(isActive.value[item] ? ToolbarButtonActive :
|
|
450
|
+
'gap-md', ...(isActive.value[item] ? ToolbarButtonActive : [])];
|
|
442
451
|
};
|
|
443
452
|
//Effects
|
|
444
453
|
watch(proxyModelValue, value => {
|
|
@@ -574,7 +583,7 @@ var __vue_staticRenderFns__ = [];
|
|
|
574
583
|
/* style */
|
|
575
584
|
const __vue_inject_styles__ = function (inject) {
|
|
576
585
|
if (!inject) return;
|
|
577
|
-
inject("data-v-
|
|
586
|
+
inject("data-v-98327460_0", {
|
|
578
587
|
source: ".tiptap-editor ol{margin:0 24px;list-style:decimal}.tiptap-editor ul{margin:0 24px;list-style:initial}.tiptap-editor pre{background-color:rgba(186,209,236,.3);padding:4px 8px;margin:4px 0;width:100%;border-radius:4px}.tiptap-editor blockquote{margin:8px 24px;padding:0 24px;border-left:4px solid #bad1ec}.tiptap-editor .is-editor-empty::before{content:attr(data-placeholder);height:0;pointer-events:none;float:left}.tiptap-editor .cm-editor{border:none;border-radius:4px}.tiptap-editor .cm-editor .cm-scroller{border-radius:4px}.tiptap-editor .cm-editor.cm-focused{outline:0}.tiptap-editor .cm-editor .cm-gutters{background-color:rgba(0,95,177,.08);border:none}.tiptap-editor .cm-editor .cm-gutters .cm-gutterElement{padding:0 10px}.tiptap-editor .cm-editor .cm-gutters .cm-gutterElement.cm-activeLineGutter{background-color:rgba(0,95,177,.07)}",
|
|
579
588
|
map: undefined,
|
|
580
589
|
media: undefined
|
|
@@ -96,7 +96,7 @@ export { p as PropsV3, a as useQueueV3, u as useToastV3 } from '../useToast-0665
|
|
|
96
96
|
export { _ as OrTooltip } from '../OrTooltip-614b016d.js';
|
|
97
97
|
export { _ as OrTooltipContent } from '../OrTooltip.vue_rollup-plugin-vue_script-63559536.js';
|
|
98
98
|
export { _ as OrTooltipV3 } from '../OrTooltip-513bee30.js';
|
|
99
|
-
export { _ as OrRichTextEditorV3 } from '../OrRichTextEditor-
|
|
99
|
+
export { _ as OrRichTextEditorV3 } from '../OrRichTextEditor-3a2ba021.js';
|
|
100
100
|
import 'vue-demi';
|
|
101
101
|
import 'lodash';
|
|
102
102
|
import '../normalize-component-6e8e3d80.js';
|
|
@@ -2,5 +2,6 @@ export declare const EditorContainer: string[];
|
|
|
2
2
|
export declare const ToolbarContainer: string[];
|
|
3
3
|
export declare const Toolbar: string[];
|
|
4
4
|
export declare const ToolbarButton: string[];
|
|
5
|
+
export declare const ToolbarButtonFocused: string[];
|
|
5
6
|
export declare const ToolbarButtonActive: string[];
|
|
6
7
|
export declare const EditorInput: string[];
|
package/dist/esm/v2/index.js
CHANGED
|
@@ -96,7 +96,7 @@ export { p as PropsV3, a as useQueueV3, u as useToastV3 } from './useToast-06654
|
|
|
96
96
|
export { _ as OrTooltip } from './OrTooltip-614b016d.js';
|
|
97
97
|
export { _ as OrTooltipContent } from './OrTooltip.vue_rollup-plugin-vue_script-63559536.js';
|
|
98
98
|
export { _ as OrTooltipV3 } from './OrTooltip-513bee30.js';
|
|
99
|
-
export { _ as OrRichTextEditorV3 } from './OrRichTextEditor-
|
|
99
|
+
export { _ as OrRichTextEditorV3 } from './OrRichTextEditor-3a2ba021.js';
|
|
100
100
|
export { D as DropdownClose, a as DropdownOpen } from './dropdown-open-0d314aa4.js';
|
|
101
101
|
export { u as useClassAttribute } from './useClassAttribute-47fdb016.js';
|
|
102
102
|
export { u as useElevation } from './useElevation-31bfe1f6.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent, ref, onMounted, onBeforeUnmount, computed, watch } from 'vue-demi';
|
|
2
2
|
import { u as useClassAttribute } from './useClassAttribute-47fdb016.js';
|
|
3
|
-
import '@vueuse/core';
|
|
3
|
+
import { onClickOutside } from '@vueuse/core';
|
|
4
4
|
import { defaultMarkdownSerializer, MarkdownSerializer } from 'prosemirror-markdown';
|
|
5
5
|
import { DOMParser as DOMParser$1 } from 'prosemirror-model';
|
|
6
6
|
import { marked } from 'marked';
|
|
@@ -127,7 +127,10 @@ const Toolbar = [
|
|
|
127
127
|
'last-of-type:border-none'];
|
|
128
128
|
const ToolbarButton = [
|
|
129
129
|
// Typography
|
|
130
|
-
'text-on-disabled', 'dark:text-
|
|
130
|
+
'text-on-disabled', 'dark:text-on-disabled-dark'];
|
|
131
|
+
const ToolbarButtonFocused = [
|
|
132
|
+
// Typography
|
|
133
|
+
'text-outline', 'dark:text-outline-dark'];
|
|
131
134
|
const ToolbarButtonActive = [
|
|
132
135
|
// Typography
|
|
133
136
|
'text-on-background', 'dark:text-on-background-dark'];
|
|
@@ -228,6 +231,7 @@ var script = defineComponent({
|
|
|
228
231
|
const toolbarButtonRef = ref();
|
|
229
232
|
const menuRef = ref();
|
|
230
233
|
const isActive = ref({});
|
|
234
|
+
const isFocused = ref(props.autofocus);
|
|
231
235
|
const headingLevels = [1, 2, 3, 4];
|
|
232
236
|
const previousHeadingLevel = ref();
|
|
233
237
|
const activeHeadingLevel = ref(0);
|
|
@@ -270,6 +274,7 @@ var script = defineComponent({
|
|
|
270
274
|
onUpdate: ({
|
|
271
275
|
editor
|
|
272
276
|
}) => {
|
|
277
|
+
isFocused.value = true;
|
|
273
278
|
setActiveFormats();
|
|
274
279
|
const html = editor.getHTML();
|
|
275
280
|
const text = editor.getText();
|
|
@@ -331,7 +336,10 @@ var script = defineComponent({
|
|
|
331
336
|
onBeforeUnmount(() => {
|
|
332
337
|
editor === null || editor === void 0 ? void 0 : editor.destroy();
|
|
333
338
|
});
|
|
334
|
-
|
|
339
|
+
onClickOutside(root, () => {
|
|
340
|
+
isFocused.value = false;
|
|
341
|
+
// trap.deactivate();
|
|
342
|
+
});
|
|
335
343
|
// Computed
|
|
336
344
|
const proxyModelValue = computed({
|
|
337
345
|
get: () => {
|
|
@@ -356,6 +364,7 @@ var script = defineComponent({
|
|
|
356
364
|
//Methods
|
|
357
365
|
const handleEditorClick = () => {
|
|
358
366
|
setActiveFormats();
|
|
367
|
+
isFocused.value = true;
|
|
359
368
|
editor === null || editor === void 0 ? void 0 : editor.commands.focus();
|
|
360
369
|
};
|
|
361
370
|
const handleToolbarClick = (item, level) => {
|
|
@@ -428,7 +437,7 @@ var script = defineComponent({
|
|
|
428
437
|
return [...ToolbarContainer];
|
|
429
438
|
});
|
|
430
439
|
const toolbarStyles = computed(() => {
|
|
431
|
-
return [...Toolbar];
|
|
440
|
+
return [...Toolbar, ...(isFocused.value ? ToolbarButtonFocused : ToolbarButton)];
|
|
432
441
|
});
|
|
433
442
|
const editorInputStyles = computed(() => {
|
|
434
443
|
return ['tiptap-editor', ...(props.fullHeight ? ['h-full'] : []), ...EditorInput];
|
|
@@ -438,7 +447,7 @@ var script = defineComponent({
|
|
|
438
447
|
// Layout
|
|
439
448
|
'flex',
|
|
440
449
|
// Spacing
|
|
441
|
-
'gap-md', ...(isActive.value[item] ? ToolbarButtonActive :
|
|
450
|
+
'gap-md', ...(isActive.value[item] ? ToolbarButtonActive : [])];
|
|
442
451
|
};
|
|
443
452
|
//Effects
|
|
444
453
|
watch(proxyModelValue, value => {
|
|
@@ -90,7 +90,7 @@ export { a as OrToastContainerV3, s as OrToastV3, t as TypesV3 } from '../types-
|
|
|
90
90
|
export { p as PropsV3, a as useQueueV3, u as useToastV3 } from '../useToast-0665462d.js';
|
|
91
91
|
export { s as OrTooltip, a as OrTooltipContent } from '../OrTooltip-78cd7f6b.js';
|
|
92
92
|
export { s as OrTooltipV3 } from '../OrTooltip-50d27b4f.js';
|
|
93
|
-
export { s as OrRichTextEditorV3 } from '../OrRichTextEditor-
|
|
93
|
+
export { s as OrRichTextEditorV3 } from '../OrRichTextEditor-91a94381.js';
|
|
94
94
|
import 'vue-demi';
|
|
95
95
|
import 'lodash';
|
|
96
96
|
import 'vue';
|
|
@@ -2,5 +2,6 @@ export declare const EditorContainer: string[];
|
|
|
2
2
|
export declare const ToolbarContainer: string[];
|
|
3
3
|
export declare const Toolbar: string[];
|
|
4
4
|
export declare const ToolbarButton: string[];
|
|
5
|
+
export declare const ToolbarButtonFocused: string[];
|
|
5
6
|
export declare const ToolbarButtonActive: string[];
|
|
6
7
|
export declare const EditorInput: string[];
|
package/dist/esm/v3/index.js
CHANGED
|
@@ -90,7 +90,7 @@ export { a as OrToastContainerV3, s as OrToastV3, t as TypesV3 } from './types-8
|
|
|
90
90
|
export { p as PropsV3, a as useQueueV3, u as useToastV3 } from './useToast-0665462d.js';
|
|
91
91
|
export { s as OrTooltip, a as OrTooltipContent } from './OrTooltip-78cd7f6b.js';
|
|
92
92
|
export { s as OrTooltipV3 } from './OrTooltip-50d27b4f.js';
|
|
93
|
-
export { s as OrRichTextEditorV3 } from './OrRichTextEditor-
|
|
93
|
+
export { s as OrRichTextEditorV3 } from './OrRichTextEditor-91a94381.js';
|
|
94
94
|
export { D as DropdownClose, a as DropdownOpen } from './dropdown-open-0d314aa4.js';
|
|
95
95
|
export { u as useClassAttribute } from './useClassAttribute-47fdb016.js';
|
|
96
96
|
export { u as useElevation } from './useElevation-31bfe1f6.js';
|
package/package.json
CHANGED
|
@@ -69,7 +69,8 @@
|
|
|
69
69
|
<script lang="ts">
|
|
70
70
|
import { defineComponent, ref, computed, onBeforeUnmount, onMounted, watch } from 'vue-demi';
|
|
71
71
|
import { useClassAttribute } from '../../hooks';
|
|
72
|
-
//
|
|
72
|
+
// import { useFocusTrap, UseFocusTrapReturn } from '@vueuse/integrations/useFocusTrap';
|
|
73
|
+
import { onClickOutside } from '@vueuse/core';
|
|
73
74
|
import { serialize, deserialize } from './utils/markdown';
|
|
74
75
|
|
|
75
76
|
import { OrIconButtonV3 as OrIconButton } from '../or-icon-button-v3';
|
|
@@ -82,6 +83,7 @@ import {
|
|
|
82
83
|
ToolbarContainer,
|
|
83
84
|
Toolbar,
|
|
84
85
|
ToolbarButtonActive,
|
|
86
|
+
ToolbarButtonFocused,
|
|
85
87
|
ToolbarButton,
|
|
86
88
|
EditorInput,
|
|
87
89
|
} from './styles';
|
|
@@ -162,6 +164,7 @@ export default defineComponent({
|
|
|
162
164
|
const toolbarButtonRef = ref<InstanceType<typeof OrIconButton>>();
|
|
163
165
|
const menuRef = ref<InstanceType<typeof OrMenu>>();
|
|
164
166
|
const isActive = ref<{[key: string]: boolean;}>({});
|
|
167
|
+
const isFocused = ref< boolean>(props.autofocus);
|
|
165
168
|
const headingLevels = [1, 2, 3, 4] as Level[];
|
|
166
169
|
const previousHeadingLevel = ref<Level>();
|
|
167
170
|
const activeHeadingLevel = ref<number>(0);
|
|
@@ -203,6 +206,7 @@ export default defineComponent({
|
|
|
203
206
|
onMounted(() => {
|
|
204
207
|
editor = new Editor({
|
|
205
208
|
onUpdate: ({ editor }) => {
|
|
209
|
+
isFocused.value = true;
|
|
206
210
|
setActiveFormats();
|
|
207
211
|
const html = editor.getHTML();
|
|
208
212
|
const text = editor.getText();
|
|
@@ -272,7 +276,10 @@ export default defineComponent({
|
|
|
272
276
|
editor?.destroy();
|
|
273
277
|
});
|
|
274
278
|
|
|
275
|
-
|
|
279
|
+
onClickOutside(root, () => {
|
|
280
|
+
isFocused.value = false;
|
|
281
|
+
// trap.deactivate();
|
|
282
|
+
});
|
|
276
283
|
|
|
277
284
|
// Computed
|
|
278
285
|
const proxyModelValue = computed({
|
|
@@ -300,6 +307,7 @@ export default defineComponent({
|
|
|
300
307
|
//Methods
|
|
301
308
|
const handleEditorClick = () => {
|
|
302
309
|
setActiveFormats();
|
|
310
|
+
isFocused.value = true;
|
|
303
311
|
editor?.commands.focus();
|
|
304
312
|
};
|
|
305
313
|
|
|
@@ -396,6 +404,7 @@ export default defineComponent({
|
|
|
396
404
|
const toolbarStyles = computed(() => {
|
|
397
405
|
return [
|
|
398
406
|
...Toolbar,
|
|
407
|
+
...isFocused.value ? ToolbarButtonFocused : ToolbarButton,
|
|
399
408
|
];
|
|
400
409
|
});
|
|
401
410
|
|
|
@@ -413,7 +422,7 @@ export default defineComponent({
|
|
|
413
422
|
'flex',
|
|
414
423
|
// Spacing
|
|
415
424
|
'gap-md',
|
|
416
|
-
...isActive.value[item] ? ToolbarButtonActive :
|
|
425
|
+
...isActive.value[item] ? ToolbarButtonActive : [],
|
|
417
426
|
];
|
|
418
427
|
};
|
|
419
428
|
|
|
@@ -45,6 +45,12 @@ export const Toolbar: string[] = [
|
|
|
45
45
|
export const ToolbarButton: string[] = [
|
|
46
46
|
// Typography
|
|
47
47
|
'text-on-disabled',
|
|
48
|
+
'dark:text-on-disabled-dark',
|
|
49
|
+
];
|
|
50
|
+
|
|
51
|
+
export const ToolbarButtonFocused: string[] = [
|
|
52
|
+
// Typography
|
|
53
|
+
'text-outline',
|
|
48
54
|
'dark:text-outline-dark',
|
|
49
55
|
];
|
|
50
56
|
|