@strapi/admin 4.13.0-beta.0 → 4.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/admin/src/components/NpsSurvey/hooks/useNpsSurveySettings.js +17 -0
- package/admin/src/components/NpsSurvey/index.js +365 -0
- package/admin/src/content-manager/components/DynamicZone/components/DynamicZoneLabel.js +1 -1
- package/admin/src/content-manager/components/EditViewDataManagerProvider/reducer.js +7 -9
- package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/cleanData.js +6 -0
- package/admin/src/content-manager/components/Filter/Filter.js +21 -23
- package/admin/src/content-manager/components/InputUID/index.js +222 -216
- package/admin/src/content-manager/components/RelationInput/RelationInput.js +4 -0
- package/admin/src/content-manager/components/RepeatableComponent/index.js +32 -2
- package/admin/src/content-manager/components/Wysiwyg/Editor.js +432 -68
- package/admin/src/content-manager/components/Wysiwyg/WysiwygNav.js +7 -30
- package/admin/src/content-manager/components/Wysiwyg/WysiwygStyles.js +0 -7
- package/admin/src/content-manager/components/Wysiwyg/index.js +147 -152
- package/admin/src/content-manager/constants/attributes.js +3 -0
- package/admin/src/content-manager/hooks/useAllowedAttributes.js +3 -7
- package/admin/src/content-manager/pages/CollectionTypeRecursivePath/index.js +1 -1
- package/admin/src/content-manager/pages/ListSettingsView/index.js +16 -41
- package/admin/src/content-manager/pages/ListView/components/ViewSettingsMenu/index.js +7 -1
- package/admin/src/content-manager/pages/ListView/index.js +14 -5
- package/admin/src/pages/Admin/index.js +3 -1
- package/admin/src/pages/AuthPage/components/Register/index.js +5 -0
- package/admin/src/pages/MarketplacePage/index.js +0 -1
- package/admin/src/pages/SettingsPage/components/SettingsNav/index.js +3 -3
- package/admin/src/pages/SettingsPage/index.js +16 -26
- package/admin/src/pages/SettingsPage/pages/ApiTokens/ListView/index.js +24 -31
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/index.js +69 -35
- package/admin/src/pages/SettingsPage/pages/TransferTokens/ListView/index.js +11 -6
- package/admin/src/pages/SettingsPage/pages/Users/EditPage/index.js +2 -0
- package/admin/src/pages/SettingsPage/pages/Users/ListPage/index.js +1 -0
- package/admin/src/plugins.js +7 -8
- package/admin/src/translations/en.json +7 -0
- package/build/{1049.f76cb14b.chunk.js → 1049.ec69f5e0.chunk.js} +1 -1
- package/build/1227.9f37e1dc.chunk.js +1 -0
- package/build/{1386.879bcd90.chunk.js → 1386.ea73b677.chunk.js} +1 -1
- package/build/1504.eff012f7.chunk.js +95 -0
- package/build/{2225.c6244756.chunk.js → 2225.649fb7bc.chunk.js} +11 -11
- package/build/2237.b832ae6e.chunk.js +114 -0
- package/build/2379.1f98a31a.chunk.js +1 -0
- package/build/2395.0e5e8ded.chunk.js +26 -0
- package/build/2801.8e1aa82a.chunk.js +1 -0
- package/build/{3483.03c24f96.chunk.js → 3483.19381b40.chunk.js} +1 -1
- package/build/{4174.fa8f9954.chunk.js → 4174.f1f39e40.chunk.js} +1 -1
- package/build/{4546.ff09eeda.chunk.js → 4546.a5946d22.chunk.js} +1 -1
- package/build/4724.aea5c8c1.chunk.js +6 -0
- package/build/502.7bba43b1.chunk.js +1 -0
- package/build/7464.eb057bec.chunk.js +1 -0
- package/build/8276.be3ed581.chunk.js +26 -0
- package/build/{Admin-authenticatedApp.53a24d28.chunk.js → Admin-authenticatedApp.baece4ac.chunk.js} +2 -2
- package/build/{Admin_InternalErrorPage.f45f2462.chunk.js → Admin_InternalErrorPage.38155af3.chunk.js} +1 -1
- package/build/{Admin_homePage.ac9dfb86.chunk.js → Admin_homePage.6f128523.chunk.js} +1 -1
- package/build/{Admin_marketplace.dde9c148.chunk.js → Admin_marketplace.061a6e5a.chunk.js} +2 -2
- package/build/{Admin_pluginsPage.bbe79434.chunk.js → Admin_pluginsPage.16f837b8.chunk.js} +1 -1
- package/build/{Admin_profilePage.192edc52.chunk.js → Admin_profilePage.678bce24.chunk.js} +2 -2
- package/build/Admin_settingsPage.af7309e4.chunk.js +111 -0
- package/build/{Upload_ConfigureTheView.345ac1e0.chunk.js → Upload_ConfigureTheView.3fc1c100.chunk.js} +1 -1
- package/build/admin-app.d63bd229.chunk.js +36 -0
- package/build/{admin-edit-roles-page.6d567273.chunk.js → admin-edit-roles-page.38a6c863.chunk.js} +3 -3
- package/build/admin-edit-users.545fc882.chunk.js +10 -0
- package/build/{admin-roles-list.23ddff26.chunk.js → admin-roles-list.1e2e814d.chunk.js} +1 -1
- package/build/{admin-users.123aa08e.chunk.js → admin-users.b8ea5677.chunk.js} +2 -2
- package/build/{api-tokens-create-page.46c2ea84.chunk.js → api-tokens-create-page.e0c15627.chunk.js} +1 -1
- package/build/{api-tokens-edit-page.58139df9.chunk.js → api-tokens-edit-page.9f2dce47.chunk.js} +1 -1
- package/build/api-tokens-list-page.d747051c.chunk.js +16 -0
- package/build/{audit-logs-settings-page.0f73ccf8.chunk.js → audit-logs-settings-page.96f9d608.chunk.js} +1 -1
- package/build/content-manager.2d676432.chunk.js +1097 -0
- package/build/{content-type-builder-list-view.bf9be456.chunk.js → content-type-builder-list-view.b71cf240.chunk.js} +1 -1
- package/build/{content-type-builder.cd999f6e.chunk.js → content-type-builder.e5669749.chunk.js} +2 -2
- package/build/email-settings-page.2809f0bf.chunk.js +11 -0
- package/build/en-json.e12fd5fc.chunk.js +1 -0
- package/build/{i18n-settings-page.47f78016.chunk.js → i18n-settings-page.5f716172.chunk.js} +1 -1
- package/build/index.html +1 -1
- package/build/main.c6c9e04c.js +2859 -0
- package/build/review-workflows-settings-create-view.4a156a19.chunk.js +1 -0
- package/build/review-workflows-settings-edit-view.ce984d1f.chunk.js +1 -0
- package/build/review-workflows-settings-list-view.419b8deb.chunk.js +56 -0
- package/build/{runtime~main.b16af570.js → runtime~main.a883e1c1.js} +2 -2
- package/build/{sso-settings-page.12b6d8ae.chunk.js → sso-settings-page.45153df5.chunk.js} +1 -1
- package/build/{transfer-tokens-create-page.1597e6ab.chunk.js → transfer-tokens-create-page.ebba16d8.chunk.js} +1 -1
- package/build/{transfer-tokens-edit-page.8741529f.chunk.js → transfer-tokens-edit-page.d7bb2b3e.chunk.js} +1 -1
- package/build/transfer-tokens-list-page.cfe1736c.chunk.js +16 -0
- package/build/{upload-settings.7f93d4c0.chunk.js → upload-settings.cc5ad813.chunk.js} +1 -1
- package/build/{upload.37488080.chunk.js → upload.756efc28.chunk.js} +1 -1
- package/build/users-advanced-settings-page.818d84eb.chunk.js +9 -0
- package/build/users-email-settings-page.c1967c09.chunk.js +9 -0
- package/build/users-providers-settings-page.11893e08.chunk.js +14 -0
- package/build/users-roles-settings-page.2b051e6a.chunk.js +55 -0
- package/build/{webhook-edit-page.6cb479ff.chunk.js → webhook-edit-page.de45c635.chunk.js} +2 -2
- package/build/{webhook-list-page.65e1b5bb.chunk.js → webhook-list-page.ca91df8b.chunk.js} +1 -1
- package/ee/admin/content-manager/pages/EditView/InformationBox/components/AssigneeSelect/AssigneeSelect.js +69 -71
- package/ee/admin/content-manager/pages/EditView/InformationBox/components/StageSelect/StageSelect.js +3 -1
- package/ee/admin/content-manager/pages/ListView/ReviewWorkflowsColumn/ReviewWorkflowsAssigneeEE.js +8 -38
- package/ee/admin/hooks/useAuthProviders.js +25 -0
- package/ee/admin/hooks/{useLicenseLimitNotification/index.js → useLicenseLimitNotification.js} +2 -4
- package/ee/admin/hooks/{useLicenseLimits/useLicenseLimits.js → useLicenseLimits.js} +4 -1
- package/ee/admin/pages/AuthPage/components/Login/index.js +8 -4
- package/ee/admin/pages/AuthPage/components/Providers/index.js +8 -5
- package/ee/admin/pages/HomePage/index.js +1 -1
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/CreateView/CreateView.js +1 -1
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/EditView/EditView.js +1 -1
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/pages/ListView/ListView.js +1 -1
- package/ee/admin/pages/SettingsPage/pages/Users/ListPage/CreateAction/index.js +1 -1
- package/ee/admin/pages/SettingsPage/pages/Users/ListPage/index.js +1 -1
- package/index.js +2 -6
- package/package.json +9 -9
- package/scripts/build.js +15 -15
- package/scripts/create-dev-plugins-file.js +5 -38
- package/server/controllers/role.js +2 -0
- package/server/controllers/user.js +2 -0
- package/server/services/permission/permissions-manager/index.js +3 -1
- package/server/services/permission/permissions-manager/sanitize.js +7 -7
- package/server/services/permission/permissions-manager/validate.js +218 -0
- package/utils/create-cache-dir.js +62 -16
- package/utils/create-plugins-exclude-path.js +3 -23
- package/utils/get-plugins.js +110 -0
- package/utils/index.js +1 -1
- package/webpack.config.js +10 -13
- package/admin/src/content-manager/components/Wysiwyg/EditorStylesContainer.js +0 -344
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/api.js +0 -23
- package/admin/src/pages/SettingsPage/pages/ApplicationInfosPage/utils/prefixAllUrls.js +0 -17
- package/admin/src/pages/SettingsPage/utils/createSectionsRoutes.js +0 -11
- package/admin/src/pages/SettingsPage/utils/getSectionsToDisplay.js +0 -5
- package/admin/src/pages/SettingsPage/utils/index.js +0 -2
- package/build/1227.32fe57ce.chunk.js +0 -1
- package/build/2379.f1641312.chunk.js +0 -1
- package/build/2395.46f8d0c1.chunk.js +0 -26
- package/build/2801.5cef5ec8.chunk.js +0 -1
- package/build/3929.5632f24d.chunk.js +0 -114
- package/build/4724.baf7c5b1.chunk.js +0 -6
- package/build/502.8ae8ef60.chunk.js +0 -1
- package/build/5542.2415a393.chunk.js +0 -63
- package/build/7464.3e64a1d5.chunk.js +0 -1
- package/build/8276.10a3f883.chunk.js +0 -26
- package/build/Admin_settingsPage.97cb9d41.chunk.js +0 -111
- package/build/admin-app.91898385.chunk.js +0 -36
- package/build/admin-edit-users.79eeb125.chunk.js +0 -10
- package/build/api-tokens-list-page.505bf7e0.chunk.js +0 -16
- package/build/content-manager.7f96a2f1.chunk.js +0 -1097
- package/build/email-settings-page.d494d1eb.chunk.js +0 -11
- package/build/en-json.4f06fe03.chunk.js +0 -1
- package/build/main.40b94779.js +0 -2859
- package/build/review-workflows-settings-create-view.cb08cfa2.chunk.js +0 -1
- package/build/review-workflows-settings-edit-view.3c7cbe63.chunk.js +0 -1
- package/build/review-workflows-settings-list-view.1611dc1f.chunk.js +0 -56
- package/build/transfer-tokens-list-page.22147d2c.chunk.js +0 -16
- package/build/users-advanced-settings-page.f0760eb8.chunk.js +0 -9
- package/build/users-email-settings-page.ff4b32f3.chunk.js +0 -9
- package/build/users-providers-settings-page.48de0306.chunk.js +0 -14
- package/build/users-roles-settings-page.9d9a1eff.chunk.js +0 -30
- package/ee/admin/hooks/index.js +0 -4
- package/ee/admin/hooks/useAuthProviders/index.js +0 -50
- package/ee/admin/hooks/useAuthProviders/reducer.js +0 -26
- package/ee/admin/hooks/useLicenseLimits/index.js +0 -1
- package/scripts/create-plugins-file.js +0 -92
- package/utils/get-plugins-path.js +0 -41
- /package/ee/admin/hooks/{useLicenseLimits/__mocks__/index.js → __mocks__/useLicenseLimits.js} +0 -0
- /package/server/services/permission/permissions-manager/{query-builers.js → query-builders.js} +0 -0
|
@@ -1,83 +1,101 @@
|
|
|
1
|
-
import React, { useEffect, useRef } from 'react';
|
|
1
|
+
import React, { forwardRef, useEffect, useImperativeHandle, useRef } from 'react';
|
|
2
2
|
|
|
3
3
|
import CodeMirror from 'codemirror5';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
|
+
import styled from 'styled-components';
|
|
5
6
|
|
|
6
7
|
import PreviewWysiwyg from '../PreviewWysiwyg';
|
|
7
8
|
|
|
8
|
-
import { EditorStylesContainer } from './EditorStylesContainer';
|
|
9
9
|
import newlineAndIndentContinueMarkdownList from './utils/continueList';
|
|
10
|
-
import { EditorAndPreviewWrapper } from './WysiwygStyles';
|
|
11
10
|
|
|
12
11
|
import 'codemirror5/addon/display/placeholder';
|
|
13
12
|
|
|
14
|
-
const Editor = (
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
value,
|
|
25
|
-
}) => {
|
|
26
|
-
const onChangeRef = useRef(onChange);
|
|
27
|
-
|
|
28
|
-
useEffect(() => {
|
|
29
|
-
editorRef.current = CodeMirror.fromTextArea(textareaRef.current, {
|
|
30
|
-
lineWrapping: true,
|
|
31
|
-
extraKeys: {
|
|
32
|
-
Enter: 'newlineAndIndentContinueMarkdownList',
|
|
33
|
-
Tab: false,
|
|
34
|
-
'Shift-Tab': false,
|
|
35
|
-
},
|
|
36
|
-
readOnly: false,
|
|
37
|
-
smartIndent: false,
|
|
13
|
+
const Editor = forwardRef(
|
|
14
|
+
(
|
|
15
|
+
{
|
|
16
|
+
disabled,
|
|
17
|
+
editorRef,
|
|
18
|
+
error,
|
|
19
|
+
isPreviewMode,
|
|
20
|
+
isExpandMode,
|
|
21
|
+
name,
|
|
22
|
+
onChange,
|
|
38
23
|
placeholder,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
onChangeRef.current({ target: { name, value: doc.getValue(), type: 'wysiwyg' } });
|
|
46
|
-
});
|
|
47
|
-
}, [editorRef, textareaRef, name, placeholder]);
|
|
48
|
-
|
|
49
|
-
useEffect(() => {
|
|
50
|
-
if (value && !editorRef.current.hasFocus()) {
|
|
51
|
-
editorRef.current.setValue(value);
|
|
52
|
-
}
|
|
53
|
-
}, [editorRef, value]);
|
|
24
|
+
textareaRef,
|
|
25
|
+
value,
|
|
26
|
+
},
|
|
27
|
+
forwardedRef
|
|
28
|
+
) => {
|
|
29
|
+
const onChangeRef = useRef(onChange);
|
|
54
30
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
editorRef.current = CodeMirror.fromTextArea(textareaRef.current, {
|
|
33
|
+
lineWrapping: true,
|
|
34
|
+
extraKeys: {
|
|
35
|
+
Enter: 'newlineAndIndentContinueMarkdownList',
|
|
36
|
+
Tab: false,
|
|
37
|
+
'Shift-Tab': false,
|
|
38
|
+
},
|
|
39
|
+
readOnly: false,
|
|
40
|
+
smartIndent: false,
|
|
41
|
+
placeholder,
|
|
42
|
+
spellcheck: true,
|
|
43
|
+
inputStyle: 'contenteditable',
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
CodeMirror.commands.newlineAndIndentContinueMarkdownList =
|
|
47
|
+
newlineAndIndentContinueMarkdownList;
|
|
48
|
+
editorRef.current.on('change', (doc) => {
|
|
49
|
+
onChangeRef.current({ target: { name, value: doc.getValue(), type: 'wysiwyg' } });
|
|
50
|
+
});
|
|
51
|
+
}, [editorRef, textareaRef, name, placeholder]);
|
|
52
|
+
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
if (value && !editorRef.current.hasFocus()) {
|
|
55
|
+
editorRef.current.setValue(value);
|
|
56
|
+
}
|
|
57
|
+
}, [editorRef, value]);
|
|
58
|
+
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
if (isPreviewMode || disabled) {
|
|
61
|
+
editorRef.current.setOption('readOnly', 'nocursor');
|
|
62
|
+
} else {
|
|
63
|
+
editorRef.current.setOption('readOnly', false);
|
|
64
|
+
}
|
|
65
|
+
}, [disabled, isPreviewMode, editorRef]);
|
|
66
|
+
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
if (error) {
|
|
69
|
+
editorRef.current.setOption('screenReaderLabel', error);
|
|
70
|
+
} else {
|
|
71
|
+
// to replace with translation
|
|
72
|
+
editorRef.current.setOption('screenReaderLabel', 'Editor');
|
|
73
|
+
}
|
|
74
|
+
}, [editorRef, error]);
|
|
75
|
+
|
|
76
|
+
useImperativeHandle(
|
|
77
|
+
forwardedRef,
|
|
78
|
+
() => ({
|
|
79
|
+
focus() {
|
|
80
|
+
editorRef.current.getInputField().focus();
|
|
81
|
+
},
|
|
82
|
+
scrollIntoView(args) {
|
|
83
|
+
editorRef.current.getInputField().scrollIntoView(args);
|
|
84
|
+
},
|
|
85
|
+
}),
|
|
86
|
+
[editorRef]
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
return (
|
|
90
|
+
<EditorAndPreviewWrapper>
|
|
91
|
+
<EditorStylesContainer isExpandMode={isExpandMode} disabled={disabled || isPreviewMode}>
|
|
92
|
+
<textarea ref={textareaRef} />
|
|
93
|
+
</EditorStylesContainer>
|
|
94
|
+
{isPreviewMode && <PreviewWysiwyg data={value} />}
|
|
95
|
+
</EditorAndPreviewWrapper>
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
);
|
|
81
99
|
|
|
82
100
|
Editor.defaultProps = {
|
|
83
101
|
disabled: false,
|
|
@@ -101,4 +119,350 @@ Editor.propTypes = {
|
|
|
101
119
|
value: PropTypes.string,
|
|
102
120
|
};
|
|
103
121
|
|
|
122
|
+
const EditorAndPreviewWrapper = styled.div`
|
|
123
|
+
position: relative;
|
|
124
|
+
height: calc(100% - 48px);
|
|
125
|
+
`;
|
|
126
|
+
|
|
127
|
+
const EditorStylesContainer = styled.div`
|
|
128
|
+
cursor: ${({ disabled }) => (disabled ? 'not-allowed !important' : 'auto')};
|
|
129
|
+
height: 100%;
|
|
130
|
+
/* BASICS */
|
|
131
|
+
.CodeMirror-placeholder {
|
|
132
|
+
color: ${({ theme }) => theme.colors.neutral600} !important;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.CodeMirror {
|
|
136
|
+
/* Set height, width, borders, and global font properties here */
|
|
137
|
+
font-size: ${14 / 16}rem;
|
|
138
|
+
height: ${({ isExpandMode }) => (isExpandMode ? '100%' : '290px')};
|
|
139
|
+
color: ${({ theme }) => theme.colors.neutral800};
|
|
140
|
+
direction: ltr;
|
|
141
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,
|
|
142
|
+
'Open Sans', 'Helvetica Neue', sans-serif;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/* PADDING */
|
|
146
|
+
|
|
147
|
+
.CodeMirror-lines {
|
|
148
|
+
padding: ${({ theme }) => `${theme.spaces[3]} ${theme.spaces[4]}`};
|
|
149
|
+
/* Vertical padding around content */
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.CodeMirror-scrollbar-filler,
|
|
153
|
+
.CodeMirror-gutter-filler {
|
|
154
|
+
/* The little square between H and V scrollbars */
|
|
155
|
+
background-color: ${({ theme }) => `${theme.colors.neutral0}`};
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/* GUTTER */
|
|
159
|
+
|
|
160
|
+
.CodeMirror-gutters {
|
|
161
|
+
border-right: 1px solid #ddd;
|
|
162
|
+
background-color: #f7f7f7;
|
|
163
|
+
white-space: nowrap;
|
|
164
|
+
}
|
|
165
|
+
.CodeMirror-linenumbers {
|
|
166
|
+
}
|
|
167
|
+
.CodeMirror-linenumber {
|
|
168
|
+
padding: 0 3px 0 5px;
|
|
169
|
+
min-width: 20px;
|
|
170
|
+
text-align: right;
|
|
171
|
+
color: #999;
|
|
172
|
+
white-space: nowrap;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.CodeMirror-guttermarker {
|
|
176
|
+
color: black;
|
|
177
|
+
}
|
|
178
|
+
.CodeMirror-guttermarker-subtle {
|
|
179
|
+
color: #999;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/* CURSOR */
|
|
183
|
+
|
|
184
|
+
.CodeMirror-cursor {
|
|
185
|
+
border-left: 1px solid black;
|
|
186
|
+
border-right: none;
|
|
187
|
+
width: 0;
|
|
188
|
+
}
|
|
189
|
+
/* Shown when moving in bi-directional text */
|
|
190
|
+
.CodeMirror div.CodeMirror-secondarycursor {
|
|
191
|
+
border-left: 1px solid silver;
|
|
192
|
+
}
|
|
193
|
+
.cm-fat-cursor .CodeMirror-cursor {
|
|
194
|
+
width: auto;
|
|
195
|
+
border: 0 !important;
|
|
196
|
+
background: #7e7;
|
|
197
|
+
}
|
|
198
|
+
.cm-fat-cursor div.CodeMirror-cursors {
|
|
199
|
+
/* z-index: 1; */
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.cm-fat-cursor-mark {
|
|
203
|
+
background-color: rgba(20, 255, 20, 0.5);
|
|
204
|
+
-webkit-animation: blink 1.06s steps(1) infinite;
|
|
205
|
+
-moz-animation: blink 1.06s steps(1) infinite;
|
|
206
|
+
animation: blink 1.06s steps(1) infinite;
|
|
207
|
+
}
|
|
208
|
+
.cm-animate-fat-cursor {
|
|
209
|
+
width: auto;
|
|
210
|
+
border: 0;
|
|
211
|
+
-webkit-animation: blink 1.06s steps(1) infinite;
|
|
212
|
+
-moz-animation: blink 1.06s steps(1) infinite;
|
|
213
|
+
animation: blink 1.06s steps(1) infinite;
|
|
214
|
+
background-color: #7e7;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/* Can style cursor different in overwrite (non-insert) mode */
|
|
218
|
+
.CodeMirror-overwrite .CodeMirror-cursor {
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.cm-tab {
|
|
222
|
+
display: inline-block;
|
|
223
|
+
text-decoration: inherit;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.CodeMirror-rulers {
|
|
227
|
+
position: absolute;
|
|
228
|
+
left: 0;
|
|
229
|
+
right: 0;
|
|
230
|
+
top: -50px;
|
|
231
|
+
bottom: 0;
|
|
232
|
+
overflow: hidden;
|
|
233
|
+
}
|
|
234
|
+
.CodeMirror-ruler {
|
|
235
|
+
border-left: 1px solid #ccc;
|
|
236
|
+
top: 0;
|
|
237
|
+
bottom: 0;
|
|
238
|
+
position: absolute;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/* DEFAULT THEME */
|
|
242
|
+
|
|
243
|
+
.cm-header,
|
|
244
|
+
.cm-strong {
|
|
245
|
+
font-weight: bold;
|
|
246
|
+
}
|
|
247
|
+
.cm-em {
|
|
248
|
+
font-style: italic;
|
|
249
|
+
}
|
|
250
|
+
.cm-link {
|
|
251
|
+
text-decoration: underline;
|
|
252
|
+
}
|
|
253
|
+
.cm-strikethrough {
|
|
254
|
+
text-decoration: line-through;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
.CodeMirror-composing {
|
|
258
|
+
border-bottom: 2px solid;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/* Default styles for common addons */
|
|
262
|
+
|
|
263
|
+
div.CodeMirror span.CodeMirror-matchingbracket {
|
|
264
|
+
color: #0b0;
|
|
265
|
+
}
|
|
266
|
+
div.CodeMirror span.CodeMirror-nonmatchingbracket {
|
|
267
|
+
color: #a22;
|
|
268
|
+
}
|
|
269
|
+
.CodeMirror-matchingtag {
|
|
270
|
+
background: rgba(255, 150, 0, 0.3);
|
|
271
|
+
}
|
|
272
|
+
.CodeMirror-activeline-background {
|
|
273
|
+
background: #e8f2ff;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/* STOP */
|
|
277
|
+
|
|
278
|
+
/* The rest of this file contains styles related to the mechanics of
|
|
279
|
+
the editor. You probably shouldn't touch them. */
|
|
280
|
+
|
|
281
|
+
.CodeMirror {
|
|
282
|
+
position: relative;
|
|
283
|
+
overflow: hidden;
|
|
284
|
+
background: ${({ theme }) => `${theme.colors.neutral0}`};
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
.CodeMirror-scroll {
|
|
288
|
+
overflow: scroll !important; /* Things will break if this is overridden */
|
|
289
|
+
/* 50px is the magic margin used to hide the element's real scrollbars */
|
|
290
|
+
/* See overflow: hidden in .CodeMirror */
|
|
291
|
+
margin-bottom: -50px;
|
|
292
|
+
margin-right: -50px;
|
|
293
|
+
padding-bottom: 50px;
|
|
294
|
+
height: 100%;
|
|
295
|
+
outline: none; /* Prevent dragging from highlighting the element */
|
|
296
|
+
position: relative;
|
|
297
|
+
}
|
|
298
|
+
.CodeMirror-sizer {
|
|
299
|
+
position: relative;
|
|
300
|
+
border-right: 50px solid transparent;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/* The fake, visible scrollbars. Used to force redraw during scrolling
|
|
304
|
+
before actual scrolling happens, thus preventing shaking and
|
|
305
|
+
flickering artifacts. */
|
|
306
|
+
.CodeMirror-vscrollbar,
|
|
307
|
+
.CodeMirror-hscrollbar,
|
|
308
|
+
.CodeMirror-scrollbar-filler,
|
|
309
|
+
.CodeMirror-gutter-filler {
|
|
310
|
+
position: absolute;
|
|
311
|
+
z-index: 1;
|
|
312
|
+
display: none;
|
|
313
|
+
outline: none;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
.CodeMirror-vscrollbar {
|
|
317
|
+
right: 0;
|
|
318
|
+
top: 0;
|
|
319
|
+
overflow-x: hidden;
|
|
320
|
+
overflow-y: scroll;
|
|
321
|
+
}
|
|
322
|
+
.CodeMirror-hscrollbar {
|
|
323
|
+
bottom: 0;
|
|
324
|
+
left: 0;
|
|
325
|
+
overflow-y: hidden;
|
|
326
|
+
overflow-x: scroll;
|
|
327
|
+
}
|
|
328
|
+
.CodeMirror-scrollbar-filler {
|
|
329
|
+
right: 0;
|
|
330
|
+
bottom: 0;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
.CodeMirror-lines {
|
|
334
|
+
cursor: text;
|
|
335
|
+
min-height: 1px; /* prevents collapsing before first draw */
|
|
336
|
+
}
|
|
337
|
+
/* Reset some styles that the rest of the page might have set */
|
|
338
|
+
.CodeMirror pre.CodeMirror-line,
|
|
339
|
+
.CodeMirror pre.CodeMirror-line-like {
|
|
340
|
+
-moz-border-radius: 0;
|
|
341
|
+
-webkit-border-radius: 0;
|
|
342
|
+
border-radius: 0;
|
|
343
|
+
border-width: 0;
|
|
344
|
+
background: transparent;
|
|
345
|
+
font-family: inherit;
|
|
346
|
+
font-size: inherit;
|
|
347
|
+
margin: 0;
|
|
348
|
+
white-space: pre;
|
|
349
|
+
word-wrap: normal;
|
|
350
|
+
line-height: 1.5;
|
|
351
|
+
color: inherit;
|
|
352
|
+
/* z-index: 2; */
|
|
353
|
+
position: relative;
|
|
354
|
+
overflow: visible;
|
|
355
|
+
-webkit-tap-highlight-color: transparent;
|
|
356
|
+
-webkit-font-variant-ligatures: contextual;
|
|
357
|
+
font-variant-ligatures: contextual;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
.CodeMirror pre.CodeMirror-line-like {
|
|
361
|
+
z-index: 2;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
.CodeMirror-wrap pre.CodeMirror-line,
|
|
365
|
+
.CodeMirror-wrap pre.CodeMirror-line-like {
|
|
366
|
+
word-wrap: break-word;
|
|
367
|
+
white-space: pre-wrap;
|
|
368
|
+
word-break: normal;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
.CodeMirror-linebackground {
|
|
372
|
+
position: absolute;
|
|
373
|
+
left: 0;
|
|
374
|
+
right: 0;
|
|
375
|
+
top: 0;
|
|
376
|
+
bottom: 0;
|
|
377
|
+
z-index: 0;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
.CodeMirror-linewidget {
|
|
381
|
+
position: relative;
|
|
382
|
+
/* z-index: 2; */
|
|
383
|
+
padding: 0.1px; /* Force widget margins to stay inside of the container */
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
.CodeMirror-widget {
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
.CodeMirror-rtl pre {
|
|
390
|
+
direction: rtl;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
.CodeMirror-code {
|
|
394
|
+
outline: none;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/* Force content-box sizing for the elements where we expect it */
|
|
398
|
+
.CodeMirror-scroll,
|
|
399
|
+
.CodeMirror-sizer,
|
|
400
|
+
.CodeMirror-gutter,
|
|
401
|
+
.CodeMirror-gutters,
|
|
402
|
+
.CodeMirror-linenumber {
|
|
403
|
+
-moz-box-sizing: content-box;
|
|
404
|
+
box-sizing: content-box;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
.CodeMirror-measure {
|
|
408
|
+
position: absolute;
|
|
409
|
+
width: 100%;
|
|
410
|
+
height: 0;
|
|
411
|
+
overflow: hidden;
|
|
412
|
+
visibility: hidden;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
.CodeMirror-cursor {
|
|
416
|
+
position: absolute;
|
|
417
|
+
pointer-events: none;
|
|
418
|
+
border-color: ${({ theme }) => `${theme.colors.neutral800}`};
|
|
419
|
+
}
|
|
420
|
+
.CodeMirror-measure pre {
|
|
421
|
+
position: static;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
div.CodeMirror-cursors {
|
|
425
|
+
visibility: hidden;
|
|
426
|
+
position: relative;
|
|
427
|
+
+ div {
|
|
428
|
+
z-index: 0 !important;
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
div.CodeMirror-dragcursors {
|
|
433
|
+
visibility: visible;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
.CodeMirror-focused div.CodeMirror-cursors {
|
|
437
|
+
visibility: visible;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
.CodeMirror-selected {
|
|
441
|
+
background: ${({ theme }) => theme.colors.neutral200};
|
|
442
|
+
/* z-index: -10; */
|
|
443
|
+
}
|
|
444
|
+
.CodeMirror-crosshair {
|
|
445
|
+
cursor: crosshair;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
/* Used to force a border model for a node */
|
|
449
|
+
.cm-force-border {
|
|
450
|
+
padding-right: 0.1px;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
/* See issue #2901 */
|
|
454
|
+
.cm-tab-wrap-hack:after {
|
|
455
|
+
content: '';
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
/* Help users use markselection to safely style text background */
|
|
459
|
+
span.CodeMirror-selectedtext {
|
|
460
|
+
background: none;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
span {
|
|
464
|
+
color: ${({ theme }) => theme.colors.neutral800} !important;
|
|
465
|
+
}
|
|
466
|
+
`;
|
|
467
|
+
|
|
104
468
|
export default Editor;
|
|
@@ -64,22 +64,16 @@ const WysiwygNav = ({
|
|
|
64
64
|
</Select>
|
|
65
65
|
|
|
66
66
|
<MainButtons>
|
|
67
|
-
<CustomIconButton disabled
|
|
68
|
-
<CustomIconButton disabled
|
|
69
|
-
<CustomIconButton
|
|
70
|
-
disabled
|
|
71
|
-
id="Underline"
|
|
72
|
-
label="Underline"
|
|
73
|
-
name="Underline"
|
|
74
|
-
icon={<Underline />}
|
|
75
|
-
/>
|
|
67
|
+
<CustomIconButton disabled label="Bold" name="Bold" icon={<Bold />} />
|
|
68
|
+
<CustomIconButton disabled label="Italic" name="Italic" icon={<Italic />} />
|
|
69
|
+
<CustomIconButton disabled label="Underline" name="Underline" icon={<Underline />} />
|
|
76
70
|
</MainButtons>
|
|
77
71
|
|
|
78
|
-
<MoreButton disabled
|
|
72
|
+
<MoreButton disabled label="More" icon={<More />} />
|
|
79
73
|
</StyledFlex>
|
|
80
74
|
|
|
81
75
|
{!isExpandMode && (
|
|
82
|
-
<Button onClick={onTogglePreviewMode} variant="tertiary"
|
|
76
|
+
<Button onClick={onTogglePreviewMode} variant="tertiary">
|
|
83
77
|
{formatMessage({
|
|
84
78
|
id: 'components.Wysiwyg.ToggleMode.markdown-mode',
|
|
85
79
|
defaultMessage: 'Markdown mode',
|
|
@@ -110,21 +104,18 @@ const WysiwygNav = ({
|
|
|
110
104
|
<MainButtons>
|
|
111
105
|
<CustomIconButton
|
|
112
106
|
onClick={() => onActionClick('Bold', editorRef)}
|
|
113
|
-
id="Bold"
|
|
114
107
|
label="Bold"
|
|
115
108
|
name="Bold"
|
|
116
109
|
icon={<Bold />}
|
|
117
110
|
/>
|
|
118
111
|
<CustomIconButton
|
|
119
112
|
onClick={() => onActionClick('Italic', editorRef)}
|
|
120
|
-
id="Italic"
|
|
121
113
|
label="Italic"
|
|
122
114
|
name="Italic"
|
|
123
115
|
icon={<Italic />}
|
|
124
116
|
/>
|
|
125
117
|
<CustomIconButton
|
|
126
118
|
onClick={() => onActionClick('Underline', editorRef)}
|
|
127
|
-
id="Underline"
|
|
128
119
|
label="Underline"
|
|
129
120
|
name="Underline"
|
|
130
121
|
icon={<Underline />}
|
|
@@ -134,37 +125,27 @@ const WysiwygNav = ({
|
|
|
134
125
|
<MoreButton
|
|
135
126
|
ref={buttonMoreRef}
|
|
136
127
|
onClick={handleTogglePopover}
|
|
137
|
-
id="more"
|
|
138
128
|
label="More"
|
|
139
129
|
icon={<More />}
|
|
140
130
|
/>
|
|
141
131
|
{visiblePopover && (
|
|
142
|
-
<Popover
|
|
143
|
-
onDismiss={handleTogglePopover}
|
|
144
|
-
centered
|
|
145
|
-
source={buttonMoreRef}
|
|
146
|
-
spacing={4}
|
|
147
|
-
id="popover"
|
|
148
|
-
>
|
|
132
|
+
<Popover onDismiss={handleTogglePopover} centered source={buttonMoreRef} spacing={4}>
|
|
149
133
|
<Flex>
|
|
150
134
|
<IconButtonGroupMargin>
|
|
151
135
|
<CustomIconButton
|
|
152
136
|
onClick={() => onActionClick('Strikethrough', editorRef, handleTogglePopover)}
|
|
153
|
-
id="Strikethrough"
|
|
154
137
|
label="Strikethrough"
|
|
155
138
|
name="Strikethrough"
|
|
156
139
|
icon={<StrikeThrough />}
|
|
157
140
|
/>
|
|
158
141
|
<CustomIconButton
|
|
159
142
|
onClick={() => onActionClick('BulletList', editorRef, handleTogglePopover)}
|
|
160
|
-
id="BulletList"
|
|
161
143
|
label="BulletList"
|
|
162
144
|
name="BulletList"
|
|
163
145
|
icon={<BulletList />}
|
|
164
146
|
/>
|
|
165
147
|
<CustomIconButton
|
|
166
148
|
onClick={() => onActionClick('NumberList', editorRef, handleTogglePopover)}
|
|
167
|
-
id="NumberList"
|
|
168
149
|
label="NumberList"
|
|
169
150
|
name="NumberList"
|
|
170
151
|
icon={<NumberList />}
|
|
@@ -173,7 +154,6 @@ const WysiwygNav = ({
|
|
|
173
154
|
<IconButtonGroup>
|
|
174
155
|
<CustomIconButton
|
|
175
156
|
onClick={() => onActionClick('Code', editorRef, handleTogglePopover)}
|
|
176
|
-
id="Code"
|
|
177
157
|
label="Code"
|
|
178
158
|
name="Code"
|
|
179
159
|
icon={<Code />}
|
|
@@ -183,14 +163,12 @@ const WysiwygNav = ({
|
|
|
183
163
|
handleTogglePopover();
|
|
184
164
|
onToggleMediaLib();
|
|
185
165
|
}}
|
|
186
|
-
id="Image"
|
|
187
166
|
label="Image"
|
|
188
167
|
name="Image"
|
|
189
168
|
icon={<Image />}
|
|
190
169
|
/>
|
|
191
170
|
<CustomLinkIconButton
|
|
192
171
|
onClick={() => onActionClick('Link', editorRef, handleTogglePopover)}
|
|
193
|
-
id="Link"
|
|
194
172
|
label="Link"
|
|
195
173
|
name="Link"
|
|
196
174
|
// eslint-disable-next-line jsx-a11y/anchor-is-valid
|
|
@@ -198,7 +176,6 @@ const WysiwygNav = ({
|
|
|
198
176
|
/>
|
|
199
177
|
<CustomIconButton
|
|
200
178
|
onClick={() => onActionClick('Quote', editorRef, handleTogglePopover)}
|
|
201
|
-
id="Quote"
|
|
202
179
|
label="Quote"
|
|
203
180
|
name="Quote"
|
|
204
181
|
icon={<Quote />}
|
|
@@ -210,7 +187,7 @@ const WysiwygNav = ({
|
|
|
210
187
|
</StyledFlex>
|
|
211
188
|
|
|
212
189
|
{onTogglePreviewMode && (
|
|
213
|
-
<Button onClick={onTogglePreviewMode} variant="tertiary"
|
|
190
|
+
<Button onClick={onTogglePreviewMode} variant="tertiary">
|
|
214
191
|
{formatMessage({
|
|
215
192
|
id: 'components.Wysiwyg.ToggleMode.preview-mode',
|
|
216
193
|
defaultMessage: 'Preview mode',
|
|
@@ -40,13 +40,6 @@ export const IconButtonGroupMargin = styled(IconButtonGroup)`
|
|
|
40
40
|
margin-right: ${({ theme }) => `${theme.spaces[2]}`};
|
|
41
41
|
`;
|
|
42
42
|
|
|
43
|
-
// EDITOR && PREVIEW
|
|
44
|
-
|
|
45
|
-
export const EditorAndPreviewWrapper = styled.div`
|
|
46
|
-
position: relative;
|
|
47
|
-
height: calc(100% - 48px);
|
|
48
|
-
`;
|
|
49
|
-
|
|
50
43
|
// FOOTER
|
|
51
44
|
export const ExpandButton = styled(BaseButton)`
|
|
52
45
|
background-color: transparent;
|