@antscorp/antsomi-ui 2.0.83-text-editor-beta.10 → 2.0.84
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/es/assets/css/main.scss +2 -4
- package/es/components/molecules/DisplayFormat/constants.js +2 -2
- package/es/components/molecules/DisplayFormat/utils.js +2 -2
- package/es/components/molecules/EmojiPopover/EmojiPopover.js +1 -5
- package/es/components/molecules/VirtualizedMenu/VirtualizedMenu.d.ts +3 -6
- package/es/components/molecules/VirtualizedMenu/__mocks__/index.js +982 -2594
- package/es/components/molecules/VirtualizedMenu/components/Item/Item.d.ts +3 -13
- package/es/components/molecules/VirtualizedMenu/components/Item/Item.js +25 -53
- package/es/components/molecules/VirtualizedMenu/components/Item/index.d.ts +1 -1
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/MenuInline.d.ts +5 -8
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/MenuInline.js +46 -289
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/index.js +0 -1
- package/es/components/molecules/VirtualizedMenu/styled.d.ts +1 -1
- package/es/components/molecules/VirtualizedMenu/styled.js +4 -23
- package/es/components/molecules/VirtualizedMenu/types.d.ts +9 -6
- package/es/components/molecules/VirtualizedMenu/utils.d.ts +5 -8
- package/es/components/molecules/VirtualizedMenu/utils.js +18 -13
- package/es/components/molecules/index.d.ts +0 -1
- package/es/components/molecules/index.js +0 -1
- package/es/components/organism/index.d.ts +0 -1
- package/es/components/organism/index.js +0 -1
- package/es/hooks/index.d.ts +0 -1
- package/es/hooks/index.js +0 -1
- package/es/utils/common.d.ts +9 -6
- package/es/utils/common.js +23 -44
- package/es/utils/index.d.ts +0 -1
- package/es/utils/index.js +0 -1
- package/es/utils/web.d.ts +0 -4
- package/es/utils/web.js +0 -25
- package/package.json +3 -29
- package/es/components/index.scss +0 -2
- package/es/components/molecules/FontSizeInput/FontSizeInput.d.ts +0 -3
- package/es/components/molecules/FontSizeInput/FontSizeInput.js +0 -128
- package/es/components/molecules/FontSizeInput/components/FontSizeControl.d.ts +0 -8
- package/es/components/molecules/FontSizeInput/components/FontSizeControl.js +0 -14
- package/es/components/molecules/FontSizeInput/components/FontSizeDropdown.d.ts +0 -20
- package/es/components/molecules/FontSizeInput/components/FontSizeDropdown.js +0 -17
- package/es/components/molecules/FontSizeInput/constants.d.ts +0 -2
- package/es/components/molecules/FontSizeInput/constants.js +0 -5
- package/es/components/molecules/FontSizeInput/index.d.ts +0 -2
- package/es/components/molecules/FontSizeInput/index.js +0 -1
- package/es/components/molecules/FontSizeInput/styled.d.ts +0 -3
- package/es/components/molecules/FontSizeInput/styled.js +0 -22
- package/es/components/molecules/FontSizeInput/styles.scss +0 -15
- package/es/components/molecules/FontSizeInput/types.d.ts +0 -24
- package/es/components/molecules/FontSizeInput/types.js +0 -1
- package/es/components/molecules/FontSizeInput/utils.d.ts +0 -7
- package/es/components/molecules/FontSizeInput/utils.js +0 -9
- package/es/components/molecules/index.scss +0 -1
- package/es/components/organism/ActivityTimeline/__mocks__/event_tracking.json +0 -1290
- package/es/components/organism/ActivityTimeline/__mocks__/timeline.json +0 -3059
- package/es/components/organism/TextEditor/TextEditor.d.ts +0 -3
- package/es/components/organism/TextEditor/TextEditor.js +0 -251
- package/es/components/organism/TextEditor/__mocks__/text-block.settings.json +0 -320
- package/es/components/organism/TextEditor/__mocks__/text-contennt.d.ts +0 -1
- package/es/components/organism/TextEditor/__mocks__/text-contennt.js +0 -38
- package/es/components/organism/TextEditor/constants.d.ts +0 -135
- package/es/components/organism/TextEditor/constants.js +0 -280
- package/es/components/organism/TextEditor/extensions/BackgroundColor.d.ts +0 -25
- package/es/components/organism/TextEditor/extensions/BackgroundColor.js +0 -46
- package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu-plugin.d.ts +0 -130
- package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu-plugin.js +0 -247
- package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu.d.ts +0 -15
- package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu.js +0 -31
- package/es/components/organism/TextEditor/extensions/BubbleMenu/index.d.ts +0 -2
- package/es/components/organism/TextEditor/extensions/BubbleMenu/index.js +0 -2
- package/es/components/organism/TextEditor/extensions/Color.d.ts +0 -6
- package/es/components/organism/TextEditor/extensions/Color.js +0 -41
- package/es/components/organism/TextEditor/extensions/Emoji.d.ts +0 -57
- package/es/components/organism/TextEditor/extensions/Emoji.js +0 -184
- package/es/components/organism/TextEditor/extensions/FontFamily.d.ts +0 -6
- package/es/components/organism/TextEditor/extensions/FontFamily.js +0 -43
- package/es/components/organism/TextEditor/extensions/FontSize.d.ts +0 -32
- package/es/components/organism/TextEditor/extensions/FontSize.js +0 -47
- package/es/components/organism/TextEditor/extensions/FontWeight.d.ts +0 -23
- package/es/components/organism/TextEditor/extensions/FontWeight.js +0 -41
- package/es/components/organism/TextEditor/extensions/Highlight.d.ts +0 -1
- package/es/components/organism/TextEditor/extensions/Highlight.js +0 -14
- package/es/components/organism/TextEditor/extensions/Indent.d.ts +0 -28
- package/es/components/organism/TextEditor/extensions/Indent.js +0 -68
- package/es/components/organism/TextEditor/extensions/LineHeight.d.ts +0 -20
- package/es/components/organism/TextEditor/extensions/LineHeight.js +0 -36
- package/es/components/organism/TextEditor/extensions/Link.d.ts +0 -15
- package/es/components/organism/TextEditor/extensions/Link.js +0 -50
- package/es/components/organism/TextEditor/extensions/ListItemMarker.d.ts +0 -13
- package/es/components/organism/TextEditor/extensions/ListItemMarker.js +0 -174
- package/es/components/organism/TextEditor/extensions/Selection.d.ts +0 -6
- package/es/components/organism/TextEditor/extensions/Selection.js +0 -40
- package/es/components/organism/TextEditor/extensions/SmartTag.d.ts +0 -39
- package/es/components/organism/TextEditor/extensions/SmartTag.js +0 -167
- package/es/components/organism/TextEditor/extensions/StyleMemory.d.ts +0 -36
- package/es/components/organism/TextEditor/extensions/StyleMemory.js +0 -163
- package/es/components/organism/TextEditor/extensions/TextTransform.d.ts +0 -31
- package/es/components/organism/TextEditor/extensions/TextTransform.js +0 -37
- package/es/components/organism/TextEditor/hooks/index.d.ts +0 -6
- package/es/components/organism/TextEditor/hooks/index.js +0 -6
- package/es/components/organism/TextEditor/hooks/useDocumentState.d.ts +0 -18
- package/es/components/organism/TextEditor/hooks/useDocumentState.js +0 -42
- package/es/components/organism/TextEditor/hooks/useLinkHandler.d.ts +0 -10
- package/es/components/organism/TextEditor/hooks/useLinkHandler.js +0 -223
- package/es/components/organism/TextEditor/hooks/useMarkTracking.d.ts +0 -26
- package/es/components/organism/TextEditor/hooks/useMarkTracking.js +0 -68
- package/es/components/organism/TextEditor/hooks/usePersistence.d.ts +0 -31
- package/es/components/organism/TextEditor/hooks/usePersistence.js +0 -169
- package/es/components/organism/TextEditor/hooks/useStyleMemory.d.ts +0 -6
- package/es/components/organism/TextEditor/hooks/useStyleMemory.js +0 -42
- package/es/components/organism/TextEditor/hooks/useStylePresets.d.ts +0 -34
- package/es/components/organism/TextEditor/hooks/useStylePresets.js +0 -83
- package/es/components/organism/TextEditor/index.d.ts +0 -14
- package/es/components/organism/TextEditor/index.js +0 -6
- package/es/components/organism/TextEditor/index.scss +0 -61
- package/es/components/organism/TextEditor/provider.d.ts +0 -10
- package/es/components/organism/TextEditor/provider.js +0 -20
- package/es/components/organism/TextEditor/store.d.ts +0 -11
- package/es/components/organism/TextEditor/store.js +0 -12
- package/es/components/organism/TextEditor/styled.d.ts +0 -8
- package/es/components/organism/TextEditor/styled.js +0 -90
- package/es/components/organism/TextEditor/types.d.ts +0 -92
- package/es/components/organism/TextEditor/types.js +0 -1
- package/es/components/organism/TextEditor/ui/BubbleMenu/BubbleMenu.d.ts +0 -6
- package/es/components/organism/TextEditor/ui/BubbleMenu/BubbleMenu.js +0 -78
- package/es/components/organism/TextEditor/ui/BubbleMenu/index.d.ts +0 -1
- package/es/components/organism/TextEditor/ui/BubbleMenu/index.js +0 -1
- package/es/components/organism/TextEditor/ui/ColorPicker/ColorPicker.d.ts +0 -43
- package/es/components/organism/TextEditor/ui/ColorPicker/ColorPicker.js +0 -120
- package/es/components/organism/TextEditor/ui/ColorPicker/index.d.ts +0 -1
- package/es/components/organism/TextEditor/ui/ColorPicker/index.js +0 -1
- package/es/components/organism/TextEditor/ui/Emoji/EmojiList.d.ts +0 -11
- package/es/components/organism/TextEditor/ui/Emoji/EmojiList.js +0 -66
- package/es/components/organism/TextEditor/ui/Emoji/index.d.ts +0 -2
- package/es/components/organism/TextEditor/ui/Emoji/index.js +0 -2
- package/es/components/organism/TextEditor/ui/Emoji/suggestion.d.ts +0 -4
- package/es/components/organism/TextEditor/ui/Emoji/suggestion.js +0 -71
- package/es/components/organism/TextEditor/ui/FontPopover/FontPopover.d.ts +0 -12
- package/es/components/organism/TextEditor/ui/FontPopover/FontPopover.js +0 -69
- package/es/components/organism/TextEditor/ui/FontPopover/styled.d.ts +0 -1
- package/es/components/organism/TextEditor/ui/FontPopover/styled.js +0 -20
- package/es/components/organism/TextEditor/ui/Popover/Popover.d.ts +0 -6
- package/es/components/organism/TextEditor/ui/Popover/Popover.js +0 -7
- package/es/components/organism/TextEditor/ui/Popover/index.d.ts +0 -1
- package/es/components/organism/TextEditor/ui/Popover/index.js +0 -1
- package/es/components/organism/TextEditor/ui/Select/Select.d.ts +0 -4
- package/es/components/organism/TextEditor/ui/Select/Select.js +0 -7
- package/es/components/organism/TextEditor/ui/Select/index.d.ts +0 -1
- package/es/components/organism/TextEditor/ui/Select/index.js +0 -1
- package/es/components/organism/TextEditor/ui/TextAlignSelect/TextAlignSelect.d.ts +0 -30
- package/es/components/organism/TextEditor/ui/TextAlignSelect/TextAlignSelect.js +0 -49
- package/es/components/organism/TextEditor/ui/TextAlignSelect/index.d.ts +0 -1
- package/es/components/organism/TextEditor/ui/TextAlignSelect/index.js +0 -1
- package/es/components/organism/TextEditor/ui/Toolbar/Toolbar.d.ts +0 -14
- package/es/components/organism/TextEditor/ui/Toolbar/Toolbar.js +0 -42
- package/es/components/organism/TextEditor/ui/Toolbar/actions/BoldAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/BoldAction.js +0 -7
- package/es/components/organism/TextEditor/ui/Toolbar/actions/BulletListAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/BulletListAction.js +0 -7
- package/es/components/organism/TextEditor/ui/Toolbar/actions/ClearFormattingAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/ClearFormattingAction.js +0 -18
- package/es/components/organism/TextEditor/ui/Toolbar/actions/EmojiAction.d.ts +0 -4
- package/es/components/organism/TextEditor/ui/Toolbar/actions/EmojiAction.js +0 -13
- package/es/components/organism/TextEditor/ui/Toolbar/actions/FontFamilyAction.d.ts +0 -7
- package/es/components/organism/TextEditor/ui/Toolbar/actions/FontFamilyAction.js +0 -18
- package/es/components/organism/TextEditor/ui/Toolbar/actions/FontSizeAction.d.ts +0 -7
- package/es/components/organism/TextEditor/ui/Toolbar/actions/FontSizeAction.js +0 -37
- package/es/components/organism/TextEditor/ui/Toolbar/actions/HighlightAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/HighlightAction.js +0 -7
- package/es/components/organism/TextEditor/ui/Toolbar/actions/IndentAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/IndentAction.js +0 -7
- package/es/components/organism/TextEditor/ui/Toolbar/actions/ItalicAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/ItalicAction.js +0 -7
- package/es/components/organism/TextEditor/ui/Toolbar/actions/LinkAction.d.ts +0 -6
- package/es/components/organism/TextEditor/ui/Toolbar/actions/LinkAction.js +0 -4
- package/es/components/organism/TextEditor/ui/Toolbar/actions/OrderedListAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/OrderedListAction.js +0 -7
- package/es/components/organism/TextEditor/ui/Toolbar/actions/OutdentAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/OutdentAction.js +0 -7
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SmartTagAction.d.ts +0 -7
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SmartTagAction.js +0 -9
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SpacingAction.d.ts +0 -9
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SpacingAction.js +0 -22
- package/es/components/organism/TextEditor/ui/Toolbar/actions/StrikeAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/StrikeAction.js +0 -7
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SubscriptAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SubscriptAction.js +0 -13
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SuperscriptAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SuperscriptAction.js +0 -13
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextAlignAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextAlignAction.js +0 -3
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextBackgroundColorAction.d.ts +0 -7
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextBackgroundColorAction.js +0 -19
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextColorAction.d.ts +0 -15
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextColorAction.js +0 -14
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextTransformAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextTransformAction.js +0 -30
- package/es/components/organism/TextEditor/ui/Toolbar/actions/UnderlineAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/UnderlineAction.js +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/UnsetLink.d.ts +0 -6
- package/es/components/organism/TextEditor/ui/Toolbar/actions/UnsetLink.js +0 -10
- package/es/components/organism/TextEditor/ui/Toolbar/actions/index.d.ts +0 -20
- package/es/components/organism/TextEditor/ui/Toolbar/actions/index.js +0 -20
- package/es/components/organism/TextEditor/ui/Toolbar/index.d.ts +0 -1
- package/es/components/organism/TextEditor/ui/Toolbar/index.js +0 -1
- package/es/components/organism/TextEditor/utils/documentState.d.ts +0 -57
- package/es/components/organism/TextEditor/utils/documentState.js +0 -100
- package/es/components/organism/TextEditor/utils/font.d.ts +0 -84
- package/es/components/organism/TextEditor/utils/font.js +0 -175
- package/es/components/organism/TextEditor/utils/htmlProcessing.d.ts +0 -63
- package/es/components/organism/TextEditor/utils/htmlProcessing.js +0 -321
- package/es/components/organism/TextEditor/utils/index.d.ts +0 -8
- package/es/components/organism/TextEditor/utils/index.js +0 -16
- package/es/components/organism/TextEditor/utils/link.d.ts +0 -100
- package/es/components/organism/TextEditor/utils/link.js +0 -149
- package/es/components/organism/TextEditor/utils/menu.d.ts +0 -134
- package/es/components/organism/TextEditor/utils/menu.js +0 -317
- package/es/components/organism/TextEditor/utils/selection.d.ts +0 -25
- package/es/components/organism/TextEditor/utils/selection.js +0 -57
- package/es/components/organism/TextEditor/utils/smartTag.d.ts +0 -49
- package/es/components/organism/TextEditor/utils/smartTag.js +0 -89
- package/es/components/organism/TextEditor/utils/style.d.ts +0 -78
- package/es/components/organism/TextEditor/utils/style.js +0 -193
- package/es/components/organism/index.scss +0 -1
- package/es/hooks/useBroadcastedLocalStorage.d.ts +0 -5
- package/es/hooks/useBroadcastedLocalStorage.js +0 -71
- package/es/hooks/useElementSize.d.ts +0 -7
- package/es/hooks/useElementSize.js +0 -56
- package/es/utils/tree.d.ts +0 -225
- package/es/utils/tree.js +0 -469
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import '@tiptap/extension-text-style';
|
|
2
|
-
import { Extension } from '@tiptap/core';
|
|
3
|
-
import { DEFAULT_TEXT_STYLE } from '../constants';
|
|
4
|
-
/**
|
|
5
|
-
* This extension allows you to set a font size for text.
|
|
6
|
-
*/
|
|
7
|
-
export const FontSize = Extension.create({
|
|
8
|
-
name: 'fontSize',
|
|
9
|
-
addOptions() {
|
|
10
|
-
return {
|
|
11
|
-
types: ['textStyle'],
|
|
12
|
-
defaultFontSize: DEFAULT_TEXT_STYLE.fontSize,
|
|
13
|
-
};
|
|
14
|
-
},
|
|
15
|
-
addGlobalAttributes() {
|
|
16
|
-
return [
|
|
17
|
-
{
|
|
18
|
-
types: this.options.types,
|
|
19
|
-
attributes: {
|
|
20
|
-
fontSize: {
|
|
21
|
-
default: this.options.defaultFontSize,
|
|
22
|
-
parseHTML: element => element.style.fontSize || this.options.defaultFontSize,
|
|
23
|
-
renderHTML: attrs => {
|
|
24
|
-
if (!attrs.fontSize || attrs.fontSize === this.options.defaultFontSize) {
|
|
25
|
-
return {};
|
|
26
|
-
}
|
|
27
|
-
return {
|
|
28
|
-
style: `font-size: ${attrs.fontSize}`,
|
|
29
|
-
};
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
];
|
|
35
|
-
},
|
|
36
|
-
addCommands() {
|
|
37
|
-
return {
|
|
38
|
-
setFontSize: fontSize => ({ chain }) => chain().setMark('textStyle', { fontSize }).run(),
|
|
39
|
-
unsetFontSize: () => ({ chain }) => chain()
|
|
40
|
-
.setMark('textStyle', {
|
|
41
|
-
fontSize: this.options.defaultFontSize || null,
|
|
42
|
-
})
|
|
43
|
-
.removeEmptyTextStyle()
|
|
44
|
-
.run(),
|
|
45
|
-
};
|
|
46
|
-
},
|
|
47
|
-
});
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Extension } from '@tiptap/core';
|
|
2
|
-
export interface FontWeightOptions {
|
|
3
|
-
types: string[];
|
|
4
|
-
defaultWeight: string | number;
|
|
5
|
-
}
|
|
6
|
-
declare module '@tiptap/core' {
|
|
7
|
-
interface Commands<ReturnType> {
|
|
8
|
-
fontWeight: {
|
|
9
|
-
/**
|
|
10
|
-
* Set the font weight
|
|
11
|
-
* @param fontWeight The font weight
|
|
12
|
-
* @example editor.commands.setFontWeight('bold')
|
|
13
|
-
*/
|
|
14
|
-
setFontWeight: (fontWeight: string | number) => ReturnType;
|
|
15
|
-
/**
|
|
16
|
-
* Unset the font weight
|
|
17
|
-
* @example editor.commands.unsetFontWeight()
|
|
18
|
-
*/
|
|
19
|
-
unsetFontWeight: () => ReturnType;
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
export declare const FontWeight: Extension<any, any>;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { Extension } from '@tiptap/core';
|
|
2
|
-
import { DEFAULT_TEXT_STYLE } from '../constants';
|
|
3
|
-
export const FontWeight = Extension.create({
|
|
4
|
-
name: 'fontWeight',
|
|
5
|
-
addOptions() {
|
|
6
|
-
return {
|
|
7
|
-
types: ['textStyle'],
|
|
8
|
-
defaultWeight: DEFAULT_TEXT_STYLE.fontWeight,
|
|
9
|
-
};
|
|
10
|
-
},
|
|
11
|
-
addGlobalAttributes() {
|
|
12
|
-
return [
|
|
13
|
-
{
|
|
14
|
-
types: this.options.types,
|
|
15
|
-
attributes: {
|
|
16
|
-
fontWeight: {
|
|
17
|
-
default: this.options.defaultWeight,
|
|
18
|
-
renderHTML: attributes => {
|
|
19
|
-
if (!attributes.fontWeight) {
|
|
20
|
-
return {};
|
|
21
|
-
}
|
|
22
|
-
return {
|
|
23
|
-
style: `font-weight: ${attributes.fontWeight}`,
|
|
24
|
-
};
|
|
25
|
-
},
|
|
26
|
-
parseHTML: element => element.style.fontWeight,
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
];
|
|
31
|
-
},
|
|
32
|
-
addCommands() {
|
|
33
|
-
return {
|
|
34
|
-
setFontWeight: fontWeight => ({ chain }) => chain().setMark('textStyle', { fontWeight }).run(),
|
|
35
|
-
unsetFontWeight: () => ({ chain }) => chain()
|
|
36
|
-
.setMark('textStyle', { fontWeight: this.options.defaultWeight })
|
|
37
|
-
.removeEmptyTextStyle()
|
|
38
|
-
.run(),
|
|
39
|
-
};
|
|
40
|
-
},
|
|
41
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const Highlight: import("@tiptap/core").Mark<import("@tiptap/extension-highlight").HighlightOptions, any>;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Highlight as TiptapHighlightExtension } from '@tiptap/extension-highlight';
|
|
2
|
-
export const Highlight = TiptapHighlightExtension.extend({
|
|
3
|
-
parseHTML() {
|
|
4
|
-
return [
|
|
5
|
-
{
|
|
6
|
-
tag: 'mark',
|
|
7
|
-
},
|
|
8
|
-
{
|
|
9
|
-
tag: 'span',
|
|
10
|
-
getAttrs: node => node.style.backgroundColor !== undefined && null,
|
|
11
|
-
},
|
|
12
|
-
];
|
|
13
|
-
},
|
|
14
|
-
});
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Extension } from '@tiptap/core';
|
|
2
|
-
export interface IndentOptions {
|
|
3
|
-
/**
|
|
4
|
-
* Maximum indentation level
|
|
5
|
-
* @default 8
|
|
6
|
-
*/
|
|
7
|
-
maxIndent: number;
|
|
8
|
-
/**
|
|
9
|
-
* Types of nodes that can be indented
|
|
10
|
-
* @default ['paragraph', 'heading']
|
|
11
|
-
*/
|
|
12
|
-
types: string[];
|
|
13
|
-
}
|
|
14
|
-
declare module '@tiptap/core' {
|
|
15
|
-
interface Commands<ReturnType> {
|
|
16
|
-
indent: {
|
|
17
|
-
/**
|
|
18
|
-
* Increase indent
|
|
19
|
-
*/
|
|
20
|
-
indent: () => ReturnType;
|
|
21
|
-
/**
|
|
22
|
-
* Decrease indent
|
|
23
|
-
*/
|
|
24
|
-
outdent: () => ReturnType;
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
export declare const Indent: Extension<IndentOptions, any>;
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { Extension } from '@tiptap/core';
|
|
2
|
-
export const Indent = Extension.create({
|
|
3
|
-
name: 'indent',
|
|
4
|
-
addOptions() {
|
|
5
|
-
return {
|
|
6
|
-
maxIndent: 8,
|
|
7
|
-
types: ['paragraph', 'heading'],
|
|
8
|
-
};
|
|
9
|
-
},
|
|
10
|
-
addGlobalAttributes() {
|
|
11
|
-
return [
|
|
12
|
-
{
|
|
13
|
-
types: this.options.types,
|
|
14
|
-
attributes: {
|
|
15
|
-
indent: {
|
|
16
|
-
default: 0,
|
|
17
|
-
renderHTML: attrs => attrs.indent
|
|
18
|
-
? {
|
|
19
|
-
style: `margin-left: ${attrs.indent}em;`,
|
|
20
|
-
}
|
|
21
|
-
: {},
|
|
22
|
-
parseHTML: element => {
|
|
23
|
-
const indent = element.style.marginLeft;
|
|
24
|
-
if (indent) {
|
|
25
|
-
return parseInt(indent) || 0;
|
|
26
|
-
}
|
|
27
|
-
return 0;
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
];
|
|
33
|
-
},
|
|
34
|
-
addCommands() {
|
|
35
|
-
return {
|
|
36
|
-
indent: () => ({ commands }) => {
|
|
37
|
-
// Lấy giá trị indent hiện tại
|
|
38
|
-
const currentIndent = this.editor.getAttributes('paragraph').indent || 0;
|
|
39
|
-
// Giới hạn mức indent tối đa từ options
|
|
40
|
-
if (currentIndent >= this.options.maxIndent)
|
|
41
|
-
return false;
|
|
42
|
-
return this.options.types
|
|
43
|
-
.map(type => commands.updateAttributes(type, {
|
|
44
|
-
indent: currentIndent + 1,
|
|
45
|
-
}))
|
|
46
|
-
.every(reponse => reponse);
|
|
47
|
-
},
|
|
48
|
-
outdent: () => ({ commands }) => {
|
|
49
|
-
// Lấy giá trị indent hiện tại
|
|
50
|
-
const currentIndent = this.editor.getAttributes('paragraph').indent || 0;
|
|
51
|
-
// Không thể outdent khi indent = 0
|
|
52
|
-
if (currentIndent <= 0)
|
|
53
|
-
return false;
|
|
54
|
-
return this.options.types
|
|
55
|
-
.map(type => commands.updateAttributes(type, {
|
|
56
|
-
indent: currentIndent - 1,
|
|
57
|
-
}))
|
|
58
|
-
.every(reponse => reponse);
|
|
59
|
-
},
|
|
60
|
-
};
|
|
61
|
-
},
|
|
62
|
-
addKeyboardShortcuts() {
|
|
63
|
-
return {
|
|
64
|
-
Tab: () => this.editor.commands.indent(),
|
|
65
|
-
'Shift-Tab': () => this.editor.commands.outdent(),
|
|
66
|
-
};
|
|
67
|
-
},
|
|
68
|
-
});
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Extension } from '@tiptap/core';
|
|
2
|
-
export interface LineHeightOptions {
|
|
3
|
-
types: string[];
|
|
4
|
-
defaultHeight: string;
|
|
5
|
-
}
|
|
6
|
-
declare module '@tiptap/core' {
|
|
7
|
-
interface Commands<ReturnType> {
|
|
8
|
-
lineHeight: {
|
|
9
|
-
/**
|
|
10
|
-
* Set the line height attribute
|
|
11
|
-
*/
|
|
12
|
-
setLineHeight: (height: string) => ReturnType;
|
|
13
|
-
/**
|
|
14
|
-
* Unset the text align attribute
|
|
15
|
-
*/
|
|
16
|
-
unsetLineHeight: () => ReturnType;
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
export declare const LineHeight: Extension<LineHeightOptions, any>;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { Extension } from '@tiptap/core';
|
|
2
|
-
import { DEFAULT_TEXT_STYLE } from '../constants';
|
|
3
|
-
export const LineHeight = Extension.create({
|
|
4
|
-
name: 'lineHeight',
|
|
5
|
-
addOptions() {
|
|
6
|
-
return {
|
|
7
|
-
defaultHeight: DEFAULT_TEXT_STYLE.lineHeight,
|
|
8
|
-
types: ['heading', 'paragraph'],
|
|
9
|
-
};
|
|
10
|
-
},
|
|
11
|
-
addGlobalAttributes() {
|
|
12
|
-
return [
|
|
13
|
-
{
|
|
14
|
-
types: this.options.types,
|
|
15
|
-
attributes: {
|
|
16
|
-
lineHeight: {
|
|
17
|
-
default: this.options.defaultHeight,
|
|
18
|
-
parseHTML: element => element.style.lineHeight || this.options.defaultHeight,
|
|
19
|
-
renderHTML: attrs => {
|
|
20
|
-
if (!attrs.lineHeight || attrs.lineHeight === this.options.defaultHeight) {
|
|
21
|
-
return {};
|
|
22
|
-
}
|
|
23
|
-
return { style: `line-height: ${attrs.lineHeight}` };
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
];
|
|
29
|
-
},
|
|
30
|
-
addCommands() {
|
|
31
|
-
return {
|
|
32
|
-
setLineHeight: (height) => ({ commands }) => this.options.types.every(type => commands.updateAttributes(type, { lineHeight: height })),
|
|
33
|
-
unsetLineHeight: () => ({ commands }) => this.options.types.every(type => commands.resetAttributes(type, 'lineHeight')),
|
|
34
|
-
};
|
|
35
|
-
},
|
|
36
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { LinkOptions as TiptapLinkOptions } from '@tiptap/extension-link';
|
|
2
|
-
export type LinkAttrs = {
|
|
3
|
-
id: string;
|
|
4
|
-
href: string;
|
|
5
|
-
} & Partial<{
|
|
6
|
-
content: string;
|
|
7
|
-
target: string | null;
|
|
8
|
-
rel: string | null;
|
|
9
|
-
class: string | null;
|
|
10
|
-
title: string | null;
|
|
11
|
-
dynamic: boolean | null;
|
|
12
|
-
tag: boolean | null;
|
|
13
|
-
}>;
|
|
14
|
-
export type LinkOptions = TiptapLinkOptions & {};
|
|
15
|
-
export declare const Link: import("@tiptap/core").Mark<TiptapLinkOptions, any>;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import TiptapLinkExtension from '@tiptap/extension-link';
|
|
2
|
-
import { LINK_TEXT_COLOR } from '../constants';
|
|
3
|
-
export const Link = TiptapLinkExtension.extend({
|
|
4
|
-
addOptions() {
|
|
5
|
-
return {
|
|
6
|
-
...this.parent?.(),
|
|
7
|
-
openOnClick: false,
|
|
8
|
-
autolink: false,
|
|
9
|
-
};
|
|
10
|
-
},
|
|
11
|
-
addAttributes() {
|
|
12
|
-
return {
|
|
13
|
-
...this.parent?.(),
|
|
14
|
-
id: {
|
|
15
|
-
default: null,
|
|
16
|
-
parseHTML: el => el.getAttribute('data-link-id'),
|
|
17
|
-
renderHTML: attrs => ({
|
|
18
|
-
'data-link-id': attrs.id,
|
|
19
|
-
}),
|
|
20
|
-
},
|
|
21
|
-
title: {
|
|
22
|
-
default: null,
|
|
23
|
-
parseHTML: el => el.title,
|
|
24
|
-
},
|
|
25
|
-
dynamic: {
|
|
26
|
-
default: null,
|
|
27
|
-
parseHTML: el => el.getAttribute('data-dynamic') === 'true',
|
|
28
|
-
renderHTML: attrs => (attrs.dynamic ? { 'data-dynamic': attrs.dynamic } : null),
|
|
29
|
-
},
|
|
30
|
-
tag: {
|
|
31
|
-
default: null,
|
|
32
|
-
parseHTML: el => el.getAttribute('data-tag'),
|
|
33
|
-
renderHTML: attrs => (attrs.tag ? { 'data-tag': attrs.tag } : null),
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
},
|
|
37
|
-
addKeyboardShortcuts() {
|
|
38
|
-
return {
|
|
39
|
-
...this.parent?.(),
|
|
40
|
-
Enter: ({ editor }) => {
|
|
41
|
-
editor.chain().unsetUnderline().run();
|
|
42
|
-
const currentColor = editor.getAttributes('textStyle').color;
|
|
43
|
-
if (currentColor === LINK_TEXT_COLOR) {
|
|
44
|
-
editor.chain().unsetColor().run();
|
|
45
|
-
}
|
|
46
|
-
return false;
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
},
|
|
50
|
-
});
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Extension } from '@tiptap/core';
|
|
2
|
-
export interface ListItemMarkerOptions {
|
|
3
|
-
paddingRight: number;
|
|
4
|
-
defaultFontSize: string;
|
|
5
|
-
defaultFontFamily: string;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Extension tạo marker tùy chỉnh cho danh sách trong p
|
|
9
|
-
*
|
|
10
|
-
* Extension này thay thế marker mặc định của danh sách bằng các marker
|
|
11
|
-
* có thể kế thừa style (font, size, color...) từ text node đầu tiên.
|
|
12
|
-
*/
|
|
13
|
-
export declare const ListItemMarker: Extension<ListItemMarkerOptions, any>;
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
import { Extension } from '@tiptap/core';
|
|
2
|
-
import { Plugin, PluginKey } from '@tiptap/pm/state';
|
|
3
|
-
import { Decoration, DecorationSet } from '@tiptap/pm/view';
|
|
4
|
-
import { kebabCase } from 'lodash';
|
|
5
|
-
function getMaxMarkerWidth(markers, font = '16px Arial') {
|
|
6
|
-
let max = 0;
|
|
7
|
-
const canvas = document.createElement('canvas');
|
|
8
|
-
const ctx = canvas.getContext('2d');
|
|
9
|
-
if (!ctx)
|
|
10
|
-
return max;
|
|
11
|
-
ctx.font = font;
|
|
12
|
-
for (const m of markers) {
|
|
13
|
-
const w = ctx.measureText(m).width;
|
|
14
|
-
if (w > max)
|
|
15
|
-
max = w;
|
|
16
|
-
}
|
|
17
|
-
return max;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Tạo các marker tùy chỉnh cho danh sách (bullet và ordered) với style kế thừa từ text node
|
|
21
|
-
*
|
|
22
|
-
* @param doc - ProseMirror document node
|
|
23
|
-
* @returns DecorationSet chứa tất cả các widget decoration cho marker
|
|
24
|
-
*/
|
|
25
|
-
const styleMarker = (doc, options) => {
|
|
26
|
-
const decorations = [];
|
|
27
|
-
doc.descendants((listNode, listNodePos) => {
|
|
28
|
-
const isBulletList = listNode.type.name === 'bulletList';
|
|
29
|
-
const isOrderedList = listNode.type.name === 'orderedList';
|
|
30
|
-
if (!isBulletList && !isOrderedList) {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
// Khởi tạo marker dựa trên loại danh sách
|
|
34
|
-
const getMarker = (isOrderedList, index) => isOrderedList ? `${index + 1}.` : '•';
|
|
35
|
-
const markers = [];
|
|
36
|
-
const listItems = [];
|
|
37
|
-
listNode.descendants((listItem, listItemPos) => {
|
|
38
|
-
if (listItem.type.name !== 'listItem') {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
const itemInfo = {
|
|
42
|
-
node: listItem,
|
|
43
|
-
pos: listItemPos,
|
|
44
|
-
isEmpty: true,
|
|
45
|
-
};
|
|
46
|
-
listItems.push(itemInfo);
|
|
47
|
-
// Tìm paragraph đầu tiên và text node đầu tiên
|
|
48
|
-
let foundText = false;
|
|
49
|
-
let foundParagraph = false;
|
|
50
|
-
listItem.descendants((node, nodePos) => {
|
|
51
|
-
if (!foundParagraph && node.type.name === 'paragraph') {
|
|
52
|
-
foundParagraph = true;
|
|
53
|
-
itemInfo.paragraphPos = nodePos;
|
|
54
|
-
itemInfo.paragraphNode = node;
|
|
55
|
-
}
|
|
56
|
-
if (!foundText && node.type.name === 'text') {
|
|
57
|
-
foundText = true;
|
|
58
|
-
itemInfo.isEmpty = false;
|
|
59
|
-
itemInfo.textNode = node;
|
|
60
|
-
itemInfo.textNodePos = nodePos;
|
|
61
|
-
const textStyleMark = node.marks.find(nodeMark => nodeMark.type.name === 'textStyle');
|
|
62
|
-
if (textStyleMark) {
|
|
63
|
-
itemInfo.textStyleMark = textStyleMark;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
const index = listItems.length;
|
|
68
|
-
const marker = getMarker(isOrderedList, index - 1);
|
|
69
|
-
markers.push(marker);
|
|
70
|
-
});
|
|
71
|
-
for (let i = 0; i < listItems.length; i++) {
|
|
72
|
-
const item = listItems[i];
|
|
73
|
-
if (!item.textStyleMark) {
|
|
74
|
-
for (let j = i - 1; j >= 0; j--) {
|
|
75
|
-
if (listItems[j].textStyleMark) {
|
|
76
|
-
item.textStyleMark = listItems[j].textStyleMark;
|
|
77
|
-
break;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
let font = `${options.defaultFontSize} ${options.defaultFontFamily}`;
|
|
83
|
-
for (const item of listItems) {
|
|
84
|
-
if (item.textStyleMark) {
|
|
85
|
-
const { fontSize, fontFamily } = item.textStyleMark.attrs;
|
|
86
|
-
if (fontSize && fontFamily) {
|
|
87
|
-
font = `${fontSize} ${fontFamily}`;
|
|
88
|
-
break;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
const maxWidth = getMaxMarkerWidth(markers, font);
|
|
93
|
-
const { paddingRight } = options;
|
|
94
|
-
const totalWidth = maxWidth + paddingRight;
|
|
95
|
-
listItems.forEach((item, index) => {
|
|
96
|
-
if (item.paragraphPos === undefined) {
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
const marker = getMarker(isOrderedList, index);
|
|
100
|
-
const widget = document.createElement('span');
|
|
101
|
-
widget.innerHTML = marker;
|
|
102
|
-
// Đặt các thuộc tính style cơ bản
|
|
103
|
-
widget.style.setProperty('user-select', 'none');
|
|
104
|
-
widget.style.setProperty('text-decoration', 'none');
|
|
105
|
-
widget.style.setProperty('display', 'inline-block');
|
|
106
|
-
widget.style.setProperty('width', `${totalWidth}px`);
|
|
107
|
-
widget.style.setProperty('text-align', 'left');
|
|
108
|
-
// Sao chép tất cả các thuộc tính style từ mark textStyle
|
|
109
|
-
if (item.textStyleMark) {
|
|
110
|
-
for (const styleProp in item.textStyleMark.attrs) {
|
|
111
|
-
widget.style.setProperty(kebabCase(styleProp), String(item.textStyleMark.attrs[styleProp]));
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
// Tính toán vị trí chính xác cho marker
|
|
115
|
-
const absoluteListItemPos = listNodePos + item.pos + 1;
|
|
116
|
-
const absoluteParagraphPos = absoluteListItemPos + item.paragraphPos;
|
|
117
|
-
const markerPos = absoluteParagraphPos + 1;
|
|
118
|
-
// Đặt marker widget tại vị trí đã tính toán (bên trong paragraph)
|
|
119
|
-
// Decoration.widget sẽ tạo một widget tại vị trí markerPos
|
|
120
|
-
decorations.push(Decoration.widget(markerPos, widget, {
|
|
121
|
-
ignoreSelection: true,
|
|
122
|
-
}));
|
|
123
|
-
if (item.paragraphNode) {
|
|
124
|
-
// Tính toán vị trí bắt đầu và kết thúc của paragraph
|
|
125
|
-
const paragraphStart = absoluteParagraphPos;
|
|
126
|
-
const paragraphEnd = paragraphStart + item.paragraphNode.nodeSize;
|
|
127
|
-
// Thêm decoration cho paragraph với style inline-block
|
|
128
|
-
decorations.push(Decoration.node(paragraphStart + 1, paragraphEnd + 1, {
|
|
129
|
-
style: 'display: inline;',
|
|
130
|
-
}));
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
});
|
|
134
|
-
return DecorationSet.create(doc, decorations);
|
|
135
|
-
};
|
|
136
|
-
/**
|
|
137
|
-
* Extension tạo marker tùy chỉnh cho danh sách trong p
|
|
138
|
-
*
|
|
139
|
-
* Extension này thay thế marker mặc định của danh sách bằng các marker
|
|
140
|
-
* có thể kế thừa style (font, size, color...) từ text node đầu tiên.
|
|
141
|
-
*/
|
|
142
|
-
export const ListItemMarker = Extension.create({
|
|
143
|
-
name: 'list-item-marker',
|
|
144
|
-
addOptions() {
|
|
145
|
-
return {
|
|
146
|
-
...this.parent?.(),
|
|
147
|
-
paddingRight: 10,
|
|
148
|
-
defaultFontSize: '16px',
|
|
149
|
-
defaultFontFamily: 'Arial',
|
|
150
|
-
};
|
|
151
|
-
},
|
|
152
|
-
addProseMirrorPlugins() {
|
|
153
|
-
const { options } = this;
|
|
154
|
-
return [
|
|
155
|
-
new Plugin({
|
|
156
|
-
key: new PluginKey('custom-list-item-marker'),
|
|
157
|
-
state: {
|
|
158
|
-
init(_, { doc }) {
|
|
159
|
-
return styleMarker(doc, options);
|
|
160
|
-
},
|
|
161
|
-
// Chỉ tính toán lại nếu document thay đổi
|
|
162
|
-
apply(tr, oldState) {
|
|
163
|
-
return tr.docChanged ? styleMarker(tr.doc, options) : oldState;
|
|
164
|
-
},
|
|
165
|
-
},
|
|
166
|
-
props: {
|
|
167
|
-
decorations(state) {
|
|
168
|
-
return this.getState(state);
|
|
169
|
-
},
|
|
170
|
-
},
|
|
171
|
-
}),
|
|
172
|
-
];
|
|
173
|
-
},
|
|
174
|
-
});
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { Extension, isNodeSelection } from '@tiptap/core';
|
|
2
|
-
import { Plugin, PluginKey } from '@tiptap/pm/state';
|
|
3
|
-
import { Decoration, DecorationSet } from '@tiptap/pm/view';
|
|
4
|
-
const EXTENSION_NAME = 'selectionDecoration';
|
|
5
|
-
export const SelectionDecoration = Extension.create({
|
|
6
|
-
name: EXTENSION_NAME,
|
|
7
|
-
addOptions() {
|
|
8
|
-
return {
|
|
9
|
-
className: 'selection',
|
|
10
|
-
};
|
|
11
|
-
},
|
|
12
|
-
addProseMirrorPlugins() {
|
|
13
|
-
return [
|
|
14
|
-
new Plugin({
|
|
15
|
-
key: new PluginKey(EXTENSION_NAME),
|
|
16
|
-
props: {
|
|
17
|
-
decorations: () => {
|
|
18
|
-
const { state, isFocused, isEditable } = this.editor;
|
|
19
|
-
const { selection } = state;
|
|
20
|
-
const { from, to } = selection;
|
|
21
|
-
if (state.selection.empty) {
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
if (isFocused === true || !isEditable) {
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
if (isNodeSelection(state.selection)) {
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
return DecorationSet.create(state.doc, [
|
|
31
|
-
Decoration.inline(from, to, {
|
|
32
|
-
class: this.options.className,
|
|
33
|
-
}),
|
|
34
|
-
]);
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
}),
|
|
38
|
-
];
|
|
39
|
-
},
|
|
40
|
-
});
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { Node } from '@tiptap/core';
|
|
2
|
-
import { Attrs } from '@tiptap/pm/model';
|
|
3
|
-
export type SmartTagAttrs = {
|
|
4
|
-
id: string;
|
|
5
|
-
} & Partial<{
|
|
6
|
-
content: string;
|
|
7
|
-
tag: string;
|
|
8
|
-
}>;
|
|
9
|
-
/**
|
|
10
|
-
* Represents the options for the SmartTag node.
|
|
11
|
-
*/
|
|
12
|
-
export interface SmartTagOptions {
|
|
13
|
-
HTMLAttributes: Record<string, unknown>;
|
|
14
|
-
highlight: boolean;
|
|
15
|
-
}
|
|
16
|
-
export interface SmartTagStorage {
|
|
17
|
-
highlight: boolean;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Represents the options for the SmartTag node.
|
|
21
|
-
*/
|
|
22
|
-
declare module '@tiptap/core' {
|
|
23
|
-
interface Commands<ReturnType> {
|
|
24
|
-
smartTag: {
|
|
25
|
-
setSmartTag: (attrs: {
|
|
26
|
-
id: string;
|
|
27
|
-
content?: string;
|
|
28
|
-
}) => ReturnType;
|
|
29
|
-
deleteSmartTagGlobally: (predicate: (attrs: Attrs) => boolean) => ReturnType;
|
|
30
|
-
updateSmartTagAttrsGlobally: (updateFn: (attrs: Attrs) => Attrs | undefined) => ReturnType;
|
|
31
|
-
updateSmartTagHighlight: (enabled: boolean) => ReturnType;
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
export declare const EXTENSION_NAME = "smartTag";
|
|
36
|
-
/**
|
|
37
|
-
* Represents a dynamic tag node in the editor.
|
|
38
|
-
*/
|
|
39
|
-
export declare const SmartTag: Node<SmartTagOptions, SmartTagStorage>;
|