@manuscripts/body-editor 3.7.3 → 3.7.5
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/cjs/components/views/InsertSpecialCharacter.js +1 -1
- package/dist/cjs/menus.js +2 -2
- package/dist/cjs/toolbar.js +56 -5
- package/dist/cjs/versions.js +1 -1
- package/dist/es/components/views/InsertSpecialCharacter.js +1 -1
- package/dist/es/menus.js +2 -2
- package/dist/es/toolbar.js +58 -7
- package/dist/es/versions.js +1 -1
- package/dist/types/versions.d.ts +1 -1
- package/package.json +19 -16
|
@@ -55,7 +55,7 @@ const reservedCharacters = new Set([
|
|
|
55
55
|
const generateCharacters = (start, end) => Array.from({ length: end - start + 1 }, (_, i) => start + i)
|
|
56
56
|
.filter((c) => !reservedCharacters.has(c))
|
|
57
57
|
.map((c) => String.fromCharCode(c));
|
|
58
|
-
const InsertSpecialCharacterDialog = ({ view
|
|
58
|
+
const InsertSpecialCharacterDialog = ({ view }) => {
|
|
59
59
|
const [isOpen, setOpen] = (0, react_1.useState)(true);
|
|
60
60
|
const [range, setRange] = (0, react_1.useState)(unicodeRanges[0].value);
|
|
61
61
|
const handleRangeChange = (range) => range && setRange(range.value);
|
package/dist/cjs/menus.js
CHANGED
|
@@ -28,7 +28,7 @@ const template_1 = require("./lib/template");
|
|
|
28
28
|
const utils_1 = require("./lib/utils");
|
|
29
29
|
const editor_props_1 = require("./plugins/editor-props");
|
|
30
30
|
const getEditorMenus = (editor) => {
|
|
31
|
-
const { isCommandValid, state } = editor;
|
|
31
|
+
const { isCommandValid, state, view } = editor;
|
|
32
32
|
const doCommand = (command) => () => editor.doCommand(command);
|
|
33
33
|
const props = (0, editor_props_1.getEditorProps)(state);
|
|
34
34
|
const insertBackmatterSectionMenu = (category) => {
|
|
@@ -409,7 +409,7 @@ const getEditorMenus = (editor) => {
|
|
|
409
409
|
id: 'insert-special-character',
|
|
410
410
|
label: 'Special Characters',
|
|
411
411
|
isEnabled: (0, utils_1.isEditAllowed)(state) && isCommandValid((0, commands_1.canInsert)(transform_1.schema.nodes.text)),
|
|
412
|
-
run: () => (0, InsertSpecialCharacter_1.openInsertSpecialCharacterDialog)(
|
|
412
|
+
run: () => (0, InsertSpecialCharacter_1.openInsertSpecialCharacterDialog)(view),
|
|
413
413
|
isHidden: !(0, template_1.templateAllows)(state, transform_1.schema.nodes.text),
|
|
414
414
|
},
|
|
415
415
|
{
|
package/dist/cjs/toolbar.js
CHANGED
|
@@ -26,6 +26,7 @@ const react_1 = __importDefault(require("react"));
|
|
|
26
26
|
const commands_1 = require("./commands");
|
|
27
27
|
const helpers_1 = require("./components/toolbar/helpers");
|
|
28
28
|
const InsertTableDialog_1 = require("./components/toolbar/InsertTableDialog");
|
|
29
|
+
const InsertSpecialCharacter_1 = require("./components/views/InsertSpecialCharacter");
|
|
29
30
|
const utils_1 = require("./lib/utils");
|
|
30
31
|
const isEnabled = (isCommandEnabled) => (state) => {
|
|
31
32
|
return (0, utils_1.isEditAllowed)(state) && isCommandEnabled(state);
|
|
@@ -112,17 +113,31 @@ exports.toolbar = {
|
|
|
112
113
|
},
|
|
113
114
|
},
|
|
114
115
|
inline: {
|
|
116
|
+
comment: {
|
|
117
|
+
title: 'Insert comment',
|
|
118
|
+
content: react_1.default.createElement(style_guide_1.AddCommentIcon, null),
|
|
119
|
+
isEnabled: isEnabled((0, commands_1.canInsert)(transform_1.schema.nodes.highlight_marker)),
|
|
120
|
+
run: commands_1.addInlineComment,
|
|
121
|
+
},
|
|
115
122
|
citation: {
|
|
116
123
|
title: 'Insert citation',
|
|
117
124
|
content: react_1.default.createElement(style_guide_1.ToolbarCitationIcon, null),
|
|
118
125
|
isEnabled: isEnabled((0, commands_1.canInsert)(transform_1.schema.nodes.citation)),
|
|
119
126
|
run: commands_1.insertInlineCitation,
|
|
120
127
|
},
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
128
|
+
},
|
|
129
|
+
quote: {
|
|
130
|
+
blockquote: {
|
|
131
|
+
title: 'Insert blockquote',
|
|
132
|
+
content: react_1.default.createElement(style_guide_1.OutlineBlockQuoteIcon, null),
|
|
133
|
+
isEnabled: isEnabled((0, commands_1.canInsert)(transform_1.schema.nodes.blockquote_element)),
|
|
134
|
+
run: (0, commands_1.insertBlock)(transform_1.schema.nodes.blockquote_element),
|
|
135
|
+
},
|
|
136
|
+
pullquote: {
|
|
137
|
+
title: 'Insert pullquote',
|
|
138
|
+
content: react_1.default.createElement(style_guide_1.OutlinePullQuoteIcon, null),
|
|
139
|
+
isEnabled: isEnabled((0, commands_1.canInsert)(transform_1.schema.nodes.pullquote_element)),
|
|
140
|
+
run: (0, commands_1.insertBlock)(transform_1.schema.nodes.pullquote_element),
|
|
126
141
|
},
|
|
127
142
|
},
|
|
128
143
|
element: {
|
|
@@ -132,12 +147,24 @@ exports.toolbar = {
|
|
|
132
147
|
isEnabled: isEnabled((0, commands_1.canInsert)(transform_1.schema.nodes.figure_element)),
|
|
133
148
|
run: (0, commands_1.insertBlock)(transform_1.schema.nodes.figure_element),
|
|
134
149
|
},
|
|
150
|
+
image_element: {
|
|
151
|
+
title: 'Insert image',
|
|
152
|
+
content: react_1.default.createElement(style_guide_1.FileImageIcon, { width: "19", height: "16" }),
|
|
153
|
+
isEnabled: isEnabled((0, commands_1.canInsert)(transform_1.schema.nodes.image_element)),
|
|
154
|
+
run: (0, commands_1.insertBlock)(transform_1.schema.nodes.image_element),
|
|
155
|
+
},
|
|
135
156
|
table_element: {
|
|
136
157
|
title: 'Insert table',
|
|
137
158
|
content: react_1.default.createElement(style_guide_1.ToolbarTableIcon, null),
|
|
138
159
|
isEnabled: isEnabled((0, commands_1.canInsert)(transform_1.schema.nodes.table_element)),
|
|
139
160
|
run: InsertTableDialog_1.openInsertTableDialog,
|
|
140
161
|
},
|
|
162
|
+
box_element: {
|
|
163
|
+
title: 'Insert boxed text',
|
|
164
|
+
content: react_1.default.createElement(style_guide_1.ToolbarBoxedTextIcon, null),
|
|
165
|
+
isEnabled: isEnabled((0, commands_1.canInsert)(transform_1.schema.nodes.box_element)),
|
|
166
|
+
run: commands_1.insertBoxElement,
|
|
167
|
+
},
|
|
141
168
|
equation_element: {
|
|
142
169
|
title: 'Insert equation',
|
|
143
170
|
content: react_1.default.createElement(style_guide_1.ToolbarEquationIcon, null),
|
|
@@ -145,4 +172,28 @@ exports.toolbar = {
|
|
|
145
172
|
run: (0, commands_1.insertBlock)(transform_1.schema.nodes.equation_element),
|
|
146
173
|
},
|
|
147
174
|
},
|
|
175
|
+
media: {
|
|
176
|
+
embed: {
|
|
177
|
+
title: 'Insert media',
|
|
178
|
+
content: react_1.default.createElement(style_guide_1.OutlineEmbedIcon, null),
|
|
179
|
+
isEnabled: isEnabled((0, commands_1.canInsert)(transform_1.schema.nodes.embed)),
|
|
180
|
+
run: commands_1.insertEmbed,
|
|
181
|
+
},
|
|
182
|
+
link: {
|
|
183
|
+
title: 'Insert link',
|
|
184
|
+
content: react_1.default.createElement(style_guide_1.LinkIcon, null),
|
|
185
|
+
isEnabled: isEnabled((0, commands_1.canInsert)(transform_1.schema.nodes.link)),
|
|
186
|
+
run: commands_1.insertLink,
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
special: {
|
|
190
|
+
special_characters: {
|
|
191
|
+
title: 'Insert special characters',
|
|
192
|
+
content: react_1.default.createElement(style_guide_1.ToolbarSpecialCharactersIcon, null),
|
|
193
|
+
isEnabled: isEnabled((0, commands_1.canInsert)(transform_1.schema.nodes.text)),
|
|
194
|
+
run: (state, dispatch, view) => {
|
|
195
|
+
(0, InsertSpecialCharacter_1.openInsertSpecialCharacterDialog)(view);
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
},
|
|
148
199
|
};
|
package/dist/cjs/versions.js
CHANGED
|
@@ -16,7 +16,7 @@ const reservedCharacters = new Set([
|
|
|
16
16
|
const generateCharacters = (start, end) => Array.from({ length: end - start + 1 }, (_, i) => start + i)
|
|
17
17
|
.filter((c) => !reservedCharacters.has(c))
|
|
18
18
|
.map((c) => String.fromCharCode(c));
|
|
19
|
-
const InsertSpecialCharacterDialog = ({ view
|
|
19
|
+
const InsertSpecialCharacterDialog = ({ view }) => {
|
|
20
20
|
const [isOpen, setOpen] = useState(true);
|
|
21
21
|
const [range, setRange] = useState(unicodeRanges[0].value);
|
|
22
22
|
const handleRangeChange = (range) => range && setRange(range.value);
|
package/dist/es/menus.js
CHANGED
|
@@ -25,7 +25,7 @@ import { templateAllows } from './lib/template';
|
|
|
25
25
|
import { isEditAllowed } from './lib/utils';
|
|
26
26
|
import { getEditorProps } from './plugins/editor-props';
|
|
27
27
|
export const getEditorMenus = (editor) => {
|
|
28
|
-
const { isCommandValid, state } = editor;
|
|
28
|
+
const { isCommandValid, state, view } = editor;
|
|
29
29
|
const doCommand = (command) => () => editor.doCommand(command);
|
|
30
30
|
const props = getEditorProps(state);
|
|
31
31
|
const insertBackmatterSectionMenu = (category) => {
|
|
@@ -406,7 +406,7 @@ export const getEditorMenus = (editor) => {
|
|
|
406
406
|
id: 'insert-special-character',
|
|
407
407
|
label: 'Special Characters',
|
|
408
408
|
isEnabled: isEditAllowed(state) && isCommandValid(canInsert(schema.nodes.text)),
|
|
409
|
-
run: () => openInsertSpecialCharacterDialog(
|
|
409
|
+
run: () => openInsertSpecialCharacterDialog(view),
|
|
410
410
|
isHidden: !templateAllows(state, schema.nodes.text),
|
|
411
411
|
},
|
|
412
412
|
{
|
package/dist/es/toolbar.js
CHANGED
|
@@ -13,13 +13,14 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { AddCommentIcon, ToolbarBoldIcon, ToolbarCitationIcon, ToolbarEquationIcon, ToolbarFigureIcon, ToolbarIndentIcon, ToolbarItalicIcon, ToolbarOrderedListIcon, ToolbarSubscriptIcon, ToolbarSuperscriptIcon, ToolbarTableIcon, ToolbarUnderlineIcon, ToolbarUnindentIcon, ToolbarUnorderedListIcon, } from '@manuscripts/style-guide';
|
|
16
|
+
import { AddCommentIcon, FileImageIcon, LinkIcon, OutlineBlockQuoteIcon, OutlineEmbedIcon, OutlinePullQuoteIcon, ToolbarBoldIcon, ToolbarBoxedTextIcon, ToolbarCitationIcon, ToolbarEquationIcon, ToolbarFigureIcon, ToolbarIndentIcon, ToolbarItalicIcon, ToolbarOrderedListIcon, ToolbarSpecialCharactersIcon, ToolbarSubscriptIcon, ToolbarSuperscriptIcon, ToolbarTableIcon, ToolbarUnderlineIcon, ToolbarUnindentIcon, ToolbarUnorderedListIcon, } from '@manuscripts/style-guide';
|
|
17
17
|
import { schema } from '@manuscripts/transform';
|
|
18
18
|
import { toggleMark } from 'prosemirror-commands';
|
|
19
19
|
import React from 'react';
|
|
20
|
-
import { addInlineComment, blockActive, canInsert, insertBlock, insertInlineCitation, insertList, markActive, } from './commands';
|
|
20
|
+
import { addInlineComment, blockActive, canInsert, insertBlock, insertBoxElement, insertEmbed, insertInlineCitation, insertLink, insertList, markActive, } from './commands';
|
|
21
21
|
import { changeIndentation, isIndentationAllowed, } from './components/toolbar/helpers';
|
|
22
22
|
import { openInsertTableDialog } from './components/toolbar/InsertTableDialog';
|
|
23
|
+
import { openInsertSpecialCharacterDialog } from './components/views/InsertSpecialCharacter';
|
|
23
24
|
import { isEditAllowed } from './lib/utils';
|
|
24
25
|
const isEnabled = (isCommandEnabled) => (state) => {
|
|
25
26
|
return isEditAllowed(state) && isCommandEnabled(state);
|
|
@@ -106,17 +107,31 @@ export const toolbar = {
|
|
|
106
107
|
},
|
|
107
108
|
},
|
|
108
109
|
inline: {
|
|
110
|
+
comment: {
|
|
111
|
+
title: 'Insert comment',
|
|
112
|
+
content: React.createElement(AddCommentIcon, null),
|
|
113
|
+
isEnabled: isEnabled(canInsert(schema.nodes.highlight_marker)),
|
|
114
|
+
run: addInlineComment,
|
|
115
|
+
},
|
|
109
116
|
citation: {
|
|
110
117
|
title: 'Insert citation',
|
|
111
118
|
content: React.createElement(ToolbarCitationIcon, null),
|
|
112
119
|
isEnabled: isEnabled(canInsert(schema.nodes.citation)),
|
|
113
120
|
run: insertInlineCitation,
|
|
114
121
|
},
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
122
|
+
},
|
|
123
|
+
quote: {
|
|
124
|
+
blockquote: {
|
|
125
|
+
title: 'Insert blockquote',
|
|
126
|
+
content: React.createElement(OutlineBlockQuoteIcon, null),
|
|
127
|
+
isEnabled: isEnabled(canInsert(schema.nodes.blockquote_element)),
|
|
128
|
+
run: insertBlock(schema.nodes.blockquote_element),
|
|
129
|
+
},
|
|
130
|
+
pullquote: {
|
|
131
|
+
title: 'Insert pullquote',
|
|
132
|
+
content: React.createElement(OutlinePullQuoteIcon, null),
|
|
133
|
+
isEnabled: isEnabled(canInsert(schema.nodes.pullquote_element)),
|
|
134
|
+
run: insertBlock(schema.nodes.pullquote_element),
|
|
120
135
|
},
|
|
121
136
|
},
|
|
122
137
|
element: {
|
|
@@ -126,12 +141,24 @@ export const toolbar = {
|
|
|
126
141
|
isEnabled: isEnabled(canInsert(schema.nodes.figure_element)),
|
|
127
142
|
run: insertBlock(schema.nodes.figure_element),
|
|
128
143
|
},
|
|
144
|
+
image_element: {
|
|
145
|
+
title: 'Insert image',
|
|
146
|
+
content: React.createElement(FileImageIcon, { width: "19", height: "16" }),
|
|
147
|
+
isEnabled: isEnabled(canInsert(schema.nodes.image_element)),
|
|
148
|
+
run: insertBlock(schema.nodes.image_element),
|
|
149
|
+
},
|
|
129
150
|
table_element: {
|
|
130
151
|
title: 'Insert table',
|
|
131
152
|
content: React.createElement(ToolbarTableIcon, null),
|
|
132
153
|
isEnabled: isEnabled(canInsert(schema.nodes.table_element)),
|
|
133
154
|
run: openInsertTableDialog,
|
|
134
155
|
},
|
|
156
|
+
box_element: {
|
|
157
|
+
title: 'Insert boxed text',
|
|
158
|
+
content: React.createElement(ToolbarBoxedTextIcon, null),
|
|
159
|
+
isEnabled: isEnabled(canInsert(schema.nodes.box_element)),
|
|
160
|
+
run: insertBoxElement,
|
|
161
|
+
},
|
|
135
162
|
equation_element: {
|
|
136
163
|
title: 'Insert equation',
|
|
137
164
|
content: React.createElement(ToolbarEquationIcon, null),
|
|
@@ -139,4 +166,28 @@ export const toolbar = {
|
|
|
139
166
|
run: insertBlock(schema.nodes.equation_element),
|
|
140
167
|
},
|
|
141
168
|
},
|
|
169
|
+
media: {
|
|
170
|
+
embed: {
|
|
171
|
+
title: 'Insert media',
|
|
172
|
+
content: React.createElement(OutlineEmbedIcon, null),
|
|
173
|
+
isEnabled: isEnabled(canInsert(schema.nodes.embed)),
|
|
174
|
+
run: insertEmbed,
|
|
175
|
+
},
|
|
176
|
+
link: {
|
|
177
|
+
title: 'Insert link',
|
|
178
|
+
content: React.createElement(LinkIcon, null),
|
|
179
|
+
isEnabled: isEnabled(canInsert(schema.nodes.link)),
|
|
180
|
+
run: insertLink,
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
special: {
|
|
184
|
+
special_characters: {
|
|
185
|
+
title: 'Insert special characters',
|
|
186
|
+
content: React.createElement(ToolbarSpecialCharactersIcon, null),
|
|
187
|
+
isEnabled: isEnabled(canInsert(schema.nodes.text)),
|
|
188
|
+
run: (state, dispatch, view) => {
|
|
189
|
+
openInsertSpecialCharacterDialog(view);
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
},
|
|
142
193
|
};
|
package/dist/es/versions.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '3.7.
|
|
1
|
+
export const VERSION = '3.7.5';
|
|
2
2
|
export const MATHJAX_VERSION = '3.2.2';
|
package/dist/types/versions.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "3.7.
|
|
1
|
+
export declare const VERSION = "3.7.5";
|
|
2
2
|
export declare const MATHJAX_VERSION = "3.2.2";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manuscripts/body-editor",
|
|
3
3
|
"description": "Prosemirror components for editing and viewing manuscripts",
|
|
4
|
-
"version": "3.7.
|
|
4
|
+
"version": "3.7.5",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-body-editor",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
"@citation-js/plugin-ris": "0.7.18",
|
|
39
39
|
"@iarna/word-count": "1.1.2",
|
|
40
40
|
"@manuscripts/json-schema": "2.2.12",
|
|
41
|
-
"@manuscripts/style-guide": "3.3.
|
|
42
|
-
"@manuscripts/track-changes-plugin": "2.2.
|
|
43
|
-
"@manuscripts/transform": "4.3.
|
|
41
|
+
"@manuscripts/style-guide": "3.3.7",
|
|
42
|
+
"@manuscripts/track-changes-plugin": "2.2.1",
|
|
43
|
+
"@manuscripts/transform": "4.3.10",
|
|
44
44
|
"@popperjs/core": "2.11.8",
|
|
45
45
|
"citeproc": "2.4.63",
|
|
46
46
|
"codemirror": "5.65.19",
|
|
@@ -81,6 +81,8 @@
|
|
|
81
81
|
"@babel/preset-env": "7.23.8",
|
|
82
82
|
"@babel/preset-react": "7.27.1",
|
|
83
83
|
"@babel/preset-typescript": "7.23.3",
|
|
84
|
+
"@eslint/eslintrc": "3.3.1",
|
|
85
|
+
"@eslint/js": "9.39.1",
|
|
84
86
|
"@manuscripts/eslint-config": "0.5.1",
|
|
85
87
|
"@types/codemirror": "5.60.15",
|
|
86
88
|
"@types/csl": "npm:csl-json@0.1.0",
|
|
@@ -92,27 +94,28 @@
|
|
|
92
94
|
"@types/react-router-dom": "5.3.3",
|
|
93
95
|
"@types/styled-components": "5.1.34",
|
|
94
96
|
"@types/uuid": "9.0.8",
|
|
95
|
-
"@typescript-eslint/eslint-plugin": "
|
|
96
|
-
"@typescript-eslint/parser": "
|
|
97
|
-
"eslint": "
|
|
98
|
-
"eslint-config-prettier": "
|
|
97
|
+
"@typescript-eslint/eslint-plugin": "8.46.4",
|
|
98
|
+
"@typescript-eslint/parser": "8.46.4",
|
|
99
|
+
"eslint": "9.39.1",
|
|
100
|
+
"eslint-config-prettier": "10.1.8",
|
|
101
|
+
"eslint-plugin-diff": "2.0.3",
|
|
99
102
|
"eslint-plugin-header": "3.1.1",
|
|
100
|
-
"eslint-plugin-import": "2.
|
|
101
|
-
"eslint-plugin-jest": "
|
|
103
|
+
"eslint-plugin-import": "2.32.0",
|
|
104
|
+
"eslint-plugin-jest": "29.1.0",
|
|
102
105
|
"eslint-plugin-jsx-a11y": "6.10.2",
|
|
103
|
-
"eslint-plugin-mdx": "
|
|
106
|
+
"eslint-plugin-mdx": "3.6.2",
|
|
104
107
|
"eslint-plugin-node": "11.1.0",
|
|
105
|
-
"eslint-plugin-prettier": "
|
|
106
|
-
"eslint-plugin-promise": "
|
|
108
|
+
"eslint-plugin-prettier": "5.5.4",
|
|
109
|
+
"eslint-plugin-promise": "7.2.1",
|
|
107
110
|
"eslint-plugin-react": "7.37.5",
|
|
108
|
-
"eslint-plugin-react-hooks": "
|
|
109
|
-
"eslint-plugin-simple-import-sort": "
|
|
111
|
+
"eslint-plugin-react-hooks": "7.0.1",
|
|
112
|
+
"eslint-plugin-simple-import-sort": "12.1.1",
|
|
110
113
|
"husky": "8.0.3",
|
|
111
114
|
"jest": "30.0.5",
|
|
112
115
|
"jest-environment-jsdom": "30.0.5",
|
|
113
116
|
"jest-prosemirror": "3.0.1",
|
|
114
117
|
"npm-run-all": "4.1.5",
|
|
115
|
-
"prettier": "
|
|
118
|
+
"prettier": "3.6.2",
|
|
116
119
|
"regenerator-runtime": "0.14.1",
|
|
117
120
|
"rimraf": "6.0.1",
|
|
118
121
|
"typescript": "5.9.2",
|