@onereach/ui-components 4.4.0-beta.2688.0 → 4.4.0-beta.2691.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/components/OrRichTextEditorV3/OrRichTextEditor.js +55 -21
- package/dist/bundled/v2/components/OrRichTextEditorV3/OrRichTextEditor.vue.d.ts +10 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/styles.js +1 -1
- package/dist/bundled/v2/index.js +1 -1
- package/dist/bundled/v3/{OrRichTextEditor.vue_vue_type_script_lang-6d5a6b7e.js → OrRichTextEditor.vue_vue_type_script_lang-8bc72542.js} +19 -19
- package/dist/bundled/v3/components/OrRichTextEditorV3/OrRichTextEditor.js +27 -18
- package/dist/bundled/v3/components/OrRichTextEditorV3/OrRichTextEditor.vue.d.ts +10 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/index.js +1 -1
- package/dist/bundled/v3/components/OrRichTextEditorV3/styles.js +1 -1
- package/dist/bundled/v3/components/index.js +1 -1
- package/dist/bundled/v3/index.js +2 -2
- package/dist/esm/v2/{OrRichTextEditor-cb50c4f6.js → OrRichTextEditor-95d1070d.js} +56 -22
- package/dist/esm/v2/components/index.js +1 -1
- package/dist/esm/v2/components/or-rich-text-editor-v3/OrRichTextEditor.vue.d.ts +10 -0
- package/dist/esm/v2/components/or-rich-text-editor-v3/index.js +1 -1
- package/dist/esm/v2/index.js +1 -1
- package/dist/esm/v3/{OrRichTextEditor-c3560ddb.js → OrRichTextEditor-bdee1f41.js} +45 -36
- package/dist/esm/v3/components/index.js +1 -1
- package/dist/esm/v3/components/or-rich-text-editor-v3/OrRichTextEditor.vue.d.ts +10 -0
- package/dist/esm/v3/components/or-rich-text-editor-v3/index.js +1 -1
- package/dist/esm/v3/index.js +1 -1
- package/package.json +2 -2
- package/src/components/or-rich-text-editor-v3/OrRichTextEditor.stories3.ts +7 -3
- package/src/components/or-rich-text-editor-v3/OrRichTextEditor.vue +28 -21
- package/src/components/or-rich-text-editor-v3/styles.ts +1 -0
|
@@ -1523,6 +1523,7 @@ var script = defineComponent({
|
|
|
1523
1523
|
const root = ref();
|
|
1524
1524
|
let editor = null;
|
|
1525
1525
|
const editorRef = ref();
|
|
1526
|
+
const textareaRef = ref();
|
|
1526
1527
|
const containerRef = ref();
|
|
1527
1528
|
const toolbarRef = ref();
|
|
1528
1529
|
const moreButtonRef = ref();
|
|
@@ -1539,6 +1540,7 @@ var script = defineComponent({
|
|
|
1539
1540
|
const text = ref('');
|
|
1540
1541
|
const link = ref('');
|
|
1541
1542
|
const countOfNotVisibleTools = ref(0);
|
|
1543
|
+
const sourceValue = ref('');
|
|
1542
1544
|
let trap = useFocusTrap(editorRef, {
|
|
1543
1545
|
immediate: true,
|
|
1544
1546
|
fallbackFocus: '.container',
|
|
@@ -1655,7 +1657,7 @@ var script = defineComponent({
|
|
|
1655
1657
|
})],
|
|
1656
1658
|
editorProps: {
|
|
1657
1659
|
attributes: {
|
|
1658
|
-
class: 'focus:outline-none'
|
|
1660
|
+
class: 'flex flex-col focus:outline-none gap-xs'
|
|
1659
1661
|
}
|
|
1660
1662
|
},
|
|
1661
1663
|
parseOptions: {
|
|
@@ -1720,25 +1722,18 @@ var script = defineComponent({
|
|
|
1720
1722
|
}
|
|
1721
1723
|
return !notVisibleTools.value.includes(value);
|
|
1722
1724
|
};
|
|
1725
|
+
const handleInput = event => {
|
|
1726
|
+
const target = event.target;
|
|
1727
|
+
const value = target.value;
|
|
1728
|
+
editor === null || editor === void 0 ? void 0 : editor.commands.setContent(deserialize(editor === null || editor === void 0 ? void 0 : editor.schema, value));
|
|
1729
|
+
};
|
|
1723
1730
|
const handleToolbarClick = (item, level) => {
|
|
1724
|
-
var _a, _b;
|
|
1731
|
+
var _a, _b, _c;
|
|
1725
1732
|
switch (item) {
|
|
1726
1733
|
case 'source':
|
|
1727
1734
|
disableMarkdown.value = !disableMarkdown.value;
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
enablePasteRules: !disableMarkdown.value
|
|
1731
|
-
});
|
|
1732
|
-
editor === null || editor === void 0 ? void 0 : editor.view.updateState(editor === null || editor === void 0 ? void 0 : editor.state.reconfigure({
|
|
1733
|
-
plugins: editor.extensionManager.plugins
|
|
1734
|
-
}));
|
|
1735
|
-
if (disableMarkdown.value) {
|
|
1736
|
-
const content = serialize(editor === null || editor === void 0 ? void 0 : editor.schema, editor === null || editor === void 0 ? void 0 : editor.getJSON());
|
|
1737
|
-
editor === null || editor === void 0 ? void 0 : editor.commands.clearContent();
|
|
1738
|
-
editor === null || editor === void 0 ? void 0 : editor.commands.insertContent(content);
|
|
1739
|
-
} else {
|
|
1740
|
-
editor === null || editor === void 0 ? void 0 : editor.commands.setContent(deserialize(editor === null || editor === void 0 ? void 0 : editor.schema, editor === null || editor === void 0 ? void 0 : editor.getText()));
|
|
1741
|
-
}
|
|
1735
|
+
(_a = textareaRef.value) === null || _a === void 0 ? void 0 : _a.focus();
|
|
1736
|
+
sourceValue.value = serialize(editor === null || editor === void 0 ? void 0 : editor.schema, editor === null || editor === void 0 ? void 0 : editor.getJSON());
|
|
1742
1737
|
break;
|
|
1743
1738
|
case 'bulletList':
|
|
1744
1739
|
case 'orderedList':
|
|
@@ -1752,8 +1747,8 @@ var script = defineComponent({
|
|
|
1752
1747
|
to,
|
|
1753
1748
|
empty
|
|
1754
1749
|
} = editor.state.selection;
|
|
1755
|
-
const isLink = (
|
|
1756
|
-
const existedText = (isLink === null || isLink === void 0 ? void 0 : isLink.length) ? ((
|
|
1750
|
+
const isLink = (_b = editor.view.state.doc.nodeAt(cursorPosition)) === null || _b === void 0 ? void 0 : _b.marks.filter(mark => mark.type.name === 'link');
|
|
1751
|
+
const existedText = (isLink === null || isLink === void 0 ? void 0 : isLink.length) ? ((_c = editor.view.state.doc.nodeAt(cursorPosition)) === null || _c === void 0 ? void 0 : _c.text) || '' : '';
|
|
1757
1752
|
text.value = empty ? existedText : editor.state.doc.textBetween(from, to, ' ');
|
|
1758
1753
|
link.value = editor.getAttributes('link').href || '';
|
|
1759
1754
|
}
|
|
@@ -1883,6 +1878,7 @@ var script = defineComponent({
|
|
|
1883
1878
|
containerRef,
|
|
1884
1879
|
toolbarButtonRef,
|
|
1885
1880
|
moreButtonRef,
|
|
1881
|
+
textareaRef,
|
|
1886
1882
|
moreRef,
|
|
1887
1883
|
menuRef,
|
|
1888
1884
|
iconsEnum,
|
|
@@ -1907,12 +1903,16 @@ var script = defineComponent({
|
|
|
1907
1903
|
isFocused,
|
|
1908
1904
|
isVisible,
|
|
1909
1905
|
countOfNotVisibleTools,
|
|
1910
|
-
notVisibleTools
|
|
1906
|
+
notVisibleTools,
|
|
1907
|
+
handleInput,
|
|
1908
|
+
proxyModelValue,
|
|
1909
|
+
disableMarkdown,
|
|
1910
|
+
sourceValue
|
|
1911
1911
|
};
|
|
1912
1912
|
}
|
|
1913
1913
|
});
|
|
1914
1914
|
|
|
1915
|
-
var css_248z = ".tiptap-editor-v3 ol{margin:0 24px;list-style:decimal}.tiptap-editor-v3 .ProseMirror p{margin:4px}.tiptap-editor-v3 .ProseMirror h1,.tiptap-editor-v3 .ProseMirror h2,.tiptap-editor-v3 .ProseMirror h3,.tiptap-editor-v3 .ProseMirror h4,.tiptap-editor-v3 .ProseMirror h5,.tiptap-editor-v3 .ProseMirror h6{margin:4px}.tiptap-editor-v3 ul{margin:0 24px;list-style:disc outside none;list-style:initial}.tiptap-editor-v3 blockquote{margin:8px 24px;padding:0 24px;border-left:4px solid
|
|
1915
|
+
var css_248z = ".tiptap-editor-v3 ol{margin:0 24px;list-style:decimal}.tiptap-editor-v3 .ProseMirror p{margin:4px}.tiptap-editor-v3 .ProseMirror h1,.tiptap-editor-v3 .ProseMirror h2,.tiptap-editor-v3 .ProseMirror h3,.tiptap-editor-v3 .ProseMirror h4,.tiptap-editor-v3 .ProseMirror h5,.tiptap-editor-v3 .ProseMirror h6{margin:4px}.tiptap-editor-v3 ul{margin:0 24px;list-style:disc outside none;list-style:initial}.tiptap-editor-v3 blockquote{margin:8px 24px;padding:0 24px;border-left:4px solid rgba(0, 95, 177, 0.16)}.tiptap-editor-v3 .is-editor-empty::before{content:attr(data-placeholder);height:0;pointer-events:none;float:left}.tiptap-editor-v3 .cm-editor{border:none;border-radius:4px}.tiptap-editor-v3 .cm-editor .cm-scroller{border-radius:4px}.tiptap-editor-v3 .cm-editor.cm-focused{outline:0}.tiptap-editor-v3 .cm-editor .cm-gutters{background-color:rgba(0, 95, 177, 0.12);border:none}.tiptap-editor-v3 .cm-editor .cm-gutters .cm-gutterElement{padding:0 10px}.tiptap-editor-v3 .cm-editor .cm-gutters .cm-gutterElement.cm-activeLineGutter{background-color:rgba(0, 95, 177, 0.16)}";
|
|
1916
1916
|
styleInject(css_248z);
|
|
1917
1917
|
|
|
1918
1918
|
/* script */
|
|
@@ -2010,7 +2010,41 @@ var __vue_render__ = function () {
|
|
|
2010
2010
|
class: ['p-sm', {
|
|
2011
2011
|
'h-[calc(100%-32px)] md:h-[calc(100%-36px)]': _vm.fullHeight
|
|
2012
2012
|
}]
|
|
2013
|
-
}, [_c('
|
|
2013
|
+
}, [_c('textarea', {
|
|
2014
|
+
directives: [{
|
|
2015
|
+
name: "show",
|
|
2016
|
+
rawName: "v-show",
|
|
2017
|
+
value: _vm.disableMarkdown,
|
|
2018
|
+
expression: "disableMarkdown"
|
|
2019
|
+
}, {
|
|
2020
|
+
name: "model",
|
|
2021
|
+
rawName: "v-model",
|
|
2022
|
+
value: _vm.sourceValue,
|
|
2023
|
+
expression: "sourceValue"
|
|
2024
|
+
}],
|
|
2025
|
+
ref: "textareaRef",
|
|
2026
|
+
staticClass: "w-full h-full resize-none border-none outline-none bg-transparent",
|
|
2027
|
+
attrs: {
|
|
2028
|
+
"activated": _vm.disableMarkdown
|
|
2029
|
+
},
|
|
2030
|
+
domProps: {
|
|
2031
|
+
"value": _vm.sourceValue
|
|
2032
|
+
},
|
|
2033
|
+
on: {
|
|
2034
|
+
"input": [function ($event) {
|
|
2035
|
+
if ($event.target.composing) {
|
|
2036
|
+
return;
|
|
2037
|
+
}
|
|
2038
|
+
_vm.sourceValue = $event.target.value;
|
|
2039
|
+
}, _vm.handleInput]
|
|
2040
|
+
}
|
|
2041
|
+
}), _vm._v(" "), _c('div', {
|
|
2042
|
+
directives: [{
|
|
2043
|
+
name: "show",
|
|
2044
|
+
rawName: "v-show",
|
|
2045
|
+
value: !_vm.disableMarkdown,
|
|
2046
|
+
expression: "!disableMarkdown"
|
|
2047
|
+
}],
|
|
2014
2048
|
ref: "editorRef",
|
|
2015
2049
|
class: _vm.editorInputStyles
|
|
2016
2050
|
}), _vm._v(" "), _vm._t("files")], 2)]), _vm._v(" "), _vm.moreButtonRef ? _c('or-menu', {
|
|
@@ -13,6 +13,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
13
13
|
[x: number]: string;
|
|
14
14
|
} | {}, true> | undefined>;
|
|
15
15
|
moreButtonRef: import("@vue/composition-api").Ref<HTMLDivElement | undefined>;
|
|
16
|
+
textareaRef: import("@vue/composition-api").Ref<HTMLTextAreaElement | undefined>;
|
|
16
17
|
moreRef: import("@vue/composition-api").Ref<HTMLDivElement | undefined>;
|
|
17
18
|
menuRef: import("@vue/composition-api").Ref<import("@vue/composition-api").ComponentRenderProxy<{} & {}, import("@vue/composition-api").ShallowUnwrapRef<unknown>, unknown, import("@vue/composition-api").ComputedOptions, import("@vue/composition-api").MethodOptions, unknown, unknown, {
|
|
18
19
|
[x: string]: ((...args: any[]) => any) | null;
|
|
@@ -48,6 +49,10 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
48
49
|
isVisible: (value: string | Array<string>) => boolean;
|
|
49
50
|
countOfNotVisibleTools: import("@vue/composition-api").Ref<number>;
|
|
50
51
|
notVisibleTools: import("@vue/composition-api").ComputedRef<string[]>;
|
|
52
|
+
handleInput: (event: InputEvent) => void;
|
|
53
|
+
proxyModelValue: import("@vue/composition-api").WritableComputedRef<string>;
|
|
54
|
+
disableMarkdown: import("@vue/composition-api").Ref<boolean>;
|
|
55
|
+
sourceValue: import("@vue/composition-api").Ref<string>;
|
|
51
56
|
}> & import("@vue/composition-api").Data, {}, {}, {
|
|
52
57
|
modelValue: {
|
|
53
58
|
type: StringConstructor;
|
|
@@ -153,6 +158,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
153
158
|
[x: number]: string;
|
|
154
159
|
} | {}, true> | undefined>;
|
|
155
160
|
moreButtonRef: import("@vue/composition-api").Ref<HTMLDivElement | undefined>;
|
|
161
|
+
textareaRef: import("@vue/composition-api").Ref<HTMLTextAreaElement | undefined>;
|
|
156
162
|
moreRef: import("@vue/composition-api").Ref<HTMLDivElement | undefined>;
|
|
157
163
|
menuRef: import("@vue/composition-api").Ref<import("@vue/composition-api").ComponentRenderProxy<{} & {}, import("@vue/composition-api").ShallowUnwrapRef<unknown>, unknown, import("@vue/composition-api").ComputedOptions, import("@vue/composition-api").MethodOptions, unknown, unknown, {
|
|
158
164
|
[x: string]: ((...args: any[]) => any) | null;
|
|
@@ -188,6 +194,10 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
188
194
|
isVisible: (value: string | Array<string>) => boolean;
|
|
189
195
|
countOfNotVisibleTools: import("@vue/composition-api").Ref<number>;
|
|
190
196
|
notVisibleTools: import("@vue/composition-api").ComputedRef<string[]>;
|
|
197
|
+
handleInput: (event: InputEvent) => void;
|
|
198
|
+
proxyModelValue: import("@vue/composition-api").WritableComputedRef<string>;
|
|
199
|
+
disableMarkdown: import("@vue/composition-api").Ref<boolean>;
|
|
200
|
+
sourceValue: import("@vue/composition-api").Ref<string>;
|
|
191
201
|
}>, import("@vue/composition-api").Data, {}, {}, {}, {}, string[], {
|
|
192
202
|
modelValue: string;
|
|
193
203
|
toolbar: string[][];
|
|
@@ -31,7 +31,7 @@ const ToolbarButtonFocused = [
|
|
|
31
31
|
'text-outline'];
|
|
32
32
|
const EditorInput = [
|
|
33
33
|
// Typography
|
|
34
|
-
'typography-body-2-regular', 'text-on-background',
|
|
34
|
+
'typography-body-2-regular', 'text-on-background', 'dark:text-on-background-dark',
|
|
35
35
|
// Sizing
|
|
36
36
|
'min-h-[88px]'];
|
|
37
37
|
|