@strapi/content-manager 5.34.0 → 5.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin/components/ActionsDrawer.js +204 -0
- package/dist/admin/components/ActionsDrawer.js.map +1 -0
- package/dist/admin/components/ActionsDrawer.mjs +183 -0
- package/dist/admin/components/ActionsDrawer.mjs.map +1 -0
- package/dist/admin/history/components/VersionContent.js +22 -9
- package/dist/admin/history/components/VersionContent.js.map +1 -1
- package/dist/admin/history/components/VersionContent.mjs +23 -10
- package/dist/admin/history/components/VersionContent.mjs.map +1 -1
- package/dist/admin/pages/EditView/EditViewPage.js +100 -71
- package/dist/admin/pages/EditView/EditViewPage.js.map +1 -1
- package/dist/admin/pages/EditView/EditViewPage.mjs +102 -73
- package/dist/admin/pages/EditView/EditViewPage.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/DocumentActions.js +48 -40
- package/dist/admin/pages/EditView/components/DocumentActions.js.map +1 -1
- package/dist/admin/pages/EditView/components/DocumentActions.mjs +50 -42
- package/dist/admin/pages/EditView/components/DocumentActions.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/EditorToolbarObserver.js +63 -31
- package/dist/admin/pages/EditView/components/EditorToolbarObserver.js.map +1 -1
- package/dist/admin/pages/EditView/components/EditorToolbarObserver.mjs +64 -32
- package/dist/admin/pages/EditView/components/EditorToolbarObserver.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/Link.js +20 -5
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/Link.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/Link.mjs +20 -5
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/Link.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksContent.js +22 -12
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksContent.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksContent.mjs +22 -12
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksContent.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksEditor.js +6 -1
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksEditor.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksEditor.mjs +7 -2
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksEditor.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksToolbar.js +151 -10
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksToolbar.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksToolbar.mjs +152 -11
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksToolbar.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Modifiers.js +52 -5
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Modifiers.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Modifiers.mjs +53 -6
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Modifiers.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/Editor.js +6 -1
- package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/Editor.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/Editor.mjs +6 -1
- package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/Editor.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.js +1 -0
- package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.mjs +1 -0
- package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/Field.js +21 -1
- package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/Field.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/Field.mjs +24 -4
- package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/Field.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/PreviewWysiwyg.js +2 -2
- package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/PreviewWysiwyg.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/PreviewWysiwyg.mjs +2 -2
- package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/PreviewWysiwyg.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/WysiwygFooter.js +4 -0
- package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/WysiwygFooter.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/WysiwygFooter.mjs +4 -0
- package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/WysiwygFooter.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/WysiwygNav.js +30 -13
- package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/WysiwygNav.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/WysiwygNav.mjs +32 -16
- package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/WysiwygNav.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/Panels.js +67 -15
- package/dist/admin/pages/EditView/components/Panels.js.map +1 -1
- package/dist/admin/pages/EditView/components/Panels.mjs +67 -18
- package/dist/admin/pages/EditView/components/Panels.mjs.map +1 -1
- package/dist/admin/pages/ListView/ListViewPage.js +2 -2
- package/dist/admin/pages/ListView/ListViewPage.js.map +1 -1
- package/dist/admin/pages/ListView/ListViewPage.mjs +2 -2
- package/dist/admin/pages/ListView/ListViewPage.mjs.map +1 -1
- package/dist/admin/preview/index.js +9 -3
- package/dist/admin/preview/index.js.map +1 -1
- package/dist/admin/preview/index.mjs +9 -3
- package/dist/admin/preview/index.mjs.map +1 -1
- package/dist/admin/src/components/ActionsDrawer.d.ts +19 -0
- package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygNav.d.ts +7 -2
- package/dist/admin/src/pages/EditView/components/Panels.d.ts +14 -2
- package/dist/admin/translations/en.json.js +5 -1
- package/dist/admin/translations/en.json.js.map +1 -1
- package/dist/admin/translations/en.json.mjs +5 -1
- package/dist/admin/translations/en.json.mjs.map +1 -1
- package/dist/admin/translations/es.json.js +3 -1
- package/dist/admin/translations/es.json.js.map +1 -1
- package/dist/admin/translations/es.json.mjs +3 -1
- package/dist/admin/translations/es.json.mjs.map +1 -1
- package/dist/admin/translations/fr.json.js +3 -1
- package/dist/admin/translations/fr.json.js.map +1 -1
- package/dist/admin/translations/fr.json.mjs +3 -1
- package/dist/admin/translations/fr.json.mjs.map +1 -1
- package/package.json +5 -5
|
@@ -2,7 +2,7 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
2
2
|
import 'react';
|
|
3
3
|
import { Typography } from '@strapi/design-system';
|
|
4
4
|
import { Bold, Italic, Underline, StrikeThrough, Code } from '@strapi/icons';
|
|
5
|
-
import { Editor, Transforms } from 'slate';
|
|
5
|
+
import { Editor, Range, Text, Transforms } from 'slate';
|
|
6
6
|
import { css, styled } from 'styled-components';
|
|
7
7
|
|
|
8
8
|
const stylesToInherit = css`
|
|
@@ -40,21 +40,68 @@ const InlineCode = styled.code`
|
|
|
40
40
|
/**
|
|
41
41
|
* The default handler for checking if a modifier is active
|
|
42
42
|
*/ const baseCheckIsActive = (editor, name)=>{
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
const { selection } = editor;
|
|
44
|
+
// If there's no selection, fall back to Slate's current marks.
|
|
45
|
+
// (This is what will be applied to newly inserted text.)
|
|
46
|
+
if (!selection) {
|
|
47
|
+
const marks = Editor.marks(editor);
|
|
48
|
+
return Boolean(marks?.[name]);
|
|
49
|
+
}
|
|
50
|
+
// Collapsed selection (caret): current marks are reliable.
|
|
51
|
+
if (Range.isCollapsed(selection)) {
|
|
52
|
+
const marks = Editor.marks(editor);
|
|
53
|
+
return Boolean(marks?.[name]);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Expanded selection: derive "active" state from the selected text nodes.
|
|
57
|
+
*
|
|
58
|
+
* This avoids a common mobile edge case where the selection focus can sit just
|
|
59
|
+
* outside the formatted span (so relying on caret/focus marks would be wrong).
|
|
60
|
+
*
|
|
61
|
+
* Additionally, mobile selection often includes an extra whitespace character at
|
|
62
|
+
* the edge (e.g. the trailing space after a word). We ignore whitespace-only
|
|
63
|
+
* portions when computing active state so the toolbar reflects the intended
|
|
64
|
+
* formatted text.
|
|
65
|
+
*/ const range = Editor.unhangRange(editor, selection);
|
|
66
|
+
const selectedTextEntries = Array.from(Editor.nodes(editor, {
|
|
67
|
+
at: range,
|
|
68
|
+
match: Text.isText,
|
|
69
|
+
mode: 'all'
|
|
70
|
+
}));
|
|
71
|
+
if (selectedTextEntries.length === 0) return false;
|
|
72
|
+
const summary = selectedTextEntries.reduce((acc, [node, path])=>{
|
|
73
|
+
const nodeRange = Editor.range(editor, path);
|
|
74
|
+
const intersection = Range.intersection(range, nodeRange);
|
|
75
|
+
if (!intersection) {
|
|
76
|
+
return acc;
|
|
77
|
+
}
|
|
78
|
+
const start = Math.min(intersection.anchor.offset, intersection.focus.offset);
|
|
79
|
+
const end = Math.max(intersection.anchor.offset, intersection.focus.offset);
|
|
80
|
+
const selectedSlice = node.text.slice(start, end);
|
|
81
|
+
// Ignore whitespace-only slices (common in mobile selection boundaries).
|
|
82
|
+
if (selectedSlice.trim().length === 0) {
|
|
83
|
+
return acc;
|
|
84
|
+
}
|
|
85
|
+
return {
|
|
86
|
+
hasNonWhitespaceSelection: true,
|
|
87
|
+
isEveryRelevantNodeMarked: acc.isEveryRelevantNodeMarked && Boolean(node[name])
|
|
88
|
+
};
|
|
89
|
+
}, {
|
|
90
|
+
hasNonWhitespaceSelection: false,
|
|
91
|
+
isEveryRelevantNodeMarked: true
|
|
92
|
+
});
|
|
93
|
+
return summary.hasNonWhitespaceSelection && summary.isEveryRelevantNodeMarked;
|
|
46
94
|
};
|
|
47
95
|
/**
|
|
48
96
|
* The default handler for toggling a modifier
|
|
49
97
|
*/ const baseHandleToggle = (editor, name)=>{
|
|
50
|
-
const marks = Editor.marks(editor);
|
|
51
98
|
// If there is no selection, set selection to the end of line
|
|
52
99
|
if (!editor.selection) {
|
|
53
100
|
const endOfEditor = Editor.end(editor, []);
|
|
54
101
|
Transforms.select(editor, endOfEditor);
|
|
55
102
|
}
|
|
56
103
|
// Toggle the modifier
|
|
57
|
-
if (
|
|
104
|
+
if (baseCheckIsActive(editor, name)) {
|
|
58
105
|
Editor.removeMark(editor, name);
|
|
59
106
|
} else {
|
|
60
107
|
Editor.addMark(editor, name, true);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modifiers.mjs","sources":["../../../../../../../admin/src/pages/EditView/components/FormInputs/BlocksInput/Modifiers.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Typography, TypographyComponent } from '@strapi/design-system';\nimport { Bold, Italic, Underline, StrikeThrough, Code } from '@strapi/icons';\nimport { type MessageDescriptor } from 'react-intl';\nimport { Editor, Text, Transforms } from 'slate';\nimport { styled, css } from 'styled-components';\n\nconst stylesToInherit = css`\n font-size: inherit;\n color: inherit;\n line-height: inherit;\n`;\n\nconst BoldText = styled<TypographyComponent>(Typography).attrs({ fontWeight: 'bold' })`\n ${stylesToInherit}\n`;\n\nconst ItalicText = styled<TypographyComponent>(Typography)`\n font-style: italic;\n ${stylesToInherit}\n`;\n\nconst UnderlineText = styled<TypographyComponent>(Typography).attrs({\n textDecoration: 'underline',\n})`\n ${stylesToInherit}\n`;\n\nconst StrikeThroughText = styled<TypographyComponent>(Typography).attrs({\n textDecoration: 'line-through',\n})`\n ${stylesToInherit}\n`;\n\nconst InlineCode = styled.code`\n background-color: ${({ theme }) => theme.colors.neutral150};\n border-radius: ${({ theme }) => theme.borderRadius};\n padding: ${({ theme }) => `0 ${theme.spaces[2]}`};\n font-family: 'SF Mono', SFMono-Regular, ui-monospace, 'DejaVu Sans Mono', Menlo, Consolas,\n monospace;\n color: inherit;\n`;\n\ntype ModifierKey = Exclude<keyof Text, 'type' | 'text'>;\n\ntype ModifiersStore = {\n [K in ModifierKey]: {\n icon: React.ComponentType;\n isValidEventKey: (event: React.KeyboardEvent<HTMLElement>) => boolean;\n label: MessageDescriptor;\n checkIsActive: (editor: Editor) => boolean;\n handleToggle: (editor: Editor) => void;\n renderLeaf: (children: React.JSX.Element | string) => React.JSX.Element;\n };\n};\n\n/**\n * The default handler for checking if a modifier is active\n */\nconst baseCheckIsActive = (editor: Editor, name: ModifierKey) => {\n const marks = Editor.marks(editor);\n if (!marks) return false;\n\n return Boolean(marks[name]);\n};\n\n/**\n * The default handler for toggling a modifier\n */\nconst baseHandleToggle = (editor: Editor, name: ModifierKey) => {\n const marks = Editor.marks(editor);\n\n // If there is no selection, set selection to the end of line\n if (!editor.selection) {\n const endOfEditor = Editor.end(editor, []);\n Transforms.select(editor, endOfEditor);\n }\n\n // Toggle the modifier\n if (marks?.[name]) {\n Editor.removeMark(editor, name);\n } else {\n Editor.addMark(editor, name, true);\n }\n};\n\nconst modifiers: ModifiersStore = {\n bold: {\n icon: Bold,\n isValidEventKey: (event) => event.key === 'b',\n label: { id: 'components.Blocks.modifiers.bold', defaultMessage: 'Bold' },\n checkIsActive: (editor) => baseCheckIsActive(editor, 'bold'),\n handleToggle: (editor) => baseHandleToggle(editor, 'bold'),\n renderLeaf: (children) => <BoldText>{children}</BoldText>,\n },\n italic: {\n icon: Italic,\n isValidEventKey: (event) => event.key === 'i',\n label: { id: 'components.Blocks.modifiers.italic', defaultMessage: 'Italic' },\n checkIsActive: (editor) => baseCheckIsActive(editor, 'italic'),\n handleToggle: (editor) => baseHandleToggle(editor, 'italic'),\n renderLeaf: (children) => <ItalicText>{children}</ItalicText>,\n },\n underline: {\n icon: Underline,\n isValidEventKey: (event) => event.key === 'u',\n label: { id: 'components.Blocks.modifiers.underline', defaultMessage: 'Underline' },\n checkIsActive: (editor) => baseCheckIsActive(editor, 'underline'),\n handleToggle: (editor) => baseHandleToggle(editor, 'underline'),\n renderLeaf: (children) => <UnderlineText>{children}</UnderlineText>,\n },\n strikethrough: {\n icon: StrikeThrough,\n isValidEventKey: (event) => event.key === 'S' && event.shiftKey,\n label: { id: 'components.Blocks.modifiers.strikethrough', defaultMessage: 'Strikethrough' },\n checkIsActive: (editor) => baseCheckIsActive(editor, 'strikethrough'),\n handleToggle: (editor) => baseHandleToggle(editor, 'strikethrough'),\n renderLeaf: (children) => <StrikeThroughText>{children}</StrikeThroughText>,\n },\n code: {\n icon: Code,\n isValidEventKey: (event) => event.key === 'e',\n label: { id: 'components.Blocks.modifiers.code', defaultMessage: 'Inline code' },\n checkIsActive: (editor) => baseCheckIsActive(editor, 'code'),\n handleToggle: (editor) => baseHandleToggle(editor, 'code'),\n renderLeaf: (children) => <InlineCode>{children}</InlineCode>,\n },\n};\n\nexport { type ModifiersStore, modifiers };\n"],"names":["stylesToInherit","css","BoldText","styled","Typography","attrs","fontWeight","ItalicText","UnderlineText","textDecoration","StrikeThroughText","InlineCode","code","theme","colors","neutral150","borderRadius","spaces","baseCheckIsActive","editor","name","marks","Editor","Boolean","baseHandleToggle","selection","endOfEditor","end","Transforms","select","removeMark","addMark","modifiers","bold","icon","Bold","isValidEventKey","event","key","label","id","defaultMessage","checkIsActive","handleToggle","renderLeaf","children","_jsx","italic","Italic","underline","Underline","strikethrough","StrikeThrough","shiftKey","Code"],"mappings":";;;;;;;AAQA,MAAMA,eAAAA,GAAkBC,GAAG;;;;AAI3B,CAAC;AAED,MAAMC,QAAWC,GAAAA,MAAAA,CAA4BC,UA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AAAA;AACNlB,QAAAA,eAAAA,EAAiB,CAACC,KAAAA,GAAUA,KAAMC,CAAAA,GAAG,KAAK,GAAA;QAC1CC,KAAO,EAAA;YAAEC,EAAI,EAAA,kCAAA;YAAoCC,cAAgB,EAAA;AAAc,SAAA;QAC/EC,aAAe,EAAA,CAACvB,MAAWD,GAAAA,iBAAAA,CAAkBC,MAAQ,EAAA,MAAA,CAAA;QACrDwB,YAAc,EAAA,CAACxB,MAAWK,GAAAA,gBAAAA,CAAiBL,MAAQ,EAAA,MAAA,CAAA;QACnDyB,UAAY,EAAA,CAACC,yBAAaC,GAACnC,CAAAA,UAAAA,EAAAA;AAAYkC,gBAAAA,QAAAA,EAAAA;;AACzC;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"Modifiers.mjs","sources":["../../../../../../../admin/src/pages/EditView/components/FormInputs/BlocksInput/Modifiers.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Typography, TypographyComponent } from '@strapi/design-system';\nimport { Bold, Italic, Underline, StrikeThrough, Code } from '@strapi/icons';\nimport { type MessageDescriptor } from 'react-intl';\nimport { Editor, type NodeEntry, Range, Text, Transforms } from 'slate';\nimport { styled, css } from 'styled-components';\n\nconst stylesToInherit = css`\n font-size: inherit;\n color: inherit;\n line-height: inherit;\n`;\n\nconst BoldText = styled<TypographyComponent>(Typography).attrs({ fontWeight: 'bold' })`\n ${stylesToInherit}\n`;\n\nconst ItalicText = styled<TypographyComponent>(Typography)`\n font-style: italic;\n ${stylesToInherit}\n`;\n\nconst UnderlineText = styled<TypographyComponent>(Typography).attrs({\n textDecoration: 'underline',\n})`\n ${stylesToInherit}\n`;\n\nconst StrikeThroughText = styled<TypographyComponent>(Typography).attrs({\n textDecoration: 'line-through',\n})`\n ${stylesToInherit}\n`;\n\nconst InlineCode = styled.code`\n background-color: ${({ theme }) => theme.colors.neutral150};\n border-radius: ${({ theme }) => theme.borderRadius};\n padding: ${({ theme }) => `0 ${theme.spaces[2]}`};\n font-family: 'SF Mono', SFMono-Regular, ui-monospace, 'DejaVu Sans Mono', Menlo, Consolas,\n monospace;\n color: inherit;\n`;\n\ntype ModifierKey = Exclude<keyof Text, 'type' | 'text'>;\n\ntype ModifiersStore = {\n [K in ModifierKey]: {\n icon: React.ComponentType;\n isValidEventKey: (event: React.KeyboardEvent<HTMLElement>) => boolean;\n label: MessageDescriptor;\n checkIsActive: (editor: Editor) => boolean;\n handleToggle: (editor: Editor) => void;\n renderLeaf: (children: React.JSX.Element | string) => React.JSX.Element;\n };\n};\n\n/**\n * The default handler for checking if a modifier is active\n */\nconst baseCheckIsActive = (editor: Editor, name: ModifierKey) => {\n const { selection } = editor;\n\n // If there's no selection, fall back to Slate's current marks.\n // (This is what will be applied to newly inserted text.)\n if (!selection) {\n const marks = Editor.marks(editor);\n return Boolean(marks?.[name]);\n }\n\n // Collapsed selection (caret): current marks are reliable.\n if (Range.isCollapsed(selection)) {\n const marks = Editor.marks(editor);\n return Boolean(marks?.[name]);\n }\n\n /**\n * Expanded selection: derive \"active\" state from the selected text nodes.\n *\n * This avoids a common mobile edge case where the selection focus can sit just\n * outside the formatted span (so relying on caret/focus marks would be wrong).\n *\n * Additionally, mobile selection often includes an extra whitespace character at\n * the edge (e.g. the trailing space after a word). We ignore whitespace-only\n * portions when computing active state so the toolbar reflects the intended\n * formatted text.\n */\n const range = Editor.unhangRange(editor, selection);\n const selectedTextEntries = Array.from(\n Editor.nodes(editor, { at: range, match: Text.isText, mode: 'all' })\n ) as NodeEntry<Text>[];\n\n if (selectedTextEntries.length === 0) return false;\n\n const summary = selectedTextEntries.reduce(\n (acc, [node, path]) => {\n const nodeRange = Editor.range(editor, path);\n const intersection = Range.intersection(range, nodeRange);\n\n if (!intersection) {\n return acc;\n }\n\n const start = Math.min(intersection.anchor.offset, intersection.focus.offset);\n const end = Math.max(intersection.anchor.offset, intersection.focus.offset);\n const selectedSlice = node.text.slice(start, end);\n\n // Ignore whitespace-only slices (common in mobile selection boundaries).\n if (selectedSlice.trim().length === 0) {\n return acc;\n }\n\n return {\n hasNonWhitespaceSelection: true,\n isEveryRelevantNodeMarked: acc.isEveryRelevantNodeMarked && Boolean(node[name]),\n };\n },\n { hasNonWhitespaceSelection: false, isEveryRelevantNodeMarked: true }\n );\n\n return summary.hasNonWhitespaceSelection && summary.isEveryRelevantNodeMarked;\n};\n\n/**\n * The default handler for toggling a modifier\n */\nconst baseHandleToggle = (editor: Editor, name: ModifierKey) => {\n // If there is no selection, set selection to the end of line\n if (!editor.selection) {\n const endOfEditor = Editor.end(editor, []);\n Transforms.select(editor, endOfEditor);\n }\n\n // Toggle the modifier\n if (baseCheckIsActive(editor, name)) {\n Editor.removeMark(editor, name);\n } else {\n Editor.addMark(editor, name, true);\n }\n};\n\nconst modifiers: ModifiersStore = {\n bold: {\n icon: Bold,\n isValidEventKey: (event) => event.key === 'b',\n label: { id: 'components.Blocks.modifiers.bold', defaultMessage: 'Bold' },\n checkIsActive: (editor) => baseCheckIsActive(editor, 'bold'),\n handleToggle: (editor) => baseHandleToggle(editor, 'bold'),\n renderLeaf: (children) => <BoldText>{children}</BoldText>,\n },\n italic: {\n icon: Italic,\n isValidEventKey: (event) => event.key === 'i',\n label: { id: 'components.Blocks.modifiers.italic', defaultMessage: 'Italic' },\n checkIsActive: (editor) => baseCheckIsActive(editor, 'italic'),\n handleToggle: (editor) => baseHandleToggle(editor, 'italic'),\n renderLeaf: (children) => <ItalicText>{children}</ItalicText>,\n },\n underline: {\n icon: Underline,\n isValidEventKey: (event) => event.key === 'u',\n label: { id: 'components.Blocks.modifiers.underline', defaultMessage: 'Underline' },\n checkIsActive: (editor) => baseCheckIsActive(editor, 'underline'),\n handleToggle: (editor) => baseHandleToggle(editor, 'underline'),\n renderLeaf: (children) => <UnderlineText>{children}</UnderlineText>,\n },\n strikethrough: {\n icon: StrikeThrough,\n isValidEventKey: (event) => event.key === 'S' && event.shiftKey,\n label: { id: 'components.Blocks.modifiers.strikethrough', defaultMessage: 'Strikethrough' },\n checkIsActive: (editor) => baseCheckIsActive(editor, 'strikethrough'),\n handleToggle: (editor) => baseHandleToggle(editor, 'strikethrough'),\n renderLeaf: (children) => <StrikeThroughText>{children}</StrikeThroughText>,\n },\n code: {\n icon: Code,\n isValidEventKey: (event) => event.key === 'e',\n label: { id: 'components.Blocks.modifiers.code', defaultMessage: 'Inline code' },\n checkIsActive: (editor) => baseCheckIsActive(editor, 'code'),\n handleToggle: (editor) => baseHandleToggle(editor, 'code'),\n renderLeaf: (children) => <InlineCode>{children}</InlineCode>,\n },\n};\n\nexport { type ModifiersStore, modifiers };\n"],"names":["stylesToInherit","css","BoldText","styled","Typography","attrs","fontWeight","ItalicText","UnderlineText","textDecoration","StrikeThroughText","InlineCode","code","theme","colors","neutral150","borderRadius","spaces","baseCheckIsActive","editor","name","selection","marks","Editor","Boolean","Range","isCollapsed","range","unhangRange","selectedTextEntries","Array","from","nodes","at","match","Text","isText","mode","length","summary","reduce","acc","node","path","nodeRange","intersection","start","Math","min","anchor","offset","focus","end","max","selectedSlice","text","slice","trim","hasNonWhitespaceSelection","isEveryRelevantNodeMarked","baseHandleToggle","endOfEditor","Transforms","select","removeMark","addMark","modifiers","bold","icon","Bold","isValidEventKey","event","key","label","id","defaultMessage","checkIsActive","handleToggle","renderLeaf","children","_jsx","italic","Italic","underline","Underline","strikethrough","StrikeThrough","shiftKey","Code"],"mappings":";;;;;;;AAQA,MAAMA,eAAAA,GAAkBC,GAAG;;;;AAI3B,CAAC;AAED,MAAMC,QAAWC,GAAAA,MAAAA,CAA4BC,UAAYC,CAAAA,CAAAA,KAAK,CAAC;IAAEC,UAAY,EAAA;AAAO,CAAA,CAAE;AACpF,EAAA,EAAEN,eAAgB;AACpB,CAAC;AAED,MAAMO,UAAAA,GAAaJ,MAA4BC,CAAAA,UAAAA,CAAW;;AAExD,EAAA,EAAEJ,eAAgB;AACpB,CAAC;AAED,MAAMQ,aAAgBL,GAAAA,MAAAA,CAA4BC,UAAYC,CAAAA,CAAAA,KAAK,CAAC;IACl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A,CAAC1D,MAAWyC,GAAAA,gBAAAA,CAAiBzC,MAAQ,EAAA,eAAA,CAAA;QACnD2D,UAAY,EAAA,CAACC,yBAAaC,GAACtE,CAAAA,iBAAAA,EAAAA;AAAmBqE,gBAAAA,QAAAA,EAAAA;;AAChD,KAAA;IACAnE,IAAM,EAAA;QACJwD,IAAMoB,EAAAA,IAAAA;AACNlB,QAAAA,eAAAA,EAAiB,CAACC,KAAAA,GAAUA,KAAMC,CAAAA,GAAG,KAAK,GAAA;QAC1CC,KAAO,EAAA;YAAEC,EAAI,EAAA,kCAAA;YAAoCC,cAAgB,EAAA;AAAc,SAAA;QAC/EC,aAAe,EAAA,CAACzD,MAAWD,GAAAA,iBAAAA,CAAkBC,MAAQ,EAAA,MAAA,CAAA;QACrD0D,YAAc,EAAA,CAAC1D,MAAWyC,GAAAA,gBAAAA,CAAiBzC,MAAQ,EAAA,MAAA,CAAA;QACnD2D,UAAY,EAAA,CAACC,yBAAaC,GAACrE,CAAAA,UAAAA,EAAAA;AAAYoE,gBAAAA,QAAAA,EAAAA;;AACzC;AACF;;;;"}
|
|
@@ -116,7 +116,11 @@ const Editor = /*#__PURE__*/ React__namespace.forwardRef(({ disabled, editorRef,
|
|
|
116
116
|
});
|
|
117
117
|
const EditorAndPreviewWrapper = styledComponents.styled.div`
|
|
118
118
|
position: relative;
|
|
119
|
-
height: calc(100%
|
|
119
|
+
height: calc(100%);
|
|
120
|
+
|
|
121
|
+
${({ theme })=>theme.breakpoints.medium} {
|
|
122
|
+
height: calc(100% - 48px);
|
|
123
|
+
}
|
|
120
124
|
`;
|
|
121
125
|
const EditorStylesContainer = styledComponents.styled.div`
|
|
122
126
|
cursor: ${({ $disabled })=>$disabled ? 'not-allowed !important' : 'auto'};
|
|
@@ -279,6 +283,7 @@ const EditorStylesContainer = styledComponents.styled.div`
|
|
|
279
283
|
.CodeMirror {
|
|
280
284
|
position: relative;
|
|
281
285
|
overflow: hidden;
|
|
286
|
+
border-radius: ${({ theme })=>theme.borderRadius};
|
|
282
287
|
background: ${({ theme })=>`${theme.colors.neutral0}`};
|
|
283
288
|
}
|
|
284
289
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Editor.js","sources":["../../../../../../../admin/src/pages/EditView/components/FormInputs/Wysiwyg/Editor.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport CodeMirror, { EditorFromTextArea } from 'codemirror5';\nimport { styled } from 'styled-components';\n\nimport { PreviewWysiwyg } from './PreviewWysiwyg';\nimport { newlineAndIndentContinueMarkdownList } from './utils/continueList';\n\nimport type { FieldValue, InputProps } from '@strapi/admin/strapi-admin';\n\nimport 'codemirror5/addon/display/placeholder';\n\ninterface EditorApi {\n focus: () => void;\n scrollIntoView: (args?: Parameters<HTMLElement['scrollIntoView']>[0]) => void;\n}\n\ninterface EditorProps extends Omit<FieldValue, 'initialValue'>, Omit<InputProps, 'type' | 'label'> {\n editorRef: React.MutableRefObject<EditorFromTextArea>;\n isPreviewMode?: boolean;\n isExpandMode?: boolean;\n textareaRef: React.RefObject<HTMLTextAreaElement>;\n}\n\nconst Editor = React.forwardRef<EditorApi, EditorProps>(\n (\n {\n disabled,\n editorRef,\n error,\n isPreviewMode,\n isExpandMode,\n name,\n onChange,\n placeholder,\n textareaRef,\n value,\n },\n forwardedRef\n ) => {\n const onChangeRef = React.useRef(onChange);\n\n React.useEffect(() => {\n if (editorRef.current) {\n // Ensure the editor and its wrapper are cleaned up whenever this view is re-rendered\n // e.g. in case of re-ordering wysiwyg components in a DynamicZone\n editorRef.current.toTextArea();\n }\n editorRef.current = CodeMirror.fromTextArea(textareaRef.current!, {\n lineWrapping: true,\n extraKeys: {\n Enter: 'newlineAndIndentContinueMarkdownList',\n Tab: false,\n 'Shift-Tab': false,\n },\n readOnly: false,\n smartIndent: false,\n placeholder,\n spellcheck: true,\n inputStyle: 'contenteditable',\n });\n\n // @ts-expect-error – doesn't think command exists?\n CodeMirror.commands.newlineAndIndentContinueMarkdownList =\n newlineAndIndentContinueMarkdownList;\n editorRef.current.on('change', (doc) => {\n onChangeRef.current(name, doc.getValue());\n });\n }, [editorRef, textareaRef, name, placeholder]);\n\n React.useEffect(() => {\n if (value && !editorRef.current.hasFocus()) {\n editorRef.current.setValue(value);\n }\n }, [editorRef, value]);\n\n React.useEffect(() => {\n if (isPreviewMode || disabled) {\n editorRef.current.setOption('readOnly', 'nocursor');\n } else {\n editorRef.current.setOption('readOnly', false);\n }\n }, [disabled, isPreviewMode, editorRef]);\n\n React.useEffect(() => {\n if (error) {\n editorRef.current.setOption('screenReaderLabel', error);\n } else {\n // to replace with translation\n editorRef.current.setOption('screenReaderLabel', 'Editor');\n }\n }, [editorRef, error]);\n\n React.useImperativeHandle(\n forwardedRef,\n () => ({\n focus() {\n editorRef.current.getInputField().focus();\n },\n scrollIntoView(args?: Parameters<HTMLElement['scrollIntoView']>[0]) {\n editorRef.current.getInputField().scrollIntoView(args);\n },\n }),\n [editorRef]\n );\n\n return (\n <EditorAndPreviewWrapper>\n <EditorStylesContainer $isExpandMode={isExpandMode} $disabled={disabled || isPreviewMode}>\n <textarea ref={textareaRef} />\n </EditorStylesContainer>\n {isPreviewMode && <PreviewWysiwyg data={value} />}\n </EditorAndPreviewWrapper>\n );\n }\n);\n\nconst EditorAndPreviewWrapper = styled.div`\n position: relative;\n height: calc(100% - 48px);\n`;\n\nconst EditorStylesContainer = styled.div<{ $disabled?: boolean; $isExpandMode?: boolean }>`\n cursor: ${({ $disabled }) => ($disabled ? 'not-allowed !important' : 'auto')};\n height: 100%;\n /* BASICS */\n .CodeMirror-placeholder {\n color: ${({ theme }) => theme.colors.neutral600} !important;\n }\n\n .CodeMirror {\n /* Set height, width, borders, and global font properties here */\n font-size: 1.6rem;\n height: ${({ $isExpandMode }) =>\n $isExpandMode\n ? '100%'\n : '410px'}; // 512px(total height) - 48px (header) - 52px(footer) - 2px border\n color: ${({ theme }) => theme.colors.neutral800};\n direction: ltr;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,\n 'Open Sans', 'Helvetica Neue', sans-serif;\n\n ${({ theme }) => theme.breakpoints.medium} {\n font-size: 1.4rem;\n }\n }\n\n /* PADDING */\n\n .CodeMirror-lines {\n padding: ${({ theme }) => `${theme.spaces[3]} ${theme.spaces[4]}`};\n /* Vertical padding around content */\n }\n\n .CodeMirror-scrollbar-filler,\n .CodeMirror-gutter-filler {\n /* The little square between H and V scrollbars */\n background-color: ${({ theme }) => `${theme.colors.neutral0}`};\n }\n\n /* GUTTER */\n\n .CodeMirror-gutters {\n border-right: 1px solid #ddd;\n background-color: #f7f7f7;\n white-space: nowrap;\n }\n .CodeMirror-linenumbers {\n }\n .CodeMirror-linenumber {\n padding: 0 3px 0 5px;\n min-width: 20px;\n text-align: right;\n color: #999;\n white-space: nowrap;\n }\n\n .CodeMirror-guttermarker {\n color: black;\n }\n .CodeMirror-guttermarker-subtle {\n color: #999;\n }\n\n /* CURSOR */\n\n .CodeMirror-cursor {\n border-left: 1px solid black;\n border-right: none;\n width: 0;\n }\n /* Shown when moving in bi-directional text */\n .CodeMirror div.CodeMirror-secondarycursor {\n border-left: 1px solid silver;\n }\n .cm-fat-cursor .CodeMirror-cursor {\n width: auto;\n border: 0 !important;\n background: #7e7;\n }\n .cm-fat-cursor div.CodeMirror-cursors {\n /* z-index: 1; */\n }\n\n .cm-fat-cursor-mark {\n background-color: rgba(20, 255, 20, 0.5);\n -webkit-animation: blink 1.06s steps(1) infinite;\n -moz-animation: blink 1.06s steps(1) infinite;\n animation: blink 1.06s steps(1) infinite;\n }\n .cm-animate-fat-cursor {\n width: auto;\n border: 0;\n -webkit-animation: blink 1.06s steps(1) infinite;\n -moz-animation: blink 1.06s steps(1) infinite;\n animation: blink 1.06s steps(1) infinite;\n background-color: #7e7;\n }\n\n /* Can style cursor different in overwrite (non-insert) mode */\n .CodeMirror-overwrite .CodeMirror-cursor {\n }\n\n .cm-tab {\n display: inline-block;\n text-decoration: inherit;\n }\n\n .CodeMirror-rulers {\n position: absolute;\n left: 0;\n right: 0;\n top: -50px;\n bottom: 0;\n overflow: hidden;\n }\n .CodeMirror-ruler {\n border-left: 1px solid #ccc;\n top: 0;\n bottom: 0;\n position: absolute;\n }\n\n /* DEFAULT THEME */\n\n .cm-header,\n .cm-strong {\n font-weight: bold;\n }\n .cm-em {\n font-style: italic;\n }\n .cm-link {\n text-decoration: underline;\n }\n .cm-strikethrough {\n text-decoration: line-through;\n }\n\n .CodeMirror-composing {\n border-bottom: 2px solid;\n }\n\n /* Default styles for common addons */\n\n div.CodeMirror span.CodeMirror-matchingbracket {\n color: #0b0;\n }\n div.CodeMirror span.CodeMirror-nonmatchingbracket {\n color: #a22;\n }\n .CodeMirror-matchingtag {\n background: rgba(255, 150, 0, 0.3);\n }\n .CodeMirror-activeline-background {\n background: #e8f2ff;\n }\n\n /* STOP */\n\n /* The rest of this file contains styles related to the mechanics of\n the editor. You probably shouldn't touch them. */\n\n .CodeMirror {\n position: relative;\n overflow: hidden;\n background: ${({ theme }) => `${theme.colors.neutral0}`};\n }\n\n .CodeMirror-scroll {\n overflow: scroll !important; /* Things will break if this is overridden */\n /* 50px is the magic margin used to hide the element's real scrollbars */\n /* See overflow: hidden in .CodeMirror */\n margin-bottom: -50px;\n margin-right: -50px;\n padding-bottom: 50px;\n height: 100%;\n outline: none; /* Prevent dragging from highlighting the element */\n position: relative;\n }\n .CodeMirror-sizer {\n position: relative;\n border-right: 50px solid transparent;\n }\n\n /* The fake, visible scrollbars. Used to force redraw during scrolling\n before actual scrolling happens, thus preventing shaking and\n flickering artifacts. */\n .CodeMirror-vscrollbar,\n .CodeMirror-hscrollbar,\n .CodeMirror-scrollbar-filler,\n .CodeMirror-gutter-filler {\n position: absolute;\n z-index: 1;\n display: none;\n outline: none;\n }\n\n .CodeMirror-vscrollbar {\n right: 0;\n top: 0;\n overflow-x: hidden;\n overflow-y: scroll;\n }\n .CodeMirror-hscrollbar {\n bottom: 0;\n left: 0;\n overflow-y: hidden;\n overflow-x: scroll;\n }\n .CodeMirror-scrollbar-filler {\n right: 0;\n bottom: 0;\n }\n\n .CodeMirror-lines {\n cursor: text;\n min-height: 1px; /* prevents collapsing before first draw */\n }\n /* Reset some styles that the rest of the page might have set */\n .CodeMirror pre.CodeMirror-line,\n .CodeMirror pre.CodeMirror-line-like {\n -moz-border-radius: 0;\n -webkit-border-radius: 0;\n border-radius: 0;\n border-width: 0;\n background: transparent;\n font-family: inherit;\n font-size: inherit;\n margin: 0;\n white-space: pre;\n word-wrap: normal;\n line-height: 1.5;\n color: inherit;\n /* z-index: 2; */\n position: relative;\n overflow: visible;\n -webkit-tap-highlight-color: transparent;\n -webkit-font-variant-ligatures: contextual;\n font-variant-ligatures: contextual;\n }\n\n .CodeMirror pre.CodeMirror-line-like {\n z-index: 2;\n }\n\n .CodeMirror-wrap pre.CodeMirror-line,\n .CodeMirror-wrap pre.CodeMirror-line-like {\n word-wrap: break-word;\n white-space: pre-wrap;\n word-break: break-word;\n }\n\n .CodeMirror-linebackground {\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n z-index: 0;\n }\n\n .CodeMirror-linewidget {\n position: relative;\n /* z-index: 2; */\n padding: 0.1px; /* Force widget margins to stay inside of the container */\n }\n\n .CodeMirror-widget {\n }\n\n .CodeMirror-rtl pre {\n direction: rtl;\n }\n\n .CodeMirror-code {\n outline: none;\n }\n\n /* Force content-box sizing for the elements where we expect it */\n .CodeMirror-scroll,\n .CodeMirror-sizer,\n .CodeMirror-gutter,\n .CodeMirror-gutters,\n .CodeMirror-linenumber {\n -moz-box-sizing: content-box;\n box-sizing: content-box;\n }\n\n .CodeMirror-measure {\n position: absolute;\n width: 100%;\n height: 0;\n overflow: hidden;\n visibility: hidden;\n }\n\n .CodeMirror-cursor {\n position: absolute;\n pointer-events: none;\n border-color: ${({ theme }) => `${theme.colors.neutral800}`};\n }\n .CodeMirror-measure pre {\n position: static;\n }\n\n div.CodeMirror-cursors {\n visibility: hidden;\n position: relative;\n + div {\n z-index: 0 !important;\n }\n }\n\n div.CodeMirror-dragcursors {\n visibility: visible;\n }\n\n .CodeMirror-focused div.CodeMirror-cursors {\n visibility: visible;\n }\n\n .CodeMirror-selected {\n background: ${({ theme }) => theme.colors.neutral200};\n /* z-index: -10; */\n }\n .CodeMirror-crosshair {\n cursor: crosshair;\n }\n\n /* Used to force a border model for a node */\n .cm-force-border {\n padding-right: 0.1px;\n }\n\n /* See issue #2901 */\n .cm-tab-wrap-hack:after {\n content: '';\n }\n\n /* Help users use markselection to safely style text background */\n span.CodeMirror-selectedtext {\n background: none;\n }\n\n span {\n color: ${({ theme }) => theme.colors.neutral800} !important;\n }\n`;\n\nexport { Editor };\nexport type { EditorProps, EditorApi };\n"],"names":["Editor","React","forwardRef","disabled","editorRef","error","isPreviewMode","isExpandMode","name","onChange","placeholder","textareaRef","value","forwardedRef","onChangeRef","useRef","useEffect","current","toTextArea","CodeMirror","fromTextArea","lineWrapping","extraKeys","Enter","Tab","readOnly","smartIndent","spellcheck","inputStyle","commands","newlineAndIndentContinueMarkdownList","on","doc","getValue","hasFocus","setValue","setOption","useImperativeHandle","focus","getInputField","scrollIntoView","args","_jsxs","EditorAndPreviewWrapper","_jsx","EditorStylesContainer","$isExpandMode","$disabled","textarea","ref","PreviewWysiwyg","data","styled","div","theme","colors","neutral600","neutral800","breakpoints","medium","spaces","neutral0","neutral200"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBMA,MAAAA,MAAAA,iBAASC,gBAAMC,CAAAA,UAAU,CAC7B,CACE,EACEC,QAAQ,EACRC,SAAS,EACTC,KAAK,EACLC,aAAa,EACbC,YAAY,EACZC,IAAI,EACJC,QAAQ,EACRC,WAAW,EACXC,WAAW,EACXC,KAAK,EACN,EACDC,YAAAA,GAAAA;IAEA,MAAMC,WAAAA,GAAcb,gBAAMc,CAAAA,MAAM,CAACN,QAAAA,CAAAA;AAEjCR,IAAAA,gBAAAA,CAAMe,SAAS,CAAC,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAsI1C,EAAE,CAAC,EAAEP,KAAK,EAAE,GAAK,CAAGA,EAAAA,KAAAA,CAAMC,MAAM,CAACE,UAAU,CAAA,CAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;gBAuBhD,EAAE,CAAC,EAAEH,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAACO,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;WAuB9C,EAAE,CAAC,EAAER,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAACE,UAAU,CAAC;;AAEpD,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"Editor.js","sources":["../../../../../../../admin/src/pages/EditView/components/FormInputs/Wysiwyg/Editor.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport CodeMirror, { EditorFromTextArea } from 'codemirror5';\nimport { styled } from 'styled-components';\n\nimport { PreviewWysiwyg } from './PreviewWysiwyg';\nimport { newlineAndIndentContinueMarkdownList } from './utils/continueList';\n\nimport type { FieldValue, InputProps } from '@strapi/admin/strapi-admin';\n\nimport 'codemirror5/addon/display/placeholder';\n\ninterface EditorApi {\n focus: () => void;\n scrollIntoView: (args?: Parameters<HTMLElement['scrollIntoView']>[0]) => void;\n}\n\ninterface EditorProps extends Omit<FieldValue, 'initialValue'>, Omit<InputProps, 'type' | 'label'> {\n editorRef: React.MutableRefObject<EditorFromTextArea>;\n isPreviewMode?: boolean;\n isExpandMode?: boolean;\n textareaRef: React.RefObject<HTMLTextAreaElement>;\n}\n\nconst Editor = React.forwardRef<EditorApi, EditorProps>(\n (\n {\n disabled,\n editorRef,\n error,\n isPreviewMode,\n isExpandMode,\n name,\n onChange,\n placeholder,\n textareaRef,\n value,\n },\n forwardedRef\n ) => {\n const onChangeRef = React.useRef(onChange);\n\n React.useEffect(() => {\n if (editorRef.current) {\n // Ensure the editor and its wrapper are cleaned up whenever this view is re-rendered\n // e.g. in case of re-ordering wysiwyg components in a DynamicZone\n editorRef.current.toTextArea();\n }\n editorRef.current = CodeMirror.fromTextArea(textareaRef.current!, {\n lineWrapping: true,\n extraKeys: {\n Enter: 'newlineAndIndentContinueMarkdownList',\n Tab: false,\n 'Shift-Tab': false,\n },\n readOnly: false,\n smartIndent: false,\n placeholder,\n spellcheck: true,\n inputStyle: 'contenteditable',\n });\n\n // @ts-expect-error – doesn't think command exists?\n CodeMirror.commands.newlineAndIndentContinueMarkdownList =\n newlineAndIndentContinueMarkdownList;\n editorRef.current.on('change', (doc) => {\n onChangeRef.current(name, doc.getValue());\n });\n }, [editorRef, textareaRef, name, placeholder]);\n\n React.useEffect(() => {\n if (value && !editorRef.current.hasFocus()) {\n editorRef.current.setValue(value);\n }\n }, [editorRef, value]);\n\n React.useEffect(() => {\n if (isPreviewMode || disabled) {\n editorRef.current.setOption('readOnly', 'nocursor');\n } else {\n editorRef.current.setOption('readOnly', false);\n }\n }, [disabled, isPreviewMode, editorRef]);\n\n React.useEffect(() => {\n if (error) {\n editorRef.current.setOption('screenReaderLabel', error);\n } else {\n // to replace with translation\n editorRef.current.setOption('screenReaderLabel', 'Editor');\n }\n }, [editorRef, error]);\n\n React.useImperativeHandle(\n forwardedRef,\n () => ({\n focus() {\n editorRef.current.getInputField().focus();\n },\n scrollIntoView(args?: Parameters<HTMLElement['scrollIntoView']>[0]) {\n editorRef.current.getInputField().scrollIntoView(args);\n },\n }),\n [editorRef]\n );\n\n return (\n <EditorAndPreviewWrapper>\n <EditorStylesContainer $isExpandMode={isExpandMode} $disabled={disabled || isPreviewMode}>\n <textarea ref={textareaRef} />\n </EditorStylesContainer>\n {isPreviewMode && <PreviewWysiwyg data={value} />}\n </EditorAndPreviewWrapper>\n );\n }\n);\n\nconst EditorAndPreviewWrapper = styled.div`\n position: relative;\n height: calc(100%);\n\n ${({ theme }) => theme.breakpoints.medium} {\n height: calc(100% - 48px);\n }\n`;\n\nconst EditorStylesContainer = styled.div<{ $disabled?: boolean; $isExpandMode?: boolean }>`\n cursor: ${({ $disabled }) => ($disabled ? 'not-allowed !important' : 'auto')};\n height: 100%;\n /* BASICS */\n .CodeMirror-placeholder {\n color: ${({ theme }) => theme.colors.neutral600} !important;\n }\n\n .CodeMirror {\n /* Set height, width, borders, and global font properties here */\n font-size: 1.6rem;\n height: ${({ $isExpandMode }) =>\n $isExpandMode\n ? '100%'\n : '410px'}; // 512px(total height) - 48px (header) - 52px(footer) - 2px border\n color: ${({ theme }) => theme.colors.neutral800};\n direction: ltr;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,\n 'Open Sans', 'Helvetica Neue', sans-serif;\n\n ${({ theme }) => theme.breakpoints.medium} {\n font-size: 1.4rem;\n }\n }\n\n /* PADDING */\n\n .CodeMirror-lines {\n padding: ${({ theme }) => `${theme.spaces[3]} ${theme.spaces[4]}`};\n /* Vertical padding around content */\n }\n\n .CodeMirror-scrollbar-filler,\n .CodeMirror-gutter-filler {\n /* The little square between H and V scrollbars */\n background-color: ${({ theme }) => `${theme.colors.neutral0}`};\n }\n\n /* GUTTER */\n\n .CodeMirror-gutters {\n border-right: 1px solid #ddd;\n background-color: #f7f7f7;\n white-space: nowrap;\n }\n .CodeMirror-linenumbers {\n }\n .CodeMirror-linenumber {\n padding: 0 3px 0 5px;\n min-width: 20px;\n text-align: right;\n color: #999;\n white-space: nowrap;\n }\n\n .CodeMirror-guttermarker {\n color: black;\n }\n .CodeMirror-guttermarker-subtle {\n color: #999;\n }\n\n /* CURSOR */\n\n .CodeMirror-cursor {\n border-left: 1px solid black;\n border-right: none;\n width: 0;\n }\n /* Shown when moving in bi-directional text */\n .CodeMirror div.CodeMirror-secondarycursor {\n border-left: 1px solid silver;\n }\n .cm-fat-cursor .CodeMirror-cursor {\n width: auto;\n border: 0 !important;\n background: #7e7;\n }\n .cm-fat-cursor div.CodeMirror-cursors {\n /* z-index: 1; */\n }\n\n .cm-fat-cursor-mark {\n background-color: rgba(20, 255, 20, 0.5);\n -webkit-animation: blink 1.06s steps(1) infinite;\n -moz-animation: blink 1.06s steps(1) infinite;\n animation: blink 1.06s steps(1) infinite;\n }\n .cm-animate-fat-cursor {\n width: auto;\n border: 0;\n -webkit-animation: blink 1.06s steps(1) infinite;\n -moz-animation: blink 1.06s steps(1) infinite;\n animation: blink 1.06s steps(1) infinite;\n background-color: #7e7;\n }\n\n /* Can style cursor different in overwrite (non-insert) mode */\n .CodeMirror-overwrite .CodeMirror-cursor {\n }\n\n .cm-tab {\n display: inline-block;\n text-decoration: inherit;\n }\n\n .CodeMirror-rulers {\n position: absolute;\n left: 0;\n right: 0;\n top: -50px;\n bottom: 0;\n overflow: hidden;\n }\n .CodeMirror-ruler {\n border-left: 1px solid #ccc;\n top: 0;\n bottom: 0;\n position: absolute;\n }\n\n /* DEFAULT THEME */\n\n .cm-header,\n .cm-strong {\n font-weight: bold;\n }\n .cm-em {\n font-style: italic;\n }\n .cm-link {\n text-decoration: underline;\n }\n .cm-strikethrough {\n text-decoration: line-through;\n }\n\n .CodeMirror-composing {\n border-bottom: 2px solid;\n }\n\n /* Default styles for common addons */\n\n div.CodeMirror span.CodeMirror-matchingbracket {\n color: #0b0;\n }\n div.CodeMirror span.CodeMirror-nonmatchingbracket {\n color: #a22;\n }\n .CodeMirror-matchingtag {\n background: rgba(255, 150, 0, 0.3);\n }\n .CodeMirror-activeline-background {\n background: #e8f2ff;\n }\n\n /* STOP */\n\n /* The rest of this file contains styles related to the mechanics of\n the editor. You probably shouldn't touch them. */\n\n .CodeMirror {\n position: relative;\n overflow: hidden;\n border-radius: ${({ theme }) => theme.borderRadius};\n background: ${({ theme }) => `${theme.colors.neutral0}`};\n }\n\n .CodeMirror-scroll {\n overflow: scroll !important; /* Things will break if this is overridden */\n /* 50px is the magic margin used to hide the element's real scrollbars */\n /* See overflow: hidden in .CodeMirror */\n margin-bottom: -50px;\n margin-right: -50px;\n padding-bottom: 50px;\n height: 100%;\n outline: none; /* Prevent dragging from highlighting the element */\n position: relative;\n }\n .CodeMirror-sizer {\n position: relative;\n border-right: 50px solid transparent;\n }\n\n /* The fake, visible scrollbars. Used to force redraw during scrolling\n before actual scrolling happens, thus preventing shaking and\n flickering artifacts. */\n .CodeMirror-vscrollbar,\n .CodeMirror-hscrollbar,\n .CodeMirror-scrollbar-filler,\n .CodeMirror-gutter-filler {\n position: absolute;\n z-index: 1;\n display: none;\n outline: none;\n }\n\n .CodeMirror-vscrollbar {\n right: 0;\n top: 0;\n overflow-x: hidden;\n overflow-y: scroll;\n }\n .CodeMirror-hscrollbar {\n bottom: 0;\n left: 0;\n overflow-y: hidden;\n overflow-x: scroll;\n }\n .CodeMirror-scrollbar-filler {\n right: 0;\n bottom: 0;\n }\n\n .CodeMirror-lines {\n cursor: text;\n min-height: 1px; /* prevents collapsing before first draw */\n }\n /* Reset some styles that the rest of the page might have set */\n .CodeMirror pre.CodeMirror-line,\n .CodeMirror pre.CodeMirror-line-like {\n -moz-border-radius: 0;\n -webkit-border-radius: 0;\n border-radius: 0;\n border-width: 0;\n background: transparent;\n font-family: inherit;\n font-size: inherit;\n margin: 0;\n white-space: pre;\n word-wrap: normal;\n line-height: 1.5;\n color: inherit;\n /* z-index: 2; */\n position: relative;\n overflow: visible;\n -webkit-tap-highlight-color: transparent;\n -webkit-font-variant-ligatures: contextual;\n font-variant-ligatures: contextual;\n }\n\n .CodeMirror pre.CodeMirror-line-like {\n z-index: 2;\n }\n\n .CodeMirror-wrap pre.CodeMirror-line,\n .CodeMirror-wrap pre.CodeMirror-line-like {\n word-wrap: break-word;\n white-space: pre-wrap;\n word-break: break-word;\n }\n\n .CodeMirror-linebackground {\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n z-index: 0;\n }\n\n .CodeMirror-linewidget {\n position: relative;\n /* z-index: 2; */\n padding: 0.1px; /* Force widget margins to stay inside of the container */\n }\n\n .CodeMirror-widget {\n }\n\n .CodeMirror-rtl pre {\n direction: rtl;\n }\n\n .CodeMirror-code {\n outline: none;\n }\n\n /* Force content-box sizing for the elements where we expect it */\n .CodeMirror-scroll,\n .CodeMirror-sizer,\n .CodeMirror-gutter,\n .CodeMirror-gutters,\n .CodeMirror-linenumber {\n -moz-box-sizing: content-box;\n box-sizing: content-box;\n }\n\n .CodeMirror-measure {\n position: absolute;\n width: 100%;\n height: 0;\n overflow: hidden;\n visibility: hidden;\n }\n\n .CodeMirror-cursor {\n position: absolute;\n pointer-events: none;\n border-color: ${({ theme }) => `${theme.colors.neutral800}`};\n }\n .CodeMirror-measure pre {\n position: static;\n }\n\n div.CodeMirror-cursors {\n visibility: hidden;\n position: relative;\n + div {\n z-index: 0 !important;\n }\n }\n\n div.CodeMirror-dragcursors {\n visibility: visible;\n }\n\n .CodeMirror-focused div.CodeMirror-cursors {\n visibility: visible;\n }\n\n .CodeMirror-selected {\n background: ${({ theme }) => theme.colors.neutral200};\n /* z-index: -10; */\n }\n .CodeMirror-crosshair {\n cursor: crosshair;\n }\n\n /* Used to force a border model for a node */\n .cm-force-border {\n padding-right: 0.1px;\n }\n\n /* See issue #2901 */\n .cm-tab-wrap-hack:after {\n content: '';\n }\n\n /* Help users use markselection to safely style text background */\n span.CodeMirror-selectedtext {\n background: none;\n }\n\n span {\n color: ${({ theme }) => theme.colors.neutral800} !important;\n }\n`;\n\nexport { Editor };\nexport type { EditorProps, EditorApi };\n"],"names":["Editor","React","forwardRef","disabled","editorRef","error","isPreviewMode","isExpandMode","name","onChange","placeholder","textareaRef","value","forwardedRef","onChangeRef","useRef","useEffect","current","toTextArea","CodeMirror","fromTextArea","lineWrapping","extraKeys","Enter","Tab","readOnly","smartIndent","spellcheck","inputStyle","commands","newlineAndIndentContinueMarkdownList","on","doc","getValue","hasFocus","setValue","setOption","useImperativeHandle","focus","getInputField","scrollIntoView","args","_jsxs","EditorAndPreviewWrapper","_jsx","EditorStylesContainer","$isExpandMode","$disabled","textarea","ref","PreviewWysiwyg","data","styled","div","theme","breakp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M,CAAC,CAAA,CAAE,EAAE,CAAC;;;;;;;sBAOhD,EAAE,CAAC,EAAEN,KAAK,EAAE,GAAK,CAAGA,EAAAA,KAAAA,CAAMG,MAAM,CAACI,QAAQ,CAAA,CAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiI/C,mBAAA,EAAE,CAAC,EAAEP,KAAK,EAAE,GAAKA,KAAAA,CAAMQ,YAAY,CAAC;gBACvC,EAAE,CAAC,EAAER,KAAK,EAAE,GAAK,CAAGA,EAAAA,KAAAA,CAAMG,MAAM,CAACI,QAAQ,CAAA,CAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAsI1C,EAAE,CAAC,EAAEP,KAAK,EAAE,GAAK,CAAGA,EAAAA,KAAAA,CAAMG,MAAM,CAACE,UAAU,CAAA,CAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;gBAuBhD,EAAE,CAAC,EAAEL,KAAK,EAAE,GAAKA,KAAMG,CAAAA,MAAM,CAACM,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;WAuB9C,EAAE,CAAC,EAAET,KAAK,EAAE,GAAKA,KAAMG,CAAAA,MAAM,CAACE,UAAU,CAAC;;AAEpD,CAAC;;;;"}
|
|
@@ -95,7 +95,11 @@ const Editor = /*#__PURE__*/ React.forwardRef(({ disabled, editorRef, error, isP
|
|
|
95
95
|
});
|
|
96
96
|
const EditorAndPreviewWrapper = styled.div`
|
|
97
97
|
position: relative;
|
|
98
|
-
height: calc(100%
|
|
98
|
+
height: calc(100%);
|
|
99
|
+
|
|
100
|
+
${({ theme })=>theme.breakpoints.medium} {
|
|
101
|
+
height: calc(100% - 48px);
|
|
102
|
+
}
|
|
99
103
|
`;
|
|
100
104
|
const EditorStylesContainer = styled.div`
|
|
101
105
|
cursor: ${({ $disabled })=>$disabled ? 'not-allowed !important' : 'auto'};
|
|
@@ -258,6 +262,7 @@ const EditorStylesContainer = styled.div`
|
|
|
258
262
|
.CodeMirror {
|
|
259
263
|
position: relative;
|
|
260
264
|
overflow: hidden;
|
|
265
|
+
border-radius: ${({ theme })=>theme.borderRadius};
|
|
261
266
|
background: ${({ theme })=>`${theme.colors.neutral0}`};
|
|
262
267
|
}
|
|
263
268
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Editor.mjs","sources":["../../../../../../../admin/src/pages/EditView/components/FormInputs/Wysiwyg/Editor.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport CodeMirror, { EditorFromTextArea } from 'codemirror5';\nimport { styled } from 'styled-components';\n\nimport { PreviewWysiwyg } from './PreviewWysiwyg';\nimport { newlineAndIndentContinueMarkdownList } from './utils/continueList';\n\nimport type { FieldValue, InputProps } from '@strapi/admin/strapi-admin';\n\nimport 'codemirror5/addon/display/placeholder';\n\ninterface EditorApi {\n focus: () => void;\n scrollIntoView: (args?: Parameters<HTMLElement['scrollIntoView']>[0]) => void;\n}\n\ninterface EditorProps extends Omit<FieldValue, 'initialValue'>, Omit<InputProps, 'type' | 'label'> {\n editorRef: React.MutableRefObject<EditorFromTextArea>;\n isPreviewMode?: boolean;\n isExpandMode?: boolean;\n textareaRef: React.RefObject<HTMLTextAreaElement>;\n}\n\nconst Editor = React.forwardRef<EditorApi, EditorProps>(\n (\n {\n disabled,\n editorRef,\n error,\n isPreviewMode,\n isExpandMode,\n name,\n onChange,\n placeholder,\n textareaRef,\n value,\n },\n forwardedRef\n ) => {\n const onChangeRef = React.useRef(onChange);\n\n React.useEffect(() => {\n if (editorRef.current) {\n // Ensure the editor and its wrapper are cleaned up whenever this view is re-rendered\n // e.g. in case of re-ordering wysiwyg components in a DynamicZone\n editorRef.current.toTextArea();\n }\n editorRef.current = CodeMirror.fromTextArea(textareaRef.current!, {\n lineWrapping: true,\n extraKeys: {\n Enter: 'newlineAndIndentContinueMarkdownList',\n Tab: false,\n 'Shift-Tab': false,\n },\n readOnly: false,\n smartIndent: false,\n placeholder,\n spellcheck: true,\n inputStyle: 'contenteditable',\n });\n\n // @ts-expect-error – doesn't think command exists?\n CodeMirror.commands.newlineAndIndentContinueMarkdownList =\n newlineAndIndentContinueMarkdownList;\n editorRef.current.on('change', (doc) => {\n onChangeRef.current(name, doc.getValue());\n });\n }, [editorRef, textareaRef, name, placeholder]);\n\n React.useEffect(() => {\n if (value && !editorRef.current.hasFocus()) {\n editorRef.current.setValue(value);\n }\n }, [editorRef, value]);\n\n React.useEffect(() => {\n if (isPreviewMode || disabled) {\n editorRef.current.setOption('readOnly', 'nocursor');\n } else {\n editorRef.current.setOption('readOnly', false);\n }\n }, [disabled, isPreviewMode, editorRef]);\n\n React.useEffect(() => {\n if (error) {\n editorRef.current.setOption('screenReaderLabel', error);\n } else {\n // to replace with translation\n editorRef.current.setOption('screenReaderLabel', 'Editor');\n }\n }, [editorRef, error]);\n\n React.useImperativeHandle(\n forwardedRef,\n () => ({\n focus() {\n editorRef.current.getInputField().focus();\n },\n scrollIntoView(args?: Parameters<HTMLElement['scrollIntoView']>[0]) {\n editorRef.current.getInputField().scrollIntoView(args);\n },\n }),\n [editorRef]\n );\n\n return (\n <EditorAndPreviewWrapper>\n <EditorStylesContainer $isExpandMode={isExpandMode} $disabled={disabled || isPreviewMode}>\n <textarea ref={textareaRef} />\n </EditorStylesContainer>\n {isPreviewMode && <PreviewWysiwyg data={value} />}\n </EditorAndPreviewWrapper>\n );\n }\n);\n\nconst EditorAndPreviewWrapper = styled.div`\n position: relative;\n height: calc(100% - 48px);\n`;\n\nconst EditorStylesContainer = styled.div<{ $disabled?: boolean; $isExpandMode?: boolean }>`\n cursor: ${({ $disabled }) => ($disabled ? 'not-allowed !important' : 'auto')};\n height: 100%;\n /* BASICS */\n .CodeMirror-placeholder {\n color: ${({ theme }) => theme.colors.neutral600} !important;\n }\n\n .CodeMirror {\n /* Set height, width, borders, and global font properties here */\n font-size: 1.6rem;\n height: ${({ $isExpandMode }) =>\n $isExpandMode\n ? '100%'\n : '410px'}; // 512px(total height) - 48px (header) - 52px(footer) - 2px border\n color: ${({ theme }) => theme.colors.neutral800};\n direction: ltr;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,\n 'Open Sans', 'Helvetica Neue', sans-serif;\n\n ${({ theme }) => theme.breakpoints.medium} {\n font-size: 1.4rem;\n }\n }\n\n /* PADDING */\n\n .CodeMirror-lines {\n padding: ${({ theme }) => `${theme.spaces[3]} ${theme.spaces[4]}`};\n /* Vertical padding around content */\n }\n\n .CodeMirror-scrollbar-filler,\n .CodeMirror-gutter-filler {\n /* The little square between H and V scrollbars */\n background-color: ${({ theme }) => `${theme.colors.neutral0}`};\n }\n\n /* GUTTER */\n\n .CodeMirror-gutters {\n border-right: 1px solid #ddd;\n background-color: #f7f7f7;\n white-space: nowrap;\n }\n .CodeMirror-linenumbers {\n }\n .CodeMirror-linenumber {\n padding: 0 3px 0 5px;\n min-width: 20px;\n text-align: right;\n color: #999;\n white-space: nowrap;\n }\n\n .CodeMirror-guttermarker {\n color: black;\n }\n .CodeMirror-guttermarker-subtle {\n color: #999;\n }\n\n /* CURSOR */\n\n .CodeMirror-cursor {\n border-left: 1px solid black;\n border-right: none;\n width: 0;\n }\n /* Shown when moving in bi-directional text */\n .CodeMirror div.CodeMirror-secondarycursor {\n border-left: 1px solid silver;\n }\n .cm-fat-cursor .CodeMirror-cursor {\n width: auto;\n border: 0 !important;\n background: #7e7;\n }\n .cm-fat-cursor div.CodeMirror-cursors {\n /* z-index: 1; */\n }\n\n .cm-fat-cursor-mark {\n background-color: rgba(20, 255, 20, 0.5);\n -webkit-animation: blink 1.06s steps(1) infinite;\n -moz-animation: blink 1.06s steps(1) infinite;\n animation: blink 1.06s steps(1) infinite;\n }\n .cm-animate-fat-cursor {\n width: auto;\n border: 0;\n -webkit-animation: blink 1.06s steps(1) infinite;\n -moz-animation: blink 1.06s steps(1) infinite;\n animation: blink 1.06s steps(1) infinite;\n background-color: #7e7;\n }\n\n /* Can style cursor different in overwrite (non-insert) mode */\n .CodeMirror-overwrite .CodeMirror-cursor {\n }\n\n .cm-tab {\n display: inline-block;\n text-decoration: inherit;\n }\n\n .CodeMirror-rulers {\n position: absolute;\n left: 0;\n right: 0;\n top: -50px;\n bottom: 0;\n overflow: hidden;\n }\n .CodeMirror-ruler {\n border-left: 1px solid #ccc;\n top: 0;\n bottom: 0;\n position: absolute;\n }\n\n /* DEFAULT THEME */\n\n .cm-header,\n .cm-strong {\n font-weight: bold;\n }\n .cm-em {\n font-style: italic;\n }\n .cm-link {\n text-decoration: underline;\n }\n .cm-strikethrough {\n text-decoration: line-through;\n }\n\n .CodeMirror-composing {\n border-bottom: 2px solid;\n }\n\n /* Default styles for common addons */\n\n div.CodeMirror span.CodeMirror-matchingbracket {\n color: #0b0;\n }\n div.CodeMirror span.CodeMirror-nonmatchingbracket {\n color: #a22;\n }\n .CodeMirror-matchingtag {\n background: rgba(255, 150, 0, 0.3);\n }\n .CodeMirror-activeline-background {\n background: #e8f2ff;\n }\n\n /* STOP */\n\n /* The rest of this file contains styles related to the mechanics of\n the editor. You probably shouldn't touch them. */\n\n .CodeMirror {\n position: relative;\n overflow: hidden;\n background: ${({ theme }) => `${theme.colors.neutral0}`};\n }\n\n .CodeMirror-scroll {\n overflow: scroll !important; /* Things will break if this is overridden */\n /* 50px is the magic margin used to hide the element's real scrollbars */\n /* See overflow: hidden in .CodeMirror */\n margin-bottom: -50px;\n margin-right: -50px;\n padding-bottom: 50px;\n height: 100%;\n outline: none; /* Prevent dragging from highlighting the element */\n position: relative;\n }\n .CodeMirror-sizer {\n position: relative;\n border-right: 50px solid transparent;\n }\n\n /* The fake, visible scrollbars. Used to force redraw during scrolling\n before actual scrolling happens, thus preventing shaking and\n flickering artifacts. */\n .CodeMirror-vscrollbar,\n .CodeMirror-hscrollbar,\n .CodeMirror-scrollbar-filler,\n .CodeMirror-gutter-filler {\n position: absolute;\n z-index: 1;\n display: none;\n outline: none;\n }\n\n .CodeMirror-vscrollbar {\n right: 0;\n top: 0;\n overflow-x: hidden;\n overflow-y: scroll;\n }\n .CodeMirror-hscrollbar {\n bottom: 0;\n left: 0;\n overflow-y: hidden;\n overflow-x: scroll;\n }\n .CodeMirror-scrollbar-filler {\n right: 0;\n bottom: 0;\n }\n\n .CodeMirror-lines {\n cursor: text;\n min-height: 1px; /* prevents collapsing before first draw */\n }\n /* Reset some styles that the rest of the page might have set */\n .CodeMirror pre.CodeMirror-line,\n .CodeMirror pre.CodeMirror-line-like {\n -moz-border-radius: 0;\n -webkit-border-radius: 0;\n border-radius: 0;\n border-width: 0;\n background: transparent;\n font-family: inherit;\n font-size: inherit;\n margin: 0;\n white-space: pre;\n word-wrap: normal;\n line-height: 1.5;\n color: inherit;\n /* z-index: 2; */\n position: relative;\n overflow: visible;\n -webkit-tap-highlight-color: transparent;\n -webkit-font-variant-ligatures: contextual;\n font-variant-ligatures: contextual;\n }\n\n .CodeMirror pre.CodeMirror-line-like {\n z-index: 2;\n }\n\n .CodeMirror-wrap pre.CodeMirror-line,\n .CodeMirror-wrap pre.CodeMirror-line-like {\n word-wrap: break-word;\n white-space: pre-wrap;\n word-break: break-word;\n }\n\n .CodeMirror-linebackground {\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n z-index: 0;\n }\n\n .CodeMirror-linewidget {\n position: relative;\n /* z-index: 2; */\n padding: 0.1px; /* Force widget margins to stay inside of the container */\n }\n\n .CodeMirror-widget {\n }\n\n .CodeMirror-rtl pre {\n direction: rtl;\n }\n\n .CodeMirror-code {\n outline: none;\n }\n\n /* Force content-box sizing for the elements where we expect it */\n .CodeMirror-scroll,\n .CodeMirror-sizer,\n .CodeMirror-gutter,\n .CodeMirror-gutters,\n .CodeMirror-linenumber {\n -moz-box-sizing: content-box;\n box-sizing: content-box;\n }\n\n .CodeMirror-measure {\n position: absolute;\n width: 100%;\n height: 0;\n overflow: hidden;\n visibility: hidden;\n }\n\n .CodeMirror-cursor {\n position: absolute;\n pointer-events: none;\n border-color: ${({ theme }) => `${theme.colors.neutral800}`};\n }\n .CodeMirror-measure pre {\n position: static;\n }\n\n div.CodeMirror-cursors {\n visibility: hidden;\n position: relative;\n + div {\n z-index: 0 !important;\n }\n }\n\n div.CodeMirror-dragcursors {\n visibility: visible;\n }\n\n .CodeMirror-focused div.CodeMirror-cursors {\n visibility: visible;\n }\n\n .CodeMirror-selected {\n background: ${({ theme }) => theme.colors.neutral200};\n /* z-index: -10; */\n }\n .CodeMirror-crosshair {\n cursor: crosshair;\n }\n\n /* Used to force a border model for a node */\n .cm-force-border {\n padding-right: 0.1px;\n }\n\n /* See issue #2901 */\n .cm-tab-wrap-hack:after {\n content: '';\n }\n\n /* Help users use markselection to safely style text background */\n span.CodeMirror-selectedtext {\n background: none;\n }\n\n span {\n color: ${({ theme }) => theme.colors.neutral800} !important;\n }\n`;\n\nexport { Editor };\nexport type { EditorProps, EditorApi };\n"],"names":["Editor","React","forwardRef","disabled","editorRef","error","isPreviewMode","isExpandMode","name","onChange","placeholder","textareaRef","value","forwardedRef","onChangeRef","useRef","useEffect","current","toTextArea","CodeMirror","fromTextArea","lineWrapping","extraKeys","Enter","Tab","readOnly","smartIndent","spellcheck","inputStyle","commands","newlineAndIndentContinueMarkdownList","on","doc","getValue","hasFocus","setValue","setOption","useImperativeHandle","focus","getInputField","scrollIntoView","args","_jsxs","EditorAndPreviewWrapper","_jsx","EditorStylesContainer","$isExpandMode","$disabled","textarea","ref","PreviewWysiwyg","data","styled","div","theme","colors","neutral600","neutral800","breakpoints","medium","spaces","neutral0","neutral200"],"mappings":";;;;;;;;AAwBMA,MAAAA,MAAAA,iBAASC,KAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAiIlD,EAAE,CAAC,EAAEP,KAAK,EAAE,GAAK,CAAGA,EAAAA,KAAAA,CAAMC,MAAM,CAACM,QAAQ,CAAA,CAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAsI1C,EAAE,CAAC,EAAEP,KAAK,EAAE,GAAK,CAAGA,EAAAA,KAAAA,CAAMC,MAAM,CAACE,UAAU,CAAA,CAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;gBAuBhD,EAAE,CAAC,EAAEH,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAACO,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;WAuB9C,EAAE,CAAC,EAAER,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAACE,UAAU,CAAC;;AAEpD,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"Editor.mjs","sources":["../../../../../../../admin/src/pages/EditView/components/FormInputs/Wysiwyg/Editor.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport CodeMirror, { EditorFromTextArea } from 'codemirror5';\nimport { styled } from 'styled-components';\n\nimport { PreviewWysiwyg } from './PreviewWysiwyg';\nimport { newlineAndIndentContinueMarkdownList } from './utils/continueList';\n\nimport type { FieldValue, InputProps } from '@strapi/admin/strapi-admin';\n\nimport 'codemirror5/addon/display/placeholder';\n\ninterface EditorApi {\n focus: () => void;\n scrollIntoView: (args?: Parameters<HTMLElement['scrollIntoView']>[0]) => void;\n}\n\ninterface EditorProps extends Omit<FieldValue, 'initialValue'>, Omit<InputProps, 'type' | 'label'> {\n editorRef: React.MutableRefObject<EditorFromTextArea>;\n isPreviewMode?: boolean;\n isExpandMode?: boolean;\n textareaRef: React.RefObject<HTMLTextAreaElement>;\n}\n\nconst Editor = React.forwardRef<EditorApi, EditorProps>(\n (\n {\n disabled,\n editorRef,\n error,\n isPreviewMode,\n isExpandMode,\n name,\n onChange,\n placeholder,\n textareaRef,\n value,\n },\n forwardedRef\n ) => {\n const onChangeRef = React.useRef(onChange);\n\n React.useEffect(() => {\n if (editorRef.current) {\n // Ensure the editor and its wrapper are cleaned up whenever this view is re-rendered\n // e.g. in case of re-ordering wysiwyg components in a DynamicZone\n editorRef.current.toTextArea();\n }\n editorRef.current = CodeMirror.fromTextArea(textareaRef.current!, {\n lineWrapping: true,\n extraKeys: {\n Enter: 'newlineAndIndentContinueMarkdownList',\n Tab: false,\n 'Shift-Tab': false,\n },\n readOnly: false,\n smartIndent: false,\n placeholder,\n spellcheck: true,\n inputStyle: 'contenteditable',\n });\n\n // @ts-expect-error – doesn't think command exists?\n CodeMirror.commands.newlineAndIndentContinueMarkdownList =\n newlineAndIndentContinueMarkdownList;\n editorRef.current.on('change', (doc) => {\n onChangeRef.current(name, doc.getValue());\n });\n }, [editorRef, textareaRef, name, placeholder]);\n\n React.useEffect(() => {\n if (value && !editorRef.current.hasFocus()) {\n editorRef.current.setValue(value);\n }\n }, [editorRef, value]);\n\n React.useEffect(() => {\n if (isPreviewMode || disabled) {\n editorRef.current.setOption('readOnly', 'nocursor');\n } else {\n editorRef.current.setOption('readOnly', false);\n }\n }, [disabled, isPreviewMode, editorRef]);\n\n React.useEffect(() => {\n if (error) {\n editorRef.current.setOption('screenReaderLabel', error);\n } else {\n // to replace with translation\n editorRef.current.setOption('screenReaderLabel', 'Editor');\n }\n }, [editorRef, error]);\n\n React.useImperativeHandle(\n forwardedRef,\n () => ({\n focus() {\n editorRef.current.getInputField().focus();\n },\n scrollIntoView(args?: Parameters<HTMLElement['scrollIntoView']>[0]) {\n editorRef.current.getInputField().scrollIntoView(args);\n },\n }),\n [editorRef]\n );\n\n return (\n <EditorAndPreviewWrapper>\n <EditorStylesContainer $isExpandMode={isExpandMode} $disabled={disabled || isPreviewMode}>\n <textarea ref={textareaRef} />\n </EditorStylesContainer>\n {isPreviewMode && <PreviewWysiwyg data={value} />}\n </EditorAndPreviewWrapper>\n );\n }\n);\n\nconst EditorAndPreviewWrapper = styled.div`\n position: relative;\n height: calc(100%);\n\n ${({ theme }) => theme.breakpoints.medium} {\n height: calc(100% - 48px);\n }\n`;\n\nconst EditorStylesContainer = styled.div<{ $disabled?: boolean; $isExpandMode?: boolean }>`\n cursor: ${({ $disabled }) => ($disabled ? 'not-allowed !important' : 'auto')};\n height: 100%;\n /* BASICS */\n .CodeMirror-placeholder {\n color: ${({ theme }) => theme.colors.neutral600} !important;\n }\n\n .CodeMirror {\n /* Set height, width, borders, and global font properties here */\n font-size: 1.6rem;\n height: ${({ $isExpandMode }) =>\n $isExpandMode\n ? '100%'\n : '410px'}; // 512px(total height) - 48px (header) - 52px(footer) - 2px border\n color: ${({ theme }) => theme.colors.neutral800};\n direction: ltr;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,\n 'Open Sans', 'Helvetica Neue', sans-serif;\n\n ${({ theme }) => theme.breakpoints.medium} {\n font-size: 1.4rem;\n }\n }\n\n /* PADDING */\n\n .CodeMirror-lines {\n padding: ${({ theme }) => `${theme.spaces[3]} ${theme.spaces[4]}`};\n /* Vertical padding around content */\n }\n\n .CodeMirror-scrollbar-filler,\n .CodeMirror-gutter-filler {\n /* The little square between H and V scrollbars */\n background-color: ${({ theme }) => `${theme.colors.neutral0}`};\n }\n\n /* GUTTER */\n\n .CodeMirror-gutters {\n border-right: 1px solid #ddd;\n background-color: #f7f7f7;\n white-space: nowrap;\n }\n .CodeMirror-linenumbers {\n }\n .CodeMirror-linenumber {\n padding: 0 3px 0 5px;\n min-width: 20px;\n text-align: right;\n color: #999;\n white-space: nowrap;\n }\n\n .CodeMirror-guttermarker {\n color: black;\n }\n .CodeMirror-guttermarker-subtle {\n color: #999;\n }\n\n /* CURSOR */\n\n .CodeMirror-cursor {\n border-left: 1px solid black;\n border-right: none;\n width: 0;\n }\n /* Shown when moving in bi-directional text */\n .CodeMirror div.CodeMirror-secondarycursor {\n border-left: 1px solid silver;\n }\n .cm-fat-cursor .CodeMirror-cursor {\n width: auto;\n border: 0 !important;\n background: #7e7;\n }\n .cm-fat-cursor div.CodeMirror-cursors {\n /* z-index: 1; */\n }\n\n .cm-fat-cursor-mark {\n background-color: rgba(20, 255, 20, 0.5);\n -webkit-animation: blink 1.06s steps(1) infinite;\n -moz-animation: blink 1.06s steps(1) infinite;\n animation: blink 1.06s steps(1) infinite;\n }\n .cm-animate-fat-cursor {\n width: auto;\n border: 0;\n -webkit-animation: blink 1.06s steps(1) infinite;\n -moz-animation: blink 1.06s steps(1) infinite;\n animation: blink 1.06s steps(1) infinite;\n background-color: #7e7;\n }\n\n /* Can style cursor different in overwrite (non-insert) mode */\n .CodeMirror-overwrite .CodeMirror-cursor {\n }\n\n .cm-tab {\n display: inline-block;\n text-decoration: inherit;\n }\n\n .CodeMirror-rulers {\n position: absolute;\n left: 0;\n right: 0;\n top: -50px;\n bottom: 0;\n overflow: hidden;\n }\n .CodeMirror-ruler {\n border-left: 1px solid #ccc;\n top: 0;\n bottom: 0;\n position: absolute;\n }\n\n /* DEFAULT THEME */\n\n .cm-header,\n .cm-strong {\n font-weight: bold;\n }\n .cm-em {\n font-style: italic;\n }\n .cm-link {\n text-decoration: underline;\n }\n .cm-strikethrough {\n text-decoration: line-through;\n }\n\n .CodeMirror-composing {\n border-bottom: 2px solid;\n }\n\n /* Default styles for common addons */\n\n div.CodeMirror span.CodeMirror-matchingbracket {\n color: #0b0;\n }\n div.CodeMirror span.CodeMirror-nonmatchingbracket {\n color: #a22;\n }\n .CodeMirror-matchingtag {\n background: rgba(255, 150, 0, 0.3);\n }\n .CodeMirror-activeline-background {\n background: #e8f2ff;\n }\n\n /* STOP */\n\n /* The rest of this file contains styles related to the mechanics of\n the editor. You probably shouldn't touch them. */\n\n .CodeMirror {\n position: relative;\n overflow: hidden;\n border-radius: ${({ theme }) => theme.borderRadius};\n background: ${({ theme }) => `${theme.colors.neutral0}`};\n }\n\n .CodeMirror-scroll {\n overflow: scroll !important; /* Things will break if this is overridden */\n /* 50px is the magic margin used to hide the element's real scrollbars */\n /* See overflow: hidden in .CodeMirror */\n margin-bottom: -50px;\n margin-right: -50px;\n padding-bottom: 50px;\n height: 100%;\n outline: none; /* Prevent dragging from highlighting the element */\n position: relative;\n }\n .CodeMirror-sizer {\n position: relative;\n border-right: 50px solid transparent;\n }\n\n /* The fake, visible scrollbars. Used to force redraw during scrolling\n before actual scrolling happens, thus preventing shaking and\n flickering artifacts. */\n .CodeMirror-vscrollbar,\n .CodeMirror-hscrollbar,\n .CodeMirror-scrollbar-filler,\n .CodeMirror-gutter-filler {\n position: absolute;\n z-index: 1;\n display: none;\n outline: none;\n }\n\n .CodeMirror-vscrollbar {\n right: 0;\n top: 0;\n overflow-x: hidden;\n overflow-y: scroll;\n }\n .CodeMirror-hscrollbar {\n bottom: 0;\n left: 0;\n overflow-y: hidden;\n overflow-x: scroll;\n }\n .CodeMirror-scrollbar-filler {\n right: 0;\n bottom: 0;\n }\n\n .CodeMirror-lines {\n cursor: text;\n min-height: 1px; /* prevents collapsing before first draw */\n }\n /* Reset some styles that the rest of the page might have set */\n .CodeMirror pre.CodeMirror-line,\n .CodeMirror pre.CodeMirror-line-like {\n -moz-border-radius: 0;\n -webkit-border-radius: 0;\n border-radius: 0;\n border-width: 0;\n background: transparent;\n font-family: inherit;\n font-size: inherit;\n margin: 0;\n white-space: pre;\n word-wrap: normal;\n line-height: 1.5;\n color: inherit;\n /* z-index: 2; */\n position: relative;\n overflow: visible;\n -webkit-tap-highlight-color: transparent;\n -webkit-font-variant-ligatures: contextual;\n font-variant-ligatures: contextual;\n }\n\n .CodeMirror pre.CodeMirror-line-like {\n z-index: 2;\n }\n\n .CodeMirror-wrap pre.CodeMirror-line,\n .CodeMirror-wrap pre.CodeMirror-line-like {\n word-wrap: break-word;\n white-space: pre-wrap;\n word-break: break-word;\n }\n\n .CodeMirror-linebackground {\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n z-index: 0;\n }\n\n .CodeMirror-linewidget {\n position: relative;\n /* z-index: 2; */\n padding: 0.1px; /* Force widget margins to stay inside of the container */\n }\n\n .CodeMirror-widget {\n }\n\n .CodeMirror-rtl pre {\n direction: rtl;\n }\n\n .CodeMirror-code {\n outline: none;\n }\n\n /* Force content-box sizing for the elements where we expect it */\n .CodeMirror-scroll,\n .CodeMirror-sizer,\n .CodeMirror-gutter,\n .CodeMirror-gutters,\n .CodeMirror-linenumber {\n -moz-box-sizing: content-box;\n box-sizing: content-box;\n }\n\n .CodeMirror-measure {\n position: absolute;\n width: 100%;\n height: 0;\n overflow: hidden;\n visibility: hidden;\n }\n\n .CodeMirror-cursor {\n position: absolute;\n pointer-events: none;\n border-color: ${({ theme }) => `${theme.colors.neutral800}`};\n }\n .CodeMirror-measure pre {\n position: static;\n }\n\n div.CodeMirror-cursors {\n visibility: hidden;\n position: relative;\n + div {\n z-index: 0 !important;\n }\n }\n\n div.CodeMirror-dragcursors {\n visibility: visible;\n }\n\n .CodeMirror-focused div.CodeMirror-cursors {\n visibility: visible;\n }\n\n .CodeMirror-selected {\n background: ${({ theme }) => theme.colors.neutral200};\n /* z-index: -10; */\n }\n .CodeMirror-crosshair {\n cursor: crosshair;\n }\n\n /* Used to force a border model for a node */\n .cm-force-border {\n padding-right: 0.1px;\n }\n\n /* See issue #2901 */\n .cm-tab-wrap-hack:after {\n content: '';\n }\n\n /* Help users use markselection to safely style text background */\n span.CodeMirror-selectedtext {\n background: none;\n }\n\n span {\n color: ${({ theme }) => theme.colors.neutral800} !important;\n }\n`;\n\nexport { Editor };\nexport type { EditorProps, EditorApi };\n"],"names":["Editor","React","forwardRef","disabled","editorRef","error","isPreviewMode","isExpandMode","name","onChange","placeholder","textareaRef","value","forwardedRef","onChangeRef","useRef","useEffect","current","toTextArea","CodeMirror","fromTextArea","lineWrapping","extraKeys","Enter","Tab","readOnly","smartIndent","spellcheck","inputStyle","commands","newlineAndIndentContinueMarkdownList","on","doc","getValue","hasFocus","setValue","setOption","useImperativeHandle","focus","getInputField","scrollIntoView","args","_jsxs","EditorAndPreviewWrapper","_jsx","EditorStylesContainer","$isExpandMode","$disabled","textarea","ref","PreviewWysiwyg","data","styled","div","theme","breakpoints","medium","colors","neutral600","neutral800","spaces","neutral0","borderRadius","neutral200"],"mappings":";;;;;;;;AAwBMA,MAAAA,MAAAA,iBAASC,KAAMC,CAAAA,UAAU,CAC7B,CACE,EACEC,QAAQ,EACRC,SAAS,EACTC,KAAK,EACLC,aAAa,EACbC,YAAY,EACZC,IAAI,EACJC,QAAQ,EACRC,WAAW,EACXC,WAAW,EACXC,KAAK,EACN,EACDC,YAAAA,GAAAA;IAEA,MAAMC,WAAAA,GAAcb,KAAMc,CAAAA,MAAM,CAACN,QAAAA,CAAAA;AAEjCR,IAAAA,KAAAA,CAAMe,SAAS,CAAC,IAAA;QACd,IAAIZ,SAAAA,CAAUa,OAAO,EAAE;;;YAGrBb,SAAUa,CAAAA,OAAO,CAACC,UAAU,EAAA;AAC9B;AACAd,QAAAA,SAAAA,CAAUa,OAAO,GAAGE,UAAAA,CAAWC,YAAY,CAACT,WAAAA,CAAYM,OAAO,EAAG;YAChEI,YAAc,EAAA,IAAA;YACdC,SAAW,EAAA;gBACTC,KAAO,EAAA,sCAAA;gBACPC,GAAK,EAAA,KAAA;gBACL,WAAa,EAAA;AACf,aAAA;YACAC,QAAU,EAAA,KAAA;YACVC,WAAa,EAAA,KAAA;AACbhB,YAAAA,WAAAA;YACAiB,UAAY,EAAA,IAAA;YACZC,UAAY,EAAA;AACd,SAAA,CAAA;;QAGAT,UAAWU,CAAAA,QAAQ,CAACC,oCAAoC,GACtDA,oCAAAA;AACF1B,QAAAA,SAAAA,CAAUa,OAAO,CAACc,EAAE,CAAC,UA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AAC;;AAEpD,CAAC;;;;"}
|
|
@@ -74,6 +74,7 @@ const EditorLayout = ({ children, isExpandMode, error, previewContent = '', onCo
|
|
|
74
74
|
}
|
|
75
75
|
return /*#__PURE__*/ jsxRuntime.jsx(designSystem.Flex, {
|
|
76
76
|
borderColor: error ? 'danger600' : 'neutral200',
|
|
77
|
+
position: "relative",
|
|
77
78
|
borderStyle: "solid",
|
|
78
79
|
borderWidth: "1px",
|
|
79
80
|
hasRadius: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorLayout.js","sources":["../../../../../../../admin/src/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Button, Box, BoxComponent, Flex, Typography, Modal } from '@strapi/design-system';\nimport { Collapse } from '@strapi/icons';\nimport { useIntl } from 'react-intl';\nimport { styled } from 'styled-components';\n\nimport { PreviewWysiwyg } from './PreviewWysiwyg';\n\ninterface EditorLayoutProps {\n children: React.ReactNode;\n isExpandMode: boolean;\n error?: string;\n previewContent?: string;\n onCollapse: () => void;\n}\n\nconst EditorLayout = ({\n children,\n isExpandMode,\n error,\n previewContent = '',\n onCollapse,\n}: EditorLayoutProps) => {\n const { formatMessage } = useIntl();\n\n if (isExpandMode) {\n return (\n <Modal.Root open={isExpandMode} onOpenChange={onCollapse}>\n <Modal.Content style={{ maxWidth: 'unset', width: 'unset' }}>\n <Flex height=\"90dvh\" width=\"90dvw\" alignItems=\"flex-start\">\n <BoxWithBorder flex=\"1\" height=\"100%\">\n {children}\n </BoxWithBorder>\n <Flex alignItems=\"start\" direction=\"column\" flex={1} height=\"100%\" width=\"100%\">\n <Flex\n height=\"4.8rem\"\n background=\"neutral100\"\n justifyContent=\"flex-end\"\n shrink={0}\n width=\"100%\"\n >\n <ExpandButton onClick={onCollapse} variant=\"tertiary\" size=\"M\">\n <Typography>\n {formatMessage({\n id: 'components.Wysiwyg.collapse',\n defaultMessage: 'Collapse',\n })}\n </Typography>\n <Collapse />\n </ExpandButton>\n </Flex>\n <Box position=\"relative\" height=\"100%\" width=\"100%\">\n <PreviewWysiwyg data={previewContent} />\n </Box>\n </Flex>\n </Flex>\n </Modal.Content>\n </Modal.Root>\n );\n }\n\n return (\n <Flex\n borderColor={error ? 'danger600' : 'neutral200'}\n borderStyle=\"solid\"\n borderWidth=\"1px\"\n hasRadius\n direction=\"column\"\n alignItems=\"stretch\"\n >\n {children}\n </Flex>\n );\n};\n\nconst BoxWithBorder = styled<BoxComponent>(Box)`\n border-right: 1px solid ${({ theme }) => theme.colors.neutral200};\n`;\n\nconst ExpandButton = styled(Button)`\n background-color: transparent;\n border: none;\n align-items: center;\n\n & > span {\n display: flex;\n justify-content: space-between;\n align-items: center;\n width: 100%;\n font-weight: ${({ theme }) => theme.fontWeights.regular};\n }\n\n svg {\n margin-left: ${({ theme }) => `${theme.spaces[2]}`};\n\n path {\n fill: ${({ theme }) => theme.colors.neutral700};\n width: 1.2rem;\n height: 1.2rem;\n }\n }\n`;\n\nexport { EditorLayout, ExpandButton };\nexport type { EditorLayoutProps };\n"],"names":["EditorLayout","children","isExpandMode","error","previewContent","onCollapse","formatMessage","useIntl","_jsx","Modal","Root","open","onOpenChange","Content","style","maxWidth","width","_jsxs","Flex","height","alignItems","BoxWithBorder","flex","direction","background","justifyContent","shrink","ExpandButton","onClick","variant","size","Typography","id","defaultMessage","Collapse","Box","position","PreviewWysiwyg","data","borderColor","borderStyle","borderWidth","hasRadius","styled","theme","colors","neutral200","Button","fontWeights","regular","spaces","neutral700"],"mappings":";;;;;;;;;;AAiBA,MAAMA,YAAe,GAAA,CAAC,EACpBC,QAAQ,EACRC,YAAY,EACZC,KAAK,EACLC,cAAAA,GAAiB,EAAE,EACnBC,UAAU,EACQ,GAAA;IAClB,MAAM,EAAEC,aAAa,EAAE,GAAGC,iBAAAA,EAAAA;AAE1B,IAAA,IAAIL,YAAc,EAAA;QAChB,qBACEM,cAAA,CAACC,mBAAMC,IAAI,EAAA;YAAC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AAR,cAAC6B,CAAAA,6BAAAA,EAAAA;wCAAeC,IAAMlC,EAAAA;;;;;;;;;AAOpC;AAEA,IAAA,qBACEI,cAACU,CAAAA,iBAAAA,EAAAA;AACCqB,QAAAA,WAAAA,EAAapC,QAAQ,WAAc,GAAA,YAAA;
|
|
1
|
+
{"version":3,"file":"EditorLayout.js","sources":["../../../../../../../admin/src/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Button, Box, BoxComponent, Flex, Typography, Modal } from '@strapi/design-system';\nimport { Collapse } from '@strapi/icons';\nimport { useIntl } from 'react-intl';\nimport { styled } from 'styled-components';\n\nimport { PreviewWysiwyg } from './PreviewWysiwyg';\n\ninterface EditorLayoutProps {\n children: React.ReactNode;\n isExpandMode: boolean;\n error?: string;\n previewContent?: string;\n onCollapse: () => void;\n}\n\nconst EditorLayout = ({\n children,\n isExpandMode,\n error,\n previewContent = '',\n onCollapse,\n}: EditorLayoutProps) => {\n const { formatMessage } = useIntl();\n\n if (isExpandMode) {\n return (\n <Modal.Root open={isExpandMode} onOpenChange={onCollapse}>\n <Modal.Content style={{ maxWidth: 'unset', width: 'unset' }}>\n <Flex height=\"90dvh\" width=\"90dvw\" alignItems=\"flex-start\">\n <BoxWithBorder flex=\"1\" height=\"100%\">\n {children}\n </BoxWithBorder>\n <Flex alignItems=\"start\" direction=\"column\" flex={1} height=\"100%\" width=\"100%\">\n <Flex\n height=\"4.8rem\"\n background=\"neutral100\"\n justifyContent=\"flex-end\"\n shrink={0}\n width=\"100%\"\n >\n <ExpandButton onClick={onCollapse} variant=\"tertiary\" size=\"M\">\n <Typography>\n {formatMessage({\n id: 'components.Wysiwyg.collapse',\n defaultMessage: 'Collapse',\n })}\n </Typography>\n <Collapse />\n </ExpandButton>\n </Flex>\n <Box position=\"relative\" height=\"100%\" width=\"100%\">\n <PreviewWysiwyg data={previewContent} />\n </Box>\n </Flex>\n </Flex>\n </Modal.Content>\n </Modal.Root>\n );\n }\n\n return (\n <Flex\n borderColor={error ? 'danger600' : 'neutral200'}\n position=\"relative\"\n borderStyle=\"solid\"\n borderWidth=\"1px\"\n hasRadius\n direction=\"column\"\n alignItems=\"stretch\"\n >\n {children}\n </Flex>\n );\n};\n\nconst BoxWithBorder = styled<BoxComponent>(Box)`\n border-right: 1px solid ${({ theme }) => theme.colors.neutral200};\n`;\n\nconst ExpandButton = styled(Button)`\n background-color: transparent;\n border: none;\n align-items: center;\n\n & > span {\n display: flex;\n justify-content: space-between;\n align-items: center;\n width: 100%;\n font-weight: ${({ theme }) => theme.fontWeights.regular};\n }\n\n svg {\n margin-left: ${({ theme }) => `${theme.spaces[2]}`};\n\n path {\n fill: ${({ theme }) => theme.colors.neutral700};\n width: 1.2rem;\n height: 1.2rem;\n }\n }\n`;\n\nexport { EditorLayout, ExpandButton };\nexport type { EditorLayoutProps };\n"],"names":["EditorLayout","children","isExpandMode","error","previewContent","onCollapse","formatMessage","useIntl","_jsx","Modal","Root","open","onOpenChange","Content","style","maxWidth","width","_jsxs","Flex","height","alignItems","BoxWithBorder","flex","direction","background","justifyContent","shrink","ExpandButton","onClick","variant","size","Typography","id","defaultMessage","Collapse","Box","position","PreviewWysiwyg","data","borderColor","borderStyle","borderWidth","hasRadius","styled","theme","colors","neutral200","Button","fontWeights","regular","spaces","neutral700"],"mappings":";;;;;;;;;;AAiBA,MAAMA,YAAe,GAAA,CAAC,EACpBC,QAAQ,EACRC,YAAY,EACZC,KAAK,EACLC,cAAAA,GAAiB,EAAE,EACnBC,UAAU,EACQ,GAAA;IAClB,MAAM,EAAEC,aAAa,EAAE,GAAGC,iBAAAA,EAAAA;AAE1B,IAAA,IAAIL,YAAc,EAAA;QAChB,qBACEM,cAAA,CAACC,mBAAMC,IAAI,EAAA;YAACC,IAAMT,EAAAA,YAAAA;YAAcU,YAAcP,EAAAA,UAAAA;oCAC5CG,cAAA,CAACC,mBAAMI,OAAO,EAAA;gBAACC,KAAO,EAAA;oBAAEC,Q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;AACCqB,QAAAA,WAAAA,EAAapC,QAAQ,WAAc,GAAA,YAAA;QACnCiC,QAAS,EAAA,UAAA;QACTI,WAAY,EAAA,OAAA;QACZC,WAAY,EAAA,KAAA;QACZC,SAAS,EAAA,IAAA;QACTnB,SAAU,EAAA,QAAA;QACVH,UAAW,EAAA,SAAA;AAEVnB,QAAAA,QAAAA,EAAAA;;AAGP;AAEA,MAAMoB,aAAAA,GAAgBsB,uBAAqBR,CAAAA,gBAAAA,CAAI;0BACrB,EAAE,CAAC,EAAES,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAACC,UAAU,CAAC;AACnE,CAAC;AAEKnB,MAAAA,YAAAA,GAAegB,uBAAOI,CAAAA,mBAAAA,CAAO;;;;;;;;;;iBAUlB,EAAE,CAAC,EAAEH,KAAK,EAAE,GAAKA,KAAMI,CAAAA,WAAW,CAACC,OAAO,CAAC;;;;iBAI3C,EAAE,CAAC,EAAEL,KAAK,EAAE,GAAK,CAAGA,EAAAA,KAAAA,CAAMM,MAAM,CAAC,CAAE,CAAA,CAAA,CAAE,CAAC;;;YAG3C,EAAE,CAAC,EAAEN,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAACM,UAAU,CAAC;;;;;AAKrD;;;;;"}
|
|
@@ -72,6 +72,7 @@ const EditorLayout = ({ children, isExpandMode, error, previewContent = '', onCo
|
|
|
72
72
|
}
|
|
73
73
|
return /*#__PURE__*/ jsx(Flex, {
|
|
74
74
|
borderColor: error ? 'danger600' : 'neutral200',
|
|
75
|
+
position: "relative",
|
|
75
76
|
borderStyle: "solid",
|
|
76
77
|
borderWidth: "1px",
|
|
77
78
|
hasRadius: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorLayout.mjs","sources":["../../../../../../../admin/src/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Button, Box, BoxComponent, Flex, Typography, Modal } from '@strapi/design-system';\nimport { Collapse } from '@strapi/icons';\nimport { useIntl } from 'react-intl';\nimport { styled } from 'styled-components';\n\nimport { PreviewWysiwyg } from './PreviewWysiwyg';\n\ninterface EditorLayoutProps {\n children: React.ReactNode;\n isExpandMode: boolean;\n error?: string;\n previewContent?: string;\n onCollapse: () => void;\n}\n\nconst EditorLayout = ({\n children,\n isExpandMode,\n error,\n previewContent = '',\n onCollapse,\n}: EditorLayoutProps) => {\n const { formatMessage } = useIntl();\n\n if (isExpandMode) {\n return (\n <Modal.Root open={isExpandMode} onOpenChange={onCollapse}>\n <Modal.Content style={{ maxWidth: 'unset', width: 'unset' }}>\n <Flex height=\"90dvh\" width=\"90dvw\" alignItems=\"flex-start\">\n <BoxWithBorder flex=\"1\" height=\"100%\">\n {children}\n </BoxWithBorder>\n <Flex alignItems=\"start\" direction=\"column\" flex={1} height=\"100%\" width=\"100%\">\n <Flex\n height=\"4.8rem\"\n background=\"neutral100\"\n justifyContent=\"flex-end\"\n shrink={0}\n width=\"100%\"\n >\n <ExpandButton onClick={onCollapse} variant=\"tertiary\" size=\"M\">\n <Typography>\n {formatMessage({\n id: 'components.Wysiwyg.collapse',\n defaultMessage: 'Collapse',\n })}\n </Typography>\n <Collapse />\n </ExpandButton>\n </Flex>\n <Box position=\"relative\" height=\"100%\" width=\"100%\">\n <PreviewWysiwyg data={previewContent} />\n </Box>\n </Flex>\n </Flex>\n </Modal.Content>\n </Modal.Root>\n );\n }\n\n return (\n <Flex\n borderColor={error ? 'danger600' : 'neutral200'}\n borderStyle=\"solid\"\n borderWidth=\"1px\"\n hasRadius\n direction=\"column\"\n alignItems=\"stretch\"\n >\n {children}\n </Flex>\n );\n};\n\nconst BoxWithBorder = styled<BoxComponent>(Box)`\n border-right: 1px solid ${({ theme }) => theme.colors.neutral200};\n`;\n\nconst ExpandButton = styled(Button)`\n background-color: transparent;\n border: none;\n align-items: center;\n\n & > span {\n display: flex;\n justify-content: space-between;\n align-items: center;\n width: 100%;\n font-weight: ${({ theme }) => theme.fontWeights.regular};\n }\n\n svg {\n margin-left: ${({ theme }) => `${theme.spaces[2]}`};\n\n path {\n fill: ${({ theme }) => theme.colors.neutral700};\n width: 1.2rem;\n height: 1.2rem;\n }\n }\n`;\n\nexport { EditorLayout, ExpandButton };\nexport type { EditorLayoutProps };\n"],"names":["EditorLayout","children","isExpandMode","error","previewContent","onCollapse","formatMessage","useIntl","_jsx","Modal","Root","open","onOpenChange","Content","style","maxWidth","width","_jsxs","Flex","height","alignItems","BoxWithBorder","flex","direction","background","justifyContent","shrink","ExpandButton","onClick","variant","size","Typography","id","defaultMessage","Collapse","Box","position","PreviewWysiwyg","data","borderColor","borderStyle","borderWidth","hasRadius","styled","theme","colors","neutral200","Button","fontWeights","regular","spaces","neutral700"],"mappings":";;;;;;;;AAiBA,MAAMA,YAAe,GAAA,CAAC,EACpBC,QAAQ,EACRC,YAAY,EACZC,KAAK,EACLC,cAAAA,GAAiB,EAAE,EACnBC,UAAU,EACQ,GAAA;IAClB,MAAM,EAAEC,aAAa,EAAE,GAAGC,OAAAA,EAAAA;AAE1B,IAAA,IAAIL,YAAc,EAAA;QAChB,qBACEM,GAAA,CAACC,MAAMC,IAAI,EAAA;YAACC,IAAMT,EAAAA,YAAAA;YAAcU,YAAcP,EAAAA,UAAAA;oCAC5CG,GAAA,CAACC,MAAMI,OAAO,EAAA;gBAACC,KAAO,EAAA;oBAAEC,QAAU,EAAA,OAAA;oBAASC,KAAO,EAAA;AAAQ,iBAAA;AACxD,gBAAA,QAAA,gBAAAC,IAACC,CAAAA,IAAAA,EAAAA;oBAAKC,MAAO,EAAA,OAAA;oBAAQH,KAAM,EAAA,OAAA;oBAAQI,UAAW,EAAA,YAAA;;sCAC5CZ,GAACa,CAAAA,aAAAA,EAAAA;4BAAcC,IAAK,EAAA,GAAA;4BAAIH,MAAO,EAAA,MAAA;AAC5BlB,4BAAAA,QAAAA,EAAAA;;sCAEHgB,IAACC,CAAAA,IAAAA,EAAAA;4BAAKE,UAAW,EAAA,OAAA;4BAAQG,SAAU,EAAA,QAAA;4BAASD,IAAM,EAAA,CAAA;4BAAGH,MAAO,EAAA,MAAA;4BAAOH,KAAM,EAAA,MAAA;;8CACvER,GAACU,CAAAA,IAAAA,EAAAA;oCACCC,MAAO,EAAA,QAAA;oCACPK,UAAW,EAAA,YAAA;oCACXC,cAAe,EAAA,UAAA;oCACfC,MAAQ,EAAA,CAAA;oCACRV,KAAM,EAAA,MAAA;AAEN,oCAAA,QAAA,gBAAAC,IAACU,CAAAA,YAAAA,EAAAA;wCAAaC,OAASvB,EAAAA,UAAAA;wCAAYwB,OAAQ,EAAA,UAAA;wCAAWC,IAAK,EAAA,GAAA;;0DACzDtB,GAACuB,CAAAA,UAAAA,EAAAA;0DACEzB,aAAc,CAAA;oDACb0B,EAAI,EAAA,6BAAA;oDACJC,cAAgB,EAAA;AAClB,iDAAA;;0DAEFzB,GAAC0B,CAAAA,QAAAA,EAAAA,EAAAA;;;;8CAGL1B,GAAC2B,CAAAA,GAAAA,EAAAA;oCAAIC,QAAS,EAAA,UAAA;oCAAWjB,MAAO,EAAA,MAAA;oCAAOH,KAAM,EAAA,MAAA;AAC3C,oCAAA,QAAA,gBAAAR,GAAC6B,CAAAA,cAAAA,EAAAA;wCAAeC,IAAMlC,EAAAA;;;;;;;;;AAOpC;AAEA,IAAA,qBACEI,GAACU,CAAAA,IAAAA,EAAAA;AACCqB,QAAAA,WAAAA,EAAapC,QAAQ,WAAc,GAAA,YAAA;
|
|
1
|
+
{"version":3,"file":"EditorLayout.mjs","sources":["../../../../../../../admin/src/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Button, Box, BoxComponent, Flex, Typography, Modal } from '@strapi/design-system';\nimport { Collapse } from '@strapi/icons';\nimport { useIntl } from 'react-intl';\nimport { styled } from 'styled-components';\n\nimport { PreviewWysiwyg } from './PreviewWysiwyg';\n\ninterface EditorLayoutProps {\n children: React.ReactNode;\n isExpandMode: boolean;\n error?: string;\n previewContent?: string;\n onCollapse: () => void;\n}\n\nconst EditorLayout = ({\n children,\n isExpandMode,\n error,\n previewContent = '',\n onCollapse,\n}: EditorLayoutProps) => {\n const { formatMessage } = useIntl();\n\n if (isExpandMode) {\n return (\n <Modal.Root open={isExpandMode} onOpenChange={onCollapse}>\n <Modal.Content style={{ maxWidth: 'unset', width: 'unset' }}>\n <Flex height=\"90dvh\" width=\"90dvw\" alignItems=\"flex-start\">\n <BoxWithBorder flex=\"1\" height=\"100%\">\n {children}\n </BoxWithBorder>\n <Flex alignItems=\"start\" direction=\"column\" flex={1} height=\"100%\" width=\"100%\">\n <Flex\n height=\"4.8rem\"\n background=\"neutral100\"\n justifyContent=\"flex-end\"\n shrink={0}\n width=\"100%\"\n >\n <ExpandButton onClick={onCollapse} variant=\"tertiary\" size=\"M\">\n <Typography>\n {formatMessage({\n id: 'components.Wysiwyg.collapse',\n defaultMessage: 'Collapse',\n })}\n </Typography>\n <Collapse />\n </ExpandButton>\n </Flex>\n <Box position=\"relative\" height=\"100%\" width=\"100%\">\n <PreviewWysiwyg data={previewContent} />\n </Box>\n </Flex>\n </Flex>\n </Modal.Content>\n </Modal.Root>\n );\n }\n\n return (\n <Flex\n borderColor={error ? 'danger600' : 'neutral200'}\n position=\"relative\"\n borderStyle=\"solid\"\n borderWidth=\"1px\"\n hasRadius\n direction=\"column\"\n alignItems=\"stretch\"\n >\n {children}\n </Flex>\n );\n};\n\nconst BoxWithBorder = styled<BoxComponent>(Box)`\n border-right: 1px solid ${({ theme }) => theme.colors.neutral200};\n`;\n\nconst ExpandButton = styled(Button)`\n background-color: transparent;\n border: none;\n align-items: center;\n\n & > span {\n display: flex;\n justify-content: space-between;\n align-items: center;\n width: 100%;\n font-weight: ${({ theme }) => theme.fontWeights.regular};\n }\n\n svg {\n margin-left: ${({ theme }) => `${theme.spaces[2]}`};\n\n path {\n fill: ${({ theme }) => theme.colors.neutral700};\n width: 1.2rem;\n height: 1.2rem;\n }\n }\n`;\n\nexport { EditorLayout, ExpandButton };\nexport type { EditorLayoutProps };\n"],"names":["EditorLayout","children","isExpandMode","error","previewContent","onCollapse","formatMessage","useIntl","_jsx","Modal","Root","open","onOpenChange","Content","style","maxWidth","width","_jsxs","Flex","height","alignItems","BoxWithBorder","flex","direction","background","justifyContent","shrink","ExpandButton","onClick","variant","size","Typography","id","defaultMessage","Collapse","Box","position","PreviewWysiwyg","data","borderColor","borderStyle","borderWidth","hasRadius","styled","theme","colors","neutral200","Button","fontWeights","regular","spaces","neutral700"],"mappings":";;;;;;;;AAiBA,MAAMA,YAAe,GAAA,CAAC,EACpBC,QAAQ,EACRC,YAAY,EACZC,KAAK,EACLC,cAAAA,GAAiB,EAAE,EACnBC,UAAU,EACQ,GAAA;IAClB,MAAM,EAAEC,aAAa,EAAE,GAAGC,OAAAA,EAAAA;AAE1B,IAAA,IAAIL,YAAc,EAAA;QAChB,qBACEM,GAAA,CAACC,MAAMC,IAAI,EAAA;YAACC,IAAMT,EAAAA,YAAAA;YAAcU,YAAcP,EAAAA,UAAAA;oCAC5CG,GAAA,CAACC,MAAMI,OAAO,EAAA;gBAACC,KAAO,EAAA;oBAAEC,QAAU,EAAA,OAAA;oBAASC,KAAO,EAAA;AAAQ,iBAAA;AACxD,gBAAA,QAAA,gBAAAC,IAACC,CAAAA,IAAAA,EAAAA;oBAAKC,MAAO,EAAA,OAAA;oBAAQH,KAAM,EAAA,OAAA;oBAAQI,UAAW,EAAA,YAAA;;sCAC5CZ,GAACa,CAAAA,aAAAA,EAAAA;4BAAcC,IAAK,EAAA,GAAA;4BAAIH,MAAO,EAAA,MAAA;AAC5BlB,4BAAAA,QAAAA,EAAAA;;sCAEHgB,IAACC,CAAAA,IAAAA,EAAAA;4BAAKE,UAAW,EAAA,OAAA;4BAAQG,SAAU,EAAA,QAAA;4BAASD,IAAM,EAAA,CAAA;4BAAGH,MAAO,EAAA,MAAA;4BAAOH,KAAM,EAAA,MAAA;;8CACvER,GAACU,CAAAA,IAAAA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I,CAAAA,WAAW,CAACC,OAAO,CAAC;;;;iBAI3C,EAAE,CAAC,EAAEL,KAAK,EAAE,GAAK,CAAGA,EAAAA,KAAAA,CAAMM,MAAM,CAAC,CAAE,CAAA,CAAA,CAAE,CAAC;;;YAG3C,EAAE,CAAC,EAAEN,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAACM,UAAU,CAAC;;;;;AAKrD;;;;"}
|
|
@@ -37,6 +37,7 @@ const Wysiwyg = /*#__PURE__*/ React__namespace.forwardRef(({ hint, disabled, lab
|
|
|
37
37
|
const [isPreviewMode, setIsPreviewMode] = React__namespace.useState(false);
|
|
38
38
|
const [mediaLibVisible, setMediaLibVisible] = React__namespace.useState(false);
|
|
39
39
|
const [isExpandMode, setIsExpandMode] = React__namespace.useState(false);
|
|
40
|
+
const isMobile = strapiAdmin.useIsMobile();
|
|
40
41
|
const components = strapiAdmin.useStrapiApp('ImageDialog', (state)=>state.components);
|
|
41
42
|
const MediaLibraryDialog = components['media-library'];
|
|
42
43
|
const handleToggleMediaLib = ()=>setMediaLibVisible((prev)=>!prev);
|
|
@@ -96,8 +97,27 @@ const Wysiwyg = /*#__PURE__*/ React__namespace.forwardRef(({ hint, disabled, lab
|
|
|
96
97
|
value: field.value,
|
|
97
98
|
ref: forwardedRef
|
|
98
99
|
}),
|
|
99
|
-
!isExpandMode && /*#__PURE__*/ jsxRuntime.jsx(WysiwygFooter.WysiwygFooter, {
|
|
100
|
+
!isExpandMode && !isMobile && /*#__PURE__*/ jsxRuntime.jsx(WysiwygFooter.WysiwygFooter, {
|
|
100
101
|
onToggleExpand: handleToggleExpand
|
|
102
|
+
}),
|
|
103
|
+
isMobile && /*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {
|
|
104
|
+
position: "absolute",
|
|
105
|
+
bottom: 0,
|
|
106
|
+
right: 0,
|
|
107
|
+
left: 0,
|
|
108
|
+
pointerEvents: "none",
|
|
109
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Flex, {
|
|
110
|
+
justifyContent: "flex-end",
|
|
111
|
+
padding: 4,
|
|
112
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Box, {
|
|
113
|
+
pointerEvents: "auto",
|
|
114
|
+
display: "inline-flex",
|
|
115
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(WysiwygNav.WysiwygPreviewToggleButton, {
|
|
116
|
+
isPreviewMode: isPreviewMode,
|
|
117
|
+
onTogglePreviewMode: handleTogglePreviewMode
|
|
118
|
+
})
|
|
119
|
+
})
|
|
120
|
+
})
|
|
101
121
|
})
|
|
102
122
|
]
|
|
103
123
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Field.js","sources":["../../../../../../../admin/src/pages/EditView/components/FormInputs/Wysiwyg/Field.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { useField, useStrapiApp, type InputProps } from '@strapi/admin/strapi-admin';\nimport { Field, Flex } from '@strapi/design-system';\nimport { EditorFromTextArea } from 'codemirror5';\n\nimport { prefixFileUrlWithBackendUrl } from '../../../../../utils/urls';\n\nimport { Editor, EditorApi } from './Editor';\nimport { EditorLayout } from './EditorLayout';\nimport { insertFile } from './utils/utils';\nimport { WysiwygFooter } from './WysiwygFooter';\nimport { WysiwygNav } from './WysiwygNav';\n\nimport type { Schema } from '@strapi/types';\n\ninterface WysiwygProps extends Omit<InputProps, 'type'> {\n labelAction?: React.ReactNode;\n type: Schema.Attribute.RichText['type'];\n}\n\nconst Wysiwyg = React.forwardRef<EditorApi, WysiwygProps>(\n ({ hint, disabled, label, name, placeholder, required, labelAction }, forwardedRef) => {\n const field = useField(name);\n const textareaRef = React.useRef<HTMLTextAreaElement>(null);\n const editorRef = React.useRef<EditorFromTextArea>(\n null\n ) as React.MutableRefObject<EditorFromTextArea>;\n const [isPreviewMode, setIsPreviewMode] = React.useState(false);\n const [mediaLibVisible, setMediaLibVisible] = React.useState(false);\n const [isExpandMode, setIsExpandMode] = React.useState(false);\n const components = useStrapiApp('ImageDialog', (state) => state.components);\n\n const MediaLibraryDialog = components['media-library'];\n\n const handleToggleMediaLib = () => setMediaLibVisible((prev) => !prev);\n const handleTogglePreviewMode = () => setIsPreviewMode((prev) => !prev);\n const handleToggleExpand = () => {\n setIsPreviewMode(false);\n setIsExpandMode((prev) => !prev);\n };\n\n const handleSelectAssets = (files: any[]) => {\n const formattedFiles = files.map((f) => ({\n alt: f.alternativeText || f.name,\n url: prefixFileUrlWithBackendUrl(f.url),\n mime: f.mime,\n }));\n\n insertFile(editorRef, formattedFiles);\n setMediaLibVisible(false);\n };\n\n return (\n <Field.Root name={name} hint={hint} error={field.error} required={required}>\n <Flex direction=\"column\" alignItems=\"stretch\" gap={1}>\n <Field.Label action={labelAction}>{label}</Field.Label>\n <EditorLayout\n isExpandMode={isExpandMode}\n error={field.error}\n previewContent={field.value}\n onCollapse={handleToggleExpand}\n >\n <WysiwygNav\n isExpandMode={isExpandMode}\n editorRef={editorRef}\n isPreviewMode={isPreviewMode}\n onToggleMediaLib={handleToggleMediaLib}\n onTogglePreviewMode={isExpandMode ? undefined : handleTogglePreviewMode}\n disabled={disabled}\n />\n
|
|
1
|
+
{"version":3,"file":"Field.js","sources":["../../../../../../../admin/src/pages/EditView/components/FormInputs/Wysiwyg/Field.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { useField, useStrapiApp, useIsMobile, type InputProps } from '@strapi/admin/strapi-admin';\nimport { Box, Field, Flex } from '@strapi/design-system';\nimport { EditorFromTextArea } from 'codemirror5';\n\nimport { prefixFileUrlWithBackendUrl } from '../../../../../utils/urls';\n\nimport { Editor, EditorApi } from './Editor';\nimport { EditorLayout } from './EditorLayout';\nimport { insertFile } from './utils/utils';\nimport { WysiwygFooter } from './WysiwygFooter';\nimport { WysiwygNav, WysiwygPreviewToggleButton } from './WysiwygNav';\n\nimport type { Schema } from '@strapi/types';\n\ninterface WysiwygProps extends Omit<InputProps, 'type'> {\n labelAction?: React.ReactNode;\n type: Schema.Attribute.RichText['type'];\n}\n\nconst Wysiwyg = React.forwardRef<EditorApi, WysiwygProps>(\n ({ hint, disabled, label, name, placeholder, required, labelAction }, forwardedRef) => {\n const field = useField(name);\n const textareaRef = React.useRef<HTMLTextAreaElement>(null);\n const editorRef = React.useRef<EditorFromTextArea>(\n null\n ) as React.MutableRefObject<EditorFromTextArea>;\n const [isPreviewMode, setIsPreviewMode] = React.useState(false);\n const [mediaLibVisible, setMediaLibVisible] = React.useState(false);\n const [isExpandMode, setIsExpandMode] = React.useState(false);\n const isMobile = useIsMobile();\n const components = useStrapiApp('ImageDialog', (state) => state.components);\n\n const MediaLibraryDialog = components['media-library'];\n\n const handleToggleMediaLib = () => setMediaLibVisible((prev) => !prev);\n const handleTogglePreviewMode = () => setIsPreviewMode((prev) => !prev);\n const handleToggleExpand = () => {\n setIsPreviewMode(false);\n setIsExpandMode((prev) => !prev);\n };\n\n const handleSelectAssets = (files: any[]) => {\n const formattedFiles = files.map((f) => ({\n alt: f.alternativeText || f.name,\n url: prefixFileUrlWithBackendUrl(f.url),\n mime: f.mime,\n }));\n\n insertFile(editorRef, formattedFiles);\n setMediaLibVisible(false);\n };\n\n return (\n <Field.Root name={name} hint={hint} error={field.error} required={required}>\n <Flex direction=\"column\" alignItems=\"stretch\" gap={1}>\n <Field.Label action={labelAction}>{label}</Field.Label>\n <EditorLayout\n isExpandMode={isExpandMode}\n error={field.error}\n previewContent={field.value}\n onCollapse={handleToggleExpand}\n >\n <WysiwygNav\n isExpandMode={isExpandMode}\n editorRef={editorRef}\n isPreviewMode={isPreviewMode}\n onToggleMediaLib={handleToggleMediaLib}\n onTogglePreviewMode={isExpandMode ? undefined : handleTogglePreviewMode}\n disabled={disabled}\n />\n <Editor\n disabled={disabled}\n isExpandMode={isExpandMode}\n editorRef={editorRef}\n error={field.error}\n isPreviewMode={isPreviewMode}\n name={name}\n onChange={field.onChange}\n placeholder={placeholder}\n textareaRef={textareaRef}\n value={field.value}\n ref={forwardedRef}\n />\n {!isExpandMode && !isMobile && <WysiwygFooter onToggleExpand={handleToggleExpand} />}\n {isMobile && (\n <Box position=\"absolute\" bottom={0} right={0} left={0} pointerEvents=\"none\">\n <Flex justifyContent=\"flex-end\" padding={4}>\n <Box pointerEvents=\"auto\" display=\"inline-flex\">\n <WysiwygPreviewToggleButton\n isPreviewMode={isPreviewMode}\n onTogglePreviewMode={handleTogglePreviewMode}\n />\n </Box>\n </Flex>\n </Box>\n )}\n </EditorLayout>\n <Field.Hint />\n <Field.Error />\n </Flex>\n {mediaLibVisible && (\n // @ts-expect-error – TODO: fix this way of injecting because it's not really typeable without a registry.\n <MediaLibraryDialog onClose={handleToggleMediaLib} onSelectAssets={handleSelectAssets} />\n )}\n </Field.Root>\n );\n }\n);\n\nconst MemoizedWysiwyg = React.memo(Wysiwyg);\n\nexport { MemoizedWysiwyg as Wysiwyg };\nexport type { WysiwygProps };\n"],"names":["Wysiwyg","React","forwardRef","hint","disabled","label","name","placeholder","required","labelAction","forwardedRef","field","useField","textareaRef","useRef","editorRef","isPreviewMode","setIsPreviewMode","useState","mediaLibVisible","setMediaLibVisible","isExpandMode","setIsExpandMode","isMobile","useIsMobile","components","useStrapiApp","state","MediaLibraryDialog","handleToggleMediaLib","prev","handleTogglePreviewMode","handleToggleExpand","handleSelectAssets","files","formattedFiles","map","f","alt","alternativeText","url","prefixFileUrlWithBackendUrl","mime","insertFile","_jsxs","Field","Root","error","Flex","direction","alignItems","gap","_jsx","Label","action","EditorLayout","previewContent","value","onCollapse","WysiwygNav","onToggleMediaLib","onTogglePreviewMode","undefined","Editor","onChange","ref","WysiwygFooter","onToggleExpand","Box","position","bottom","right","left","pointerEvents","justifyContent","padding","display","WysiwygPreviewToggleButton","Hint","Error","onClose","onSelectAssets","MemoizedWysiwyg","memo"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,MAAMA,OAAAA,iBAAUC,iBAAMC,UAAU,CAC9B,CAAC,EAAEC,IAAI,EAAEC,QAAQ,EAAEC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I3E,CAAA,CAAA;AAGIiD,MAAAA,eAAAA,iBAAkBjF,gBAAMkF,CAAAA,IAAI,CAACnF,OAAAA;;;;"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { useField, useStrapiApp } from '@strapi/admin/strapi-admin';
|
|
4
|
-
import { Field, Flex } from '@strapi/design-system';
|
|
3
|
+
import { useField, useIsMobile, useStrapiApp } from '@strapi/admin/strapi-admin';
|
|
4
|
+
import { Field, Flex, Box } from '@strapi/design-system';
|
|
5
5
|
import { prefixFileUrlWithBackendUrl } from '../../../../../utils/urls.mjs';
|
|
6
6
|
import { Editor } from './Editor.mjs';
|
|
7
7
|
import { EditorLayout } from './EditorLayout.mjs';
|
|
8
8
|
import { insertFile } from './utils/utils.mjs';
|
|
9
9
|
import { WysiwygFooter } from './WysiwygFooter.mjs';
|
|
10
|
-
import { WysiwygNav } from './WysiwygNav.mjs';
|
|
10
|
+
import { WysiwygNav, WysiwygPreviewToggleButton } from './WysiwygNav.mjs';
|
|
11
11
|
|
|
12
12
|
const Wysiwyg = /*#__PURE__*/ React.forwardRef(({ hint, disabled, label, name, placeholder, required, labelAction }, forwardedRef)=>{
|
|
13
13
|
const field = useField(name);
|
|
@@ -16,6 +16,7 @@ const Wysiwyg = /*#__PURE__*/ React.forwardRef(({ hint, disabled, label, name, p
|
|
|
16
16
|
const [isPreviewMode, setIsPreviewMode] = React.useState(false);
|
|
17
17
|
const [mediaLibVisible, setMediaLibVisible] = React.useState(false);
|
|
18
18
|
const [isExpandMode, setIsExpandMode] = React.useState(false);
|
|
19
|
+
const isMobile = useIsMobile();
|
|
19
20
|
const components = useStrapiApp('ImageDialog', (state)=>state.components);
|
|
20
21
|
const MediaLibraryDialog = components['media-library'];
|
|
21
22
|
const handleToggleMediaLib = ()=>setMediaLibVisible((prev)=>!prev);
|
|
@@ -75,8 +76,27 @@ const Wysiwyg = /*#__PURE__*/ React.forwardRef(({ hint, disabled, label, name, p
|
|
|
75
76
|
value: field.value,
|
|
76
77
|
ref: forwardedRef
|
|
77
78
|
}),
|
|
78
|
-
!isExpandMode && /*#__PURE__*/ jsx(WysiwygFooter, {
|
|
79
|
+
!isExpandMode && !isMobile && /*#__PURE__*/ jsx(WysiwygFooter, {
|
|
79
80
|
onToggleExpand: handleToggleExpand
|
|
81
|
+
}),
|
|
82
|
+
isMobile && /*#__PURE__*/ jsx(Box, {
|
|
83
|
+
position: "absolute",
|
|
84
|
+
bottom: 0,
|
|
85
|
+
right: 0,
|
|
86
|
+
left: 0,
|
|
87
|
+
pointerEvents: "none",
|
|
88
|
+
children: /*#__PURE__*/ jsx(Flex, {
|
|
89
|
+
justifyContent: "flex-end",
|
|
90
|
+
padding: 4,
|
|
91
|
+
children: /*#__PURE__*/ jsx(Box, {
|
|
92
|
+
pointerEvents: "auto",
|
|
93
|
+
display: "inline-flex",
|
|
94
|
+
children: /*#__PURE__*/ jsx(WysiwygPreviewToggleButton, {
|
|
95
|
+
isPreviewMode: isPreviewMode,
|
|
96
|
+
onTogglePreviewMode: handleTogglePreviewMode
|
|
97
|
+
})
|
|
98
|
+
})
|
|
99
|
+
})
|
|
80
100
|
})
|
|
81
101
|
]
|
|
82
102
|
}),
|