@manuscripts/body-editor 2.0.9 → 2.0.11

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.
@@ -37,6 +37,7 @@ const objects_1 = __importDefault(require("../plugins/objects"));
37
37
  const paragraphs_1 = __importDefault(require("../plugins/paragraphs"));
38
38
  const persist_1 = __importDefault(require("../plugins/persist"));
39
39
  const placeholder_1 = __importDefault(require("../plugins/placeholder"));
40
+ const section_title_1 = __importDefault(require("../plugins/section_title"));
40
41
  const sections_1 = __importDefault(require("../plugins/sections"));
41
42
  const selected_suggestion_1 = __importDefault(require("../plugins/selected-suggestion"));
42
43
  const table_footnote_1 = __importDefault(require("../plugins/table-footnote"));
@@ -56,6 +57,7 @@ exports.default = (props) => {
56
57
  ? track_changes_plugin_1.TrackChangesStatus.disabled
57
58
  : track_changes_plugin_1.TrackChangesStatus.enabled,
58
59
  }),
60
+ (0, section_title_1.default)(),
59
61
  (0, tables_cursor_fix_1.default)(),
60
62
  (0, elements_1.default)(),
61
63
  (0, persist_1.default)(),
@@ -44,6 +44,7 @@ const paragraph_editable_1 = __importDefault(require("../views/paragraph_editabl
44
44
  const placeholder_1 = __importDefault(require("../views/placeholder"));
45
45
  const placeholder_element_editable_1 = __importDefault(require("../views/placeholder_element_editable"));
46
46
  const pullquote_element_editable_1 = __importDefault(require("../views/pullquote_element_editable"));
47
+ const section_1 = __importDefault(require("../views/section"));
47
48
  const section_label_1 = __importDefault(require("../views/section_label"));
48
49
  const section_title_editable_1 = __importDefault(require("../views/section_title_editable"));
49
50
  const table_cell_1 = __importDefault(require("../views/table_cell"));
@@ -76,6 +77,7 @@ exports.default = (props, dispatch) => {
76
77
  paragraph: (0, paragraph_editable_1.default)(props),
77
78
  placeholder: (0, placeholder_1.default)(props),
78
79
  placeholder_element: (0, placeholder_element_editable_1.default)(props),
80
+ section: (0, section_1.default)(props),
79
81
  pullquote_element: (0, pullquote_element_editable_1.default)(props),
80
82
  section_title: (0, section_title_editable_1.default)(props),
81
83
  section_label: (0, section_label_1.default)(props),
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sectionTitleKey = void 0;
4
+ const transform_1 = require("@manuscripts/transform");
5
+ const prosemirror_state_1 = require("prosemirror-state");
6
+ const prosemirror_utils_1 = require("prosemirror-utils");
7
+ const track_changes_utils_1 = require("../lib/track-changes-utils");
8
+ exports.sectionTitleKey = new prosemirror_state_1.PluginKey('sectionNumbering');
9
+ const calculateSectionLevels = (node, startPos, sectionNumberMap, numbering = [0]) => {
10
+ node.forEach((childNode, offset) => {
11
+ if (childNode.type === transform_1.schema.nodes.section &&
12
+ !(0, track_changes_utils_1.isRejectedInsert)(childNode)) {
13
+ numbering[numbering.length - 1] += 1;
14
+ const sectionNumber = numbering.join('.');
15
+ const sectionStartPos = startPos + offset + 1;
16
+ childNode.forEach((innerChildNode) => {
17
+ if (innerChildNode.type === transform_1.schema.nodes.section_title) {
18
+ sectionNumberMap.set(childNode.attrs.id, sectionNumber);
19
+ }
20
+ });
21
+ calculateSectionLevels(childNode, sectionStartPos, sectionNumberMap, [
22
+ ...numbering,
23
+ 0,
24
+ ]);
25
+ }
26
+ });
27
+ };
28
+ const getPluginState = (doc) => {
29
+ const bodyNodes = (0, prosemirror_utils_1.findChildrenByType)(doc, transform_1.schema.nodes.body);
30
+ const bodyNode = bodyNodes[0];
31
+ const sectionNumberMap = new Map();
32
+ calculateSectionLevels(bodyNode.node, bodyNode.pos, sectionNumberMap);
33
+ return sectionNumberMap;
34
+ };
35
+ exports.default = () => {
36
+ return new prosemirror_state_1.Plugin({
37
+ key: exports.sectionTitleKey,
38
+ state: {
39
+ init: (_, state) => {
40
+ return getPluginState(state.doc);
41
+ },
42
+ apply: (tr, oldSectionNumberMap, oldState, newState) => {
43
+ if (tr.docChanged) {
44
+ return getPluginState(newState.doc);
45
+ }
46
+ return oldSectionNumberMap;
47
+ },
48
+ },
49
+ });
50
+ };
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MATHJAX_VERSION = exports.VERSION = void 0;
4
- exports.VERSION = '2.0.9';
4
+ exports.VERSION = '2.0.11';
5
5
  exports.MATHJAX_VERSION = '3.2.2';
@@ -73,7 +73,7 @@ class BibliographyElementBlockView extends block_view_1.default {
73
73
  componentProps.actions.push({
74
74
  label: 'Edit',
75
75
  action: () => this.handleEdit(element.id),
76
- icon: 'EditIcon',
76
+ icon: 'Edit',
77
77
  });
78
78
  }
79
79
  componentProps.actions.push({
@@ -77,11 +77,15 @@ class CitationEditableView extends citation_1.CitationView {
77
77
  };
78
78
  this.showContextMenu = () => {
79
79
  this.props.popper.destroy();
80
+ const can = this.props.getCapabilities();
81
+ const actions = [
82
+ { label: 'Comment', action: this.handleComment, icon: 'AddComment' },
83
+ ];
84
+ if (can.editArticle) {
85
+ actions.unshift({ label: 'Edit', action: this.handleEdit, icon: 'Edit' });
86
+ }
80
87
  const componentProps = {
81
- actions: [
82
- { label: 'Edit', action: this.handleEdit, icon: 'EditIcon' },
83
- { label: 'Comment', action: this.handleComment, icon: 'AddComment' },
84
- ],
88
+ actions,
85
89
  };
86
90
  this.contextMenu = (0, ReactSubView_1.default)(this.props, style_guide_1.ContextMenu, componentProps, this.node, this.getPos, this.view, 'context-menu');
87
91
  this.props.popper.show(this.dom, this.contextMenu, 'right-start', false);
@@ -205,7 +205,7 @@ class ContributorsView extends block_view_1.default {
205
205
  {
206
206
  label: 'Edit',
207
207
  action: () => this.handleEdit(element.id),
208
- icon: 'EditIcon',
208
+ icon: 'Edit',
209
209
  },
210
210
  ],
211
211
  };
@@ -34,8 +34,23 @@ class InlineFootnoteView extends base_node_view_1.BaseNodeView {
34
34
  constructor() {
35
35
  super(...arguments);
36
36
  this.findParentTableElement = () => (0, prosemirror_utils_1.findParentNodeClosestToPos)(this.view.state.doc.resolve(this.getPos()), (node) => node.type === transform_1.schema.nodes.table_element);
37
+ this.showContextMenu = () => {
38
+ this.props.popper.destroy();
39
+ const componentProps = {
40
+ actions: [
41
+ {
42
+ label: 'Edit',
43
+ action: () => {
44
+ this.props.popper.destroy();
45
+ this.activateGenericFnModal();
46
+ },
47
+ icon: 'Edit',
48
+ },
49
+ ],
50
+ };
51
+ this.props.popper.show(this.dom, (0, ReactSubView_1.default)(this.props, style_guide_1.ContextMenu, componentProps, this.node, this.getPos, this.view, 'context-menu'), 'right-start', false);
52
+ };
37
53
  this.handleClick = () => {
38
- var _a;
39
54
  if ((0, track_changes_utils_1.isDeleted)(this.node)) {
40
55
  return;
41
56
  }
@@ -46,21 +61,59 @@ class InlineFootnoteView extends base_node_view_1.BaseNodeView {
46
61
  onAdd: this.onAdd,
47
62
  });
48
63
  }
49
- else if (!this.activateGenericFnModal()) {
50
- if ((_a = this.node.attrs.rids) === null || _a === void 0 ? void 0 : _a.length) {
51
- let nodePos = undefined;
52
- this.view.state.doc.descendants((node, pos) => {
53
- if (node.attrs.id === this.node.attrs.rids[0]) {
54
- nodePos = pos;
55
- }
56
- });
57
- if (nodePos && this.props.dispatch) {
58
- const sel = prosemirror_state_1.TextSelection.near(this.view.state.doc.resolve(nodePos + 1));
59
- this.props.dispatch(this.view.state.tr.setSelection(sel).scrollIntoView());
64
+ else {
65
+ this.showContextMenu();
66
+ }
67
+ };
68
+ this.scrollToReferenced = () => {
69
+ var _a;
70
+ if ((_a = this.node.attrs.rids) === null || _a === void 0 ? void 0 : _a.length) {
71
+ let nodePos = undefined;
72
+ this.view.state.doc.descendants((node, pos) => {
73
+ if (node.attrs.id === this.node.attrs.rids[0]) {
74
+ nodePos = pos;
60
75
  }
76
+ });
77
+ if (nodePos && this.props.dispatch) {
78
+ const sel = prosemirror_state_1.TextSelection.near(this.view.state.doc.resolve(nodePos + 1));
79
+ this.props.dispatch(this.view.state.tr.setSelection(sel).scrollIntoView());
61
80
  }
62
81
  }
63
82
  };
83
+ this.activateGenericFnModal = () => {
84
+ if (!this.props.getCapabilities().editArticle) {
85
+ return;
86
+ }
87
+ const fnState = footnotes_1.footnotesKey.getState(this.view.state);
88
+ console.log(fnState);
89
+ if (fnState) {
90
+ this.activateModal({
91
+ notes: Array.from(fnState.unusedFootnotes.values()).map((n) => ({
92
+ node: n[0],
93
+ })),
94
+ onCancel: () => {
95
+ const { tr } = this.view.state;
96
+ if (!this.node.attrs.rids.length) {
97
+ this.view.dispatch(tr.delete(this.getPos(), this.getPos() + this.node.nodeSize));
98
+ }
99
+ this.destroy();
100
+ },
101
+ onAdd: () => {
102
+ const footnote = (0, commands_1.createFootnote)(this.view.state, 'footnote');
103
+ const tr = (0, commands_1.insertFootnote)(this.view.state, this.view.state.tr, footnote);
104
+ tr.setNodeAttribute(tr.mapping.map(this.getPos()), 'rids', [
105
+ footnote.attrs.id,
106
+ ]);
107
+ this.view.dispatch(tr);
108
+ this.view.focus();
109
+ this.destroy();
110
+ },
111
+ addNewLabel: 'Replace with new footnote',
112
+ });
113
+ return true;
114
+ }
115
+ return false;
116
+ };
64
117
  this.updateContents = () => {
65
118
  const attrs = this.node.attrs;
66
119
  this.dom.setAttribute('rids', attrs.rids.join(','));
@@ -154,39 +207,6 @@ class InlineFootnoteView extends base_node_view_1.BaseNodeView {
154
207
  this.popperContainer = (0, ReactSubView_1.default)(Object.assign(Object.assign({}, this.props), { dispatch: this.view.dispatch }), style_guide_1.FootnotesSelector, Object.assign(Object.assign({}, defaultModal), modalProps), this.node, this.getPos, this.view, 'footnote-editor');
155
208
  this.props.popper.show(this.dom, this.popperContainer, 'auto', false);
156
209
  }
157
- activateGenericFnModal() {
158
- if (!this.props.getCapabilities().editArticle) {
159
- return;
160
- }
161
- const fnState = footnotes_1.footnotesKey.getState(this.view.state);
162
- if (fnState && fnState.unusedFootnotes.size > 0) {
163
- this.activateModal({
164
- notes: Array.from(fnState.unusedFootnotes.values()).map((n) => ({
165
- node: n[0],
166
- })),
167
- onCancel: () => {
168
- const { tr } = this.view.state;
169
- if (!this.node.attrs.rids.length) {
170
- this.view.dispatch(tr.delete(this.getPos(), this.getPos() + this.node.nodeSize));
171
- }
172
- this.destroy();
173
- },
174
- onAdd: () => {
175
- const footnote = (0, commands_1.createFootnote)(this.view.state, 'footnote');
176
- const tr = (0, commands_1.insertFootnote)(this.view.state, this.view.state.tr, footnote);
177
- tr.setNodeAttribute(tr.mapping.map(this.getPos()), 'rids', [
178
- footnote.attrs.id,
179
- ]);
180
- this.view.dispatch(tr);
181
- this.view.focus();
182
- this.destroy();
183
- },
184
- addNewLabel: 'Replace with new footnote',
185
- });
186
- return true;
187
- }
188
- return false;
189
- }
190
210
  }
191
211
  exports.InlineFootnoteView = InlineFootnoteView;
192
212
  exports.default = (0, creators_1.createNodeView)(InlineFootnoteView);
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ /*!
3
+ * © 2019 Atypon Systems LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ var __importDefault = (this && this.__importDefault) || function (mod) {
18
+ return (mod && mod.__esModule) ? mod : { "default": mod };
19
+ };
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.SectionView = exports.handleSectionNumbering = void 0;
22
+ const transform_1 = require("@manuscripts/transform");
23
+ const section_title_1 = require("../plugins/section_title");
24
+ const block_view_1 = __importDefault(require("./block_view"));
25
+ const creators_1 = require("./creators");
26
+ const handleSectionNumbering = (sections) => {
27
+ sections.forEach((sectionNumber, sectionId) => {
28
+ const section = document.getElementById(sectionId);
29
+ const sectionTitle = section === null || section === void 0 ? void 0 : section.querySelector('h1');
30
+ if (sectionTitle) {
31
+ sectionTitle.dataset.sectionNumber = sectionNumber;
32
+ }
33
+ });
34
+ };
35
+ exports.handleSectionNumbering = handleSectionNumbering;
36
+ class SectionView extends block_view_1.default {
37
+ constructor() {
38
+ super(...arguments);
39
+ this.elementType = 'section';
40
+ this.initialise = () => {
41
+ this.createDOM();
42
+ this.createElement();
43
+ this.updateContents();
44
+ };
45
+ this.createElement = () => {
46
+ this.contentDOM = document.createElement(this.elementType);
47
+ this.dom.appendChild(this.contentDOM);
48
+ };
49
+ this.onUpdateContent = () => {
50
+ const sectionTitleState = section_title_1.sectionTitleKey.getState(this.view.state);
51
+ const { titleSuppressed, generatedLabel, pageBreakStyle, id, category } = this.node.attrs;
52
+ const classNames = [];
53
+ if (titleSuppressed) {
54
+ classNames.push('title-suppressed');
55
+ }
56
+ if (typeof generatedLabel === 'undefined' || generatedLabel) {
57
+ classNames.push('generated-label');
58
+ }
59
+ if (pageBreakStyle === transform_1.PAGE_BREAK_BEFORE ||
60
+ pageBreakStyle === transform_1.PAGE_BREAK_BEFORE_AND_AFTER) {
61
+ classNames.push('page-break-before');
62
+ }
63
+ if (pageBreakStyle === transform_1.PAGE_BREAK_AFTER ||
64
+ pageBreakStyle === transform_1.PAGE_BREAK_BEFORE_AND_AFTER) {
65
+ classNames.push('page-break-after');
66
+ }
67
+ if (this.contentDOM) {
68
+ this.contentDOM.id = id;
69
+ this.contentDOM.classList.add(...classNames);
70
+ category && this.contentDOM.setAttribute('data-category', category);
71
+ }
72
+ if (sectionTitleState) {
73
+ (0, exports.handleSectionNumbering)(sectionTitleState);
74
+ }
75
+ };
76
+ }
77
+ }
78
+ exports.SectionView = SectionView;
79
+ exports.default = (0, creators_1.createNodeView)(SectionView);
@@ -19,23 +19,33 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
19
19
  };
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
21
  exports.SectionTitleView = void 0;
22
+ const transform_1 = require("@manuscripts/transform");
23
+ const prosemirror_utils_1 = require("prosemirror-utils");
22
24
  const context_menu_1 = require("../lib/context-menu");
25
+ const section_title_1 = require("../plugins/section_title");
23
26
  const block_view_1 = __importDefault(require("./block_view"));
24
27
  const creators_1 = require("./creators");
25
28
  class SectionTitleView extends block_view_1.default {
26
29
  constructor() {
27
30
  super(...arguments);
28
31
  this.elementType = 'h1';
29
- this.updateContents = () => {
32
+ this.onUpdateContent = () => {
30
33
  const $pos = this.view.state.doc.resolve(this.getPos());
34
+ const sectionTitleState = section_title_1.sectionTitleKey.getState(this.view.state);
35
+ const parentSection = (0, prosemirror_utils_1.findParentNodeOfTypeClosestToPos)($pos, transform_1.schema.nodes.section);
36
+ const sectionNumber = sectionTitleState === null || sectionTitleState === void 0 ? void 0 : sectionTitleState.get(parentSection === null || parentSection === void 0 ? void 0 : parentSection.node.attrs.id);
37
+ const level = $pos.depth > 1 ? $pos.depth - 1 : $pos.depth;
31
38
  if (this.node.childCount) {
32
39
  this.contentDOM.classList.remove('empty-node');
33
40
  }
34
41
  else {
35
42
  this.contentDOM.classList.add('empty-node');
36
- const level = $pos.depth > 1 ? $pos.depth - 1 : $pos.depth;
37
43
  this.contentDOM.setAttribute('data-placeholder', `${(0, context_menu_1.sectionLevel)(level)} heading`);
38
44
  }
45
+ if (sectionTitleState) {
46
+ this.contentDOM.dataset.sectionNumber = sectionNumber;
47
+ this.contentDOM.dataset.titleLevel = level.toString();
48
+ }
39
49
  };
40
50
  }
41
51
  }
@@ -32,6 +32,7 @@ import objects from '../plugins/objects';
32
32
  import paragraphs from '../plugins/paragraphs';
33
33
  import persist from '../plugins/persist';
34
34
  import placeholder from '../plugins/placeholder';
35
+ import section_title from '../plugins/section_title';
35
36
  import sections from '../plugins/sections';
36
37
  import selected_suggestion from '../plugins/selected-suggestion';
37
38
  import table_footnote from '../plugins/table-footnote';
@@ -51,6 +52,7 @@ export default (props) => {
51
52
  ? TrackChangesStatus.disabled
52
53
  : TrackChangesStatus.enabled,
53
54
  }),
55
+ section_title(),
54
56
  table_editing_fix(),
55
57
  elements(),
56
58
  persist(),
@@ -39,6 +39,7 @@ import paragraph from '../views/paragraph_editable';
39
39
  import placeholder from '../views/placeholder';
40
40
  import placeholderElement from '../views/placeholder_element_editable';
41
41
  import pullquoteElement from '../views/pullquote_element_editable';
42
+ import section from '../views/section';
42
43
  import sectionLabel from '../views/section_label';
43
44
  import sectionTitle from '../views/section_title_editable';
44
45
  import tableCell from '../views/table_cell';
@@ -71,6 +72,7 @@ export default (props, dispatch) => {
71
72
  paragraph: paragraph(props),
72
73
  placeholder: placeholder(props),
73
74
  placeholder_element: placeholderElement(props),
75
+ section: section(props),
74
76
  pullquote_element: pullquoteElement(props),
75
77
  section_title: sectionTitle(props),
76
78
  section_label: sectionLabel(props),
@@ -0,0 +1,47 @@
1
+ import { schema } from '@manuscripts/transform';
2
+ import { Plugin, PluginKey } from 'prosemirror-state';
3
+ import { findChildrenByType } from 'prosemirror-utils';
4
+ import { isRejectedInsert } from '../lib/track-changes-utils';
5
+ export const sectionTitleKey = new PluginKey('sectionNumbering');
6
+ const calculateSectionLevels = (node, startPos, sectionNumberMap, numbering = [0]) => {
7
+ node.forEach((childNode, offset) => {
8
+ if (childNode.type === schema.nodes.section &&
9
+ !isRejectedInsert(childNode)) {
10
+ numbering[numbering.length - 1] += 1;
11
+ const sectionNumber = numbering.join('.');
12
+ const sectionStartPos = startPos + offset + 1;
13
+ childNode.forEach((innerChildNode) => {
14
+ if (innerChildNode.type === schema.nodes.section_title) {
15
+ sectionNumberMap.set(childNode.attrs.id, sectionNumber);
16
+ }
17
+ });
18
+ calculateSectionLevels(childNode, sectionStartPos, sectionNumberMap, [
19
+ ...numbering,
20
+ 0,
21
+ ]);
22
+ }
23
+ });
24
+ };
25
+ const getPluginState = (doc) => {
26
+ const bodyNodes = findChildrenByType(doc, schema.nodes.body);
27
+ const bodyNode = bodyNodes[0];
28
+ const sectionNumberMap = new Map();
29
+ calculateSectionLevels(bodyNode.node, bodyNode.pos, sectionNumberMap);
30
+ return sectionNumberMap;
31
+ };
32
+ export default () => {
33
+ return new Plugin({
34
+ key: sectionTitleKey,
35
+ state: {
36
+ init: (_, state) => {
37
+ return getPluginState(state.doc);
38
+ },
39
+ apply: (tr, oldSectionNumberMap, oldState, newState) => {
40
+ if (tr.docChanged) {
41
+ return getPluginState(newState.doc);
42
+ }
43
+ return oldSectionNumberMap;
44
+ },
45
+ },
46
+ });
47
+ };
@@ -1,2 +1,2 @@
1
- export const VERSION = '2.0.9';
1
+ export const VERSION = '2.0.11';
2
2
  export const MATHJAX_VERSION = '3.2.2';
@@ -67,7 +67,7 @@ export class BibliographyElementBlockView extends BlockView {
67
67
  componentProps.actions.push({
68
68
  label: 'Edit',
69
69
  action: () => this.handleEdit(element.id),
70
- icon: 'EditIcon',
70
+ icon: 'Edit',
71
71
  });
72
72
  }
73
73
  componentProps.actions.push({
@@ -71,11 +71,15 @@ export class CitationEditableView extends CitationView {
71
71
  };
72
72
  this.showContextMenu = () => {
73
73
  this.props.popper.destroy();
74
+ const can = this.props.getCapabilities();
75
+ const actions = [
76
+ { label: 'Comment', action: this.handleComment, icon: 'AddComment' },
77
+ ];
78
+ if (can.editArticle) {
79
+ actions.unshift({ label: 'Edit', action: this.handleEdit, icon: 'Edit' });
80
+ }
74
81
  const componentProps = {
75
- actions: [
76
- { label: 'Edit', action: this.handleEdit, icon: 'EditIcon' },
77
- { label: 'Comment', action: this.handleComment, icon: 'AddComment' },
78
- ],
82
+ actions,
79
83
  };
80
84
  this.contextMenu = ReactSubView(this.props, ContextMenu, componentProps, this.node, this.getPos, this.view, 'context-menu');
81
85
  this.props.popper.show(this.dom, this.contextMenu, 'right-start', false);
@@ -199,7 +199,7 @@ export class ContributorsView extends BlockView {
199
199
  {
200
200
  label: 'Edit',
201
201
  action: () => this.handleEdit(element.id),
202
- icon: 'EditIcon',
202
+ icon: 'Edit',
203
203
  },
204
204
  ],
205
205
  };
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { FootnotesSelector } from '@manuscripts/style-guide';
16
+ import { ContextMenu, FootnotesSelector, } from '@manuscripts/style-guide';
17
17
  import { schema, } from '@manuscripts/transform';
18
18
  import { NodeSelection, TextSelection } from 'prosemirror-state';
19
19
  import { findChildrenByType, findParentNodeClosestToPos, } from 'prosemirror-utils';
@@ -28,8 +28,23 @@ export class InlineFootnoteView extends BaseNodeView {
28
28
  constructor() {
29
29
  super(...arguments);
30
30
  this.findParentTableElement = () => findParentNodeClosestToPos(this.view.state.doc.resolve(this.getPos()), (node) => node.type === schema.nodes.table_element);
31
+ this.showContextMenu = () => {
32
+ this.props.popper.destroy();
33
+ const componentProps = {
34
+ actions: [
35
+ {
36
+ label: 'Edit',
37
+ action: () => {
38
+ this.props.popper.destroy();
39
+ this.activateGenericFnModal();
40
+ },
41
+ icon: 'Edit',
42
+ },
43
+ ],
44
+ };
45
+ this.props.popper.show(this.dom, ReactSubView(this.props, ContextMenu, componentProps, this.node, this.getPos, this.view, 'context-menu'), 'right-start', false);
46
+ };
31
47
  this.handleClick = () => {
32
- var _a;
33
48
  if (isDeleted(this.node)) {
34
49
  return;
35
50
  }
@@ -40,21 +55,59 @@ export class InlineFootnoteView extends BaseNodeView {
40
55
  onAdd: this.onAdd,
41
56
  });
42
57
  }
43
- else if (!this.activateGenericFnModal()) {
44
- if ((_a = this.node.attrs.rids) === null || _a === void 0 ? void 0 : _a.length) {
45
- let nodePos = undefined;
46
- this.view.state.doc.descendants((node, pos) => {
47
- if (node.attrs.id === this.node.attrs.rids[0]) {
48
- nodePos = pos;
49
- }
50
- });
51
- if (nodePos && this.props.dispatch) {
52
- const sel = TextSelection.near(this.view.state.doc.resolve(nodePos + 1));
53
- this.props.dispatch(this.view.state.tr.setSelection(sel).scrollIntoView());
58
+ else {
59
+ this.showContextMenu();
60
+ }
61
+ };
62
+ this.scrollToReferenced = () => {
63
+ var _a;
64
+ if ((_a = this.node.attrs.rids) === null || _a === void 0 ? void 0 : _a.length) {
65
+ let nodePos = undefined;
66
+ this.view.state.doc.descendants((node, pos) => {
67
+ if (node.attrs.id === this.node.attrs.rids[0]) {
68
+ nodePos = pos;
54
69
  }
70
+ });
71
+ if (nodePos && this.props.dispatch) {
72
+ const sel = TextSelection.near(this.view.state.doc.resolve(nodePos + 1));
73
+ this.props.dispatch(this.view.state.tr.setSelection(sel).scrollIntoView());
55
74
  }
56
75
  }
57
76
  };
77
+ this.activateGenericFnModal = () => {
78
+ if (!this.props.getCapabilities().editArticle) {
79
+ return;
80
+ }
81
+ const fnState = footnotesKey.getState(this.view.state);
82
+ console.log(fnState);
83
+ if (fnState) {
84
+ this.activateModal({
85
+ notes: Array.from(fnState.unusedFootnotes.values()).map((n) => ({
86
+ node: n[0],
87
+ })),
88
+ onCancel: () => {
89
+ const { tr } = this.view.state;
90
+ if (!this.node.attrs.rids.length) {
91
+ this.view.dispatch(tr.delete(this.getPos(), this.getPos() + this.node.nodeSize));
92
+ }
93
+ this.destroy();
94
+ },
95
+ onAdd: () => {
96
+ const footnote = createFootnote(this.view.state, 'footnote');
97
+ const tr = insertFootnote(this.view.state, this.view.state.tr, footnote);
98
+ tr.setNodeAttribute(tr.mapping.map(this.getPos()), 'rids', [
99
+ footnote.attrs.id,
100
+ ]);
101
+ this.view.dispatch(tr);
102
+ this.view.focus();
103
+ this.destroy();
104
+ },
105
+ addNewLabel: 'Replace with new footnote',
106
+ });
107
+ return true;
108
+ }
109
+ return false;
110
+ };
58
111
  this.updateContents = () => {
59
112
  const attrs = this.node.attrs;
60
113
  this.dom.setAttribute('rids', attrs.rids.join(','));
@@ -148,38 +201,5 @@ export class InlineFootnoteView extends BaseNodeView {
148
201
  this.popperContainer = ReactSubView(Object.assign(Object.assign({}, this.props), { dispatch: this.view.dispatch }), FootnotesSelector, Object.assign(Object.assign({}, defaultModal), modalProps), this.node, this.getPos, this.view, 'footnote-editor');
149
202
  this.props.popper.show(this.dom, this.popperContainer, 'auto', false);
150
203
  }
151
- activateGenericFnModal() {
152
- if (!this.props.getCapabilities().editArticle) {
153
- return;
154
- }
155
- const fnState = footnotesKey.getState(this.view.state);
156
- if (fnState && fnState.unusedFootnotes.size > 0) {
157
- this.activateModal({
158
- notes: Array.from(fnState.unusedFootnotes.values()).map((n) => ({
159
- node: n[0],
160
- })),
161
- onCancel: () => {
162
- const { tr } = this.view.state;
163
- if (!this.node.attrs.rids.length) {
164
- this.view.dispatch(tr.delete(this.getPos(), this.getPos() + this.node.nodeSize));
165
- }
166
- this.destroy();
167
- },
168
- onAdd: () => {
169
- const footnote = createFootnote(this.view.state, 'footnote');
170
- const tr = insertFootnote(this.view.state, this.view.state.tr, footnote);
171
- tr.setNodeAttribute(tr.mapping.map(this.getPos()), 'rids', [
172
- footnote.attrs.id,
173
- ]);
174
- this.view.dispatch(tr);
175
- this.view.focus();
176
- this.destroy();
177
- },
178
- addNewLabel: 'Replace with new footnote',
179
- });
180
- return true;
181
- }
182
- return false;
183
- }
184
204
  }
185
205
  export default createNodeView(InlineFootnoteView);
@@ -0,0 +1,71 @@
1
+ /*!
2
+ * © 2019 Atypon Systems LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { PAGE_BREAK_AFTER, PAGE_BREAK_BEFORE, PAGE_BREAK_BEFORE_AND_AFTER, } from '@manuscripts/transform';
17
+ import { sectionTitleKey } from '../plugins/section_title';
18
+ import BlockView from './block_view';
19
+ import { createNodeView } from './creators';
20
+ export const handleSectionNumbering = (sections) => {
21
+ sections.forEach((sectionNumber, sectionId) => {
22
+ const section = document.getElementById(sectionId);
23
+ const sectionTitle = section === null || section === void 0 ? void 0 : section.querySelector('h1');
24
+ if (sectionTitle) {
25
+ sectionTitle.dataset.sectionNumber = sectionNumber;
26
+ }
27
+ });
28
+ };
29
+ export class SectionView extends BlockView {
30
+ constructor() {
31
+ super(...arguments);
32
+ this.elementType = 'section';
33
+ this.initialise = () => {
34
+ this.createDOM();
35
+ this.createElement();
36
+ this.updateContents();
37
+ };
38
+ this.createElement = () => {
39
+ this.contentDOM = document.createElement(this.elementType);
40
+ this.dom.appendChild(this.contentDOM);
41
+ };
42
+ this.onUpdateContent = () => {
43
+ const sectionTitleState = sectionTitleKey.getState(this.view.state);
44
+ const { titleSuppressed, generatedLabel, pageBreakStyle, id, category } = this.node.attrs;
45
+ const classNames = [];
46
+ if (titleSuppressed) {
47
+ classNames.push('title-suppressed');
48
+ }
49
+ if (typeof generatedLabel === 'undefined' || generatedLabel) {
50
+ classNames.push('generated-label');
51
+ }
52
+ if (pageBreakStyle === PAGE_BREAK_BEFORE ||
53
+ pageBreakStyle === PAGE_BREAK_BEFORE_AND_AFTER) {
54
+ classNames.push('page-break-before');
55
+ }
56
+ if (pageBreakStyle === PAGE_BREAK_AFTER ||
57
+ pageBreakStyle === PAGE_BREAK_BEFORE_AND_AFTER) {
58
+ classNames.push('page-break-after');
59
+ }
60
+ if (this.contentDOM) {
61
+ this.contentDOM.id = id;
62
+ this.contentDOM.classList.add(...classNames);
63
+ category && this.contentDOM.setAttribute('data-category', category);
64
+ }
65
+ if (sectionTitleState) {
66
+ handleSectionNumbering(sectionTitleState);
67
+ }
68
+ };
69
+ }
70
+ }
71
+ export default createNodeView(SectionView);
@@ -13,23 +13,33 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ import { schema } from '@manuscripts/transform';
17
+ import { findParentNodeOfTypeClosestToPos } from 'prosemirror-utils';
16
18
  import { sectionLevel } from '../lib/context-menu';
19
+ import { sectionTitleKey } from '../plugins/section_title';
17
20
  import BlockView from './block_view';
18
21
  import { createNodeView } from './creators';
19
22
  export class SectionTitleView extends BlockView {
20
23
  constructor() {
21
24
  super(...arguments);
22
25
  this.elementType = 'h1';
23
- this.updateContents = () => {
26
+ this.onUpdateContent = () => {
24
27
  const $pos = this.view.state.doc.resolve(this.getPos());
28
+ const sectionTitleState = sectionTitleKey.getState(this.view.state);
29
+ const parentSection = findParentNodeOfTypeClosestToPos($pos, schema.nodes.section);
30
+ const sectionNumber = sectionTitleState === null || sectionTitleState === void 0 ? void 0 : sectionTitleState.get(parentSection === null || parentSection === void 0 ? void 0 : parentSection.node.attrs.id);
31
+ const level = $pos.depth > 1 ? $pos.depth - 1 : $pos.depth;
25
32
  if (this.node.childCount) {
26
33
  this.contentDOM.classList.remove('empty-node');
27
34
  }
28
35
  else {
29
36
  this.contentDOM.classList.add('empty-node');
30
- const level = $pos.depth > 1 ? $pos.depth - 1 : $pos.depth;
31
37
  this.contentDOM.setAttribute('data-placeholder', `${sectionLevel(level)} heading`);
32
38
  }
39
+ if (sectionTitleState) {
40
+ this.contentDOM.dataset.sectionNumber = sectionNumber;
41
+ this.contentDOM.dataset.titleLevel = level.toString();
42
+ }
33
43
  };
34
44
  }
35
45
  }
@@ -316,6 +316,7 @@ declare const _default: (props: EditorProps, dispatch: Dispatch) => {
316
316
  destroy: () => void;
317
317
  handleDecorations: (decorations: readonly import("prosemirror-view").Decoration[]) => void;
318
318
  } & import("../views/placeholder_element").PlaceholderElementView<any>>;
319
+ section: import("../types").NodeViewCreator<import("../views/section").SectionView<any>>;
319
320
  pullquote_element: import("../types").NodeViewCreator<{
320
321
  gutterButtons: () => HTMLElement[];
321
322
  actionGutterButtons: () => HTMLElement[];
@@ -0,0 +1,5 @@
1
+ import { Plugin, PluginKey } from 'prosemirror-state';
2
+ export type PluginState = Map<string, string>;
3
+ export declare const sectionTitleKey: PluginKey<PluginState>;
4
+ declare const _default: () => Plugin<PluginState>;
5
+ export default _default;
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "2.0.9";
1
+ export declare const VERSION = "2.0.11";
2
2
  export declare const MATHJAX_VERSION = "3.2.2";
@@ -27,9 +27,11 @@ export declare class InlineFootnoteView<PropsType extends InlineFootnoteProps &
27
27
  protected popperContainer: HTMLDivElement;
28
28
  isSelected(): boolean;
29
29
  findParentTableElement: () => ContentNodeWithPos | undefined;
30
+ showContextMenu: () => void;
30
31
  handleClick: () => void;
32
+ scrollToReferenced: () => void;
31
33
  activateModal(modalProps: Partial<ModalProps>): void;
32
- activateGenericFnModal(): boolean | undefined;
34
+ activateGenericFnModal: () => boolean | undefined;
33
35
  updateContents: () => void;
34
36
  initialise: () => void;
35
37
  ignoreMutation: () => boolean;
@@ -0,0 +1,28 @@
1
+ /*!
2
+ * © 2019 Atypon Systems LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { PluginState } from '../plugins/section_title';
17
+ import { BaseNodeProps } from './base_node_view';
18
+ import BlockView from './block_view';
19
+ export declare const handleSectionNumbering: (sections: PluginState) => void;
20
+ export declare class SectionView<PropsType extends BaseNodeProps> extends BlockView<PropsType> {
21
+ elementType: string;
22
+ element: HTMLElement;
23
+ initialise: () => void;
24
+ createElement: () => void;
25
+ onUpdateContent: () => void;
26
+ }
27
+ declare const _default: (props: BaseNodeProps, dispatch?: import("..").Dispatch | undefined) => import("../types").NodeViewCreator<SectionView<any>>;
28
+ export default _default;
@@ -18,7 +18,7 @@ import BlockView from './block_view';
18
18
  export declare class SectionTitleView<PropsType extends BaseNodeProps> extends BlockView<PropsType> {
19
19
  contentDOM: HTMLElement;
20
20
  elementType: string;
21
- updateContents: () => void;
21
+ onUpdateContent: () => void;
22
22
  }
23
23
  declare const _default: (props: BaseNodeProps, dispatch?: import("..").Dispatch | undefined) => import("../types").NodeViewCreator<SectionTitleView<any>>;
24
24
  export default _default;
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.0.9",
4
+ "version": "2.0.11",
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.10",
34
34
  "@manuscripts/library": "1.3.10",
35
- "@manuscripts/style-guide": "2.0.1",
35
+ "@manuscripts/style-guide": "2.0.2",
36
36
  "@manuscripts/track-changes-plugin": "1.7.17",
37
37
  "@manuscripts/transform": "2.3.21",
38
38
  "@popperjs/core": "^2.11.8",
@@ -116,4 +116,4 @@
116
116
  "engines": {
117
117
  "node": ">=20.16.0"
118
118
  }
119
- }
119
+ }
@@ -1,147 +1,22 @@
1
- /* LVL 1 */
2
- /*
3
- This level is actually hidden in the editor
4
- Next levels are shifted 'up' by 1
5
- */
6
- .ProseMirror > div.body > section:not(.toc) {
7
- counter-increment: level_1 0;
8
- }
9
-
10
- .ProseMirror > div > .block-section_title > h1 {
11
- font-size: 16pt !important;
12
- font-style: normal !important;
13
- font-weight: bold !important;
14
- color: #000 !important;
15
- text-align: left;
16
- margin-top: 8pt !important;
17
- margin-bottom: 5pt !important;
18
- line-height: 1.5;
19
- text-indent: 0pt;
20
- display: inline;
21
- }
22
-
23
- /* LVL 2 */
24
- .ProseMirror > div.body > section:not(.toc) {
25
- counter-increment: level_1;
26
- counter-reset: level_2;
27
- }
28
- .ProseMirror > div > section > .block-section_title > h1 {
29
- font-size: 15.75pt !important;
30
- font-style: normal !important;
31
- font-weight: bold !important;
32
- color: #353535 !important;
33
- text-align: left;
34
- margin-top: 8pt !important;
35
- margin-bottom: 5pt !important;
36
- line-height: 24pt;
37
- text-indent: 0pt;
38
- display: inline;
39
- }
40
- .ProseMirror > div.body {
41
- counter-reset: level_1;
42
- }
43
1
  .ProseMirror
44
2
  > div.body
45
- > section:not(.toc)
46
- > .block-section_title
47
- > h1::before {
48
- content: counter(level_1, decimal) '. ';
3
+ section:not(.toc)
4
+ .block-section_title
5
+ h1.empty-node[data-placeholder]::before {
6
+ content: attr(data-section-number) '. ' attr(data-placeholder);
49
7
  }
50
8
 
51
9
  .ProseMirror
52
10
  > div.body
53
- > section:not(.toc)
54
- > .block-section_title
55
- > h1.empty-node[data-placeholder]::before {
56
- content: counter(level_1, decimal) '. ' attr(data-placeholder);
57
- }
58
- /* LVL 3 */
59
- .ProseMirror > div.body > section > section:not(.toc) {
60
- counter-increment: level_2;
61
- counter-reset: level_3;
62
- }
63
- .ProseMirror > div > section > section > .block-section_title > h1 {
64
- font-size: 13.5pt !important;
65
- font-style: normal !important;
66
- font-weight: 700 !important;
67
- color: #353535 !important;
68
- text-align: left;
69
- margin-top: 8pt !important;
70
- margin-bottom: 5pt !important;
71
- line-height: 24pt;
72
- text-indent: 0pt;
73
- display: inline;
74
- }
75
- .ProseMirror
76
- > div.body
77
- > section
78
- > section:not(.toc)
79
- > .block-section_title
80
- > h1::before {
81
- content: counter(level_1, decimal) '.' counter(level_2, decimal) '. ';
82
- }
83
- .ProseMirror
84
- > div.body
85
- > section
86
- > section:not(.toc)
87
- > .block-section_title
88
- > h1.empty-node[data-placeholder]::before {
89
- content: counter(level_1, decimal) '.' counter(level_2, decimal) '. '
90
- attr(data-placeholder);
91
- }
92
- /* LVL 4 */
93
- .ProseMirror > div.body > section > section > section:not(.toc) {
94
- counter-increment: level_3;
95
- counter-reset: level_4;
96
- }
97
- .ProseMirror > div > section > section > section > .block-section_title > h1 {
98
- font-size: 12pt !important;
99
- font-style: normal !important;
100
- font-weight: bold !important;
101
- color: #000 !important;
102
- text-align: left;
103
- margin-top: 8pt !important;
104
- margin-bottom: 5pt !important;
105
- line-height: 1.5;
106
- text-indent: 0pt;
107
- display: inline;
108
- }
109
- .ProseMirror
110
- > div.body
111
- > section
112
- > section
113
- > section:not(.toc)
114
- > .block-section_title
115
- > h1::before {
116
- content: counter(level_1, decimal) '.' counter(level_2, decimal) '.'
117
- counter(level_3, decimal) '. ';
11
+ section:not(.toc)
12
+ .block-section_title
13
+ h1::before {
14
+ content: attr(data-section-number) '. ';
118
15
  }
119
16
 
120
- .ProseMirror
121
- > div.body
122
- > section
123
- > section
124
- > section:not(.toc)
125
- > .block-section_title
126
- > h1.empty-node[data-placeholder]::before {
127
- content: counter(level_1, decimal) '.' counter(level_2, decimal) '.'
128
- counter(level_3, decimal) '. ' attr(data-placeholder);
129
- }
130
- /* LVL 5 */
131
- .ProseMirror > div.body > section > section > section > section:not(.toc) {
132
- counter-increment: level_4;
133
- counter-reset: level_5;
134
- }
135
17
 
136
- .ProseMirror
137
- > div
138
- > section
139
- > section
140
- > section
141
- > section
142
- > .block-section_title
143
- > h1 {
144
- font-size: 12pt !important;
18
+ .ProseMirror > div .block-section_title > h1 {
19
+ font-size: 16pt !important;
145
20
  font-style: normal !important;
146
21
  font-weight: bold !important;
147
22
  color: #000 !important;
@@ -152,147 +27,20 @@ Next levels are shifted 'up' by 1
152
27
  text-indent: 0pt;
153
28
  display: inline;
154
29
  }
155
- .ProseMirror
156
- > div.body
157
- > section
158
- > section
159
- > section
160
- > section:not(.toc)
161
- > .block-section_title
162
- > h1::before {
163
- content: counter(level_1, decimal) '.' counter(level_2, decimal) '.'
164
- counter(level_3, decimal) '.' counter(level_4, decimal) '. ';
165
- }
166
- .ProseMirror
167
- > div.body
168
- > section
169
- > section
170
- > section
171
- > section:not(.toc)
172
- > .block-section_title
173
- > h1.empty-node[data-placeholder]::before {
174
- content: counter(level_1, decimal) '.' counter(level_2, decimal) '.'
175
- counter(level_3, decimal) '.' counter(level_4, decimal) '. '
176
- attr(data-placeholder);
177
- }
178
- /* LVL 6 */
179
- .ProseMirror
180
- > div.body
181
- > section
182
- > section
183
- > section
184
- > section
185
- > section:not(.toc) {
186
- counter-increment: level_5;
187
- counter-reset: level_6;
188
- }
189
- .ProseMirror
190
- > div
191
- > section
192
- > section
193
- > section
194
- > section
195
- > section
196
- > .block-section_title
197
- > h1 {
30
+ .ProseMirror .block-section_title h1[data-title-level] {
198
31
  font-size: 12pt !important;
199
- font-style: normal !important;
200
- font-weight: bold !important;
201
- color: #000 !important;
202
- text-align: left;
203
- margin-top: 8pt !important;
204
- margin-bottom: 5pt !important;
205
- line-height: 1.5;
206
- text-indent: 0pt;
207
- display: inline;
208
32
  }
209
- .ProseMirror
210
- > div.body
211
- > section
212
- > section
213
- > section
214
- > section
215
- > section:not(.toc)
216
- > .block-section_title
217
- > h1::before {
218
- content: counter(level_1, decimal) '.' counter(level_2, decimal) '.'
219
- counter(level_3, decimal) '.' counter(level_4, decimal) '.'
220
- counter(level_5, decimal) '. ';
221
- }
222
- .ProseMirror
223
- > div.body
224
- > section
225
- > section
226
- > section
227
- > section
228
- > section:not(.toc)
229
- > .block-section_title
230
- > h1.empty-node[data-placeholder]::before {
231
- content: counter(level_1, decimal) '.' counter(level_2, decimal) '.'
232
- counter(level_3, decimal) '.' counter(level_4, decimal) '.'
233
- counter(level_5, decimal) '. ' attr(data-placeholder);
234
- }
235
- /* LVL 7 */
236
- .ProseMirror
237
- > div.body
238
- > section
239
- > section
240
- > section
241
- > section
242
- > section
243
- > section:not(.toc) {
244
- counter-increment: level_6;
245
- counter-reset: level_7;
246
- }
247
- .ProseMirror
248
- > div
249
- > section
250
- > section
251
- > section
252
- > section
253
- > section
254
- > .block-section_title
255
- > h1 {
256
- font-size: 12pt !important;
257
- font-style: normal !important;
258
- font-weight: bold !important;
259
- color: #000 !important;
260
- text-align: left;
261
- margin-top: 8pt !important;
262
- margin-bottom: 5pt !important;
263
- line-height: 1.5;
264
- text-indent: 0pt;
265
- display: inline;
266
- }
267
- .ProseMirror
268
- > div.body
269
- > section
270
- > section
271
- > section
272
- > section
273
- > section
274
- > section:not(.toc)
275
- > .block-section_title
276
- > h1::before {
277
- content: counter(level_1, decimal) '.' counter(level_2, decimal) '.'
278
- counter(level_3, decimal) '.' counter(level_4, decimal) '.'
279
- counter(level_5, decimal) '.' counter(level_6, decimal) '. ';
33
+
34
+ .ProseMirror .block-section_title h1[data-title-level='1'] {
35
+ font-size: 16pt !important;
280
36
  }
281
- .ProseMirror
282
- > div.body
283
- > section
284
- > section
285
- > section
286
- > section
287
- > section
288
- > section:not(.toc)
289
- > .block-section_title
290
- > h1.empty-node[data-placeholder]::before {
291
- content: counter(level_1, decimal) '.' counter(level_2, decimal) '.'
292
- counter(level_3, decimal) '.' counter(level_4, decimal) '.'
293
- counter(level_5, decimal) '.' counter(level_6, decimal) '. '
294
- attr(data-placeholder);
37
+
38
+ .ProseMirror .block-section_title h1[data-title-level='2'] {
39
+ font-size: 13.5pt !important;
295
40
  }
41
+
42
+
43
+
296
44
  .ProseMirror div.backmatter::before {
297
45
  content: '';
298
46
  border-bottom: 1px dashed #c9c9c9;
package/styles/Editor.css CHANGED
@@ -593,8 +593,13 @@
593
593
  display: grid;
594
594
  grid-template-columns: 52px auto 52px;
595
595
  }
596
+ .ProseMirror .block-container.block-section {
597
+ position: relative;
598
+ display: grid;
599
+ grid-template-columns: auto;
600
+ }
596
601
 
597
- .ProseMirror .block-container:hover {
602
+ .ProseMirror .block-container:not(.block-section):hover {
598
603
  z-index: 2;
599
604
  }
600
605
 
@@ -649,7 +654,7 @@
649
654
  margin-top: 16px;
650
655
  }
651
656
 
652
- .ProseMirror .block-container:hover .block-gutter {
657
+ .ProseMirror .block-container:not(.block-section):hover .block-gutter {
653
658
  opacity: 1;
654
659
  z-index: 2;
655
660
  }