@onereach/ui-components 4.4.0-beta.2663.0 → 4.4.0-beta.2678.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 +121 -36
- package/dist/bundled/v2/components/OrRichTextEditorV3/OrRichTextEditor.vue.d.ts +56 -16
- package/dist/bundled/v2/components/OrRichTextEditorV3/index.js +1 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/props.d.ts +4 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/props.js +7 -0
- package/dist/bundled/v2/components/OrRichTextEditorV3/styles.js +8 -8
- package/dist/bundled/v2/components/OrTextV3/OrText.js +6 -6
- package/dist/bundled/v2/components/index.js +1 -0
- package/dist/bundled/v2/index.js +2 -1
- package/dist/bundled/v3/{OrRichTextEditor.vue_vue_type_script_lang-e66a00b7.js → OrRichTextEditor.vue_vue_type_script_lang-c1cc12b1.js} +62 -26
- package/dist/bundled/v3/{OrText.vue_vue_type_script_lang-23ff666f.js → OrText.vue_vue_type_script_lang-6ce019db.js} +6 -6
- package/dist/bundled/v3/components/OrRichTextEditorV3/OrRichTextEditor.js +62 -17
- package/dist/bundled/v3/components/OrRichTextEditorV3/OrRichTextEditor.vue.d.ts +56 -16
- package/dist/bundled/v3/components/OrRichTextEditorV3/index.js +2 -1
- package/dist/bundled/v3/components/OrRichTextEditorV3/props.d.ts +4 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/props.js +7 -0
- package/dist/bundled/v3/components/OrRichTextEditorV3/styles.js +8 -8
- package/dist/bundled/v3/components/OrTextV3/OrText.js +2 -2
- package/dist/bundled/v3/components/OrTextV3/index.js +1 -1
- package/dist/bundled/v3/components/index.js +3 -2
- package/dist/bundled/v3/index.js +4 -3
- package/dist/esm/v2/{OrRichTextEditor-6758c259.js → OrRichTextEditor-c184da4b.js} +134 -44
- package/dist/esm/v2/{OrText-6097bca5.js → OrText-44449e7b.js} +6 -6
- package/dist/esm/v2/components/index.js +2 -2
- package/dist/esm/v2/components/or-rich-text-editor-v3/OrRichTextEditor.vue.d.ts +56 -16
- package/dist/esm/v2/components/or-rich-text-editor-v3/index.js +1 -1
- package/dist/esm/v2/components/or-rich-text-editor-v3/props.d.ts +4 -0
- package/dist/esm/v2/components/or-text-v3/index.js +1 -1
- package/dist/esm/v2/index.js +2 -2
- package/dist/esm/v3/{OrRichTextEditor-a1aae8f4.js → OrRichTextEditor-592db26c.js} +134 -49
- package/dist/esm/v3/{OrText-de6b2fe2.js → OrText-d54c951d.js} +6 -6
- package/dist/esm/v3/components/index.js +2 -2
- package/dist/esm/v3/components/or-rich-text-editor-v3/OrRichTextEditor.vue.d.ts +56 -16
- package/dist/esm/v3/components/or-rich-text-editor-v3/index.js +1 -1
- package/dist/esm/v3/components/or-rich-text-editor-v3/props.d.ts +4 -0
- package/dist/esm/v3/components/or-text-v3/index.js +1 -1
- package/dist/esm/v3/index.js +2 -2
- package/package.json +2 -2
- package/src/components/or-rich-text-editor-v3/OrRichTextEditor.stories3.ts +55 -18
- package/src/components/or-rich-text-editor-v3/OrRichTextEditor.vue +104 -42
- package/src/components/or-rich-text-editor-v3/props.ts +4 -0
- package/src/components/or-rich-text-editor-v3/styles.ts +2 -11
- package/src/components/or-text-v3/OrText.vue +11 -6
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { defineComponent, ref, onMounted, onBeforeUnmount, computed, watch } from 'vue-demi';
|
|
2
2
|
import { u as useFocusTrap } from '../../useFocusTrap-48767a70.js';
|
|
3
|
-
import { onClickOutside } from '@vueuse/core';
|
|
3
|
+
import { useResizeObserver, onClickOutside } from '@vueuse/core';
|
|
4
4
|
import { B as Blockquote, a as Bold, b as BulletList, C as CodeBlock, H as HardBreak, I as Italic, L as ListItem, O as OrderedList, P as Paragraph, S as Strike, s as serialize, d as deserialize, U as Underline, c as Link, e as Highlight } from '../../markdown-d704b3a8.js';
|
|
5
5
|
import { EditorContainer, ToolbarContainer, Toolbar, ToolbarButtonFocused, ToolbarButton, EditorInput } from './styles.js';
|
|
6
|
+
import { Formats } from './props.js';
|
|
6
7
|
import { M as Mark, m as mergeAttributes, a as markInputRule, b as markPasteRule, N as Node, E as Extension, k as keydownHandler, D as DecorationSet, c as Decoration, d as callOrReturn, g as getExtensionField, t as textblockTypeInputRule, n as nodeInputRule, e as Editor } from '../../index-1182caa8.js';
|
|
7
8
|
import { P as Plugin, d as dropPoint, S as Selection, N as NodeSelection, F as Fragment, a as Slice, T as TextSelection, b as PluginKey, M as Mapping } from '../../index-85c2efe8.js';
|
|
8
9
|
import codemirrorNode from './utils/codemirror/codemirrorNode.js';
|
|
@@ -1506,9 +1507,9 @@ var script = defineComponent({
|
|
|
1506
1507
|
type: Boolean,
|
|
1507
1508
|
default: false
|
|
1508
1509
|
},
|
|
1509
|
-
|
|
1510
|
-
type:
|
|
1511
|
-
default:
|
|
1510
|
+
format: {
|
|
1511
|
+
type: String,
|
|
1512
|
+
default: Formats.Markup
|
|
1512
1513
|
},
|
|
1513
1514
|
fullHeight: {
|
|
1514
1515
|
type: Boolean,
|
|
@@ -1523,6 +1524,9 @@ var script = defineComponent({
|
|
|
1523
1524
|
let editor = null;
|
|
1524
1525
|
const editorRef = ref();
|
|
1525
1526
|
const containerRef = ref();
|
|
1527
|
+
const toolbarRef = ref();
|
|
1528
|
+
const moreButtonRef = ref();
|
|
1529
|
+
const moreRef = ref();
|
|
1526
1530
|
const toolbarButtonRef = ref();
|
|
1527
1531
|
const menuRef = ref();
|
|
1528
1532
|
const isActive = ref({});
|
|
@@ -1534,6 +1538,7 @@ var script = defineComponent({
|
|
|
1534
1538
|
const disableMarkdown = ref(false);
|
|
1535
1539
|
const text = ref('');
|
|
1536
1540
|
const link = ref('');
|
|
1541
|
+
const countOfNotVisibleTools = ref(0);
|
|
1537
1542
|
let trap = useFocusTrap(editorRef, {
|
|
1538
1543
|
immediate: true,
|
|
1539
1544
|
fallbackFocus: '.container',
|
|
@@ -1571,6 +1576,22 @@ var script = defineComponent({
|
|
|
1571
1576
|
file: 'File',
|
|
1572
1577
|
source: 'Source'
|
|
1573
1578
|
});
|
|
1579
|
+
useResizeObserver(root, entries => {
|
|
1580
|
+
var _a, _b;
|
|
1581
|
+
const entry = entries[0];
|
|
1582
|
+
const {
|
|
1583
|
+
width
|
|
1584
|
+
} = entry.contentRect;
|
|
1585
|
+
if (containerRef.value && toolbarRef.value && toolbarLength.value) {
|
|
1586
|
+
let lengthOfItem = 0;
|
|
1587
|
+
lengthOfItem = ((_b = (_a = toolbarRef.value.firstElementChild) === null || _a === void 0 ? void 0 : _a.firstElementChild) === null || _b === void 0 ? void 0 : _b.offsetWidth) + 16;
|
|
1588
|
+
const lengthOfToolbar = lengthOfItem * toolbarLength.value;
|
|
1589
|
+
if (lengthOfToolbar >= width) {
|
|
1590
|
+
const count = width / lengthOfItem - 2;
|
|
1591
|
+
countOfNotVisibleTools.value = Math.round(toolbarLength.value - count);
|
|
1592
|
+
}
|
|
1593
|
+
}
|
|
1594
|
+
});
|
|
1574
1595
|
onMounted(() => {
|
|
1575
1596
|
editor = new Editor({
|
|
1576
1597
|
onUpdate: _ref => {
|
|
@@ -1581,7 +1602,7 @@ var script = defineComponent({
|
|
|
1581
1602
|
setActiveFormats();
|
|
1582
1603
|
const html = editor.getHTML();
|
|
1583
1604
|
const text = editor.getText();
|
|
1584
|
-
if (props.
|
|
1605
|
+
if (props.format === 'markdown') {
|
|
1585
1606
|
markdownOutput.value = disableMarkdown.value ? text : serialize(editor.schema, editor.getJSON());
|
|
1586
1607
|
proxyModelValue.value = markdownOutput.value;
|
|
1587
1608
|
} else {
|
|
@@ -1592,7 +1613,7 @@ var script = defineComponent({
|
|
|
1592
1613
|
let {
|
|
1593
1614
|
editor
|
|
1594
1615
|
} = _ref2;
|
|
1595
|
-
if (props.
|
|
1616
|
+
if (props.format === 'markdown') {
|
|
1596
1617
|
const deserialized = deserialize(editor.schema, proxyModelValue.value);
|
|
1597
1618
|
editor.commands.setContent(deserialized);
|
|
1598
1619
|
} else {
|
|
@@ -1604,16 +1625,7 @@ var script = defineComponent({
|
|
|
1604
1625
|
extensions: [codemirrorNode, StarterKit.configure({
|
|
1605
1626
|
heading: false,
|
|
1606
1627
|
codeBlock: false
|
|
1607
|
-
|
|
1608
|
-
}),
|
|
1609
|
-
// HardBreak.extend({
|
|
1610
|
-
// addKeyboardShortcuts() {
|
|
1611
|
-
// return {
|
|
1612
|
-
// Enter: () => this.editor.commands.setHardBreak(),
|
|
1613
|
-
// };
|
|
1614
|
-
// },
|
|
1615
|
-
// }),
|
|
1616
|
-
Heading.configure({
|
|
1628
|
+
}), Heading.configure({
|
|
1617
1629
|
levels: headingLevels
|
|
1618
1630
|
}).extend({
|
|
1619
1631
|
levels: headingLevels,
|
|
@@ -1674,6 +1686,20 @@ var script = defineComponent({
|
|
|
1674
1686
|
}
|
|
1675
1687
|
return 'format_paragraph';
|
|
1676
1688
|
});
|
|
1689
|
+
const toolbarLength = computed(() => {
|
|
1690
|
+
return props.toolbar.flat().length;
|
|
1691
|
+
});
|
|
1692
|
+
const notVisibleTools = computed(() => {
|
|
1693
|
+
const count = countOfNotVisibleTools.value;
|
|
1694
|
+
const toolbar = props.toolbar.flat();
|
|
1695
|
+
let notVisible = toolbar.slice(toolbar.length - count, toolbar.length);
|
|
1696
|
+
props.toolbar.forEach(tools => {
|
|
1697
|
+
if (tools.some(item => notVisible.includes(item))) {
|
|
1698
|
+
notVisible = [...notVisible, ...tools];
|
|
1699
|
+
}
|
|
1700
|
+
});
|
|
1701
|
+
return notVisible;
|
|
1702
|
+
});
|
|
1677
1703
|
//Methods
|
|
1678
1704
|
const handleEditorClick = () => {
|
|
1679
1705
|
var _a;
|
|
@@ -1682,6 +1708,13 @@ var script = defineComponent({
|
|
|
1682
1708
|
editor === null || editor === void 0 ? void 0 : editor.commands.focus();
|
|
1683
1709
|
activeHeadingLevel.value = ((_a = editor === null || editor === void 0 ? void 0 : editor.getAttributes('heading')) === null || _a === void 0 ? void 0 : _a.level) || 0;
|
|
1684
1710
|
};
|
|
1711
|
+
const isVisible = value => {
|
|
1712
|
+
if (Array.isArray(value)) {
|
|
1713
|
+
const isHaveNotVisibleTools = value.some(item => notVisibleTools.value.includes(item));
|
|
1714
|
+
return isHaveNotVisibleTools;
|
|
1715
|
+
}
|
|
1716
|
+
return !notVisibleTools.value.includes(value);
|
|
1717
|
+
};
|
|
1685
1718
|
const handleToolbarClick = (item, level) => {
|
|
1686
1719
|
var _a, _b;
|
|
1687
1720
|
switch (item) {
|
|
@@ -1695,13 +1728,8 @@ var script = defineComponent({
|
|
|
1695
1728
|
plugins: editor.extensionManager.plugins
|
|
1696
1729
|
}));
|
|
1697
1730
|
if (disableMarkdown.value) {
|
|
1698
|
-
// console.log(serialize(editor?.schema, editor?.getJSON()), 'serialize');
|
|
1699
|
-
// console.log(serialize(editor?.schema, editor?.getJSON()), 'serialize');
|
|
1700
1731
|
editor === null || editor === void 0 ? void 0 : editor.commands.setContent(serialize(editor === null || editor === void 0 ? void 0 : editor.schema, editor === null || editor === void 0 ? void 0 : editor.getJSON()));
|
|
1701
1732
|
} else {
|
|
1702
|
-
// const html = editor?.getHTML();
|
|
1703
|
-
// console.log(html, 'html');
|
|
1704
|
-
// console.log(deserialize(editor?.schema, editor?.getText()), 'deserialize');
|
|
1705
1733
|
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.getHTML()));
|
|
1706
1734
|
}
|
|
1707
1735
|
break;
|
|
@@ -1824,17 +1852,19 @@ var script = defineComponent({
|
|
|
1824
1852
|
return [...ToolbarContainer];
|
|
1825
1853
|
});
|
|
1826
1854
|
const toolbarStyles = computed(() => {
|
|
1827
|
-
return [...Toolbar,
|
|
1855
|
+
return [...Toolbar,
|
|
1856
|
+
// 'overflow-x-hidden',
|
|
1857
|
+
...(isFocused.value ? ToolbarButtonFocused : ToolbarButton)];
|
|
1828
1858
|
});
|
|
1829
1859
|
const editorInputStyles = computed(() => {
|
|
1830
|
-
return ['tiptap-editor', ...(props.fullHeight ? ['h-full overflow-y-auto'] : []), ...EditorInput];
|
|
1860
|
+
return ['tiptap-editor-v3', ...(props.fullHeight ? ['h-full overflow-y-auto'] : []), ...EditorInput];
|
|
1831
1861
|
});
|
|
1832
1862
|
//Effects
|
|
1833
1863
|
watch(proxyModelValue, value => {
|
|
1834
|
-
if (value !== (editor === null || editor === void 0 ? void 0 : editor.getHTML()) &&
|
|
1864
|
+
if (value !== (editor === null || editor === void 0 ? void 0 : editor.getHTML()) && props.format !== 'markdown') {
|
|
1835
1865
|
editor === null || editor === void 0 ? void 0 : editor.commands.setContent(value);
|
|
1836
1866
|
}
|
|
1837
|
-
if (props.
|
|
1867
|
+
if (props.format === 'markdown' && value !== markdownOutput.value) {
|
|
1838
1868
|
const deserialized = deserialize(editor === null || editor === void 0 ? void 0 : editor.schema, value);
|
|
1839
1869
|
editor === null || editor === void 0 ? void 0 : editor.commands.setContent(deserialized);
|
|
1840
1870
|
}
|
|
@@ -1842,8 +1872,11 @@ var script = defineComponent({
|
|
|
1842
1872
|
return {
|
|
1843
1873
|
editor,
|
|
1844
1874
|
editorRef,
|
|
1875
|
+
toolbarRef,
|
|
1845
1876
|
containerRef,
|
|
1846
1877
|
toolbarButtonRef,
|
|
1878
|
+
moreButtonRef,
|
|
1879
|
+
moreRef,
|
|
1847
1880
|
menuRef,
|
|
1848
1881
|
iconsEnum,
|
|
1849
1882
|
handleToolbarClick,
|
|
@@ -1864,12 +1897,15 @@ var script = defineComponent({
|
|
|
1864
1897
|
isOpenLinkModal,
|
|
1865
1898
|
text,
|
|
1866
1899
|
link,
|
|
1867
|
-
isFocused
|
|
1900
|
+
isFocused,
|
|
1901
|
+
isVisible,
|
|
1902
|
+
countOfNotVisibleTools,
|
|
1903
|
+
notVisibleTools
|
|
1868
1904
|
};
|
|
1869
1905
|
}
|
|
1870
1906
|
});
|
|
1871
1907
|
|
|
1872
|
-
var css_248z = ".tiptap-editor ol{margin:0 24px;list-style:decimal}.tiptap-editor ul{margin:0 24px;list-style:disc outside none;list-style:initial}.tiptap-editor
|
|
1908
|
+
var css_248z = ".tiptap-editor-v3 ol{margin:0 24px;list-style:decimal}.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 #bad1ec}.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,.08);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,.07)}";
|
|
1873
1909
|
styleInject(css_248z);
|
|
1874
1910
|
|
|
1875
1911
|
/* script */
|
|
@@ -1891,15 +1927,20 @@ var __vue_render__ = function () {
|
|
|
1891
1927
|
}
|
|
1892
1928
|
}
|
|
1893
1929
|
}, [_c('div', {
|
|
1930
|
+
ref: "toolbarRef",
|
|
1894
1931
|
class: _vm.toolbarContainerStyles
|
|
1895
|
-
}, _vm._l(_vm.toolbar, function (
|
|
1932
|
+
}, [_vm._l(_vm.toolbar, function (tools, index) {
|
|
1896
1933
|
return _c('div', {
|
|
1897
1934
|
key: index,
|
|
1898
|
-
class: _vm.toolbarStyles
|
|
1899
|
-
|
|
1935
|
+
class: _vm.toolbarStyles.concat([{
|
|
1936
|
+
'hidden': _vm.isVisible(tools)
|
|
1937
|
+
}])
|
|
1938
|
+
}, _vm._l(tools, function (item) {
|
|
1900
1939
|
return _c('div', {
|
|
1901
1940
|
key: item,
|
|
1902
|
-
|
|
1941
|
+
class: ['flex gap-md', {
|
|
1942
|
+
'hidden': !_vm.isVisible(item)
|
|
1943
|
+
}]
|
|
1903
1944
|
}, [item === 'heading' ? _c('or-icon-button', {
|
|
1904
1945
|
ref: "toolbarButtonRef",
|
|
1905
1946
|
refInFor: true,
|
|
@@ -1921,7 +1962,7 @@ var __vue_render__ = function () {
|
|
|
1921
1962
|
return _vm.menuRef.open();
|
|
1922
1963
|
}
|
|
1923
1964
|
}
|
|
1924
|
-
}) : _c('or-icon-button', {
|
|
1965
|
+
}) : _vm.isVisible(item) ? _c('or-icon-button', {
|
|
1925
1966
|
attrs: {
|
|
1926
1967
|
"tooltip": {
|
|
1927
1968
|
text: _vm.iconTooltipsEnum[item],
|
|
@@ -1940,16 +1981,60 @@ var __vue_render__ = function () {
|
|
|
1940
1981
|
return _vm.handleToolbarClick(item);
|
|
1941
1982
|
}
|
|
1942
1983
|
}
|
|
1943
|
-
})], 1);
|
|
1984
|
+
}) : _vm._e()], 1);
|
|
1944
1985
|
}), 0);
|
|
1945
|
-
}),
|
|
1986
|
+
}), _vm._v(" "), _vm.countOfNotVisibleTools > 0 ? _c('or-icon-button', {
|
|
1987
|
+
ref: "moreButtonRef",
|
|
1988
|
+
staticClass: "px-sm",
|
|
1989
|
+
attrs: {
|
|
1990
|
+
"disabled": !_vm.isFocused,
|
|
1991
|
+
"icon": {
|
|
1992
|
+
icon: 'more_horiz',
|
|
1993
|
+
variant: 'inherit',
|
|
1994
|
+
size: 'm'
|
|
1995
|
+
}
|
|
1996
|
+
},
|
|
1997
|
+
on: {
|
|
1998
|
+
"click": function ($event) {
|
|
1999
|
+
return _vm.moreRef.open();
|
|
2000
|
+
}
|
|
2001
|
+
}
|
|
2002
|
+
}) : _vm._e()], 2), _vm._v(" "), _c('div', {
|
|
1946
2003
|
class: ['p-sm', {
|
|
1947
|
-
'h-[calc(100%-32px)]': _vm.fullHeight
|
|
2004
|
+
'h-[calc(100%-32px)] md:h-[calc(100%-36px)]': _vm.fullHeight
|
|
1948
2005
|
}]
|
|
1949
2006
|
}, [_c('div', {
|
|
1950
2007
|
ref: "editorRef",
|
|
1951
2008
|
class: _vm.editorInputStyles
|
|
1952
|
-
}), _vm._v(" "), _vm._t("files")], 2)]), _vm._v(" "), _vm.
|
|
2009
|
+
}), _vm._v(" "), _vm._t("files")], 2)]), _vm._v(" "), _vm.moreButtonRef ? _c('or-menu', {
|
|
2010
|
+
ref: "moreRef",
|
|
2011
|
+
attrs: {
|
|
2012
|
+
"trigger": _vm.moreButtonRef.root
|
|
2013
|
+
}
|
|
2014
|
+
}, _vm._l(_vm.notVisibleTools, function (item) {
|
|
2015
|
+
return _c('or-menu-item', {
|
|
2016
|
+
key: item,
|
|
2017
|
+
on: {
|
|
2018
|
+
"click": function ($event) {
|
|
2019
|
+
return _vm.handleToolbarClick(item);
|
|
2020
|
+
}
|
|
2021
|
+
}
|
|
2022
|
+
}, [_c('or-icon-button', {
|
|
2023
|
+
attrs: {
|
|
2024
|
+
"tooltip": {
|
|
2025
|
+
text: _vm.iconTooltipsEnum[item],
|
|
2026
|
+
placement: 'top'
|
|
2027
|
+
},
|
|
2028
|
+
"selected": _vm.isActive[item],
|
|
2029
|
+
"disabled": !_vm.isFocused,
|
|
2030
|
+
"icon": {
|
|
2031
|
+
icon: _vm.iconsEnum[item],
|
|
2032
|
+
variant: 'inherit',
|
|
2033
|
+
size: 'm'
|
|
2034
|
+
}
|
|
2035
|
+
}
|
|
2036
|
+
})], 1);
|
|
2037
|
+
}), 1) : _vm._e(), _vm._v(" "), _vm.toolbarButtonRef ? _c('or-menu', {
|
|
1953
2038
|
ref: "menuRef",
|
|
1954
2039
|
attrs: {
|
|
1955
2040
|
"trigger": _vm.toolbarButtonRef[_vm.getIndexOfHeading].root,
|
|
@@ -1,14 +1,19 @@
|
|
|
1
|
+
import { ComponentPublicInstance, PropType } from 'vue-demi';
|
|
2
|
+
import { Formats } from './props';
|
|
1
3
|
import { Editor } from '@tiptap/core';
|
|
2
4
|
import { Level } from '@tiptap/extension-heading';
|
|
3
5
|
declare const _default: import("vue").ComponentOptions<import("vue").default, import("@vue/composition-api").ShallowUnwrapRef<{
|
|
4
6
|
editor: Editor | null;
|
|
5
7
|
editorRef: import("@vue/composition-api").Ref<HTMLDivElement | undefined>;
|
|
6
|
-
|
|
8
|
+
toolbarRef: import("@vue/composition-api").Ref<ComponentPublicInstance<HTMLInputElement, {}, {}, {}, {}, {}, HTMLInputElement, {}, false> | undefined>;
|
|
9
|
+
containerRef: import("@vue/composition-api").Ref<ComponentPublicInstance<HTMLInputElement, {}, {}, {}, {}, {}, HTMLInputElement, {}, false> | undefined>;
|
|
7
10
|
toolbarButtonRef: 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, {
|
|
8
11
|
[x: string]: ((...args: any[]) => any) | null;
|
|
9
12
|
} | string[], {} & {}, {
|
|
10
13
|
[x: number]: string;
|
|
11
14
|
} | {}, true> | undefined>;
|
|
15
|
+
moreButtonRef: import("@vue/composition-api").Ref<HTMLDivElement | undefined>;
|
|
16
|
+
moreRef: import("@vue/composition-api").Ref<HTMLDivElement | undefined>;
|
|
12
17
|
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, {
|
|
13
18
|
[x: string]: ((...args: any[]) => any) | null;
|
|
14
19
|
} | string[], {} & {}, {
|
|
@@ -40,13 +45,29 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
40
45
|
text: import("@vue/composition-api").Ref<string>;
|
|
41
46
|
link: import("@vue/composition-api").Ref<string>;
|
|
42
47
|
isFocused: import("@vue/composition-api").Ref<boolean>;
|
|
48
|
+
isVisible: (value: string | Array<string>) => boolean;
|
|
49
|
+
countOfNotVisibleTools: import("@vue/composition-api").Ref<number>;
|
|
50
|
+
notVisibleTools: import("@vue/composition-api").ComputedRef<string[]>;
|
|
43
51
|
}> & import("@vue/composition-api").Data, {}, {}, {
|
|
44
52
|
modelValue: {
|
|
45
53
|
type: StringConstructor;
|
|
46
54
|
default: undefined;
|
|
47
55
|
};
|
|
48
56
|
toolbar: {
|
|
49
|
-
type:
|
|
57
|
+
type: {
|
|
58
|
+
(arrayLength: number): string[][];
|
|
59
|
+
(...items: string[][]): string[][];
|
|
60
|
+
new (arrayLength: number): string[][];
|
|
61
|
+
new (...items: string[][]): string[][];
|
|
62
|
+
isArray(arg: any): arg is any[];
|
|
63
|
+
readonly prototype: any[];
|
|
64
|
+
from<T>(arrayLike: ArrayLike<T>): T[];
|
|
65
|
+
from<T_1, U>(arrayLike: ArrayLike<T_1>, mapfn: (v: T_1, k: number) => U, thisArg?: any): U[];
|
|
66
|
+
from<T_2>(iterable: Iterable<T_2> | ArrayLike<T_2>): T_2[];
|
|
67
|
+
from<T_3, U_1>(iterable: Iterable<T_3> | ArrayLike<T_3>, mapfn: (v: T_3, k: number) => U_1, thisArg?: any): U_1[];
|
|
68
|
+
of<T_4>(...items: T_4[]): T_4[];
|
|
69
|
+
readonly [Symbol.species]: ArrayConstructor;
|
|
70
|
+
};
|
|
50
71
|
default: () => never[];
|
|
51
72
|
};
|
|
52
73
|
description: {
|
|
@@ -61,9 +82,9 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
61
82
|
type: BooleanConstructor;
|
|
62
83
|
default: boolean;
|
|
63
84
|
};
|
|
64
|
-
|
|
65
|
-
type:
|
|
66
|
-
default:
|
|
85
|
+
format: {
|
|
86
|
+
type: PropType<Formats>;
|
|
87
|
+
default: Formats;
|
|
67
88
|
};
|
|
68
89
|
fullHeight: {
|
|
69
90
|
type: BooleanConstructor;
|
|
@@ -75,7 +96,20 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
75
96
|
default: undefined;
|
|
76
97
|
};
|
|
77
98
|
toolbar: {
|
|
78
|
-
type:
|
|
99
|
+
type: {
|
|
100
|
+
(arrayLength: number): string[][];
|
|
101
|
+
(...items: string[][]): string[][];
|
|
102
|
+
new (arrayLength: number): string[][];
|
|
103
|
+
new (...items: string[][]): string[][];
|
|
104
|
+
isArray(arg: any): arg is any[];
|
|
105
|
+
readonly prototype: any[];
|
|
106
|
+
from<T>(arrayLike: ArrayLike<T>): T[];
|
|
107
|
+
from<T_1, U>(arrayLike: ArrayLike<T_1>, mapfn: (v: T_1, k: number) => U, thisArg?: any): U[];
|
|
108
|
+
from<T_2>(iterable: Iterable<T_2> | ArrayLike<T_2>): T_2[];
|
|
109
|
+
from<T_3, U_1>(iterable: Iterable<T_3> | ArrayLike<T_3>, mapfn: (v: T_3, k: number) => U_1, thisArg?: any): U_1[];
|
|
110
|
+
of<T_4>(...items: T_4[]): T_4[];
|
|
111
|
+
readonly [Symbol.species]: ArrayConstructor;
|
|
112
|
+
};
|
|
79
113
|
default: () => never[];
|
|
80
114
|
};
|
|
81
115
|
description: {
|
|
@@ -90,9 +124,9 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
90
124
|
type: BooleanConstructor;
|
|
91
125
|
default: boolean;
|
|
92
126
|
};
|
|
93
|
-
|
|
94
|
-
type:
|
|
95
|
-
default:
|
|
127
|
+
format: {
|
|
128
|
+
type: PropType<Formats>;
|
|
129
|
+
default: Formats;
|
|
96
130
|
};
|
|
97
131
|
fullHeight: {
|
|
98
132
|
type: BooleanConstructor;
|
|
@@ -100,23 +134,26 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
100
134
|
};
|
|
101
135
|
}>> & Omit<import("vue").VueConstructor<import("vue").default>, never> & (new (...args: any[]) => import("@vue/composition-api").ComponentRenderProxy<{
|
|
102
136
|
modelValue: string;
|
|
103
|
-
toolbar:
|
|
137
|
+
toolbar: string[][];
|
|
104
138
|
description: string;
|
|
105
139
|
placeholder: string;
|
|
106
140
|
autofocus: boolean;
|
|
107
|
-
|
|
141
|
+
format: Formats;
|
|
108
142
|
fullHeight: boolean;
|
|
109
143
|
} & {} & {
|
|
110
144
|
[x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
|
|
111
145
|
}, import("@vue/composition-api").ShallowUnwrapRef<{
|
|
112
146
|
editor: Editor | null;
|
|
113
147
|
editorRef: import("@vue/composition-api").Ref<HTMLDivElement | undefined>;
|
|
114
|
-
|
|
148
|
+
toolbarRef: import("@vue/composition-api").Ref<ComponentPublicInstance<HTMLInputElement, {}, {}, {}, {}, {}, HTMLInputElement, {}, false> | undefined>;
|
|
149
|
+
containerRef: import("@vue/composition-api").Ref<ComponentPublicInstance<HTMLInputElement, {}, {}, {}, {}, {}, HTMLInputElement, {}, false> | undefined>;
|
|
115
150
|
toolbarButtonRef: 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, {
|
|
116
151
|
[x: string]: ((...args: any[]) => any) | null;
|
|
117
152
|
} | string[], {} & {}, {
|
|
118
153
|
[x: number]: string;
|
|
119
154
|
} | {}, true> | undefined>;
|
|
155
|
+
moreButtonRef: import("@vue/composition-api").Ref<HTMLDivElement | undefined>;
|
|
156
|
+
moreRef: import("@vue/composition-api").Ref<HTMLDivElement | undefined>;
|
|
120
157
|
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, {
|
|
121
158
|
[x: string]: ((...args: any[]) => any) | null;
|
|
122
159
|
} | string[], {} & {}, {
|
|
@@ -148,23 +185,26 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
|
|
|
148
185
|
text: import("@vue/composition-api").Ref<string>;
|
|
149
186
|
link: import("@vue/composition-api").Ref<string>;
|
|
150
187
|
isFocused: import("@vue/composition-api").Ref<boolean>;
|
|
188
|
+
isVisible: (value: string | Array<string>) => boolean;
|
|
189
|
+
countOfNotVisibleTools: import("@vue/composition-api").Ref<number>;
|
|
190
|
+
notVisibleTools: import("@vue/composition-api").ComputedRef<string[]>;
|
|
151
191
|
}>, import("@vue/composition-api").Data, {}, {}, {}, {}, string[], {
|
|
152
192
|
modelValue: string;
|
|
153
|
-
toolbar:
|
|
193
|
+
toolbar: string[][];
|
|
154
194
|
description: string;
|
|
155
195
|
placeholder: string;
|
|
156
196
|
autofocus: boolean;
|
|
157
|
-
|
|
197
|
+
format: Formats;
|
|
158
198
|
fullHeight: boolean;
|
|
159
199
|
} & {} & {
|
|
160
200
|
[x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
|
|
161
201
|
}, {
|
|
162
202
|
modelValue: string;
|
|
163
|
-
toolbar:
|
|
203
|
+
toolbar: string[][];
|
|
164
204
|
description: string;
|
|
165
205
|
placeholder: string;
|
|
166
206
|
autofocus: boolean;
|
|
167
|
-
|
|
207
|
+
format: Formats;
|
|
168
208
|
fullHeight: boolean;
|
|
169
209
|
}, true>);
|
|
170
210
|
export default _default;
|
|
@@ -8,6 +8,7 @@ import 'node:punycode';
|
|
|
8
8
|
import '../../index-1182caa8.js';
|
|
9
9
|
import '../../index.es-3f39f316.js';
|
|
10
10
|
import './styles.js';
|
|
11
|
+
import './props.js';
|
|
11
12
|
import './utils/codemirror/codemirrorNode.js';
|
|
12
13
|
import './utils/codemirror/codemirrorView.js';
|
|
13
14
|
import '../../index-0d224ae5.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const EditorContainer = [
|
|
2
2
|
// Colors
|
|
3
|
-
'border-outline', '
|
|
3
|
+
'border-outline', 'focus-within:theme-border-1-primary', 'focus-within:bg-primary-opacity-0-08', 'focus-within:theme-outline-primary',
|
|
4
4
|
// Sizing
|
|
5
5
|
'border-1', 'rounded-md', 'w-full'];
|
|
6
6
|
const ToolbarContainer = [
|
|
@@ -11,27 +11,27 @@ const ToolbarContainer = [
|
|
|
11
11
|
//Sizing
|
|
12
12
|
'border-b-1',
|
|
13
13
|
//Colors
|
|
14
|
-
'border-b-outline'
|
|
14
|
+
'border-b-outline'];
|
|
15
15
|
const Toolbar = [
|
|
16
16
|
// Layout
|
|
17
17
|
'flex',
|
|
18
18
|
// Spacing
|
|
19
19
|
'px-sm', 'gap-md',
|
|
20
20
|
// Sizing
|
|
21
|
-
'border-
|
|
21
|
+
'border-l-1',
|
|
22
22
|
//Colors
|
|
23
|
-
'border-r-disabled',
|
|
23
|
+
'border-r-disabled',
|
|
24
24
|
// Last child
|
|
25
|
-
'
|
|
25
|
+
'first-of-type:border-none'];
|
|
26
26
|
const ToolbarButton = [
|
|
27
27
|
// Typography
|
|
28
|
-
'text-on-disabled'
|
|
28
|
+
'text-on-disabled'];
|
|
29
29
|
const ToolbarButtonFocused = [
|
|
30
30
|
// Typography
|
|
31
|
-
'text-outline'
|
|
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',
|
|
35
35
|
// Sizing
|
|
36
36
|
'min-h-[88px]'];
|
|
37
37
|
|
|
@@ -38,19 +38,19 @@ var script = defineComponent({
|
|
|
38
38
|
const mainTextStyles = computed(() => [...MainText]);
|
|
39
39
|
const restTextStyles = computed(() => [...RestText]);
|
|
40
40
|
/**
|
|
41
|
-
* Preserves whitespace at the
|
|
41
|
+
* Preserves whitespace at the first position as <code> </code>
|
|
42
42
|
* @param str A string to escape
|
|
43
43
|
*/
|
|
44
|
-
const
|
|
44
|
+
const escapeFirst = str => str && '\xa0' + str.slice(1);
|
|
45
45
|
/**
|
|
46
|
-
* Preserves whitespace at the
|
|
46
|
+
* Preserves whitespace at the last position as <code> </code>
|
|
47
47
|
* @param str A string to escape
|
|
48
48
|
*/
|
|
49
|
-
const
|
|
49
|
+
const escapeLast = str => str && str.slice(0, -1) + '\xa0';
|
|
50
50
|
// State
|
|
51
51
|
const mainText = computed(() => {
|
|
52
|
-
if (props.sliceIndex) {
|
|
53
|
-
let mainPart = props.text.slice(0,
|
|
52
|
+
if (props.sliceIndex && props.sliceIndex < props.text.length) {
|
|
53
|
+
let mainPart = props.text.slice(0, Math.abs(props.sliceIndex) * -1);
|
|
54
54
|
if (mainPart[mainPart.length - 1] === ' ') {
|
|
55
55
|
mainPart = escapeLast(mainPart);
|
|
56
56
|
}
|
|
@@ -257,6 +257,7 @@ import '../index-85c2efe8.js';
|
|
|
257
257
|
import 'node:punycode';
|
|
258
258
|
import '../index-1182caa8.js';
|
|
259
259
|
import './OrRichTextEditorV3/styles.js';
|
|
260
|
+
import './OrRichTextEditorV3/props.js';
|
|
260
261
|
import './OrRichTextEditorV3/utils/codemirror/codemirrorNode.js';
|
|
261
262
|
import './OrRichTextEditorV3/utils/codemirror/codemirrorView.js';
|
|
262
263
|
import './OrRichTextEditorV3/utils/codemirror/theme.js';
|