@manuscripts/body-editor 1.10.1-LEAN-3607.0 → 1.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -24,6 +24,7 @@ const prosemirror_schema_list_1 = require("prosemirror-schema-list");
24
24
  const prosemirror_state_1 = require("prosemirror-state");
25
25
  const prosemirror_transform_1 = require("prosemirror-transform");
26
26
  const prosemirror_utils_1 = require("prosemirror-utils");
27
+ const list_1 = require("./keys/list");
27
28
  const helpers_1 = require("./lib/helpers");
28
29
  const track_changes_utils_1 = require("./lib/track-changes-utils");
29
30
  const utils_1 = require("./lib/utils");
@@ -449,7 +450,7 @@ function toggleOffList(state, dispatch) {
449
450
  return false;
450
451
  }
451
452
  }
452
- const insertList = (type, style) => (state, dispatch, view) => {
453
+ const insertList = (type, style) => (state, dispatch) => {
453
454
  const list = findSelectedList(state.selection);
454
455
  if (list) {
455
456
  if (!dispatch) {
@@ -467,23 +468,8 @@ const insertList = (type, style) => (state, dispatch, view) => {
467
468
  return true;
468
469
  }
469
470
  else {
470
- const { selection } = state;
471
- let tr = state.tr;
472
- return (0, prosemirror_schema_list_1.wrapInList)(type, { listStyleType: style })(state, (tempTr) => {
473
- const range = selection.$from.blockRange(selection.$to);
474
- if (range && dispatch) {
475
- tempTr.steps.map((step) => {
476
- if (step instanceof prosemirror_transform_1.ReplaceAroundStep) {
477
- dispatch(tr.step(step));
478
- tr = (view === null || view === void 0 ? void 0 : view.state.tr) || tr;
479
- }
480
- else {
481
- tr.step(step);
482
- }
483
- });
484
- dispatch(tr);
485
- }
486
- });
471
+ const command = (0, prosemirror_schema_list_1.wrapInList)(type, { listStyleType: style });
472
+ return (0, list_1.skipCommandTracking)(command)(state, dispatch);
487
473
  }
488
474
  };
489
475
  exports.insertList = insertList;
@@ -38,7 +38,6 @@ const inline_footnote_editable_1 = __importDefault(require("../views/inline_foot
38
38
  const keyword_1 = __importDefault(require("../views/keyword"));
39
39
  const keyword_group_1 = __importDefault(require("../views/keyword_group"));
40
40
  const link_editable_1 = __importDefault(require("../views/link_editable"));
41
- const list_item_1 = __importDefault(require("../views/list_item"));
42
41
  const listing_editable_1 = __importDefault(require("../views/listing_editable"));
43
42
  const listing_element_editable_1 = __importDefault(require("../views/listing_element_editable"));
44
43
  const ordered_list_editable_1 = __importDefault(require("../views/ordered_list_editable"));
@@ -76,7 +75,6 @@ exports.default = (props, dispatch) => {
76
75
  link: (0, link_editable_1.default)(props, dispatch),
77
76
  listing: (0, listing_editable_1.default)(props),
78
77
  listing_element: (0, listing_element_editable_1.default)(props),
79
- list_item: (0, list_item_1.default)(props),
80
78
  ordered_list: (0, ordered_list_editable_1.default)(props),
81
79
  paragraph: (0, paragraph_editable_1.default)(props),
82
80
  placeholder: (0, placeholder_1.default)(props),
@@ -19,7 +19,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
19
19
  };
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
21
  exports.bulletListCallback = exports.BulletListView = void 0;
22
- const track_changes_utils_1 = require("../lib/track-changes-utils");
23
22
  const block_view_1 = __importDefault(require("./block_view"));
24
23
  const creators_1 = require("./creators");
25
24
  const ordered_list_1 = require("./ordered_list");
@@ -31,16 +30,6 @@ class BulletListView extends block_view_1.default {
31
30
  if (this.contentDOM) {
32
31
  const type = this.node.attrs.listStyleType || 'bullet';
33
32
  this.contentDOM.style.listStyleType = ordered_list_1.JATS_HTML_LIST_STYLE_MAPPING[type];
34
- if (this.node.attrs.dataTracked) {
35
- const classes = (0, track_changes_utils_1.getChangeClasses)(this.node.attrs.dataTracked);
36
- this.contentDOM.className = classes.join(' ');
37
- this.dom.setAttribute('data-track-status', this.node.attrs.dataTracked[0].status);
38
- this.dom.setAttribute('data-track-op', this.node.attrs.dataTracked[0].operation);
39
- }
40
- else {
41
- this.dom.removeAttribute('data-track-status');
42
- this.dom.removeAttribute('data-track-op');
43
- }
44
33
  }
45
34
  };
46
35
  }
@@ -19,7 +19,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
19
19
  };
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
21
  exports.orderedListCallback = exports.OrderedListView = exports.JATS_HTML_LIST_STYLE_MAPPING = void 0;
22
- const track_changes_utils_1 = require("../lib/track-changes-utils");
23
22
  const block_view_1 = __importDefault(require("./block_view"));
24
23
  const creators_1 = require("./creators");
25
24
  exports.JATS_HTML_LIST_STYLE_MAPPING = {
@@ -39,16 +38,6 @@ class OrderedListView extends block_view_1.default {
39
38
  if (this.contentDOM) {
40
39
  const type = this.node.attrs.listStyleType || 'order';
41
40
  this.contentDOM.style.listStyleType = exports.JATS_HTML_LIST_STYLE_MAPPING[type];
42
- if (this.node.attrs.dataTracked) {
43
- const classes = (0, track_changes_utils_1.getChangeClasses)(this.node.attrs.dataTracked);
44
- this.contentDOM.className = classes.join(' ');
45
- this.dom.setAttribute('data-track-status', this.node.attrs.dataTracked[0].status);
46
- this.dom.setAttribute('data-track-op', this.node.attrs.dataTracked[0].operation);
47
- }
48
- else {
49
- this.dom.removeAttribute('data-track-status');
50
- this.dom.removeAttribute('data-track-op');
51
- }
52
41
  }
53
42
  };
54
43
  }
@@ -19,8 +19,9 @@ import { buildComment, generateID, isElementNodeType, isFootnoteNode, isInBiblio
19
19
  import { NodeRange } from 'prosemirror-model';
20
20
  import { wrapInList } from 'prosemirror-schema-list';
21
21
  import { NodeSelection, TextSelection, } from 'prosemirror-state';
22
- import { findWrapping, liftTarget, ReplaceAroundStep, } from 'prosemirror-transform';
22
+ import { findWrapping, liftTarget } from 'prosemirror-transform';
23
23
  import { findChildrenByType, findParentNodeOfType, } from 'prosemirror-utils';
24
+ import { skipCommandTracking } from './keys/list';
24
25
  import { isNodeOfType, nearestAncestor } from './lib/helpers';
25
26
  import { isDeleted, isRejectedInsert } from './lib/track-changes-utils';
26
27
  import { findParentNodeWithId, getChildOfType } from './lib/utils';
@@ -427,7 +428,7 @@ function toggleOffList(state, dispatch) {
427
428
  return false;
428
429
  }
429
430
  }
430
- export const insertList = (type, style) => (state, dispatch, view) => {
431
+ export const insertList = (type, style) => (state, dispatch) => {
431
432
  const list = findSelectedList(state.selection);
432
433
  if (list) {
433
434
  if (!dispatch) {
@@ -445,23 +446,8 @@ export const insertList = (type, style) => (state, dispatch, view) => {
445
446
  return true;
446
447
  }
447
448
  else {
448
- const { selection } = state;
449
- let tr = state.tr;
450
- return wrapInList(type, { listStyleType: style })(state, (tempTr) => {
451
- const range = selection.$from.blockRange(selection.$to);
452
- if (range && dispatch) {
453
- tempTr.steps.map((step) => {
454
- if (step instanceof ReplaceAroundStep) {
455
- dispatch(tr.step(step));
456
- tr = (view === null || view === void 0 ? void 0 : view.state.tr) || tr;
457
- }
458
- else {
459
- tr.step(step);
460
- }
461
- });
462
- dispatch(tr);
463
- }
464
- });
449
+ const command = wrapInList(type, { listStyleType: style });
450
+ return skipCommandTracking(command)(state, dispatch);
465
451
  }
466
452
  };
467
453
  export const insertBibliographySection = () => {
@@ -33,7 +33,6 @@ import inlineFootnote from '../views/inline_footnote_editable';
33
33
  import keyword from '../views/keyword';
34
34
  import keywordGroup from '../views/keyword_group';
35
35
  import link from '../views/link_editable';
36
- import list_item from '../views/list_item';
37
36
  import listing from '../views/listing_editable';
38
37
  import listingElement from '../views/listing_element_editable';
39
38
  import orderedList from '../views/ordered_list_editable';
@@ -71,7 +70,6 @@ export default (props, dispatch) => {
71
70
  link: link(props, dispatch),
72
71
  listing: listing(props),
73
72
  listing_element: listingElement(props),
74
- list_item: list_item(props),
75
73
  ordered_list: orderedList(props),
76
74
  paragraph: paragraph(props),
77
75
  placeholder: placeholder(props),
@@ -13,7 +13,6 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { getChangeClasses } from '../lib/track-changes-utils';
17
16
  import BlockView from './block_view';
18
17
  import { createNodeOrElementView } from './creators';
19
18
  import { JATS_HTML_LIST_STYLE_MAPPING } from './ordered_list';
@@ -25,16 +24,6 @@ export class BulletListView extends BlockView {
25
24
  if (this.contentDOM) {
26
25
  const type = this.node.attrs.listStyleType || 'bullet';
27
26
  this.contentDOM.style.listStyleType = JATS_HTML_LIST_STYLE_MAPPING[type];
28
- if (this.node.attrs.dataTracked) {
29
- const classes = getChangeClasses(this.node.attrs.dataTracked);
30
- this.contentDOM.className = classes.join(' ');
31
- this.dom.setAttribute('data-track-status', this.node.attrs.dataTracked[0].status);
32
- this.dom.setAttribute('data-track-op', this.node.attrs.dataTracked[0].operation);
33
- }
34
- else {
35
- this.dom.removeAttribute('data-track-status');
36
- this.dom.removeAttribute('data-track-op');
37
- }
38
27
  }
39
28
  };
40
29
  }
@@ -13,7 +13,6 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { getChangeClasses } from '../lib/track-changes-utils';
17
16
  import BlockView from './block_view';
18
17
  import { createNodeOrElementView } from './creators';
19
18
  export const JATS_HTML_LIST_STYLE_MAPPING = {
@@ -33,16 +32,6 @@ export class OrderedListView extends BlockView {
33
32
  if (this.contentDOM) {
34
33
  const type = this.node.attrs.listStyleType || 'order';
35
34
  this.contentDOM.style.listStyleType = JATS_HTML_LIST_STYLE_MAPPING[type];
36
- if (this.node.attrs.dataTracked) {
37
- const classes = getChangeClasses(this.node.attrs.dataTracked);
38
- this.contentDOM.className = classes.join(' ');
39
- this.dom.setAttribute('data-track-status', this.node.attrs.dataTracked[0].status);
40
- this.dom.setAttribute('data-track-op', this.node.attrs.dataTracked[0].operation);
41
- }
42
- else {
43
- this.dom.removeAttribute('data-track-status');
44
- this.dom.removeAttribute('data-track-op');
45
- }
46
35
  }
47
36
  };
48
37
  }
@@ -41,7 +41,7 @@ export declare const insertInlineEquation: (state: ManuscriptEditorState, dispat
41
41
  export declare const insertInlineFootnote: (kind: 'footnote' | 'endnote') => (state: ManuscriptEditorState, dispatch?: Dispatch) => boolean;
42
42
  export declare const insertGraphicalAbstract: (state: ManuscriptEditorState, dispatch?: Dispatch) => boolean;
43
43
  export declare const insertSection: (subsection?: boolean) => (state: ManuscriptEditorState, dispatch?: Dispatch) => boolean;
44
- export declare const insertList: (type: ManuscriptNodeType, style?: string) => (state: ManuscriptEditorState, dispatch?: Dispatch, view?: EditorView) => boolean;
44
+ export declare const insertList: (type: ManuscriptNodeType, style?: string) => (state: ManuscriptEditorState, dispatch?: Dispatch) => boolean;
45
45
  export declare const insertBibliographySection: () => boolean;
46
46
  export declare const insertTOCSection: () => boolean;
47
47
  export declare const ifInTableBody: (command: (state: ManuscriptEditorState) => boolean) => (state: ManuscriptEditorState) => boolean;
@@ -281,7 +281,6 @@ declare const _default: (props: EditorProps, dispatch: Dispatch) => {
281
281
  destroy: () => void;
282
282
  handleDecorations: (decorations: readonly import("prosemirror-view").Decoration[]) => void;
283
283
  } & import("../views/listing_element").ListingElementView<any>>;
284
- list_item: import("../types").NodeViewCreator<import("../views/list_item").ListItemView<any>>;
285
284
  ordered_list: import("../types").NodeViewCreator<{
286
285
  gutterButtons: () => HTMLElement[];
287
286
  actionGutterButtons: () => HTMLElement[];
@@ -14,17 +14,16 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { EditorState } from 'prosemirror-state';
17
- import { EditorView } from 'prosemirror-view';
18
17
  import { ReactNode } from 'react';
19
18
  import { Dispatch } from './commands';
20
19
  export interface ToolbarButtonConfig {
21
20
  title: string;
22
21
  content: ReactNode;
23
22
  isActive?: (state: EditorState) => boolean;
24
- run: (state: EditorState, dispatch: Dispatch, view?: EditorView) => void;
23
+ run: (state: EditorState, dispatch: Dispatch) => void;
25
24
  isEnabled: (state: EditorState) => boolean;
26
25
  options?: {
27
- [key: string]: (state: EditorState, dispatch: Dispatch, view?: EditorView) => void;
26
+ [key: string]: (state: EditorState, dispatch: Dispatch) => void;
28
27
  };
29
28
  }
30
29
  export interface ToolbarConfig {
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": "1.10.1-LEAN-3607.0",
4
+ "version": "1.10.1",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-body-editor",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",
@@ -30,9 +30,9 @@
30
30
  "@iarna/word-count": "^1.1.2",
31
31
  "@manuscripts/json-schema": "^2.2.7",
32
32
  "@manuscripts/library": "^1.3.6",
33
- "@manuscripts/style-guide": "1.12.7",
33
+ "@manuscripts/style-guide": "1.12.8",
34
34
  "@manuscripts/track-changes-plugin": "1.7.11",
35
- "@manuscripts/transform": "2.3.3",
35
+ "@manuscripts/transform": "2.3.4",
36
36
  "astrocite-eutils": "^0.16.4",
37
37
  "mathjax-full": "^3.2.2",
38
38
  "codemirror": "^5.58.1",
@@ -1,39 +0,0 @@
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.listItemCallback = exports.ListItemView = void 0;
22
- const track_changes_utils_1 = require("../lib/track-changes-utils");
23
- const block_view_1 = __importDefault(require("./block_view"));
24
- const creators_1 = require("./creators");
25
- class ListItemView extends block_view_1.default {
26
- constructor() {
27
- super(...arguments);
28
- this.elementType = 'li';
29
- }
30
- }
31
- exports.ListItemView = ListItemView;
32
- const listItemCallback = (node, dom) => {
33
- if (node.attrs.dataTracked) {
34
- const classes = (0, track_changes_utils_1.getChangeClasses)(node.attrs.dataTracked);
35
- dom.className = classes.join(' ');
36
- }
37
- };
38
- exports.listItemCallback = listItemCallback;
39
- exports.default = (0, creators_1.createNodeOrElementView)(ListItemView, 'li', exports.listItemCallback);
@@ -1,31 +0,0 @@
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 { getChangeClasses } from '../lib/track-changes-utils';
17
- import BlockView from './block_view';
18
- import { createNodeOrElementView } from './creators';
19
- export class ListItemView extends BlockView {
20
- constructor() {
21
- super(...arguments);
22
- this.elementType = 'li';
23
- }
24
- }
25
- export const listItemCallback = (node, dom) => {
26
- if (node.attrs.dataTracked) {
27
- const classes = getChangeClasses(node.attrs.dataTracked);
28
- dom.className = classes.join(' ');
29
- }
30
- };
31
- export default createNodeOrElementView(ListItemView, 'li', listItemCallback);
@@ -1,24 +0,0 @@
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 { ManuscriptNode } from '@manuscripts/transform';
17
- import { BaseNodeProps } from './base_node_view';
18
- import BlockView from './block_view';
19
- export declare class ListItemView<PropsType extends BaseNodeProps> extends BlockView<PropsType> {
20
- elementType: string;
21
- }
22
- export declare const listItemCallback: (node: ManuscriptNode, dom: HTMLElement) => void;
23
- declare const _default: (props: BaseNodeProps) => import("../types").NodeViewCreator<ListItemView<any>>;
24
- export default _default;