@manuscripts/body-editor 2.8.5 → 2.8.7
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/commands.js +3 -50
- package/dist/cjs/components/toolbar/helpers.js +85 -1
- package/dist/cjs/components/views/InsertSpecialCharacter.js +138 -0
- package/dist/cjs/menus.js +7 -0
- package/dist/cjs/toolbar.js +3 -2
- package/dist/cjs/versions.js +1 -1
- package/dist/es/commands.js +2 -46
- package/dist/es/components/toolbar/helpers.js +81 -1
- package/dist/es/components/views/InsertSpecialCharacter.js +108 -0
- package/dist/es/menus.js +7 -0
- package/dist/es/toolbar.js +3 -2
- package/dist/es/versions.js +1 -1
- package/dist/types/commands.d.ts +0 -3
- package/dist/types/components/toolbar/helpers.d.ts +6 -0
- package/dist/types/components/views/InsertSpecialCharacter.d.ts +2 -0
- package/dist/types/versions.d.ts +1 -1
- package/package.json +2 -2
- package/styles/AdvancedEditor.css +8 -0
package/dist/cjs/commands.js
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.addHeaderRow = exports.addRows = exports.addInlineComment = exports.addNodeComment = exports.isCommentingAllowed = exports.createAndFillTableElement = exports.selectAllIsolating = exports.ignoreAtomBlockNodeForward = exports.isAtEndOfTextBlock = exports.ignoreMetaNodeBackspaceCommand = exports.ignoreAtomBlockNodeBackward = exports.isTextSelection = exports.isAtStartOfTextBlock = exports.insertTOCSection = exports.insertBibliographySection = exports.insertList = exports.insertKeywords = exports.insertAward = exports.insertAffiliation = exports.insertContributors = exports.insertGraphicalAbstract = exports.insertBackmatterSection = exports.insertAbstractSection = exports.insertSection = exports.insertBoxElement = exports.insertInlineFootnote = exports.insertFootnotesElement = exports.insertTableElementFooter = exports.insertInlineEquation = exports.insertCrossReference = exports.insertInlineCitation = exports.insertLink = exports.insertSectionLabel = exports.findPosBeforeFirstSubsection = exports.insertBreak = exports.deleteBlock = exports.insertBlock = exports.insertSupplement = exports.insertTable = exports.insertFigure = exports.insertGeneralTableFootnote = exports.insertInlineTableFootnote = exports.insertEmbed = exports.createBlock = exports.createSelection = exports.canInsert = exports.blockActive = exports.isNodeSelection = exports.markActive = exports.addToStart = void 0;
|
|
19
|
-
exports.activateSearchReplace = exports.activateSearch = exports.
|
|
19
|
+
exports.activateSearchReplace = exports.activateSearch = exports.autoComplete = exports.addColumns = void 0;
|
|
20
20
|
const json_schema_1 = require("@manuscripts/json-schema");
|
|
21
21
|
const track_changes_plugin_1 = require("@manuscripts/track-changes-plugin");
|
|
22
22
|
const transform_1 = require("@manuscripts/transform");
|
|
@@ -94,7 +94,8 @@ const canInsert = (type) => (state) => {
|
|
|
94
94
|
const { $from, $to } = state.selection;
|
|
95
95
|
if (($from.node().type === transform_1.schema.nodes.title ||
|
|
96
96
|
$from.node().type === transform_1.schema.nodes.section_title) &&
|
|
97
|
-
$from.pos === $to.pos
|
|
97
|
+
$from.pos === $to.pos &&
|
|
98
|
+
type !== transform_1.schema.nodes.text) {
|
|
98
99
|
return false;
|
|
99
100
|
}
|
|
100
101
|
if ((0, transform_1.isElementNodeType)(type) &&
|
|
@@ -1156,54 +1157,6 @@ const autoComplete = (state, dispatch) => {
|
|
|
1156
1157
|
return false;
|
|
1157
1158
|
};
|
|
1158
1159
|
exports.autoComplete = autoComplete;
|
|
1159
|
-
const canIndent = (state) => {
|
|
1160
|
-
const { $from } = state.selection;
|
|
1161
|
-
const node = $from.node($from.depth);
|
|
1162
|
-
const allowedNodeTypes = [transform_1.schema.nodes.paragraph];
|
|
1163
|
-
if (!allowedNodeTypes.includes(node.type)) {
|
|
1164
|
-
return false;
|
|
1165
|
-
}
|
|
1166
|
-
const isBody = (0, prosemirror_utils_1.hasParentNodeOfType)(transform_1.schema.nodes.body)(state.selection);
|
|
1167
|
-
if (!isBody || (0, track_changes_utils_1.isDeleted)(node)) {
|
|
1168
|
-
return false;
|
|
1169
|
-
}
|
|
1170
|
-
if (node.type === transform_1.schema.nodes.paragraph) {
|
|
1171
|
-
const parentNode = $from.node($from.depth - 1);
|
|
1172
|
-
if ((parentNode === null || parentNode === void 0 ? void 0 : parentNode.type) !== transform_1.schema.nodes.section &&
|
|
1173
|
-
(parentNode === null || parentNode === void 0 ? void 0 : parentNode.type) !== transform_1.schema.nodes.body) {
|
|
1174
|
-
return false;
|
|
1175
|
-
}
|
|
1176
|
-
}
|
|
1177
|
-
return true;
|
|
1178
|
-
};
|
|
1179
|
-
exports.canIndent = canIndent;
|
|
1180
|
-
const indent = () => (state, dispatch, view) => {
|
|
1181
|
-
const { $from } = state.selection;
|
|
1182
|
-
const nodeType = $from.node().type;
|
|
1183
|
-
if (nodeType === transform_1.schema.nodes.paragraph) {
|
|
1184
|
-
(0, exports.indentParagraph)()(state, dispatch, view);
|
|
1185
|
-
}
|
|
1186
|
-
};
|
|
1187
|
-
exports.indent = indent;
|
|
1188
|
-
const indentParagraph = () => (state, dispatch, view) => {
|
|
1189
|
-
const { $from } = state.selection;
|
|
1190
|
-
const { schema, tr } = state;
|
|
1191
|
-
const beforeParagraph = $from.before($from.depth);
|
|
1192
|
-
const sectionDepth = $from.depth - 1;
|
|
1193
|
-
const parentSection = $from.node(sectionDepth);
|
|
1194
|
-
const sectionStart = $from.start(sectionDepth);
|
|
1195
|
-
const sectionEnd = $from.end(sectionDepth);
|
|
1196
|
-
const sectionTitle = schema.nodes.section_title.create();
|
|
1197
|
-
const sectionContent = prosemirror_model_1.Fragment.from(sectionTitle).append(parentSection.content.cut(beforeParagraph - sectionStart));
|
|
1198
|
-
const newSection = schema.nodes.section.create({ id: (0, transform_1.generateNodeID)(schema.nodes.section) }, sectionContent);
|
|
1199
|
-
tr.replaceWith(beforeParagraph, sectionEnd, newSection);
|
|
1200
|
-
tr.setSelection(prosemirror_state_1.TextSelection.create(tr.doc, beforeParagraph + 2));
|
|
1201
|
-
if (dispatch) {
|
|
1202
|
-
dispatch((0, track_changes_plugin_1.skipTracking)(tr));
|
|
1203
|
-
view === null || view === void 0 ? void 0 : view.focus();
|
|
1204
|
-
}
|
|
1205
|
-
};
|
|
1206
|
-
exports.indentParagraph = indentParagraph;
|
|
1207
1160
|
const activateSearch = (state, dispatch) => {
|
|
1208
1161
|
const pluginState = search_replace_1.searchReplaceKey.getState(state);
|
|
1209
1162
|
const tr = state.tr.setMeta(search_replace_1.searchReplaceKey, {
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.promoteParagraphToSection = exports.demoteSectionToParagraph = exports.findSelectedOption = exports.titleCase = exports.optionName = void 0;
|
|
3
|
+
exports.indentParagraph = exports.indentSection = exports.indent = exports.canIndent = exports.promoteParagraphToSection = exports.demoteSectionToParagraph = exports.findSelectedOption = exports.titleCase = exports.optionName = void 0;
|
|
4
4
|
const track_changes_plugin_1 = require("@manuscripts/track-changes-plugin");
|
|
5
5
|
const transform_1 = require("@manuscripts/transform");
|
|
6
6
|
const prosemirror_model_1 = require("prosemirror-model");
|
|
7
7
|
const prosemirror_state_1 = require("prosemirror-state");
|
|
8
|
+
const prosemirror_utils_1 = require("prosemirror-utils");
|
|
9
|
+
const track_changes_utils_1 = require("../../lib/track-changes-utils");
|
|
8
10
|
const optionName = (nodeType) => {
|
|
9
11
|
switch (nodeType) {
|
|
10
12
|
case nodeType.schema.nodes.section:
|
|
@@ -133,3 +135,85 @@ const promoteParagraphToSection = (state, dispatch, view) => {
|
|
|
133
135
|
view && view.focus();
|
|
134
136
|
};
|
|
135
137
|
exports.promoteParagraphToSection = promoteParagraphToSection;
|
|
138
|
+
const canIndent = () => (state) => {
|
|
139
|
+
const { $from } = state.selection;
|
|
140
|
+
const nodeType = $from.node().type;
|
|
141
|
+
const allowedNodeTypes = [transform_1.schema.nodes.section_title, transform_1.schema.nodes.paragraph];
|
|
142
|
+
if (!allowedNodeTypes.includes(nodeType)) {
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
const isInBody = (0, prosemirror_utils_1.hasParentNodeOfType)(transform_1.schema.nodes.body)(state.selection);
|
|
146
|
+
const isDeletedNode = (0, track_changes_utils_1.isDeleted)($from.node($from.depth));
|
|
147
|
+
if (!isInBody || isDeletedNode) {
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
const isParagraph = nodeType === transform_1.schema.nodes.paragraph;
|
|
151
|
+
if (isParagraph) {
|
|
152
|
+
const parentNode = $from.node($from.depth - 1);
|
|
153
|
+
if ((parentNode === null || parentNode === void 0 ? void 0 : parentNode.type) !== transform_1.schema.nodes.section &&
|
|
154
|
+
(parentNode === null || parentNode === void 0 ? void 0 : parentNode.type) !== transform_1.schema.nodes.body) {
|
|
155
|
+
return false;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return true;
|
|
159
|
+
};
|
|
160
|
+
exports.canIndent = canIndent;
|
|
161
|
+
const indent = () => (state, dispatch, view) => {
|
|
162
|
+
const { $from } = state.selection;
|
|
163
|
+
const nodeType = $from.node().type;
|
|
164
|
+
if (nodeType === transform_1.schema.nodes.section_title) {
|
|
165
|
+
(0, exports.indentSection)()(state, dispatch, view);
|
|
166
|
+
}
|
|
167
|
+
else if (nodeType === transform_1.schema.nodes.paragraph) {
|
|
168
|
+
(0, exports.indentParagraph)()(state, dispatch, view);
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
exports.indent = indent;
|
|
172
|
+
const indentSection = () => (state, dispatch, view) => {
|
|
173
|
+
const { selection: { $from }, schema, tr, } = state;
|
|
174
|
+
const { nodes } = schema;
|
|
175
|
+
const sectionDepth = $from.depth - 1;
|
|
176
|
+
const section = $from.node(sectionDepth);
|
|
177
|
+
const beforeSection = $from.before(sectionDepth);
|
|
178
|
+
const afterSection = $from.after(sectionDepth);
|
|
179
|
+
const parentSectionDepth = sectionDepth - 1;
|
|
180
|
+
const parentSection = $from.node(parentSectionDepth);
|
|
181
|
+
const startIndex = $from.index(parentSectionDepth);
|
|
182
|
+
const previousSection = startIndex > 0 ? parentSection.child(startIndex - 1) : null;
|
|
183
|
+
const isValidContainer = (previousSection === null || previousSection === void 0 ? void 0 : previousSection.type) === nodes.section;
|
|
184
|
+
let anchor;
|
|
185
|
+
if (!previousSection || !isValidContainer) {
|
|
186
|
+
const emptyTitle = nodes.section_title.create();
|
|
187
|
+
const newParentSectionContent = prosemirror_model_1.Fragment.fromArray([emptyTitle, section]);
|
|
188
|
+
const newParentSection = nodes.section.create({}, newParentSectionContent);
|
|
189
|
+
tr.replaceWith(beforeSection, afterSection, newParentSection);
|
|
190
|
+
anchor = beforeSection + 1;
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
const newPreviousSection = previousSection.copy(previousSection.content.append(prosemirror_model_1.Fragment.from(section)));
|
|
194
|
+
const beforePreviousSection = beforeSection - previousSection.nodeSize;
|
|
195
|
+
tr.replaceWith(beforePreviousSection, afterSection, newPreviousSection);
|
|
196
|
+
anchor = beforePreviousSection + 1;
|
|
197
|
+
}
|
|
198
|
+
tr.setSelection(prosemirror_state_1.TextSelection.create(tr.doc, anchor));
|
|
199
|
+
dispatch((0, track_changes_plugin_1.skipTracking)(tr));
|
|
200
|
+
view && view.focus();
|
|
201
|
+
};
|
|
202
|
+
exports.indentSection = indentSection;
|
|
203
|
+
const indentParagraph = () => (state, dispatch, view) => {
|
|
204
|
+
const { $from } = state.selection;
|
|
205
|
+
const { schema, tr } = state;
|
|
206
|
+
const beforeParagraph = $from.before($from.depth);
|
|
207
|
+
const sectionDepth = $from.depth - 1;
|
|
208
|
+
const parentSection = $from.node(sectionDepth);
|
|
209
|
+
const sectionStart = $from.start(sectionDepth);
|
|
210
|
+
const sectionEnd = $from.end(sectionDepth);
|
|
211
|
+
const sectionTitle = schema.nodes.section_title.create();
|
|
212
|
+
const sectionContent = prosemirror_model_1.Fragment.from(sectionTitle).append(parentSection.content.cut(beforeParagraph - sectionStart));
|
|
213
|
+
const newSection = schema.nodes.section.create({ id: (0, transform_1.generateNodeID)(schema.nodes.section) }, sectionContent);
|
|
214
|
+
tr.replaceWith(beforeParagraph, sectionEnd, newSection);
|
|
215
|
+
tr.setSelection(prosemirror_state_1.TextSelection.create(tr.doc, beforeParagraph + 2));
|
|
216
|
+
dispatch((0, track_changes_plugin_1.skipTracking)(tr));
|
|
217
|
+
view === null || view === void 0 ? void 0 : view.focus();
|
|
218
|
+
};
|
|
219
|
+
exports.indentParagraph = indentParagraph;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.openInsertSpecialCharacterDialog = void 0;
|
|
30
|
+
const style_guide_1 = require("@manuscripts/style-guide");
|
|
31
|
+
const react_1 = __importStar(require("react"));
|
|
32
|
+
const react_select_1 = __importDefault(require("react-select"));
|
|
33
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
34
|
+
const editor_props_1 = require("../../plugins/editor-props");
|
|
35
|
+
const ReactSubView_1 = __importDefault(require("../../views/ReactSubView"));
|
|
36
|
+
const unicodeRanges = [
|
|
37
|
+
{ label: 'Latin', value: [0x0100, 0x024f] },
|
|
38
|
+
{ label: 'Greek and Coptic', value: [0x0370, 0x03ff] },
|
|
39
|
+
{ label: 'Mathematical Operators', value: [0x2200, 0x22ff] },
|
|
40
|
+
{ label: 'Arrows', value: [0x2190, 0x21ff] },
|
|
41
|
+
];
|
|
42
|
+
const reservedCharacters = new Set([
|
|
43
|
+
0x0380, 0x0381, 0x0382, 0x0383, 0x03a2, 0x0378, 0x0379, 0x038b, 0x038d,
|
|
44
|
+
]);
|
|
45
|
+
const generateCharacters = (start, end) => Array.from({ length: end - start + 1 }, (_, i) => start + i)
|
|
46
|
+
.filter((c) => !reservedCharacters.has(c))
|
|
47
|
+
.map((c) => String.fromCharCode(c));
|
|
48
|
+
const InsertSpecialCharacterDialog = ({ view, }) => {
|
|
49
|
+
const [isOpen, setOpen] = (0, react_1.useState)(true);
|
|
50
|
+
const [range, setRange] = (0, react_1.useState)(unicodeRanges[0].value);
|
|
51
|
+
const handleRangeChange = (range) => range && setRange(range.value);
|
|
52
|
+
const handleClose = () => setOpen(false);
|
|
53
|
+
const addCharacter = (event) => view.dispatch(view.state.tr.insertText(event.currentTarget.value, view.state.selection.from));
|
|
54
|
+
return (react_1.default.createElement(style_guide_1.StyledModal, { isOpen: isOpen, onRequestClose: handleClose, shouldCloseOnOverlayClick: true },
|
|
55
|
+
react_1.default.createElement(Container, { "data-cy": "special-characters-modal" },
|
|
56
|
+
react_1.default.createElement(style_guide_1.ModalHeader, null,
|
|
57
|
+
react_1.default.createElement(style_guide_1.CloseButton, { onClick: handleClose, "data-cy": "modal-close-button" })),
|
|
58
|
+
react_1.default.createElement(StyledModalBody, null,
|
|
59
|
+
react_1.default.createElement(StyledModalSidebar, null,
|
|
60
|
+
react_1.default.createElement(style_guide_1.ModalSidebarHeader, null,
|
|
61
|
+
react_1.default.createElement(style_guide_1.ModalSidebarTitle, null, "Insert special characters")),
|
|
62
|
+
react_1.default.createElement(StyledSidebarContent, null,
|
|
63
|
+
react_1.default.createElement(react_select_1.default, { onChange: handleRangeChange, classNamePrefix: 'special-characters-ranges-select', defaultValue: unicodeRanges[0], options: unicodeRanges, components: {
|
|
64
|
+
Option: OptionComponent,
|
|
65
|
+
}, menuPosition: "fixed" }),
|
|
66
|
+
react_1.default.createElement(CharactersSetContainer, null,
|
|
67
|
+
react_1.default.createElement(CharactersSet, null, generateCharacters(range[0], range[1]).map((character) => (react_1.default.createElement(Character, { key: character, value: character, onClick: addCharacter, "data-cy": "special-character" }, character)))))),
|
|
68
|
+
react_1.default.createElement(ButtonsContainer, null,
|
|
69
|
+
react_1.default.createElement(style_guide_1.PrimaryButton, { onClick: handleClose }, "Close")))))));
|
|
70
|
+
};
|
|
71
|
+
const OptionComponent = ({ innerProps, data, }) => {
|
|
72
|
+
return (react_1.default.createElement(OptionWrapper, Object.assign({}, innerProps, { ref: null }), data.label));
|
|
73
|
+
};
|
|
74
|
+
const Container = (0, styled_components_1.default)(style_guide_1.ModalContainer) `
|
|
75
|
+
padding: 8px;
|
|
76
|
+
`;
|
|
77
|
+
const StyledModalSidebar = (0, styled_components_1.default)(style_guide_1.ModalSidebar) `
|
|
78
|
+
background: white;
|
|
79
|
+
width: 30vw;
|
|
80
|
+
`;
|
|
81
|
+
const StyledModalBody = (0, styled_components_1.default)(style_guide_1.ModalBody) `
|
|
82
|
+
height: 60vh;
|
|
83
|
+
`;
|
|
84
|
+
const StyledSidebarContent = (0, styled_components_1.default)(style_guide_1.SidebarContent) `
|
|
85
|
+
display: flex;
|
|
86
|
+
flex-direction: column;
|
|
87
|
+
`;
|
|
88
|
+
const ButtonsContainer = (0, styled_components_1.default)(style_guide_1.ButtonGroup) `
|
|
89
|
+
padding-top: ${(props) => props.theme.grid.unit * 5}px;
|
|
90
|
+
`;
|
|
91
|
+
const OptionWrapper = styled_components_1.default.div `
|
|
92
|
+
padding-left: ${(props) => props.theme.grid.unit * 4}px;
|
|
93
|
+
padding-top: ${(props) => props.theme.grid.unit * 2}px;
|
|
94
|
+
padding-bottom: ${(props) => props.theme.grid.unit * 2}px;
|
|
95
|
+
|
|
96
|
+
background-color: ${(props) => props.focused ? props.theme.colors.background.fifth : 'transparent'};
|
|
97
|
+
|
|
98
|
+
&:hover {
|
|
99
|
+
background-color: ${(props) => props.theme.colors.background.fifth};
|
|
100
|
+
}
|
|
101
|
+
`;
|
|
102
|
+
const CharactersSetContainer = styled_components_1.default.div `
|
|
103
|
+
flex: 1;
|
|
104
|
+
overflow-y: scroll;
|
|
105
|
+
margin: 18px 0;
|
|
106
|
+
border: 1px solid #ddd;
|
|
107
|
+
`;
|
|
108
|
+
const CharactersSet = (0, styled_components_1.default)(style_guide_1.IconButtonGroup) `
|
|
109
|
+
display: grid;
|
|
110
|
+
grid-template-columns: repeat(auto-fit, minmax(28px, max-content));
|
|
111
|
+
height: ${(props) => props.theme.grid.unit * 8}px;
|
|
112
|
+
`;
|
|
113
|
+
const Character = (0, styled_components_1.default)(style_guide_1.IconButton) `
|
|
114
|
+
border-bottom: 1px solid #ddd;
|
|
115
|
+
border-right: 1px solid #ddd;
|
|
116
|
+
border-radius: unset;
|
|
117
|
+
|
|
118
|
+
:hover {
|
|
119
|
+
background-color: #f0f0f0 !important;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
:active,
|
|
123
|
+
:focus {
|
|
124
|
+
color: inherit !important;
|
|
125
|
+
border-bottom: 1px solid #ddd !important;
|
|
126
|
+
border-right: 1px solid #ddd !important;
|
|
127
|
+
}
|
|
128
|
+
`;
|
|
129
|
+
const openInsertSpecialCharacterDialog = (view) => {
|
|
130
|
+
if (!view) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
const { state } = view;
|
|
134
|
+
const props = (0, editor_props_1.getEditorProps)(state);
|
|
135
|
+
const dialog = (0, ReactSubView_1.default)(props, InsertSpecialCharacterDialog, { view }, state.doc, () => 0, view);
|
|
136
|
+
document.body.appendChild(dialog);
|
|
137
|
+
};
|
|
138
|
+
exports.openInsertSpecialCharacterDialog = openInsertSpecialCharacterDialog;
|
package/dist/cjs/menus.js
CHANGED
|
@@ -23,6 +23,7 @@ const commands_1 = require("./commands");
|
|
|
23
23
|
const InsertEmbedDialog_1 = require("./components/toolbar/InsertEmbedDialog");
|
|
24
24
|
const InsertTableDialog_1 = require("./components/toolbar/InsertTableDialog");
|
|
25
25
|
const ListMenuItem_1 = require("./components/toolbar/ListMenuItem");
|
|
26
|
+
const InsertSpecialCharacter_1 = require("./components/views/InsertSpecialCharacter");
|
|
26
27
|
const hierarchy_1 = require("./lib/hierarchy");
|
|
27
28
|
const editor_props_1 = require("./plugins/editor-props");
|
|
28
29
|
const getEditorMenus = (editor) => {
|
|
@@ -317,6 +318,12 @@ const getEditorMenus = (editor) => {
|
|
|
317
318
|
isEnabled: isCommandValid((0, commands_1.canInsert)(transform_1.schema.nodes.inline_footnote)),
|
|
318
319
|
run: doCommand(commands_1.insertInlineFootnote),
|
|
319
320
|
},
|
|
321
|
+
{
|
|
322
|
+
id: 'insert-special-character',
|
|
323
|
+
label: 'Special Characters',
|
|
324
|
+
isEnabled: isCommandValid((0, commands_1.canInsert)(transform_1.schema.nodes.text)),
|
|
325
|
+
run: () => (0, InsertSpecialCharacter_1.openInsertSpecialCharacterDialog)(editor.view),
|
|
326
|
+
},
|
|
320
327
|
{
|
|
321
328
|
id: 'insert-comment',
|
|
322
329
|
label: 'Comment',
|
package/dist/cjs/toolbar.js
CHANGED
|
@@ -24,14 +24,15 @@ const transform_1 = require("@manuscripts/transform");
|
|
|
24
24
|
const prosemirror_commands_1 = require("prosemirror-commands");
|
|
25
25
|
const react_1 = __importDefault(require("react"));
|
|
26
26
|
const commands_1 = require("./commands");
|
|
27
|
+
const helpers_1 = require("./components/toolbar/helpers");
|
|
27
28
|
const InsertTableDialog_1 = require("./components/toolbar/InsertTableDialog");
|
|
28
29
|
exports.toolbar = {
|
|
29
30
|
indentation: {
|
|
30
31
|
indent: {
|
|
31
32
|
title: 'Indent',
|
|
32
33
|
content: react_1.default.createElement(style_guide_1.ToolbarIndentIcon, null),
|
|
33
|
-
isEnabled: (
|
|
34
|
-
run: (0,
|
|
34
|
+
isEnabled: (0, helpers_1.canIndent)(),
|
|
35
|
+
run: (0, helpers_1.indent)(),
|
|
35
36
|
},
|
|
36
37
|
},
|
|
37
38
|
style: {
|
package/dist/cjs/versions.js
CHANGED
package/dist/es/commands.js
CHANGED
|
@@ -86,7 +86,8 @@ export const canInsert = (type) => (state) => {
|
|
|
86
86
|
const { $from, $to } = state.selection;
|
|
87
87
|
if (($from.node().type === schema.nodes.title ||
|
|
88
88
|
$from.node().type === schema.nodes.section_title) &&
|
|
89
|
-
$from.pos === $to.pos
|
|
89
|
+
$from.pos === $to.pos &&
|
|
90
|
+
type !== schema.nodes.text) {
|
|
90
91
|
return false;
|
|
91
92
|
}
|
|
92
93
|
if (isElementNodeType(type) &&
|
|
@@ -1100,51 +1101,6 @@ export const autoComplete = (state, dispatch) => {
|
|
|
1100
1101
|
}
|
|
1101
1102
|
return false;
|
|
1102
1103
|
};
|
|
1103
|
-
export const canIndent = (state) => {
|
|
1104
|
-
const { $from } = state.selection;
|
|
1105
|
-
const node = $from.node($from.depth);
|
|
1106
|
-
const allowedNodeTypes = [schema.nodes.paragraph];
|
|
1107
|
-
if (!allowedNodeTypes.includes(node.type)) {
|
|
1108
|
-
return false;
|
|
1109
|
-
}
|
|
1110
|
-
const isBody = hasParentNodeOfType(schema.nodes.body)(state.selection);
|
|
1111
|
-
if (!isBody || isDeleted(node)) {
|
|
1112
|
-
return false;
|
|
1113
|
-
}
|
|
1114
|
-
if (node.type === schema.nodes.paragraph) {
|
|
1115
|
-
const parentNode = $from.node($from.depth - 1);
|
|
1116
|
-
if ((parentNode === null || parentNode === void 0 ? void 0 : parentNode.type) !== schema.nodes.section &&
|
|
1117
|
-
(parentNode === null || parentNode === void 0 ? void 0 : parentNode.type) !== schema.nodes.body) {
|
|
1118
|
-
return false;
|
|
1119
|
-
}
|
|
1120
|
-
}
|
|
1121
|
-
return true;
|
|
1122
|
-
};
|
|
1123
|
-
export const indent = () => (state, dispatch, view) => {
|
|
1124
|
-
const { $from } = state.selection;
|
|
1125
|
-
const nodeType = $from.node().type;
|
|
1126
|
-
if (nodeType === schema.nodes.paragraph) {
|
|
1127
|
-
indentParagraph()(state, dispatch, view);
|
|
1128
|
-
}
|
|
1129
|
-
};
|
|
1130
|
-
export const indentParagraph = () => (state, dispatch, view) => {
|
|
1131
|
-
const { $from } = state.selection;
|
|
1132
|
-
const { schema, tr } = state;
|
|
1133
|
-
const beforeParagraph = $from.before($from.depth);
|
|
1134
|
-
const sectionDepth = $from.depth - 1;
|
|
1135
|
-
const parentSection = $from.node(sectionDepth);
|
|
1136
|
-
const sectionStart = $from.start(sectionDepth);
|
|
1137
|
-
const sectionEnd = $from.end(sectionDepth);
|
|
1138
|
-
const sectionTitle = schema.nodes.section_title.create();
|
|
1139
|
-
const sectionContent = Fragment.from(sectionTitle).append(parentSection.content.cut(beforeParagraph - sectionStart));
|
|
1140
|
-
const newSection = schema.nodes.section.create({ id: generateNodeID(schema.nodes.section) }, sectionContent);
|
|
1141
|
-
tr.replaceWith(beforeParagraph, sectionEnd, newSection);
|
|
1142
|
-
tr.setSelection(TextSelection.create(tr.doc, beforeParagraph + 2));
|
|
1143
|
-
if (dispatch) {
|
|
1144
|
-
dispatch(skipTracking(tr));
|
|
1145
|
-
view === null || view === void 0 ? void 0 : view.focus();
|
|
1146
|
-
}
|
|
1147
|
-
};
|
|
1148
1104
|
export const activateSearch = (state, dispatch) => {
|
|
1149
1105
|
const pluginState = searchReplaceKey.getState(state);
|
|
1150
1106
|
const tr = state.tr.setMeta(searchReplaceKey, {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { skipTracking } from '@manuscripts/track-changes-plugin';
|
|
2
|
-
import { generateNodeID, isSectionNodeType, nodeNames, } from '@manuscripts/transform';
|
|
2
|
+
import { generateNodeID, isSectionNodeType, nodeNames, schema, } from '@manuscripts/transform';
|
|
3
3
|
import { Fragment } from 'prosemirror-model';
|
|
4
4
|
import { TextSelection } from 'prosemirror-state';
|
|
5
|
+
import { hasParentNodeOfType } from 'prosemirror-utils';
|
|
6
|
+
import { isDeleted } from '../../lib/track-changes-utils';
|
|
5
7
|
export const optionName = (nodeType) => {
|
|
6
8
|
switch (nodeType) {
|
|
7
9
|
case nodeType.schema.nodes.section:
|
|
@@ -125,3 +127,81 @@ export const promoteParagraphToSection = (state, dispatch, view) => {
|
|
|
125
127
|
dispatch(skipTracking(tr));
|
|
126
128
|
view && view.focus();
|
|
127
129
|
};
|
|
130
|
+
export const canIndent = () => (state) => {
|
|
131
|
+
const { $from } = state.selection;
|
|
132
|
+
const nodeType = $from.node().type;
|
|
133
|
+
const allowedNodeTypes = [schema.nodes.section_title, schema.nodes.paragraph];
|
|
134
|
+
if (!allowedNodeTypes.includes(nodeType)) {
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
const isInBody = hasParentNodeOfType(schema.nodes.body)(state.selection);
|
|
138
|
+
const isDeletedNode = isDeleted($from.node($from.depth));
|
|
139
|
+
if (!isInBody || isDeletedNode) {
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
const isParagraph = nodeType === schema.nodes.paragraph;
|
|
143
|
+
if (isParagraph) {
|
|
144
|
+
const parentNode = $from.node($from.depth - 1);
|
|
145
|
+
if ((parentNode === null || parentNode === void 0 ? void 0 : parentNode.type) !== schema.nodes.section &&
|
|
146
|
+
(parentNode === null || parentNode === void 0 ? void 0 : parentNode.type) !== schema.nodes.body) {
|
|
147
|
+
return false;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return true;
|
|
151
|
+
};
|
|
152
|
+
export const indent = () => (state, dispatch, view) => {
|
|
153
|
+
const { $from } = state.selection;
|
|
154
|
+
const nodeType = $from.node().type;
|
|
155
|
+
if (nodeType === schema.nodes.section_title) {
|
|
156
|
+
indentSection()(state, dispatch, view);
|
|
157
|
+
}
|
|
158
|
+
else if (nodeType === schema.nodes.paragraph) {
|
|
159
|
+
indentParagraph()(state, dispatch, view);
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
export const indentSection = () => (state, dispatch, view) => {
|
|
163
|
+
const { selection: { $from }, schema, tr, } = state;
|
|
164
|
+
const { nodes } = schema;
|
|
165
|
+
const sectionDepth = $from.depth - 1;
|
|
166
|
+
const section = $from.node(sectionDepth);
|
|
167
|
+
const beforeSection = $from.before(sectionDepth);
|
|
168
|
+
const afterSection = $from.after(sectionDepth);
|
|
169
|
+
const parentSectionDepth = sectionDepth - 1;
|
|
170
|
+
const parentSection = $from.node(parentSectionDepth);
|
|
171
|
+
const startIndex = $from.index(parentSectionDepth);
|
|
172
|
+
const previousSection = startIndex > 0 ? parentSection.child(startIndex - 1) : null;
|
|
173
|
+
const isValidContainer = (previousSection === null || previousSection === void 0 ? void 0 : previousSection.type) === nodes.section;
|
|
174
|
+
let anchor;
|
|
175
|
+
if (!previousSection || !isValidContainer) {
|
|
176
|
+
const emptyTitle = nodes.section_title.create();
|
|
177
|
+
const newParentSectionContent = Fragment.fromArray([emptyTitle, section]);
|
|
178
|
+
const newParentSection = nodes.section.create({}, newParentSectionContent);
|
|
179
|
+
tr.replaceWith(beforeSection, afterSection, newParentSection);
|
|
180
|
+
anchor = beforeSection + 1;
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
const newPreviousSection = previousSection.copy(previousSection.content.append(Fragment.from(section)));
|
|
184
|
+
const beforePreviousSection = beforeSection - previousSection.nodeSize;
|
|
185
|
+
tr.replaceWith(beforePreviousSection, afterSection, newPreviousSection);
|
|
186
|
+
anchor = beforePreviousSection + 1;
|
|
187
|
+
}
|
|
188
|
+
tr.setSelection(TextSelection.create(tr.doc, anchor));
|
|
189
|
+
dispatch(skipTracking(tr));
|
|
190
|
+
view && view.focus();
|
|
191
|
+
};
|
|
192
|
+
export const indentParagraph = () => (state, dispatch, view) => {
|
|
193
|
+
const { $from } = state.selection;
|
|
194
|
+
const { schema, tr } = state;
|
|
195
|
+
const beforeParagraph = $from.before($from.depth);
|
|
196
|
+
const sectionDepth = $from.depth - 1;
|
|
197
|
+
const parentSection = $from.node(sectionDepth);
|
|
198
|
+
const sectionStart = $from.start(sectionDepth);
|
|
199
|
+
const sectionEnd = $from.end(sectionDepth);
|
|
200
|
+
const sectionTitle = schema.nodes.section_title.create();
|
|
201
|
+
const sectionContent = Fragment.from(sectionTitle).append(parentSection.content.cut(beforeParagraph - sectionStart));
|
|
202
|
+
const newSection = schema.nodes.section.create({ id: generateNodeID(schema.nodes.section) }, sectionContent);
|
|
203
|
+
tr.replaceWith(beforeParagraph, sectionEnd, newSection);
|
|
204
|
+
tr.setSelection(TextSelection.create(tr.doc, beforeParagraph + 2));
|
|
205
|
+
dispatch(skipTracking(tr));
|
|
206
|
+
view === null || view === void 0 ? void 0 : view.focus();
|
|
207
|
+
};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { ButtonGroup, CloseButton, IconButton, IconButtonGroup, ModalBody, ModalContainer, ModalHeader, ModalSidebar, ModalSidebarHeader, ModalSidebarTitle, PrimaryButton, SidebarContent, StyledModal, } from '@manuscripts/style-guide';
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
|
+
import Select from 'react-select';
|
|
4
|
+
import styled from 'styled-components';
|
|
5
|
+
import { getEditorProps } from '../../plugins/editor-props';
|
|
6
|
+
import ReactSubView from '../../views/ReactSubView';
|
|
7
|
+
const unicodeRanges = [
|
|
8
|
+
{ label: 'Latin', value: [0x0100, 0x024f] },
|
|
9
|
+
{ label: 'Greek and Coptic', value: [0x0370, 0x03ff] },
|
|
10
|
+
{ label: 'Mathematical Operators', value: [0x2200, 0x22ff] },
|
|
11
|
+
{ label: 'Arrows', value: [0x2190, 0x21ff] },
|
|
12
|
+
];
|
|
13
|
+
const reservedCharacters = new Set([
|
|
14
|
+
0x0380, 0x0381, 0x0382, 0x0383, 0x03a2, 0x0378, 0x0379, 0x038b, 0x038d,
|
|
15
|
+
]);
|
|
16
|
+
const generateCharacters = (start, end) => Array.from({ length: end - start + 1 }, (_, i) => start + i)
|
|
17
|
+
.filter((c) => !reservedCharacters.has(c))
|
|
18
|
+
.map((c) => String.fromCharCode(c));
|
|
19
|
+
const InsertSpecialCharacterDialog = ({ view, }) => {
|
|
20
|
+
const [isOpen, setOpen] = useState(true);
|
|
21
|
+
const [range, setRange] = useState(unicodeRanges[0].value);
|
|
22
|
+
const handleRangeChange = (range) => range && setRange(range.value);
|
|
23
|
+
const handleClose = () => setOpen(false);
|
|
24
|
+
const addCharacter = (event) => view.dispatch(view.state.tr.insertText(event.currentTarget.value, view.state.selection.from));
|
|
25
|
+
return (React.createElement(StyledModal, { isOpen: isOpen, onRequestClose: handleClose, shouldCloseOnOverlayClick: true },
|
|
26
|
+
React.createElement(Container, { "data-cy": "special-characters-modal" },
|
|
27
|
+
React.createElement(ModalHeader, null,
|
|
28
|
+
React.createElement(CloseButton, { onClick: handleClose, "data-cy": "modal-close-button" })),
|
|
29
|
+
React.createElement(StyledModalBody, null,
|
|
30
|
+
React.createElement(StyledModalSidebar, null,
|
|
31
|
+
React.createElement(ModalSidebarHeader, null,
|
|
32
|
+
React.createElement(ModalSidebarTitle, null, "Insert special characters")),
|
|
33
|
+
React.createElement(StyledSidebarContent, null,
|
|
34
|
+
React.createElement(Select, { onChange: handleRangeChange, classNamePrefix: 'special-characters-ranges-select', defaultValue: unicodeRanges[0], options: unicodeRanges, components: {
|
|
35
|
+
Option: OptionComponent,
|
|
36
|
+
}, menuPosition: "fixed" }),
|
|
37
|
+
React.createElement(CharactersSetContainer, null,
|
|
38
|
+
React.createElement(CharactersSet, null, generateCharacters(range[0], range[1]).map((character) => (React.createElement(Character, { key: character, value: character, onClick: addCharacter, "data-cy": "special-character" }, character)))))),
|
|
39
|
+
React.createElement(ButtonsContainer, null,
|
|
40
|
+
React.createElement(PrimaryButton, { onClick: handleClose }, "Close")))))));
|
|
41
|
+
};
|
|
42
|
+
const OptionComponent = ({ innerProps, data, }) => {
|
|
43
|
+
return (React.createElement(OptionWrapper, Object.assign({}, innerProps, { ref: null }), data.label));
|
|
44
|
+
};
|
|
45
|
+
const Container = styled(ModalContainer) `
|
|
46
|
+
padding: 8px;
|
|
47
|
+
`;
|
|
48
|
+
const StyledModalSidebar = styled(ModalSidebar) `
|
|
49
|
+
background: white;
|
|
50
|
+
width: 30vw;
|
|
51
|
+
`;
|
|
52
|
+
const StyledModalBody = styled(ModalBody) `
|
|
53
|
+
height: 60vh;
|
|
54
|
+
`;
|
|
55
|
+
const StyledSidebarContent = styled(SidebarContent) `
|
|
56
|
+
display: flex;
|
|
57
|
+
flex-direction: column;
|
|
58
|
+
`;
|
|
59
|
+
const ButtonsContainer = styled(ButtonGroup) `
|
|
60
|
+
padding-top: ${(props) => props.theme.grid.unit * 5}px;
|
|
61
|
+
`;
|
|
62
|
+
const OptionWrapper = styled.div `
|
|
63
|
+
padding-left: ${(props) => props.theme.grid.unit * 4}px;
|
|
64
|
+
padding-top: ${(props) => props.theme.grid.unit * 2}px;
|
|
65
|
+
padding-bottom: ${(props) => props.theme.grid.unit * 2}px;
|
|
66
|
+
|
|
67
|
+
background-color: ${(props) => props.focused ? props.theme.colors.background.fifth : 'transparent'};
|
|
68
|
+
|
|
69
|
+
&:hover {
|
|
70
|
+
background-color: ${(props) => props.theme.colors.background.fifth};
|
|
71
|
+
}
|
|
72
|
+
`;
|
|
73
|
+
const CharactersSetContainer = styled.div `
|
|
74
|
+
flex: 1;
|
|
75
|
+
overflow-y: scroll;
|
|
76
|
+
margin: 18px 0;
|
|
77
|
+
border: 1px solid #ddd;
|
|
78
|
+
`;
|
|
79
|
+
const CharactersSet = styled(IconButtonGroup) `
|
|
80
|
+
display: grid;
|
|
81
|
+
grid-template-columns: repeat(auto-fit, minmax(28px, max-content));
|
|
82
|
+
height: ${(props) => props.theme.grid.unit * 8}px;
|
|
83
|
+
`;
|
|
84
|
+
const Character = styled(IconButton) `
|
|
85
|
+
border-bottom: 1px solid #ddd;
|
|
86
|
+
border-right: 1px solid #ddd;
|
|
87
|
+
border-radius: unset;
|
|
88
|
+
|
|
89
|
+
:hover {
|
|
90
|
+
background-color: #f0f0f0 !important;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
:active,
|
|
94
|
+
:focus {
|
|
95
|
+
color: inherit !important;
|
|
96
|
+
border-bottom: 1px solid #ddd !important;
|
|
97
|
+
border-right: 1px solid #ddd !important;
|
|
98
|
+
}
|
|
99
|
+
`;
|
|
100
|
+
export const openInsertSpecialCharacterDialog = (view) => {
|
|
101
|
+
if (!view) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
const { state } = view;
|
|
105
|
+
const props = getEditorProps(state);
|
|
106
|
+
const dialog = ReactSubView(props, InsertSpecialCharacterDialog, { view }, state.doc, () => 0, view);
|
|
107
|
+
document.body.appendChild(dialog);
|
|
108
|
+
};
|
package/dist/es/menus.js
CHANGED
|
@@ -20,6 +20,7 @@ import { activateSearchReplace, addInlineComment, blockActive, canInsert, insert
|
|
|
20
20
|
import { openEmbedDialog } from './components/toolbar/InsertEmbedDialog';
|
|
21
21
|
import { openInsertTableDialog } from './components/toolbar/InsertTableDialog';
|
|
22
22
|
import { ListMenuItem } from './components/toolbar/ListMenuItem';
|
|
23
|
+
import { openInsertSpecialCharacterDialog } from './components/views/InsertSpecialCharacter';
|
|
23
24
|
import { deleteClosestParentElement, findClosestParentElementNodeName, } from './lib/hierarchy';
|
|
24
25
|
import { getEditorProps } from './plugins/editor-props';
|
|
25
26
|
export const getEditorMenus = (editor) => {
|
|
@@ -314,6 +315,12 @@ export const getEditorMenus = (editor) => {
|
|
|
314
315
|
isEnabled: isCommandValid(canInsert(schema.nodes.inline_footnote)),
|
|
315
316
|
run: doCommand(insertInlineFootnote),
|
|
316
317
|
},
|
|
318
|
+
{
|
|
319
|
+
id: 'insert-special-character',
|
|
320
|
+
label: 'Special Characters',
|
|
321
|
+
isEnabled: isCommandValid(canInsert(schema.nodes.text)),
|
|
322
|
+
run: () => openInsertSpecialCharacterDialog(editor.view),
|
|
323
|
+
},
|
|
317
324
|
{
|
|
318
325
|
id: 'insert-comment',
|
|
319
326
|
label: 'Comment',
|
package/dist/es/toolbar.js
CHANGED
|
@@ -17,14 +17,15 @@ import { AddCommentIcon, ToolbarBoldIcon, ToolbarCitationIcon, ToolbarEquationIc
|
|
|
17
17
|
import { schema } from '@manuscripts/transform';
|
|
18
18
|
import { toggleMark } from 'prosemirror-commands';
|
|
19
19
|
import React from 'react';
|
|
20
|
-
import { addInlineComment, blockActive,
|
|
20
|
+
import { addInlineComment, blockActive, canInsert, insertBlock, insertInlineCitation, insertList, markActive, } from './commands';
|
|
21
|
+
import { canIndent, indent } from './components/toolbar/helpers';
|
|
21
22
|
import { openInsertTableDialog } from './components/toolbar/InsertTableDialog';
|
|
22
23
|
export const toolbar = {
|
|
23
24
|
indentation: {
|
|
24
25
|
indent: {
|
|
25
26
|
title: 'Indent',
|
|
26
27
|
content: React.createElement(ToolbarIndentIcon, null),
|
|
27
|
-
isEnabled:
|
|
28
|
+
isEnabled: canIndent(),
|
|
28
29
|
run: indent(),
|
|
29
30
|
},
|
|
30
31
|
},
|
package/dist/es/versions.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '2.8.
|
|
1
|
+
export const VERSION = '2.8.7';
|
|
2
2
|
export const MATHJAX_VERSION = '3.2.2';
|
package/dist/types/commands.d.ts
CHANGED
|
@@ -80,8 +80,5 @@ export declare const addRows: (direction: 'top' | 'bottom') => (state: EditorSta
|
|
|
80
80
|
export declare const addHeaderRow: (direction: 'above' | 'below') => (state: EditorState, dispatch?: ((tr: Transaction) => void) | undefined) => boolean;
|
|
81
81
|
export declare const addColumns: (direction: 'right' | 'left') => (state: EditorState, dispatch?: ((tr: Transaction) => void) | undefined) => boolean;
|
|
82
82
|
export declare const autoComplete: (state: ManuscriptEditorState, dispatch?: Dispatch) => boolean;
|
|
83
|
-
export declare const canIndent: (state: ManuscriptEditorState) => boolean;
|
|
84
|
-
export declare const indent: () => (state: EditorState, dispatch: Dispatch, view?: EditorView) => void;
|
|
85
|
-
export declare const indentParagraph: () => (state: ManuscriptEditorState, dispatch?: Dispatch, view?: ManuscriptEditorView) => void;
|
|
86
83
|
export declare const activateSearch: (state: ManuscriptEditorState, dispatch?: Dispatch) => boolean;
|
|
87
84
|
export declare const activateSearchReplace: (state: ManuscriptEditorState, dispatch?: Dispatch) => boolean;
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { ManuscriptEditorView, ManuscriptNodeType } from '@manuscripts/transform';
|
|
2
2
|
import { EditorState, Transaction } from 'prosemirror-state';
|
|
3
|
+
import { EditorView } from 'prosemirror-view';
|
|
4
|
+
import { Dispatch } from '../../commands';
|
|
3
5
|
import { Option } from './type-selector/TypeSelector';
|
|
4
6
|
export declare const optionName: (nodeType: ManuscriptNodeType) => string;
|
|
5
7
|
export declare const titleCase: (text: string) => string;
|
|
6
8
|
export declare const findSelectedOption: (options: Option[]) => Option | undefined;
|
|
7
9
|
export declare const demoteSectionToParagraph: (state: EditorState, dispatch: (tr: Transaction) => void, view?: ManuscriptEditorView) => void;
|
|
8
10
|
export declare const promoteParagraphToSection: (state: EditorState, dispatch: (tr: Transaction) => void, view?: ManuscriptEditorView) => void;
|
|
11
|
+
export declare const canIndent: () => (state: EditorState) => boolean;
|
|
12
|
+
export declare const indent: () => (state: EditorState, dispatch: Dispatch, view?: EditorView) => void;
|
|
13
|
+
export declare const indentSection: () => (state: EditorState, dispatch: Dispatch, view?: EditorView) => void;
|
|
14
|
+
export declare const indentParagraph: () => (state: EditorState, dispatch: Dispatch, view?: EditorView) => void;
|
package/dist/types/versions.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "2.8.
|
|
1
|
+
export declare const VERSION = "2.8.7";
|
|
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": "2.8.
|
|
4
|
+
"version": "2.8.7",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-body-editor",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@iarna/word-count": "^1.1.2",
|
|
33
33
|
"@manuscripts/json-schema": "2.2.11",
|
|
34
34
|
"@manuscripts/library": "1.3.11",
|
|
35
|
-
"@manuscripts/style-guide": "2.1.
|
|
35
|
+
"@manuscripts/style-guide": "2.1.4",
|
|
36
36
|
"@manuscripts/track-changes-plugin": "1.10.0",
|
|
37
37
|
"@manuscripts/transform": "3.0.45",
|
|
38
38
|
"@popperjs/core": "^2.11.8",
|
|
@@ -1173,3 +1173,11 @@ th:hover > .table-context-menu-button,
|
|
|
1173
1173
|
.search-result.search-result-selected {
|
|
1174
1174
|
background-color: #ffbdf8;
|
|
1175
1175
|
}
|
|
1176
|
+
|
|
1177
|
+
.special-characters-ranges-select__control {
|
|
1178
|
+
width: fit-content;
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1181
|
+
.special-characters-ranges-select__menu {
|
|
1182
|
+
min-width: 220px;
|
|
1183
|
+
}
|