@frontify/guideline-blocks-settings 0.28.1 → 0.28.2
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/CHANGELOG.md +11 -0
- package/dist/components/Attachments/AttachmentItem.es.js +54 -54
- package/dist/components/Attachments/AttachmentItem.es.js.map +1 -1
- package/dist/components/Attachments/Attachments.es.js +69 -69
- package/dist/components/Attachments/Attachments.es.js.map +1 -1
- package/dist/components/BlockInjectButton/BlockInjectButton.es.js +42 -42
- package/dist/components/BlockInjectButton/BlockInjectButton.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/BlockItemWrapper.es.js +28 -28
- package/dist/components/BlockItemWrapper/BlockItemWrapper.es.js.map +1 -1
- package/dist/components/BlockItemWrapper/Toolbar.es.js.map +1 -1
- package/dist/components/RichTextEditor/RichTextEditor.es.js +23 -23
- package/dist/components/RichTextEditor/RichTextEditor.es.js.map +1 -1
- package/dist/components/RichTextEditor/SerializedText.es.js +7 -7
- package/dist/components/RichTextEditor/SerializedText.es.js.map +1 -1
- package/dist/components/RichTextEditor/pluginPresets/defaultPluginsWithLinkChooser.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/ButtonMarkupElementNode.es.js +11 -11
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/ButtonMarkupElement/ButtonMarkupElementNode.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonToolbarButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButtonEditButton.es.js +10 -10
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButtonEditButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButtonUrlInput.es.js +13 -13
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButtonUrlInput.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/InsertButtonModal.es.js +2 -2
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/InsertButtonModal.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/useInsertModal.es.js +30 -30
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/useInsertModal.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/UnlinkButton.es.js +7 -7
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/UnlinkButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEdit.es.js +30 -30
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEdit.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEnter.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEscape.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonInsert.es.js +8 -8
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonInsert.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/createButtonPlugin.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/insertButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/unwrapButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButtonText.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/transforms/wrapButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/createButtonNode.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonInsert.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/ButtonPlugin/withButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/useFloatingLinkEdit.es.js +30 -30
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/useFloatingLinkEdit.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useFloatingLinkInsert.es.js +7 -7
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useFloatingLinkInsert.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useInsertModal.es.js +29 -29
- package/dist/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useInsertModal.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/LinkButton.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/LinkPlugin/utils/url.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/DocumentLink.es.js +14 -14
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/DocumentLink.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/DocumentLinks.es.js +27 -27
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/DocumentLinks.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/LinkSelector.es.js +27 -27
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/LinkSelector.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/PageLink.es.js +15 -15
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/PageLink.es.js.map +1 -1
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/PageLinks.es.js +13 -13
- package/dist/components/RichTextEditor/plugins/shared/LinkSelector/PageLinks.es.js.map +1 -1
- package/dist/components/RichTextEditor/serializer/nodes/button.es.js.map +1 -1
- package/dist/components/RichTextEditor/serializer/nodes/checkItemNode.es.js.map +1 -1
- package/dist/components/RichTextEditor/serializer/nodes/default.es.js.map +1 -1
- package/dist/components/RichTextEditor/serializer/nodes/link.es.js.map +1 -1
- package/dist/components/RichTextEditor/serializer/nodes/mentionHtmlNode.es.js +1 -1
- package/dist/components/RichTextEditor/serializer/serializeNodesToHtmlRecursive.es.js.map +1 -1
- package/dist/components/RichTextEditor/serializer/serializeToHtml.es.js.map +1 -1
- package/dist/components/RichTextEditor/serializer/utlis/reactCssPropsToCss.es.js.map +1 -1
- package/dist/components/RichTextEditor/serializer/utlis/serializeLeafToHtml.es.js.map +1 -1
- package/dist/helpers/addHttps.es.js.map +1 -1
- package/dist/helpers/customCoordinatesGetterFactory.es.js.map +1 -1
- package/dist/helpers/hasRichTextValue.es.js.map +1 -1
- package/dist/hooks/useAttachments.es.js.map +1 -1
- package/dist/hooks/useDndSensors.es.js.map +1 -1
- package/dist/index.cjs.js +22 -229
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +12 -10
- package/dist/index.es.js +1 -1
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +22 -229
- package/dist/index.umd.js.map +1 -1
- package/dist/settings/background.es.js.map +1 -1
- package/dist/settings/border.es.js +1 -1
- package/dist/settings/border.es.js.map +1 -1
- package/dist/settings/borderRadius.es.js +1 -1
- package/dist/settings/borderRadius.es.js.map +1 -1
- package/dist/settings/borderRadiusExtended.es.js +1 -1
- package/dist/settings/borderRadiusExtended.es.js.map +1 -1
- package/dist/settings/gutter.es.js +1 -1
- package/dist/settings/margin.es.js +1 -1
- package/dist/settings/margin.es.js.map +1 -1
- package/dist/settings/marginExtended.es.js +1 -1
- package/dist/settings/marginExtended.es.js.map +1 -1
- package/dist/settings/padding.es.js +1 -1
- package/dist/settings/padding.es.js.map +1 -1
- package/dist/settings/paddingExtended.es.js +1 -1
- package/dist/settings/paddingExtended.es.js.map +1 -1
- package/dist/settings/securityGlobalControl.es.js +1 -1
- package/dist/styles.css +1 -0
- package/dist/styles.css.es.js +5 -0
- package/dist/styles.css.es.js.map +1 -0
- package/dist/utilities/moveItemInArray.es.js.map +1 -1
- package/dist/utilities/react/getBorderStyles.es.js.map +1 -1
- package/package.json +25 -24
- package/src/components/Attachments/AttachmentItem.tsx +2 -2
- package/src/components/Attachments/Attachments.spec.ct.tsx +4 -4
- package/src/components/Attachments/Attachments.tsx +2 -2
- package/src/components/BlockInjectButton/BlockInjectButton.spec.ct.tsx +2 -2
- package/src/components/BlockItemWrapper/BlockItemWrapper.spec.ct.tsx +8 -8
- package/src/components/BlockItemWrapper/Toolbar.tsx +1 -1
- package/src/components/RichTextEditor/RichTextEditor.spec.ct.tsx +8 -8
- package/src/components/RichTextEditor/pluginPresets/defaultPluginsWithLinkChooser.tsx +2 -2
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonToolbarButton.tsx +1 -1
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/FloatingButtonUrlInput.tsx +1 -1
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/InsertButtonModal/useInsertModal.ts +1 -1
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEdit.ts +1 -1
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEnter.ts +1 -1
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonEscape.ts +1 -1
- package/src/components/RichTextEditor/plugins/ButtonPlugin/components/FloatingButton/useFloatingButtonInsert.ts +1 -1
- package/src/components/RichTextEditor/plugins/ButtonPlugin/createButtonPlugin.ts +2 -0
- package/src/components/RichTextEditor/plugins/ButtonPlugin/transforms/insertButton.ts +2 -2
- package/src/components/RichTextEditor/plugins/ButtonPlugin/transforms/unwrapButton.ts +1 -1
- package/src/components/RichTextEditor/plugins/ButtonPlugin/transforms/upsertButton.ts +5 -5
- package/src/components/RichTextEditor/plugins/ButtonPlugin/transforms/wrapButton.ts +2 -2
- package/src/components/RichTextEditor/plugins/ButtonPlugin/utils/createButtonNode.ts +1 -1
- package/src/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButton.ts +1 -1
- package/src/components/RichTextEditor/plugins/ButtonPlugin/utils/triggerFloatingButtonInsert.ts +1 -1
- package/src/components/RichTextEditor/plugins/ButtonPlugin/withButton.ts +1 -1
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/EditLinkModal/useFloatingLinkEdit.ts +1 -1
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useFloatingLinkInsert.ts +1 -1
- package/src/components/RichTextEditor/plugins/LinkPlugin/FloatingLink/InsertLinkModal/useInsertModal.ts +1 -1
- package/src/components/RichTextEditor/plugins/LinkPlugin/LinkButton.tsx +1 -1
- package/src/components/RichTextEditor/plugins/LinkPlugin/utils/relativeUrlRegex.spec.ts +24 -27
- package/src/components/RichTextEditor/serializer/nodes/checkItemNode.ts +1 -1
- package/src/components/RichTextEditor/serializer/nodes/default.ts +2 -2
- package/src/components/RichTextEditor/serializer/nodes/link.ts +1 -1
- package/src/components/RichTextEditor/serializer/serializeNodesToHtmlRecursive.ts +4 -4
- package/src/components/RichTextEditor/serializer/serializeToHtml.ts +2 -2
- package/src/hooks/useAttachments.ts +1 -1
- package/src/hooks/useDndSensors.ts +1 -1
- package/src/index.ts +3 -3
- package/src/settings/background.spec.ts +1 -1
- package/src/settings/border.spec.ts +1 -1
- package/src/settings/borderRadiusExtended.spec.ts +4 -4
- package/src/settings/marginExtended.spec.ts +4 -4
- package/src/settings/paddingExtended.spec.ts +4 -4
- package/src/styles.css +3 -0
- package/src/utilities/react/getBorderStyles.ts +1 -1
- package/vite.config.ts +22 -2
- package/dist/_virtual/_commonjsHelpers.es.js +0 -7
- package/dist/_virtual/_commonjsHelpers.es.js.map +0 -1
- package/dist/_virtual/index.es.js +0 -5
- package/dist/_virtual/index.es.js.map +0 -1
- package/dist/_virtual/index.es2.js +0 -5
- package/dist/_virtual/index.es2.js.map +0 -1
- package/dist/_virtual/index.es3.js +0 -5
- package/dist/_virtual/index.es3.js.map +0 -1
- package/dist/_virtual/react-dom.development.es.js +0 -5
- package/dist/_virtual/react-dom.development.es.js.map +0 -1
- package/dist/_virtual/react-dom.production.min.es.js +0 -5
- package/dist/_virtual/react-dom.production.min.es.js.map +0 -1
- package/dist/_virtual/react.development.es.js +0 -5
- package/dist/_virtual/react.development.es.js.map +0 -1
- package/dist/_virtual/react.production.min.es.js +0 -5
- package/dist/_virtual/react.production.min.es.js.map +0 -1
- package/dist/_virtual/scheduler.development.es.js +0 -5
- package/dist/_virtual/scheduler.development.es.js.map +0 -1
- package/dist/_virtual/scheduler.production.min.es.js +0 -5
- package/dist/_virtual/scheduler.production.min.es.js.map +0 -1
- package/dist/style.css +0 -1
|
@@ -62,7 +62,7 @@ describe('RichTextEditor', () => {
|
|
|
62
62
|
isEditing={true}
|
|
63
63
|
plugins={new PluginComposer().setPlugin([new LinkPlugin({ appBridge })])}
|
|
64
64
|
value={convertToRteValue('p', 'This is a link')}
|
|
65
|
-
|
|
65
|
+
/>,
|
|
66
66
|
);
|
|
67
67
|
cy.get(RichTextSelector).click();
|
|
68
68
|
cy.get(RichTextSelector).type('{selectall}');
|
|
@@ -83,7 +83,7 @@ describe('RichTextEditor', () => {
|
|
|
83
83
|
isEditing={true}
|
|
84
84
|
plugins={new PluginComposer().setPlugin([new LinkPlugin({ appBridge })])}
|
|
85
85
|
value={convertToRteValue('p', 'This is a link')}
|
|
86
|
-
|
|
86
|
+
/>,
|
|
87
87
|
);
|
|
88
88
|
cy.get(RichTextSelector).click();
|
|
89
89
|
cy.get(RichTextSelector).type('{selectall}');
|
|
@@ -102,7 +102,7 @@ describe('RichTextEditor', () => {
|
|
|
102
102
|
isEditing={true}
|
|
103
103
|
plugins={new PluginComposer().setPlugin([new LinkPlugin({ appBridge })])}
|
|
104
104
|
value={convertToRteValue('p', 'This is a link')}
|
|
105
|
-
|
|
105
|
+
/>,
|
|
106
106
|
);
|
|
107
107
|
|
|
108
108
|
cy.get(RichTextSelector).click();
|
|
@@ -122,7 +122,7 @@ describe('RichTextEditor', () => {
|
|
|
122
122
|
isEditing={true}
|
|
123
123
|
plugins={new PluginComposer().setPlugin([new LinkPlugin({ appBridge })])}
|
|
124
124
|
value={convertToRteValue('p', 'This is a link')}
|
|
125
|
-
|
|
125
|
+
/>,
|
|
126
126
|
);
|
|
127
127
|
cy.get(RichTextSelector).click();
|
|
128
128
|
cy.get(RichTextSelector).type('{selectall}');
|
|
@@ -140,7 +140,7 @@ describe('RichTextEditor', () => {
|
|
|
140
140
|
<RichTextEditor
|
|
141
141
|
isEditing={true}
|
|
142
142
|
plugins={new PluginComposer().setPlugin([new LinkPlugin({ appBridge })])}
|
|
143
|
-
|
|
143
|
+
/>,
|
|
144
144
|
);
|
|
145
145
|
cy.get(RichTextSelector).click();
|
|
146
146
|
cy.get(RichTextSelector).type('mailto:info@frontify.com {enter}');
|
|
@@ -155,7 +155,7 @@ describe('RichTextEditor', () => {
|
|
|
155
155
|
<RichTextEditor
|
|
156
156
|
isEditing={true}
|
|
157
157
|
plugins={new PluginComposer().setPlugin([new LinkPlugin({ appBridge })])}
|
|
158
|
-
|
|
158
|
+
/>,
|
|
159
159
|
);
|
|
160
160
|
cy.get(RichTextSelector).click();
|
|
161
161
|
cy.get(RichTextSelector).type('list:{enter}');
|
|
@@ -171,7 +171,7 @@ describe('RichTextEditor', () => {
|
|
|
171
171
|
isEditing={true}
|
|
172
172
|
plugins={new PluginComposer().setPlugin([new LinkPlugin({ appBridge })])}
|
|
173
173
|
value={convertToRteValue('p', 'This is a link')}
|
|
174
|
-
|
|
174
|
+
/>,
|
|
175
175
|
);
|
|
176
176
|
cy.get(RichTextSelector).click();
|
|
177
177
|
cy.get(RichTextSelector).type('{selectall}');
|
|
@@ -190,7 +190,7 @@ describe('RichTextEditor', () => {
|
|
|
190
190
|
isEditing={true}
|
|
191
191
|
plugins={new PluginComposer().setPlugin([new ButtonPlugin({ appBridge })])}
|
|
192
192
|
value={convertToRteValue('p', 'This is a button')}
|
|
193
|
-
|
|
193
|
+
/>,
|
|
194
194
|
);
|
|
195
195
|
cy.get(RichTextSelector).click();
|
|
196
196
|
cy.get(RichTextSelector).type('{selectall}');
|
|
@@ -27,7 +27,7 @@ export const getDefaultPluginsWithLinkChooser = (appBridge: AppBridgeBlock) => {
|
|
|
27
27
|
new SoftBreakPlugin(),
|
|
28
28
|
new TextStylePlugin({
|
|
29
29
|
textStyles: TextStylePluginsWithoutImage,
|
|
30
|
-
})
|
|
30
|
+
}),
|
|
31
31
|
)
|
|
32
32
|
.setPlugin(
|
|
33
33
|
[
|
|
@@ -48,6 +48,6 @@ export const getDefaultPluginsWithLinkChooser = (appBridge: AppBridgeBlock) => {
|
|
|
48
48
|
new CheckboxListPlugin(),
|
|
49
49
|
new OrderedListPlugin(),
|
|
50
50
|
new ResetFormattingPlugin(),
|
|
51
|
-
]
|
|
51
|
+
],
|
|
52
52
|
);
|
|
53
53
|
};
|
package/src/components/RichTextEditor/plugins/ButtonPlugin/components/ButtonToolbarButton.tsx
CHANGED
|
@@ -32,7 +32,7 @@ export const ButtonToolbarButton = ({ type, ...props }: LinkToolbarButtonProps)
|
|
|
32
32
|
tooltip={getTooltip(
|
|
33
33
|
isEnabled
|
|
34
34
|
? `Button\n${getHotkeyByPlatform('Ctrl+Shift+K')}`
|
|
35
|
-
: 'Buttons can only be set for a single text block.'
|
|
35
|
+
: 'Buttons can only be set for a single text block.',
|
|
36
36
|
)}
|
|
37
37
|
classNames={getButtonClassNames(isEnabled)}
|
|
38
38
|
active={isLink}
|
|
@@ -25,6 +25,6 @@ export const useFloatingButtonUrlInput = (props: HTMLPropsAs<'input'>): HTMLProp
|
|
|
25
25
|
onChange,
|
|
26
26
|
defaultValue: floatingButtonSelectors.url(),
|
|
27
27
|
},
|
|
28
|
-
{ ...props, ref: useComposedRef<HTMLInputElement>(props.ref, ref) }
|
|
28
|
+
{ ...props, ref: useComposedRef<HTMLInputElement>(props.ref, ref) },
|
|
29
29
|
);
|
|
30
30
|
};
|
|
@@ -14,6 +14,7 @@ import { withButton } from './withButton';
|
|
|
14
14
|
export const ELEMENT_BUTTON = 'button';
|
|
15
15
|
export const BUTTON_PLUGIN = 'button-plugin';
|
|
16
16
|
|
|
17
|
+
// eslint-disable-next-line
|
|
17
18
|
export interface ButtonPlugin {
|
|
18
19
|
forceSubmit?: boolean;
|
|
19
20
|
|
|
@@ -97,6 +98,7 @@ export type ButtonPluginProps = Omit<PluginProps, 'styles'> & {
|
|
|
97
98
|
styles?: Record<string, CSSProperties & { hover?: CSSProperties }>;
|
|
98
99
|
} & { appBridge: AppBridgeBlock };
|
|
99
100
|
|
|
101
|
+
// eslint-disable-next-line
|
|
100
102
|
export class ButtonPlugin extends Plugin {
|
|
101
103
|
public styles: CSSProperties = {};
|
|
102
104
|
private appBridge: AppBridgeBlock;
|
|
@@ -7,11 +7,11 @@ import { CreateButtonNodeOptions, createButtonNode } from '../utils/index';
|
|
|
7
7
|
export const insertButton = <V extends Value>(
|
|
8
8
|
editor: PlateEditor<V>,
|
|
9
9
|
createButtonNodeOptions: CreateButtonNodeOptions,
|
|
10
|
-
options?: InsertNodesOptions<V
|
|
10
|
+
options?: InsertNodesOptions<V>,
|
|
11
11
|
) => {
|
|
12
12
|
insertNodes<TButtonElement | TText>(
|
|
13
13
|
editor,
|
|
14
14
|
[createButtonNode(editor, createButtonNodeOptions)],
|
|
15
|
-
options as InsertNodesOptions
|
|
15
|
+
options as InsertNodesOptions,
|
|
16
16
|
);
|
|
17
17
|
};
|
|
@@ -55,7 +55,7 @@ export const upsertButton = <V extends Value>(
|
|
|
55
55
|
insertTextInButton,
|
|
56
56
|
insertNodesOptions,
|
|
57
57
|
isUrl = getPluginOptions<ButtonPlugin, V>(editor, ELEMENT_BUTTON).isUrl,
|
|
58
|
-
}: UpsertButtonOptions<V
|
|
58
|
+
}: UpsertButtonOptions<V>,
|
|
59
59
|
) => {
|
|
60
60
|
const at = editor.selection;
|
|
61
61
|
if (!at) {
|
|
@@ -136,7 +136,7 @@ export const upsertButton = <V extends Value>(
|
|
|
136
136
|
},
|
|
137
137
|
],
|
|
138
138
|
},
|
|
139
|
-
insertNodesOptions
|
|
139
|
+
insertNodesOptions,
|
|
140
140
|
);
|
|
141
141
|
return true;
|
|
142
142
|
};
|
|
@@ -151,7 +151,7 @@ function anchorAndFocusInButton<V extends Value>(
|
|
|
151
151
|
url: string,
|
|
152
152
|
buttonStyle?: RichTextButtonStyle,
|
|
153
153
|
target?: string,
|
|
154
|
-
text?: string
|
|
154
|
+
text?: string,
|
|
155
155
|
) {
|
|
156
156
|
if (buttonAbove) {
|
|
157
157
|
unwrapButton(editor, {
|
|
@@ -178,7 +178,7 @@ function editButtonUrlAndTarget<V extends Value>(
|
|
|
178
178
|
buttonAbove: TNodeEntry<TButtonElement>,
|
|
179
179
|
target?: string,
|
|
180
180
|
buttonStyle?: string,
|
|
181
|
-
text?: string
|
|
181
|
+
text?: string,
|
|
182
182
|
) {
|
|
183
183
|
if (
|
|
184
184
|
url !== buttonAbove[0]?.url ||
|
|
@@ -190,7 +190,7 @@ function editButtonUrlAndTarget<V extends Value>(
|
|
|
190
190
|
{ url, target, buttonStyle },
|
|
191
191
|
{
|
|
192
192
|
at: buttonAbove[1],
|
|
193
|
-
}
|
|
193
|
+
},
|
|
194
194
|
);
|
|
195
195
|
}
|
|
196
196
|
|
|
@@ -14,7 +14,7 @@ export interface WrapButtonOptions<V extends Value = Value> extends WrapNodesOpt
|
|
|
14
14
|
*/
|
|
15
15
|
export const wrapButton = <V extends Value>(
|
|
16
16
|
editor: PlateEditor<V>,
|
|
17
|
-
{ url, buttonStyle, target, ...options }: WrapButtonOptions<V
|
|
17
|
+
{ url, buttonStyle, target, ...options }: WrapButtonOptions<V>,
|
|
18
18
|
) => {
|
|
19
19
|
wrapNodes<TButtonElement, Value>(
|
|
20
20
|
editor,
|
|
@@ -25,6 +25,6 @@ export const wrapButton = <V extends Value>(
|
|
|
25
25
|
target,
|
|
26
26
|
children: [],
|
|
27
27
|
},
|
|
28
|
-
{ split: true, ...options } as WrapNodesOptions
|
|
28
|
+
{ split: true, ...options } as WrapNodesOptions,
|
|
29
29
|
);
|
|
30
30
|
};
|
|
@@ -14,7 +14,7 @@ export interface CreateButtonNodeOptions {
|
|
|
14
14
|
|
|
15
15
|
export const createButtonNode = <V extends Value>(
|
|
16
16
|
editor: PlateEditor<V>,
|
|
17
|
-
{ url, text = '', buttonStyle = 'primary', target, children }: CreateButtonNodeOptions
|
|
17
|
+
{ url, text = '', buttonStyle = 'primary', target, children }: CreateButtonNodeOptions,
|
|
18
18
|
): TButtonElement => {
|
|
19
19
|
const type = getPluginType(editor, ELEMENT_BUTTON);
|
|
20
20
|
|
|
@@ -22,7 +22,7 @@ export const LinkButton = ({ id, editorId }: PluginButtonProps) => {
|
|
|
22
22
|
tooltip={getTooltip(
|
|
23
23
|
isEnabled
|
|
24
24
|
? `Link\n${getHotkeyByPlatform('Ctrl+K')}`
|
|
25
|
-
: 'Links can only be set for a single text block.'
|
|
25
|
+
: 'Links can only be set for a single text block.',
|
|
26
26
|
)}
|
|
27
27
|
icon={
|
|
28
28
|
<span className="tw-p-2 tw-h-8 tw-justify-center tw-items-center tw-flex">
|
|
@@ -4,32 +4,29 @@ import { describe, expect, it } from 'vitest';
|
|
|
4
4
|
import { relativeUrlRegex } from './relativeUrlRegex';
|
|
5
5
|
|
|
6
6
|
describe('Regex values', () => {
|
|
7
|
-
it(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const isMatching = relativeUrlRegex.test(data.input);
|
|
32
|
-
expect(isMatching).toBe(data.shouldMatch);
|
|
33
|
-
}
|
|
7
|
+
it.each([
|
|
8
|
+
{
|
|
9
|
+
input: '/document/123',
|
|
10
|
+
shouldMatch: true,
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
input: '/r/123',
|
|
14
|
+
shouldMatch: true,
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
input: '/wrong/123',
|
|
18
|
+
shouldMatch: false,
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
input: '/r/',
|
|
22
|
+
shouldMatch: false,
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
input: '/document/',
|
|
26
|
+
shouldMatch: false,
|
|
27
|
+
},
|
|
28
|
+
])('should only match internal documents starting with /r/ or /document/', ({ input, shouldMatch }) => {
|
|
29
|
+
const isMatching = relativeUrlRegex.test(input);
|
|
30
|
+
expect(isMatching).toBe(shouldMatch);
|
|
34
31
|
});
|
|
35
32
|
});
|
|
@@ -9,7 +9,7 @@ export const checkItemNode = (
|
|
|
9
9
|
node: TElement,
|
|
10
10
|
children: string,
|
|
11
11
|
defaultClassNames: string,
|
|
12
|
-
styles: Record<string, CSSProperties & { hover?: CSSProperties }
|
|
12
|
+
styles: Record<string, CSSProperties & { hover?: CSSProperties }>,
|
|
13
13
|
) => {
|
|
14
14
|
return `<div disabled class="tw-flex tw-flex-row tw-pb-2 first-of-type:tw-ml-0 ${defaultClassNames}" style="margin-left:${
|
|
15
15
|
((node.indent as number) ?? 0) * 24
|
|
@@ -36,13 +36,13 @@ export const defaultNode = (node: TElement, children: string, styles: CSSPropert
|
|
|
36
36
|
if (node.type === TextStyles.imageTitle) {
|
|
37
37
|
return `<p class="${merge([defaultClassNames, 'a-image-title'])}">${getStyledChild(
|
|
38
38
|
children,
|
|
39
|
-
defaultStyles
|
|
39
|
+
defaultStyles,
|
|
40
40
|
)}</p>`;
|
|
41
41
|
}
|
|
42
42
|
if (node.type === TextStyles.imageCaption) {
|
|
43
43
|
return `<p class="${merge([defaultClassNames, 'a-image-caption'])}">${getStyledChild(
|
|
44
44
|
children,
|
|
45
|
-
defaultStyles
|
|
45
|
+
defaultStyles,
|
|
46
46
|
)}</p>`;
|
|
47
47
|
}
|
|
48
48
|
|
|
@@ -11,7 +11,7 @@ export const linkNode = (
|
|
|
11
11
|
node: TElement,
|
|
12
12
|
children: string,
|
|
13
13
|
defaultClassNames: string,
|
|
14
|
-
styles: Record<string, CSSProperties & { hover?: CSSProperties }
|
|
14
|
+
styles: Record<string, CSSProperties & { hover?: CSSProperties }>,
|
|
15
15
|
) => {
|
|
16
16
|
if (node.chosenLink) {
|
|
17
17
|
const { chosenLink } = node as TLinkElement;
|
|
@@ -57,7 +57,7 @@ type SerializeNodeToHtmlRecursiveOptions = {
|
|
|
57
57
|
export const serializeNodeToHtmlRecursive = (
|
|
58
58
|
node: TDescendant,
|
|
59
59
|
styles: Record<string, CSSProperties & { hover?: CSSProperties }> | ButtonStylesType,
|
|
60
|
-
{ mappedMentionable, nestingCount = {} }: SerializeNodeToHtmlRecursiveOptions
|
|
60
|
+
{ mappedMentionable, nestingCount = {} }: SerializeNodeToHtmlRecursiveOptions,
|
|
61
61
|
): string => {
|
|
62
62
|
if (isText(node)) {
|
|
63
63
|
return serializeLeafToHtml(node);
|
|
@@ -90,7 +90,7 @@ export const serializeNodeToHtmlRecursive = (
|
|
|
90
90
|
node,
|
|
91
91
|
children,
|
|
92
92
|
styles[node.type],
|
|
93
|
-
getClassNames(node.breakAfterColumn as string | undefined, node.align as string | undefined)
|
|
93
|
+
getClassNames(node.breakAfterColumn as string | undefined, node.align as string | undefined),
|
|
94
94
|
);
|
|
95
95
|
}
|
|
96
96
|
};
|
|
@@ -109,12 +109,12 @@ const MapNodeTypesToHtml: { [key: string]: ({ ...args }: Arguments) => string }
|
|
|
109
109
|
[ELEMENT_OL]: ({ classNames, children, node, rootNestingCount }) => {
|
|
110
110
|
const nestingLevel = Math.max(rootNestingCount - countNodesOfType([node], ELEMENT_OL), 0);
|
|
111
111
|
return `<ol class="${getOrderedListClasses(nestingLevel)} ${classNames}" style="${reactCssPropsToCss(
|
|
112
|
-
OL_STYLES
|
|
112
|
+
OL_STYLES,
|
|
113
113
|
)}">${children}</ol>`;
|
|
114
114
|
},
|
|
115
115
|
[ELEMENT_LI]: ({ classNames, children, node, styles }) =>
|
|
116
116
|
`<li class="${classNames} ${LI_CLASSNAMES}" style="${reactCssPropsToCss(
|
|
117
|
-
getLiStyles(node, styles)
|
|
117
|
+
getLiStyles(node, styles),
|
|
118
118
|
)}">${children}</li>`,
|
|
119
119
|
[ELEMENT_LIC]: ({ classNames, children, node }) =>
|
|
120
120
|
`<p class="${classNames} ${getLicElementClassNames(node)}"><span>${children}</span></p>`,
|
|
@@ -9,7 +9,7 @@ export const serializeRawToHtmlAsync = async (
|
|
|
9
9
|
raw: string,
|
|
10
10
|
columns: SerializeNodesToHtmlOptions['columns'] = 1,
|
|
11
11
|
columnGap: SerializeNodesToHtmlOptions['columnGap'] = 'normal',
|
|
12
|
-
plugins: PluginComposer = new PluginComposer()
|
|
12
|
+
plugins: PluginComposer = new PluginComposer(),
|
|
13
13
|
): Promise<string> => {
|
|
14
14
|
const nodes = parseRawValue({ raw, plugins });
|
|
15
15
|
const styles = plugins.getStyles;
|
|
@@ -18,7 +18,7 @@ export const serializeRawToHtmlAsync = async (
|
|
|
18
18
|
|
|
19
19
|
export const serializeNodesToHtml = (
|
|
20
20
|
nodes: TDescendant[],
|
|
21
|
-
{ mentionable, columns = 1, columnGap = 'normal', styles = BlockStyles }: SerializeNodesToHtmlOptions = {}
|
|
21
|
+
{ mentionable, columns = 1, columnGap = 'normal', styles = BlockStyles }: SerializeNodesToHtmlOptions = {},
|
|
22
22
|
): string => {
|
|
23
23
|
const mappedMentionable = mentionable ? mapMentionable(mentionable) : new Map();
|
|
24
24
|
|
|
@@ -24,7 +24,7 @@ export const useAttachments = (appBridge: AppBridgeBlock, assetId: string) => {
|
|
|
24
24
|
|
|
25
25
|
const onAttachmentReplace = async (attachmentToReplace: Asset, newAsset: Asset) => {
|
|
26
26
|
const newAssetIds = attachments.map((attachment) =>
|
|
27
|
-
attachment.id === attachmentToReplace.id ? newAsset.id : attachment.id
|
|
27
|
+
attachment.id === attachmentToReplace.id ? newAsset.id : attachment.id,
|
|
28
28
|
);
|
|
29
29
|
|
|
30
30
|
await updateAssetIdsFromKey(assetId, newAssetIds);
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* (c) Copyright Frontify Ltd., all rights reserved. */
|
|
2
2
|
|
|
3
|
-
import '
|
|
3
|
+
import './styles.css';
|
|
4
4
|
|
|
5
5
|
import type { FC } from 'react';
|
|
6
6
|
import type { AppBridgeBlock } from '@frontify/app-bridge';
|
|
@@ -124,9 +124,9 @@ export const defineSettings = <
|
|
|
124
124
|
T extends
|
|
125
125
|
| BlockSettingsStructureExport
|
|
126
126
|
| (() => Promise<BlockSettingsStructureExport>)
|
|
127
|
-
| (() => BlockSettingsStructureExport)
|
|
127
|
+
| (() => BlockSettingsStructureExport),
|
|
128
128
|
>(
|
|
129
|
-
settingsStructure: T
|
|
129
|
+
settingsStructure: T,
|
|
130
130
|
): T => settingsStructure;
|
|
131
131
|
|
|
132
132
|
export * from './components';
|
|
@@ -41,7 +41,7 @@ describe('getBorderSettings', () => {
|
|
|
41
41
|
});
|
|
42
42
|
expect((borderSettings.on?.[0] as MultiInputBlock<AppBridgeBlock>).blocks[1]).toHaveProperty(
|
|
43
43
|
'id',
|
|
44
|
-
'borderWidth'
|
|
44
|
+
'borderWidth',
|
|
45
45
|
);
|
|
46
46
|
expect((borderSettings.on?.[0] as MultiInputBlock<AppBridgeBlock>).blocks[1]).toHaveProperty('type', 'input');
|
|
47
47
|
expect((borderSettings.on?.[0] as MultiInputBlock<AppBridgeBlock>).blocks[2]).toEqual({
|
|
@@ -20,19 +20,19 @@ describe('getBorderRadiusExtendedSettings', () => {
|
|
|
20
20
|
|
|
21
21
|
expect((extendedBorderRadiusSettings.on?.[0] as MultiInputBlock<AppBridgeBlock>).blocks[0]).toHaveProperty(
|
|
22
22
|
'id',
|
|
23
|
-
'extendedRadiusTopLeft'
|
|
23
|
+
'extendedRadiusTopLeft',
|
|
24
24
|
);
|
|
25
25
|
expect((extendedBorderRadiusSettings.on?.[0] as MultiInputBlock<AppBridgeBlock>).blocks[1]).toHaveProperty(
|
|
26
26
|
'id',
|
|
27
|
-
'extendedRadiusTopRight'
|
|
27
|
+
'extendedRadiusTopRight',
|
|
28
28
|
);
|
|
29
29
|
expect((extendedBorderRadiusSettings.on?.[0] as MultiInputBlock<AppBridgeBlock>).blocks[2]).toHaveProperty(
|
|
30
30
|
'id',
|
|
31
|
-
'extendedRadiusBottomLeft'
|
|
31
|
+
'extendedRadiusBottomLeft',
|
|
32
32
|
);
|
|
33
33
|
expect((extendedBorderRadiusSettings.on?.[0] as MultiInputBlock<AppBridgeBlock>).blocks[3]).toHaveProperty(
|
|
34
34
|
'id',
|
|
35
|
-
'extendedRadiusBottomRight'
|
|
35
|
+
'extendedRadiusBottomRight',
|
|
36
36
|
);
|
|
37
37
|
expect(extendedBorderRadiusSettings.off?.[0]).toHaveProperty('id', 'extendedRadiusChoice');
|
|
38
38
|
expect(extendedBorderRadiusSettings.off?.[0]).toHaveProperty('type', 'segmentedControls');
|
|
@@ -20,19 +20,19 @@ describe('getMarginExtendedSettings', () => {
|
|
|
20
20
|
|
|
21
21
|
expect((extendedMarginSettings.on?.[0] as MultiInputBlock<AppBridgeBlock>).blocks[0]).toHaveProperty(
|
|
22
22
|
'id',
|
|
23
|
-
'extendedMarginTop'
|
|
23
|
+
'extendedMarginTop',
|
|
24
24
|
);
|
|
25
25
|
expect((extendedMarginSettings.on?.[0] as MultiInputBlock<AppBridgeBlock>).blocks[1]).toHaveProperty(
|
|
26
26
|
'id',
|
|
27
|
-
'extendedMarginLeft'
|
|
27
|
+
'extendedMarginLeft',
|
|
28
28
|
);
|
|
29
29
|
expect((extendedMarginSettings.on?.[0] as MultiInputBlock<AppBridgeBlock>).blocks[2]).toHaveProperty(
|
|
30
30
|
'id',
|
|
31
|
-
'extendedMarginRight'
|
|
31
|
+
'extendedMarginRight',
|
|
32
32
|
);
|
|
33
33
|
expect((extendedMarginSettings.on?.[0] as MultiInputBlock<AppBridgeBlock>).blocks[3]).toHaveProperty(
|
|
34
34
|
'id',
|
|
35
|
-
'extendedMarginBottom'
|
|
35
|
+
'extendedMarginBottom',
|
|
36
36
|
);
|
|
37
37
|
expect(extendedMarginSettings.off?.[0]).toHaveProperty('id', 'extendedMarginChoice');
|
|
38
38
|
expect(extendedMarginSettings.off?.[0]).toHaveProperty('type', 'segmentedControls');
|
|
@@ -20,19 +20,19 @@ describe('getPaddingExtendedSettings', () => {
|
|
|
20
20
|
|
|
21
21
|
expect((extendedPaddingSettings.on?.[0] as MultiInputBlock<AppBridgeBlock>).blocks[0]).toHaveProperty(
|
|
22
22
|
'id',
|
|
23
|
-
'extendedPaddingTop'
|
|
23
|
+
'extendedPaddingTop',
|
|
24
24
|
);
|
|
25
25
|
expect((extendedPaddingSettings.on?.[0] as MultiInputBlock<AppBridgeBlock>).blocks[1]).toHaveProperty(
|
|
26
26
|
'id',
|
|
27
|
-
'extendedPaddingLeft'
|
|
27
|
+
'extendedPaddingLeft',
|
|
28
28
|
);
|
|
29
29
|
expect((extendedPaddingSettings.on?.[0] as MultiInputBlock<AppBridgeBlock>).blocks[2]).toHaveProperty(
|
|
30
30
|
'id',
|
|
31
|
-
'extendedPaddingRight'
|
|
31
|
+
'extendedPaddingRight',
|
|
32
32
|
);
|
|
33
33
|
expect((extendedPaddingSettings.on?.[0] as MultiInputBlock<AppBridgeBlock>).blocks[3]).toHaveProperty(
|
|
34
34
|
'id',
|
|
35
|
-
'extendedPaddingBottom'
|
|
35
|
+
'extendedPaddingBottom',
|
|
36
36
|
);
|
|
37
37
|
expect(extendedPaddingSettings.off?.[0]).toHaveProperty('id', 'extendedPaddingChoice');
|
|
38
38
|
expect(extendedPaddingSettings.off?.[0]).toHaveProperty('type', 'segmentedControls');
|
package/src/styles.css
ADDED
|
@@ -11,7 +11,7 @@ import { toRgbaString } from '../color';
|
|
|
11
11
|
export const getBorderStyles = (
|
|
12
12
|
style = BorderStyle.Solid,
|
|
13
13
|
borderWidth = '1px',
|
|
14
|
-
color = BORDER_COLOR_DEFAULT_VALUE as Color
|
|
14
|
+
color = BORDER_COLOR_DEFAULT_VALUE as Color,
|
|
15
15
|
): CSSProperties => {
|
|
16
16
|
return {
|
|
17
17
|
borderStyle: borderStyleMap[style],
|