@antscorp/antsomi-ui 2.0.81 → 2.0.83-text-editor-beta.1
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 +4 -2
- package/es/components/index.scss +1 -0
- package/es/components/molecules/AccountSelection/AccountListing.js +14 -3
- package/es/components/molecules/EmojiPopover/EmojiPopover.js +5 -1
- package/es/components/molecules/FontSizeInput/FontSizeInput.d.ts +3 -0
- package/es/components/molecules/FontSizeInput/FontSizeInput.js +77 -0
- package/es/components/molecules/FontSizeInput/constants.d.ts +2 -0
- package/es/components/molecules/FontSizeInput/constants.js +5 -0
- package/es/components/molecules/FontSizeInput/index.d.ts +2 -0
- package/es/components/molecules/FontSizeInput/index.js +1 -0
- package/es/components/molecules/FontSizeInput/types.d.ts +21 -0
- package/es/components/molecules/FontSizeInput/types.js +1 -0
- package/es/components/molecules/QuillEditor/QuillEditor.js +1 -1
- package/es/components/molecules/VirtualizedMenu/VirtualizedMenu.d.ts +1 -2
- package/es/components/molecules/VirtualizedMenu/__mocks__/index.js +2550 -938
- package/es/components/molecules/VirtualizedMenu/components/Item/Item.d.ts +4 -3
- package/es/components/molecules/VirtualizedMenu/components/Item/Item.js +24 -22
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/MenuInline.d.ts +1 -2
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/MenuInline.js +59 -31
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/MenuInline.optimized.d.ts +19 -0
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/MenuInline.optimized.js +233 -0
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/index.d.ts +1 -1
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/index.js +2 -1
- package/es/components/molecules/VirtualizedMenu/styled.d.ts +1 -1
- package/es/components/molecules/VirtualizedMenu/styled.js +11 -3
- package/es/components/molecules/VirtualizedMenu/types.d.ts +1 -8
- package/es/components/molecules/VirtualizedMenu/utils.d.ts +7 -5
- package/es/components/molecules/VirtualizedMenu/utils.js +12 -18
- package/es/components/molecules/index.d.ts +1 -0
- package/es/components/molecules/index.js +1 -0
- package/es/components/organism/ActivityTimeline/__mocks__/event_tracking.json +1290 -0
- package/es/components/organism/ActivityTimeline/__mocks__/timeline.json +3059 -0
- package/es/components/organism/TextEditor/TextEditor.d.ts +3 -0
- package/es/components/organism/TextEditor/TextEditor.js +239 -0
- package/es/components/organism/TextEditor/__mocks__/text-block.settings.json +320 -0
- package/es/components/organism/TextEditor/__mocks__/text-contennt.d.ts +1 -0
- package/es/components/organism/TextEditor/__mocks__/text-contennt.js +38 -0
- package/es/components/organism/TextEditor/constants.d.ts +135 -0
- package/es/components/organism/TextEditor/constants.js +280 -0
- package/es/components/organism/TextEditor/extensions/BackgroundColor.d.ts +25 -0
- package/es/components/organism/TextEditor/extensions/BackgroundColor.js +41 -0
- package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu-plugin.d.ts +130 -0
- package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu-plugin.js +247 -0
- package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu.d.ts +15 -0
- package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu.js +31 -0
- package/es/components/organism/TextEditor/extensions/BubbleMenu/index.d.ts +2 -0
- package/es/components/organism/TextEditor/extensions/BubbleMenu/index.js +2 -0
- package/es/components/organism/TextEditor/extensions/Color.d.ts +6 -0
- package/es/components/organism/TextEditor/extensions/Color.js +19 -0
- package/es/components/organism/TextEditor/extensions/Emoji.d.ts +57 -0
- package/es/components/organism/TextEditor/extensions/Emoji.js +184 -0
- package/es/components/organism/TextEditor/extensions/FontFamily.d.ts +6 -0
- package/es/components/organism/TextEditor/extensions/FontFamily.js +43 -0
- package/es/components/organism/TextEditor/extensions/FontSize.d.ts +32 -0
- package/es/components/organism/TextEditor/extensions/FontSize.js +47 -0
- package/es/components/organism/TextEditor/extensions/FontWeight.d.ts +23 -0
- package/es/components/organism/TextEditor/extensions/FontWeight.js +41 -0
- package/es/components/organism/TextEditor/extensions/Highlight.d.ts +1 -0
- package/es/components/organism/TextEditor/extensions/Highlight.js +14 -0
- package/es/components/organism/TextEditor/extensions/Indent.d.ts +28 -0
- package/es/components/organism/TextEditor/extensions/Indent.js +66 -0
- package/es/components/organism/TextEditor/extensions/LineHeight.d.ts +20 -0
- package/es/components/organism/TextEditor/extensions/LineHeight.js +36 -0
- package/es/components/organism/TextEditor/extensions/Link.d.ts +3 -0
- package/es/components/organism/TextEditor/extensions/Link.js +47 -0
- package/es/components/organism/TextEditor/extensions/ListItemMarker.d.ts +13 -0
- package/es/components/organism/TextEditor/extensions/ListItemMarker.js +174 -0
- package/es/components/organism/TextEditor/extensions/Selection.d.ts +6 -0
- package/es/components/organism/TextEditor/extensions/Selection.js +40 -0
- package/es/components/organism/TextEditor/extensions/SmartTag.d.ts +33 -0
- package/es/components/organism/TextEditor/extensions/SmartTag.js +162 -0
- package/es/components/organism/TextEditor/extensions/StyleMemory.d.ts +36 -0
- package/es/components/organism/TextEditor/extensions/StyleMemory.js +163 -0
- package/es/components/organism/TextEditor/extensions/TextTransform.d.ts +31 -0
- package/es/components/organism/TextEditor/extensions/TextTransform.js +35 -0
- package/es/components/organism/TextEditor/hooks/index.d.ts +6 -0
- package/es/components/organism/TextEditor/hooks/index.js +6 -0
- package/es/components/organism/TextEditor/hooks/useDocumentState.d.ts +18 -0
- package/es/components/organism/TextEditor/hooks/useDocumentState.js +42 -0
- package/es/components/organism/TextEditor/hooks/useLinkHandler.d.ts +27 -0
- package/es/components/organism/TextEditor/hooks/useLinkHandler.js +279 -0
- package/es/components/organism/TextEditor/hooks/useMarkTracking.d.ts +26 -0
- package/es/components/organism/TextEditor/hooks/useMarkTracking.js +68 -0
- package/es/components/organism/TextEditor/hooks/usePersistence.d.ts +31 -0
- package/es/components/organism/TextEditor/hooks/usePersistence.js +169 -0
- package/es/components/organism/TextEditor/hooks/useStyleMemory.d.ts +6 -0
- package/es/components/organism/TextEditor/hooks/useStyleMemory.js +42 -0
- package/es/components/organism/TextEditor/hooks/useStylePresets.d.ts +34 -0
- package/es/components/organism/TextEditor/hooks/useStylePresets.js +83 -0
- package/es/components/organism/TextEditor/index.d.ts +5 -0
- package/es/components/organism/TextEditor/index.js +2 -0
- package/es/components/organism/TextEditor/index.scss +26 -0
- package/es/components/organism/TextEditor/provider.d.ts +10 -0
- package/es/components/organism/TextEditor/provider.js +20 -0
- package/es/components/organism/TextEditor/store.d.ts +11 -0
- package/es/components/organism/TextEditor/store.js +12 -0
- package/es/components/organism/TextEditor/styled.d.ts +5 -0
- package/es/components/organism/TextEditor/styled.js +69 -0
- package/es/components/organism/TextEditor/types.d.ts +95 -0
- package/es/components/organism/TextEditor/types.js +1 -0
- package/es/components/organism/TextEditor/ui/BubbleMenu/BubbleMenu.d.ts +6 -0
- package/es/components/organism/TextEditor/ui/BubbleMenu/BubbleMenu.js +78 -0
- package/es/components/organism/TextEditor/ui/BubbleMenu/index.d.ts +1 -0
- package/es/components/organism/TextEditor/ui/BubbleMenu/index.js +1 -0
- package/es/components/organism/TextEditor/ui/ColorPicker/ColorPicker.d.ts +43 -0
- package/es/components/organism/TextEditor/ui/ColorPicker/ColorPicker.js +120 -0
- package/es/components/organism/TextEditor/ui/ColorPicker/index.d.ts +1 -0
- package/es/components/organism/TextEditor/ui/ColorPicker/index.js +1 -0
- package/es/components/organism/TextEditor/ui/Emoji/EmojiList.d.ts +11 -0
- package/es/components/organism/TextEditor/ui/Emoji/EmojiList.js +66 -0
- package/es/components/organism/TextEditor/ui/Emoji/index.d.ts +2 -0
- package/es/components/organism/TextEditor/ui/Emoji/index.js +2 -0
- package/es/components/organism/TextEditor/ui/Emoji/suggestion.d.ts +4 -0
- package/es/components/organism/TextEditor/ui/Emoji/suggestion.js +71 -0
- package/es/components/organism/TextEditor/ui/FontPopover/FontPopover.d.ts +11 -0
- package/es/components/organism/TextEditor/ui/FontPopover/FontPopover.js +72 -0
- package/es/components/organism/TextEditor/ui/FontPopover/styled.d.ts +1 -0
- package/es/components/organism/TextEditor/ui/FontPopover/styled.js +51 -0
- package/es/components/organism/TextEditor/ui/Popover/Popover.d.ts +6 -0
- package/es/components/organism/TextEditor/ui/Popover/Popover.js +7 -0
- package/es/components/organism/TextEditor/ui/Popover/index.d.ts +1 -0
- package/es/components/organism/TextEditor/ui/Popover/index.js +1 -0
- package/es/components/organism/TextEditor/ui/Select/Select.d.ts +4 -0
- package/es/components/organism/TextEditor/ui/Select/Select.js +7 -0
- package/es/components/organism/TextEditor/ui/Select/index.d.ts +1 -0
- package/es/components/organism/TextEditor/ui/Select/index.js +1 -0
- package/es/components/organism/TextEditor/ui/TextAlignSelect/TextAlignSelect.d.ts +30 -0
- package/es/components/organism/TextEditor/ui/TextAlignSelect/TextAlignSelect.js +49 -0
- package/es/components/organism/TextEditor/ui/TextAlignSelect/index.d.ts +1 -0
- package/es/components/organism/TextEditor/ui/TextAlignSelect/index.js +1 -0
- package/es/components/organism/TextEditor/ui/Toolbar/Toolbar.d.ts +14 -0
- package/es/components/organism/TextEditor/ui/Toolbar/Toolbar.js +42 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/BoldAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/BoldAction.js +7 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/BulletListAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/BulletListAction.js +7 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/ClearFormattingAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/ClearFormattingAction.js +18 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/EmojiAction.d.ts +4 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/EmojiAction.js +13 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/FontFamilyAction.d.ts +7 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/FontFamilyAction.js +18 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/FontSizeAction.d.ts +6 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/FontSizeAction.js +42 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/HighlightAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/HighlightAction.js +7 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/IndentAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/IndentAction.js +7 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/ItalicAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/ItalicAction.js +7 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/LinkAction.d.ts +6 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/LinkAction.js +4 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/OrderedListAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/OrderedListAction.js +7 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/OutdentAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/OutdentAction.js +7 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SmartTagAction.d.ts +7 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SmartTagAction.js +9 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SpacingAction.d.ts +9 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SpacingAction.js +22 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/StrikeAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/StrikeAction.js +7 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SubscriptAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SubscriptAction.js +13 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SuperscriptAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SuperscriptAction.js +13 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextAlignAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextAlignAction.js +3 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextBackgroundColorAction.d.ts +7 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextBackgroundColorAction.js +19 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextColorAction.d.ts +15 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextColorAction.js +14 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextTransformAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextTransformAction.js +28 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/UnderlineAction.d.ts +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/UnderlineAction.js +5 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/UnsetLink.d.ts +6 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/UnsetLink.js +10 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/index.d.ts +20 -0
- package/es/components/organism/TextEditor/ui/Toolbar/actions/index.js +20 -0
- package/es/components/organism/TextEditor/ui/Toolbar/index.d.ts +1 -0
- package/es/components/organism/TextEditor/ui/Toolbar/index.js +1 -0
- package/es/components/organism/TextEditor/utils/documentState.d.ts +57 -0
- package/es/components/organism/TextEditor/utils/documentState.js +100 -0
- package/es/components/organism/TextEditor/utils/font.d.ts +84 -0
- package/es/components/organism/TextEditor/utils/font.js +175 -0
- package/es/components/organism/TextEditor/utils/htmlProcessing.d.ts +62 -0
- package/es/components/organism/TextEditor/utils/htmlProcessing.js +304 -0
- package/es/components/organism/TextEditor/utils/index.d.ts +8 -0
- package/es/components/organism/TextEditor/utils/index.js +16 -0
- package/es/components/organism/TextEditor/utils/link.d.ts +100 -0
- package/es/components/organism/TextEditor/utils/link.js +149 -0
- package/es/components/organism/TextEditor/utils/menu.d.ts +134 -0
- package/es/components/organism/TextEditor/utils/menu.js +317 -0
- package/es/components/organism/TextEditor/utils/selection.d.ts +25 -0
- package/es/components/organism/TextEditor/utils/selection.js +57 -0
- package/es/components/organism/TextEditor/utils/smartTag.d.ts +49 -0
- package/es/components/organism/TextEditor/utils/smartTag.js +89 -0
- package/es/components/organism/TextEditor/utils/style.d.ts +78 -0
- package/es/components/organism/TextEditor/utils/style.js +193 -0
- package/es/components/organism/index.d.ts +1 -0
- package/es/components/organism/index.js +1 -0
- package/es/components/organism/index.scss +1 -0
- package/es/hooks/useBroadcastedLocalStorage.d.ts +5 -0
- package/es/hooks/useBroadcastedLocalStorage.js +71 -0
- package/es/utils/common.d.ts +6 -9
- package/es/utils/common.js +44 -23
- package/es/utils/index.d.ts +1 -0
- package/es/utils/index.js +1 -0
- package/es/utils/tree.d.ts +225 -0
- package/es/utils/tree.js +469 -0
- package/es/utils/web.d.ts +4 -0
- package/es/utils/web.js +25 -0
- package/package.json +29 -3
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, memo, useCallback, useEffect, useImperativeHandle, useRef } from 'react';
|
|
3
|
+
import { useEditor } from '@tiptap/react';
|
|
4
|
+
import StarterKit from '@tiptap/starter-kit';
|
|
5
|
+
import TextStyleExt from '@tiptap/extension-text-style';
|
|
6
|
+
import Underline from '@tiptap/extension-underline';
|
|
7
|
+
import Superscript from '@tiptap/extension-superscript';
|
|
8
|
+
import SubScript from '@tiptap/extension-subscript';
|
|
9
|
+
import TextAlign from '@tiptap/extension-text-align';
|
|
10
|
+
import { FontSize } from './extensions/FontSize';
|
|
11
|
+
import Strike from '@tiptap/extension-strike';
|
|
12
|
+
import { TextTransform } from './extensions/TextTransform';
|
|
13
|
+
import { FontFamily } from './extensions/FontFamily';
|
|
14
|
+
import { SelectionDecoration } from './extensions/Selection';
|
|
15
|
+
import { SmartTag } from './extensions/SmartTag';
|
|
16
|
+
import { Indent } from './extensions/Indent';
|
|
17
|
+
import { LineHeight } from './extensions/LineHeight';
|
|
18
|
+
import { Link as LinkExtension } from './extensions/Link';
|
|
19
|
+
import { Toolbar } from './ui/Toolbar/Toolbar';
|
|
20
|
+
import { defaultShouldShowBubbleMenu, handleLinkAction, handleSmartTagAction, isShowLinkMenu, safeParseHTMLContent, } from './utils';
|
|
21
|
+
import { useLinkHandler } from './hooks/useLinkHandler';
|
|
22
|
+
import { useDebouncedCallback } from 'use-debounce';
|
|
23
|
+
// import { ListItemMarker } from './extensions/ListItemMarker';
|
|
24
|
+
import { StyledBubbleMenu, StyledEditorContent } from './styled';
|
|
25
|
+
import { BackgroundColor } from './extensions/BackgroundColor';
|
|
26
|
+
import { isBoolean } from 'lodash';
|
|
27
|
+
import { DEFAULT_TEXT_STYLE } from './constants';
|
|
28
|
+
import { Color } from './extensions/Color';
|
|
29
|
+
import { FontWeight } from './extensions/FontWeight';
|
|
30
|
+
import { useTextEditorStore } from './provider';
|
|
31
|
+
import { useDeepCompareMemo } from '@antscorp/antsomi-ui/es/hooks';
|
|
32
|
+
// import { StyleMemory } from './extensions/StyleMemory';
|
|
33
|
+
import { Emoji } from './extensions/Emoji';
|
|
34
|
+
import { emojiSuggestion } from './ui/Emoji';
|
|
35
|
+
import clsx from 'clsx';
|
|
36
|
+
import { ANTSOMI_COMPONENT_PREFIX_CLS } from '@antscorp/antsomi-ui/es/constants';
|
|
37
|
+
// import { useStyleMemory } from './hooks';
|
|
38
|
+
export const TextEditor = memo(forwardRef((props, ref) => {
|
|
39
|
+
const { id, className, config, editable = true, initialContent, dataAttributes, defaultTextStyle: defaultTextStyleProp, linkHandler: outerLinkHandler, smartTagHandler: outerSmartTagHandler, bubbleMenuProps, style, onUpdate, onFocus, onCreate, } = props;
|
|
40
|
+
const isShowBubbleMenu = useTextEditorStore(state => state.isShowBubbleMenu);
|
|
41
|
+
const setBubbleMenuContainer = useTextEditorStore(state => state.setBubbleMenuContainer);
|
|
42
|
+
const defaultTextStyle = useDeepCompareMemo(() => ({
|
|
43
|
+
...defaultTextStyleProp,
|
|
44
|
+
...DEFAULT_TEXT_STYLE,
|
|
45
|
+
}), [defaultTextStyleProp]);
|
|
46
|
+
const handleOnUpdateDebounce = useDebouncedCallback((editor) => {
|
|
47
|
+
const html = editor.getHTML();
|
|
48
|
+
const text = editor.getText();
|
|
49
|
+
const json = editor.getJSON();
|
|
50
|
+
onUpdate?.({ html, text, json });
|
|
51
|
+
}, 400);
|
|
52
|
+
const contentRef = useRef(null);
|
|
53
|
+
const editor = useEditor({
|
|
54
|
+
extensions: [
|
|
55
|
+
StarterKit.configure({
|
|
56
|
+
paragraph: {
|
|
57
|
+
HTMLAttributes: {
|
|
58
|
+
style: 'margin: 0;',
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
bulletList: {
|
|
62
|
+
HTMLAttributes: {
|
|
63
|
+
style: 'padding-left: 1em; margin: 0.5em 0; list-style-type: disc;',
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
orderedList: {
|
|
67
|
+
HTMLAttributes: {
|
|
68
|
+
style: 'padding-left: 1em; margin: 0.5em 0; list-style-type: decimal;',
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
listItem: {
|
|
72
|
+
HTMLAttributes: {
|
|
73
|
+
style: 'line-height: normal;',
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
}),
|
|
77
|
+
// Text Style Extensions
|
|
78
|
+
FontWeight.configure({
|
|
79
|
+
defaultWeight: defaultTextStyle.fontWeight,
|
|
80
|
+
}),
|
|
81
|
+
LineHeight.configure({
|
|
82
|
+
defaultHeight: defaultTextStyle.lineHeight,
|
|
83
|
+
}),
|
|
84
|
+
FontFamily.configure({
|
|
85
|
+
defaultFontFamily: defaultTextStyle.fontFamily,
|
|
86
|
+
}),
|
|
87
|
+
FontSize.configure({
|
|
88
|
+
defaultFontSize: defaultTextStyle.fontSize,
|
|
89
|
+
}),
|
|
90
|
+
Color.configure({
|
|
91
|
+
defaultColor: defaultTextStyle.color,
|
|
92
|
+
}),
|
|
93
|
+
BackgroundColor.configure({
|
|
94
|
+
defaultBackgroundColor: defaultTextStyle.backgroundColor,
|
|
95
|
+
}),
|
|
96
|
+
TextStyleExt.configure({
|
|
97
|
+
mergeNestedSpanStyles: true,
|
|
98
|
+
}),
|
|
99
|
+
TextTransform,
|
|
100
|
+
Underline,
|
|
101
|
+
Superscript,
|
|
102
|
+
SubScript,
|
|
103
|
+
Strike,
|
|
104
|
+
SelectionDecoration,
|
|
105
|
+
SmartTag.configure({
|
|
106
|
+
highlight: config?.SmartTag?.highlight,
|
|
107
|
+
}),
|
|
108
|
+
TextAlign.configure({
|
|
109
|
+
types: ['heading', 'paragraph'],
|
|
110
|
+
defaultAlignment: 'left',
|
|
111
|
+
}),
|
|
112
|
+
LinkExtension.configure({
|
|
113
|
+
openOnClick: false,
|
|
114
|
+
HTMLAttributes: {
|
|
115
|
+
style: 'text-decoration: inherit;color: inherit;',
|
|
116
|
+
},
|
|
117
|
+
}),
|
|
118
|
+
Indent,
|
|
119
|
+
// ListItemMarker,
|
|
120
|
+
Emoji.configure({
|
|
121
|
+
suggestion: emojiSuggestion({
|
|
122
|
+
container: bubbleMenuProps?.container,
|
|
123
|
+
}),
|
|
124
|
+
}),
|
|
125
|
+
],
|
|
126
|
+
content: safeParseHTMLContent(initialContent || ''),
|
|
127
|
+
onCreate: ({ editor }) => {
|
|
128
|
+
const html = editor.getHTML();
|
|
129
|
+
const text = editor.getText();
|
|
130
|
+
const json = editor.getJSON();
|
|
131
|
+
onCreate?.({ html, text, json });
|
|
132
|
+
},
|
|
133
|
+
onUpdate: ({ editor }) => {
|
|
134
|
+
handleOnUpdateDebounce(editor);
|
|
135
|
+
},
|
|
136
|
+
onFocus: ({ event }) => {
|
|
137
|
+
onFocus?.(event);
|
|
138
|
+
},
|
|
139
|
+
editorProps: {
|
|
140
|
+
attributes: { spellcheck: 'false' },
|
|
141
|
+
handleKeyDown(view, event) {
|
|
142
|
+
if (event.ctrlKey && event.key === 'k') {
|
|
143
|
+
// Add this line to prevent browser's default behavior.
|
|
144
|
+
event.preventDefault();
|
|
145
|
+
handleLinkAction(view, outerLinkHandler);
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
});
|
|
150
|
+
const { setLink, deleteLink, updateLinkAttrsGlobally, updateLinkTextGlobally } = useLinkHandler({
|
|
151
|
+
editor,
|
|
152
|
+
});
|
|
153
|
+
// useStyleMemory(editor);
|
|
154
|
+
useEffect(() => {
|
|
155
|
+
if (editable === undefined) {
|
|
156
|
+
editor?.setEditable(true);
|
|
157
|
+
}
|
|
158
|
+
else if (isBoolean(editable)) {
|
|
159
|
+
editor?.setEditable(editable);
|
|
160
|
+
}
|
|
161
|
+
}, [editor, editable]);
|
|
162
|
+
useEffect(() => {
|
|
163
|
+
if (editor && config?.SmartTag?.highlight !== undefined) {
|
|
164
|
+
editor.chain().updateSmartTagHighlight(config.SmartTag.highlight).run();
|
|
165
|
+
}
|
|
166
|
+
}, [editor, config?.SmartTag?.highlight]);
|
|
167
|
+
const handleSetSmartTag = useCallback((id, content) => {
|
|
168
|
+
editor?.chain().focus().setSmartTag({ id, content }).run();
|
|
169
|
+
}, [editor]);
|
|
170
|
+
const handleDeleteSmartTag = useCallback(id => {
|
|
171
|
+
editor
|
|
172
|
+
?.chain()
|
|
173
|
+
.deleteSmartTagGlobally(attrs => attrs.id === id)
|
|
174
|
+
.run();
|
|
175
|
+
}, [editor]);
|
|
176
|
+
const handleUpdateSmartTagAttrs = useCallback((id, updatedAttrs) => editor
|
|
177
|
+
?.chain()
|
|
178
|
+
.updateSmartTagAttrsGlobally(attrs => {
|
|
179
|
+
if (attrs.id === id)
|
|
180
|
+
return updatedAttrs;
|
|
181
|
+
})
|
|
182
|
+
.run(), [editor]);
|
|
183
|
+
const handleUpdateLinkAttrs = useCallback((id, updatedAttrs) => updateLinkAttrsGlobally((attrs) => {
|
|
184
|
+
if (attrs.id === id)
|
|
185
|
+
return updatedAttrs;
|
|
186
|
+
}), [updateLinkAttrsGlobally]);
|
|
187
|
+
const handleUpdateLinkText = useCallback((id, newText) => updateLinkTextGlobally(({ currentText, attrs }) => {
|
|
188
|
+
if (attrs.id === id && currentText !== newText) {
|
|
189
|
+
return newText;
|
|
190
|
+
}
|
|
191
|
+
}), [updateLinkTextGlobally]);
|
|
192
|
+
const shouldShowBubbleMenu = useCallback((params) => {
|
|
193
|
+
const { state, view, element } = params;
|
|
194
|
+
if (isShowLinkMenu(state)) {
|
|
195
|
+
return true;
|
|
196
|
+
}
|
|
197
|
+
return defaultShouldShowBubbleMenu({
|
|
198
|
+
state,
|
|
199
|
+
view,
|
|
200
|
+
element,
|
|
201
|
+
editor: params.editor,
|
|
202
|
+
});
|
|
203
|
+
}, []);
|
|
204
|
+
const handleBlur = useCallback((perserveSelection) => {
|
|
205
|
+
if (perserveSelection) {
|
|
206
|
+
editor?.chain().blur().run();
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
editor?.chain().blur().setTextSelection({ from: 0, to: 0 }).run();
|
|
210
|
+
}
|
|
211
|
+
}, [editor]);
|
|
212
|
+
const handleBubbleMenuRef = useCallback((htmlElement) => {
|
|
213
|
+
setBubbleMenuContainer(htmlElement);
|
|
214
|
+
}, [setBubbleMenuContainer]);
|
|
215
|
+
useImperativeHandle(ref, () => ({
|
|
216
|
+
setLink,
|
|
217
|
+
deleteLink,
|
|
218
|
+
updateLinkAttrs: handleUpdateLinkAttrs,
|
|
219
|
+
updateLinkText: handleUpdateLinkText,
|
|
220
|
+
setSmartTag: handleSetSmartTag,
|
|
221
|
+
deleteSmartTag: handleDeleteSmartTag,
|
|
222
|
+
updateSmartTagAttrs: handleUpdateSmartTagAttrs,
|
|
223
|
+
blur: handleBlur,
|
|
224
|
+
style: contentRef.current?.style,
|
|
225
|
+
editor,
|
|
226
|
+
}));
|
|
227
|
+
if (!editor) {
|
|
228
|
+
return null;
|
|
229
|
+
}
|
|
230
|
+
return (_jsxs(_Fragment, { children: [_jsx(StyledEditorContent, { className: clsx(`${ANTSOMI_COMPONENT_PREFIX_CLS}-text-editor`, className), style: style, id: id, ref: contentRef, editor: editor, ...dataAttributes }), _jsx(StyledBubbleMenu, { ref: handleBubbleMenuRef, editor: editor, shouldShow: shouldShowBubbleMenu, ...bubbleMenuProps, children: isShowBubbleMenu && (_jsx(Toolbar, { config: config, editor: editor, linkHanlder: {
|
|
231
|
+
onUpsert: () => {
|
|
232
|
+
handleLinkAction(editor.view, outerLinkHandler);
|
|
233
|
+
},
|
|
234
|
+
}, smartTagHandler: {
|
|
235
|
+
onUpsert: (event) => {
|
|
236
|
+
handleSmartTagAction(event, editor.view, outerSmartTagHandler);
|
|
237
|
+
},
|
|
238
|
+
} })) })] }));
|
|
239
|
+
}));
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "7ctw1n8f4i31mb8yuoec",
|
|
3
|
+
"type": "text",
|
|
4
|
+
"settings": {
|
|
5
|
+
"link": {
|
|
6
|
+
"data": {
|
|
7
|
+
"2o83ijfx": {
|
|
8
|
+
"text": "Dynamic Link 2\n\n",
|
|
9
|
+
"type": "content-source::csgjqgun::1",
|
|
10
|
+
"index": 1,
|
|
11
|
+
"title": "Same link 1",
|
|
12
|
+
"linkType": "dynamic",
|
|
13
|
+
"attribute": {
|
|
14
|
+
"key": "page_url",
|
|
15
|
+
"label": "Page url",
|
|
16
|
+
"value": "page_url",
|
|
17
|
+
"disabled": false
|
|
18
|
+
},
|
|
19
|
+
"openNewTab": true
|
|
20
|
+
},
|
|
21
|
+
"63g9c32g": {
|
|
22
|
+
"text": "Dynamic Link\n\n",
|
|
23
|
+
"type": "content-source::csgjqgun::1",
|
|
24
|
+
"index": 1,
|
|
25
|
+
"title": "Product Page Dynamic Link",
|
|
26
|
+
"linkType": "dynamic",
|
|
27
|
+
"attribute": {
|
|
28
|
+
"key": "page_url",
|
|
29
|
+
"label": "Page url",
|
|
30
|
+
"value": "page_url",
|
|
31
|
+
"disabled": false
|
|
32
|
+
},
|
|
33
|
+
"openNewTab": true
|
|
34
|
+
},
|
|
35
|
+
"jkeswcp5": {
|
|
36
|
+
"url": "https://ant.design/components/modal",
|
|
37
|
+
"text": "Offer",
|
|
38
|
+
"title": "Test",
|
|
39
|
+
"linkType": "static",
|
|
40
|
+
"openNewTab": false
|
|
41
|
+
},
|
|
42
|
+
"v9sifsn8": {
|
|
43
|
+
"url": "https://claude.ai/new",
|
|
44
|
+
"text": "Bo",
|
|
45
|
+
"title": "Link 1",
|
|
46
|
+
"linkType": "static",
|
|
47
|
+
"openNewTab": true
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"selectedId": ""
|
|
51
|
+
},
|
|
52
|
+
"name": "Text",
|
|
53
|
+
"type": "text",
|
|
54
|
+
"editor": "TextElementEditor",
|
|
55
|
+
"styles": {
|
|
56
|
+
"color": "#000000",
|
|
57
|
+
"fontSize": "16px",
|
|
58
|
+
"fontStyle": "normal",
|
|
59
|
+
"textAlign": "left",
|
|
60
|
+
"fontFamily": "Montserrat",
|
|
61
|
+
"fontWeight": 400,
|
|
62
|
+
"lineHeight": "1",
|
|
63
|
+
"letterSpacing": "0",
|
|
64
|
+
"textTransform": "none",
|
|
65
|
+
"textDecoration": "none"
|
|
66
|
+
},
|
|
67
|
+
"altText": "",
|
|
68
|
+
"dynamic": {
|
|
69
|
+
"data": {
|
|
70
|
+
"awh4d18k": {
|
|
71
|
+
"type": "event-attribute",
|
|
72
|
+
"event": "896830:779154",
|
|
73
|
+
"source": [556430427],
|
|
74
|
+
"attribute": {
|
|
75
|
+
"type": 1,
|
|
76
|
+
"label": "Last modified on",
|
|
77
|
+
"value": "ad_zone.utime",
|
|
78
|
+
"status": 1,
|
|
79
|
+
"children": [],
|
|
80
|
+
"dataType": "datetime",
|
|
81
|
+
"itemTypeId": -1013,
|
|
82
|
+
"itemTypeName": "ad_zone",
|
|
83
|
+
"propertyName": "utime",
|
|
84
|
+
"eventPropertySyntax": "dims.ad_zone_id",
|
|
85
|
+
"datetimeFormatSettings": {
|
|
86
|
+
"type": "datetime",
|
|
87
|
+
"language": "en",
|
|
88
|
+
"hasDateFormat": true,
|
|
89
|
+
"hasTimeFormat": true,
|
|
90
|
+
"dateParseFormat": "MM/DD/YYYY",
|
|
91
|
+
"dateParseOption": "medium",
|
|
92
|
+
"timeParseFormat": "12hour",
|
|
93
|
+
"timeParseOption": "medium",
|
|
94
|
+
"dateFormatString": "MMM DD, YYYY h:mm:ss A"
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
"mappingKey": "7ctw1n8f4i31mb8yuoec-awh4d18k",
|
|
98
|
+
"mappingFields": "event.ad_zone.utime"
|
|
99
|
+
},
|
|
100
|
+
"bcz6fw4b": {
|
|
101
|
+
"type": "content-source::csgjqgun::1",
|
|
102
|
+
"index": 1,
|
|
103
|
+
"attribute": {
|
|
104
|
+
"key": "price",
|
|
105
|
+
"label": "Price",
|
|
106
|
+
"value": "price",
|
|
107
|
+
"status": "1",
|
|
108
|
+
"dataType": "number",
|
|
109
|
+
"disabled": false,
|
|
110
|
+
"itemTypeName": "product",
|
|
111
|
+
"numberFormatSettings": {
|
|
112
|
+
"type": "number",
|
|
113
|
+
"decimal": ".",
|
|
114
|
+
"grouping": ",",
|
|
115
|
+
"isCompact": false,
|
|
116
|
+
"prefixType": "code",
|
|
117
|
+
"currencyCode": "USD",
|
|
118
|
+
"decimalPlaces": 2
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
"mappingKey": "7ctw1n8f4i31mb8yuoec-bcz6fw4b",
|
|
122
|
+
"mappingFields": "groups.csgjqgun[1].price"
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
"highlight": true,
|
|
126
|
+
"selectedId": ""
|
|
127
|
+
},
|
|
128
|
+
"rawHTML": "<div class=\"fr-element fr-view\" dir=\"auto\" contenteditable=\"true\" aria-disabled=\"false\" spellcheck=\"true\"><div class=\"fr-element fr-view\" contenteditable=\"true\" dir=\"auto\" spellcheck=\"true\"><div class=\"fr-element fr-view\" contenteditable=\"true\" dir=\"auto\" spellcheck=\"false\"><div class=\"fr-element fr-view\" contenteditable=\"true\" dir=\"auto\" spellcheck=\"true\"><div class=\"fr-element fr-view\" contenteditable=\"true\" dir=\"auto\" spellcheck=\"true\"><div class=\"fr-element fr-view\" contenteditable=\"true\" dir=\"auto\" spellcheck=\"true\"><div class=\"fr-element fr-view\" contenteditable=\"true\" dir=\"auto\" spellcheck=\"true\"><div class=\"fr-element fr-view\" contenteditable=\"true\" dir=\"auto\" spellcheck=\"true\" style=\"font-family: Montserrat;\"><div class=\"fr-element fr-view\" contenteditable=\"true\" dir=\"auto\" spellcheck=\"true\"><div class=\"fr-element fr-view\" contenteditable=\"true\" dir=\"auto\" spellcheck=\"true\"><div class=\"fr-element fr-view\" contenteditable=\"true\" dir=\"auto\" spellcheck=\"true\"><p style=\"font-size: 16px;\"><span style=\"font-family: Montserrat; font-size: 22px; letter-spacing: 0px;\"><span data-dynamic=\"true\" data-dynamic-id=\"bcz6fw4b\" style=\"direction: unset; unicode-bidi: bidi-override; text-align: right; background-color: rgba(0, 199, 97, 0.2);\">******</span> </span></p><p style=\"font-size: 16px;\"><span style=\"font-family: Montserrat; font-size: 22px; letter-spacing: 0px;\">Special </span><span style=\"font-family: Georgia; font-size: 22px; letter-spacing: 0px;\"><a data-link-id=\"v9sifsn8\" href=\"https://claude.ai/new\" target=\"_blank\" title=\"Link 1\"><span style=\"font-weight: 200;\">Bo</span></a><span style=\"font-weight: 200;\">nus</span></span><span style=\"font-family: Montserrat; font-size: 22px; letter-spacing: 0px;\"> <a data-link-id=\"jkeswcp5\" href=\"https://ant.design/components/modal\" style=\"color: inherit;\" target=\"_self\" title=\"Test\"><span style=\"color: rgb(147, 101, 184);\">Off</span>er</a> H<span style=\"background-color: rgb(87, 184, 194);\">as Been </span><span data-dynamic=\"true\" data-dynamic-id=\"awh4d18k\" style=\"direction: unset; unicode-bidi: bidi-override; text-align: right; background-color: rgb(87, 184, 194); color: rgb(226, 80, 65);\"><strong><em>Last modified on</em></strong></span></span></p><p style=\"font-size: 16px;\"><span style=\"font-family: Montserrat; font-size: 22px; letter-spacing: 0px;\"><span style=\"background-color: rgb(87, 184, 194);\">c</span>ó <strong><em>chuyện</em></strong> gì <strong><u>hô</u></strong></span><strong>m <span style=\"font-family: Montserrat; font-size: 22px; letter-spacing: 0px;\">nay không? </span></strong></p><p style=\"font-size: 16px;\"></p><p><a data-dynamic=\"true\" data-link-id=\"63g9c32g\" href=\"https://sandbox-magento.antsomi.com/argus-all-weather-tank.html\" style=\"background-color: rgba(0, 199, 97, 0.2);\" target=\"_blank\" title=\"Product Page Dynamic Link\"><span style=\"font-size: 22px;\"><strong>Dynamic Link\n\n</strong></span></a></p><p style=\"font-size: 16px;\"><strong></strong></p><p style=\"font-size: 16px;\"><strong></strong><a data-link-id=\"2o83ijfx\" data-dynamic=\"true\" title=\"Same link 1\" target=\"_blank\" href=\"https://sandbox-magento.antsomi.com/montana-wind-jacket.html\" style=\"background-color: rgba(0, 199, 97, 0.2);\"><strong><span style=\"font-family: Montserrat; font-size: 22px; letter-spacing: 0px;\">Dynamic Link 2\n\n</span></strong></a></p><p style=\"font-size: 16px;\"><strong></strong></p><p style=\"font-size: 16px;\"><strong><span style=\"font-family: Montserrat; font-size: 22px; letter-spacing: 0px;\">Danh sách</span></strong></p><ul style=\"font-size: 16px;\"><li style=\"line-height: 2.3;\"><strong><span style=\"font-family: Montserrat; font-size: 22px; letter-spacing: 0px;\">Giá trị 1</span></strong></li><li style=\"line-height: 2.3;\"><strong><span style=\"font-family: Montserrat; font-size: 22px; letter-spacing: 0px;\"><strong>Giá <span style=\"color: rgb(137, 18, 221);\">t<em>r</em>ị</span> 2</strong></span></strong></li><li style=\"line-height: 2.3;\"><strong><span style=\"font-family: Montserrat; font-size: 22px; letter-spacing: 0px;\">Giá trị 3</span></strong></li></ul><p style=\"font-size: 16px;\"><strong><span style=\"font-family: Montserrat; font-size: 22px; letter-spacing: 0px;\"><em>Number list</em></span></strong></p><ol style=\"font-size: 16px;\"><li><strong><span style=\"font-family: Montserrat; font-size: 22px; letter-spacing: 0px;\"><em>Item 1</em></span></strong></li><li><strong><span style=\"font-family: Montserrat; font-size: 22px; letter-spacing: 0px;\"><em>Item 2</em></span></strong></li><li><strong><span style=\"font-family: Montserrat; font-size: 22px; letter-spacing: 0px;\"><em>Item 3</em></span></strong></li></ol></div></div></div></div></div></div></div></div></div></div></div>",
|
|
129
|
+
"component": "TextElement",
|
|
130
|
+
"linkStyles": {
|
|
131
|
+
"color": "#1e5494",
|
|
132
|
+
"textDecoration": "underline"
|
|
133
|
+
},
|
|
134
|
+
"blockStyles": {
|
|
135
|
+
"top": "0px",
|
|
136
|
+
"left": "0px",
|
|
137
|
+
"right": "0px",
|
|
138
|
+
"width": "auto",
|
|
139
|
+
"bottom": "0px",
|
|
140
|
+
"height": "auto",
|
|
141
|
+
"zIndex": 0,
|
|
142
|
+
"maxWidth": "100%",
|
|
143
|
+
"position": "relative",
|
|
144
|
+
"boxShadow": "none",
|
|
145
|
+
"marginTop": "0px",
|
|
146
|
+
"background": "transparent",
|
|
147
|
+
"marginLeft": "0px",
|
|
148
|
+
"paddingTop": "0px",
|
|
149
|
+
"borderColor": "#000000",
|
|
150
|
+
"borderStyle": "none",
|
|
151
|
+
"marginRight": "0px",
|
|
152
|
+
"paddingLeft": "0px",
|
|
153
|
+
"marginBottom": "0px",
|
|
154
|
+
"paddingRight": "0px",
|
|
155
|
+
"paddingBottom": "0px",
|
|
156
|
+
"borderTopWidth": "0px",
|
|
157
|
+
"borderLeftWidth": "0px",
|
|
158
|
+
"borderRightWidth": "0px",
|
|
159
|
+
"borderBottomWidth": "0px",
|
|
160
|
+
"borderTopLeftRadius": "0px",
|
|
161
|
+
"borderTopRightRadius": "0px",
|
|
162
|
+
"borderBottomLeftRadius": "0px",
|
|
163
|
+
"borderBottomRightRadius": "0px"
|
|
164
|
+
},
|
|
165
|
+
"breakpoints": {
|
|
166
|
+
"sm": {
|
|
167
|
+
"blockStyles": {},
|
|
168
|
+
"blockHoverStyles": {},
|
|
169
|
+
"blockStylesSettings": {},
|
|
170
|
+
"blockHoverStylesSettings": {}
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
"textStyling": {
|
|
174
|
+
"isEllipsisText": true,
|
|
175
|
+
"selectLineDisplay": ""
|
|
176
|
+
},
|
|
177
|
+
"blockHoverStyles": {
|
|
178
|
+
"top": "0px",
|
|
179
|
+
"left": "0px",
|
|
180
|
+
"right": "0px",
|
|
181
|
+
"width": "auto",
|
|
182
|
+
"bottom": "0px",
|
|
183
|
+
"height": "auto",
|
|
184
|
+
"zIndex": 0,
|
|
185
|
+
"maxWidth": "100%",
|
|
186
|
+
"position": "relative",
|
|
187
|
+
"boxShadow": "none",
|
|
188
|
+
"marginTop": "0px",
|
|
189
|
+
"background": "transparent",
|
|
190
|
+
"marginLeft": "0px",
|
|
191
|
+
"paddingTop": "0px",
|
|
192
|
+
"borderColor": "#000000",
|
|
193
|
+
"borderStyle": "none",
|
|
194
|
+
"marginRight": "0px",
|
|
195
|
+
"paddingLeft": "0px",
|
|
196
|
+
"marginBottom": "0px",
|
|
197
|
+
"paddingRight": "0px",
|
|
198
|
+
"paddingBottom": "0px",
|
|
199
|
+
"borderTopWidth": "0px",
|
|
200
|
+
"borderLeftWidth": "0px",
|
|
201
|
+
"borderRightWidth": "0px",
|
|
202
|
+
"borderBottomWidth": "0px",
|
|
203
|
+
"borderTopLeftRadius": "0px",
|
|
204
|
+
"borderTopRightRadius": "0px",
|
|
205
|
+
"borderBottomLeftRadius": "0px",
|
|
206
|
+
"borderBottomRightRadius": "0px"
|
|
207
|
+
},
|
|
208
|
+
"blockStylesSettings": {
|
|
209
|
+
"hidden": false,
|
|
210
|
+
"customId": "",
|
|
211
|
+
"gradients": [
|
|
212
|
+
{
|
|
213
|
+
"gradientColor": "#ffffff",
|
|
214
|
+
"gradientColorLocation": 0
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
"gradientColor": "#000000",
|
|
218
|
+
"gradientColorLocation": 50
|
|
219
|
+
}
|
|
220
|
+
],
|
|
221
|
+
"customClass": "",
|
|
222
|
+
"linearAngle": 45,
|
|
223
|
+
"gradientType": "linear-gradient",
|
|
224
|
+
"heightSuffix": "auto",
|
|
225
|
+
"marginSuffix": "px",
|
|
226
|
+
"boxShadowBlur": "0px",
|
|
227
|
+
"paddingSuffix": "px",
|
|
228
|
+
"backgroundSize": "cover",
|
|
229
|
+
"boxShadowColor": "#ffffff",
|
|
230
|
+
"boxShadowInset": false,
|
|
231
|
+
"boxShadowStyle": "none",
|
|
232
|
+
"radialPosition": "center center",
|
|
233
|
+
"backgroundColor": "transparent",
|
|
234
|
+
"boxShadowSpread": "0px",
|
|
235
|
+
"backgroundRepeat": "no-repeat",
|
|
236
|
+
"displayCondition": {
|
|
237
|
+
"pool": null,
|
|
238
|
+
"type": "visitor-attribute",
|
|
239
|
+
"value": "2025-04-22 23:59:59",
|
|
240
|
+
"operator": "after_date",
|
|
241
|
+
"attribute": {
|
|
242
|
+
"key": "date_created",
|
|
243
|
+
"label": "Created date",
|
|
244
|
+
"value": "date_created",
|
|
245
|
+
"status": 1,
|
|
246
|
+
"dataType": "datetime",
|
|
247
|
+
"disabled": false,
|
|
248
|
+
"displayFormat": {
|
|
249
|
+
"type": "DATE_AND_TIME",
|
|
250
|
+
"config": {}
|
|
251
|
+
}
|
|
252
|
+
},
|
|
253
|
+
"condition": "show_when",
|
|
254
|
+
"time_unit": "",
|
|
255
|
+
"value_type": "normal",
|
|
256
|
+
"event_metadata": {}
|
|
257
|
+
},
|
|
258
|
+
"borderRadiusStyle": "none",
|
|
259
|
+
"boxShadowVertical": "0px",
|
|
260
|
+
"linkedMarginInput": true,
|
|
261
|
+
"backgroundPosition": "left top",
|
|
262
|
+
"borderRadiusSuffix": "px",
|
|
263
|
+
"linkedPaddingInput": false,
|
|
264
|
+
"boxShadowHorizontal": "0px",
|
|
265
|
+
"backgroundColorStyle": "color",
|
|
266
|
+
"linkedBorderWidthInput": true,
|
|
267
|
+
"linkedBorderRadiusInput": true
|
|
268
|
+
},
|
|
269
|
+
"defaultDynamicIndex": 1,
|
|
270
|
+
"blockHoverStylesSettings": {
|
|
271
|
+
"hidden": false,
|
|
272
|
+
"customId": "",
|
|
273
|
+
"editHover": false,
|
|
274
|
+
"gradients": [
|
|
275
|
+
{
|
|
276
|
+
"gradientColor": "#ffffff",
|
|
277
|
+
"gradientColorLocation": 0
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
"gradientColor": "#000000",
|
|
281
|
+
"gradientColorLocation": 50
|
|
282
|
+
}
|
|
283
|
+
],
|
|
284
|
+
"customClass": "",
|
|
285
|
+
"linearAngle": 45,
|
|
286
|
+
"gradientType": "linear-gradient",
|
|
287
|
+
"heightSuffix": "auto",
|
|
288
|
+
"marginSuffix": "px",
|
|
289
|
+
"boxShadowBlur": "0px",
|
|
290
|
+
"paddingSuffix": "px",
|
|
291
|
+
"backgroundSize": "cover",
|
|
292
|
+
"boxShadowColor": "#ffffff",
|
|
293
|
+
"boxShadowInset": false,
|
|
294
|
+
"boxShadowStyle": "none",
|
|
295
|
+
"radialPosition": "center center",
|
|
296
|
+
"backgroundColor": "transparent",
|
|
297
|
+
"boxShadowSpread": "0px",
|
|
298
|
+
"backgroundRepeat": "no-repeat",
|
|
299
|
+
"displayCondition": {
|
|
300
|
+
"type": "",
|
|
301
|
+
"index": 1,
|
|
302
|
+
"value": "",
|
|
303
|
+
"operator": "",
|
|
304
|
+
"attribute": {},
|
|
305
|
+
"condition": ""
|
|
306
|
+
},
|
|
307
|
+
"borderRadiusStyle": "none",
|
|
308
|
+
"boxShadowVertical": "0px",
|
|
309
|
+
"linkedMarginInput": true,
|
|
310
|
+
"backgroundPosition": "left top",
|
|
311
|
+
"borderRadiusSuffix": "px",
|
|
312
|
+
"linkedPaddingInput": false,
|
|
313
|
+
"boxShadowHorizontal": "0px",
|
|
314
|
+
"backgroundColorStyle": "color",
|
|
315
|
+
"linkedBorderWidthInput": true,
|
|
316
|
+
"linkedBorderRadiusInput": true
|
|
317
|
+
}
|
|
318
|
+
},
|
|
319
|
+
"createdAt": "18/04/2025 - 11:03:44"
|
|
320
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const HTML_DOM: string;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import SETTINGS from './text-block.settings.json';
|
|
2
|
+
const CONTENT_WITH_INHERITED_STYLES = `
|
|
3
|
+
<div class="fr-box" role="application">
|
|
4
|
+
<div class="fr-wrapper" dir="auto">
|
|
5
|
+
<div class="fr-element fr-view" dir="auto" contenteditable="true" aria-disabled="false" spellcheck="true">
|
|
6
|
+
<p style="text-align: center;">
|
|
7
|
+
<span style="font-family: Montserrat; font-size: 22px; letter-spacing: 0px; color: rgb(0, 0, 0);">
|
|
8
|
+
<span id="isPasted" style="font-weight: 800; font-size: 34px; line-height: inherit; font-family: Montserrat; letter-spacing: 0px; text-align: center; text-transform: none; color: rgb(77, 96, 116);">Receive </span>
|
|
9
|
+
<span style="font-weight: 400; font-size: 34px; line-height: inherit; font-family: Montserrat; color: rgb(0, 0, 0); letter-spacing: normal; text-align: center; text-transform: none;">
|
|
10
|
+
<span style="font-weight: 800; font-size: inherit; line-height: inherit; font-family: Montserrat; letter-spacing: 0px; color: rgb(255, 79, 66);"><u>10% Off</u></span>
|
|
11
|
+
</span>
|
|
12
|
+
<span style="font-weight: 800; font-size: 34px; line-height: inherit; font-family: Montserrat; letter-spacing: 0px; text-align: center; text-transform: none; color: rgb(77, 96, 116);"> Your First Order!</span>
|
|
13
|
+
</span>
|
|
14
|
+
</p>
|
|
15
|
+
</div>
|
|
16
|
+
<span class="fr-placeholder" style="font-size: 12px; line-height: 12px; margin-top: 0px; padding-top: 0px; padding-left: 0px; margin-left: 0px; padding-right: 0px; margin-right: 0px; text-align: left;">Enter your text here</span>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
`;
|
|
20
|
+
export const HTML_DOM = `<!doctype html>
|
|
21
|
+
<html lang="en">
|
|
22
|
+
<head>
|
|
23
|
+
<meta charset="UTF-8" />
|
|
24
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
25
|
+
<title>Raw HTML</title>
|
|
26
|
+
</head>
|
|
27
|
+
<body>
|
|
28
|
+
<p style="line-height: 1.4; text-align: center;">
|
|
29
|
+
<span style="font-family: Poppins; font-weight: 500;">Enter your email address below for a chance to spin the wheel and save big on your next purchase. <span class="fr-emoticon fr-deletable">😁</span></span>
|
|
30
|
+
<span style="font-family: Montserrat; font-size: 22px; letter-spacing: 0px; color: rgb(0, 0, 0);"></span>
|
|
31
|
+
</p>
|
|
32
|
+
|
|
33
|
+
${CONTENT_WITH_INHERITED_STYLES}
|
|
34
|
+
|
|
35
|
+
${SETTINGS.settings.rawHTML}
|
|
36
|
+
</body>
|
|
37
|
+
</html>
|
|
38
|
+
`;
|