@manuscripts/body-editor 3.8.6 → 3.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.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /*!
3
- * © 2019 Atypon Systems LLC
3
+ * © 2026 Atypon Systems LLC
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
6
6
  * you may not use this file except in compliance with the License.
@@ -44,6 +44,7 @@ const move_node_1 = __importDefault(require("../plugins/move-node"));
44
44
  const objects_1 = __importDefault(require("../plugins/objects"));
45
45
  const paragraphs_1 = __importDefault(require("../plugins/paragraphs"));
46
46
  const persist_1 = __importDefault(require("../plugins/persist"));
47
+ const persistent_cursor_1 = __importDefault(require("../plugins/persistent-cursor"));
47
48
  const placeholder_1 = __importDefault(require("../plugins/placeholder"));
48
49
  const prevent_empty_1 = __importDefault(require("../plugins/prevent-empty"));
49
50
  const search_replace_1 = __importDefault(require("../plugins/search-replace"));
@@ -96,6 +97,12 @@ exports.default = (props) => {
96
97
  (0, move_node_1.default)(),
97
98
  (0, link_1.default)(),
98
99
  ];
100
+ if (!window.Cypress) {
101
+ allPlugins.push((0, persistent_cursor_1.default)());
102
+ }
103
+ else {
104
+ console.warn('Skipping cursor imitation plugin for automated testing runs.');
105
+ }
99
106
  if (props.collabProvider) {
100
107
  allPlugins.push((0, prosemirror_collab_1.collab)({ version: props.collabProvider.currentVersion }));
101
108
  }
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ /*!
3
+ * © 2025 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
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.persistentCursor = void 0;
19
+ const prosemirror_state_1 = require("prosemirror-state");
20
+ const prosemirror_view_1 = require("prosemirror-view");
21
+ exports.persistentCursor = new prosemirror_state_1.PluginKey('persistent-cursor');
22
+ exports.default = () => {
23
+ return new prosemirror_state_1.Plugin({
24
+ state: {
25
+ init(_, state) {
26
+ return { on: false };
27
+ },
28
+ apply(tr, value) {
29
+ if (tr.getMeta(exports.persistentCursor)) {
30
+ return tr.getMeta(exports.persistentCursor);
31
+ }
32
+ return value;
33
+ },
34
+ },
35
+ props: {
36
+ decorations(state) {
37
+ const selection = state.selection;
38
+ if (this.getState(state)?.on && selection.from === selection.to) {
39
+ const decorations = [
40
+ prosemirror_view_1.Decoration.widget(selection.to, (view) => {
41
+ const cursor = document.createElement('span');
42
+ cursor.classList.add('cursor-placeholder');
43
+ return cursor;
44
+ }),
45
+ ];
46
+ return prosemirror_view_1.DecorationSet.create(state.doc, decorations);
47
+ }
48
+ return prosemirror_view_1.DecorationSet.empty;
49
+ },
50
+ handleDOMEvents: {
51
+ focus(view, event) {
52
+ const newTr = view.state.tr.setMeta(exports.persistentCursor, { on: false });
53
+ view.dispatch(newTr);
54
+ },
55
+ blur(view, event) {
56
+ const newTr = view.state.tr.setMeta(exports.persistentCursor, { on: true });
57
+ view.dispatch(newTr);
58
+ },
59
+ },
60
+ },
61
+ });
62
+ };
@@ -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 = '3.8.6';
4
+ exports.VERSION = '3.8.7';
5
5
  exports.MATHJAX_VERSION = '3.2.2';
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * © 2019 Atypon Systems LLC
2
+ * © 2026 Atypon Systems LLC
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -39,6 +39,7 @@ import move_node from '../plugins/move-node';
39
39
  import objects from '../plugins/objects';
40
40
  import paragraphs from '../plugins/paragraphs';
41
41
  import persist from '../plugins/persist';
42
+ import persistent_cursor from '../plugins/persistent-cursor';
42
43
  import placeholder from '../plugins/placeholder';
43
44
  import prevent_empty from '../plugins/prevent-empty';
44
45
  import search_replace from '../plugins/search-replace';
@@ -91,6 +92,12 @@ export default (props) => {
91
92
  move_node(),
92
93
  link(),
93
94
  ];
95
+ if (!window.Cypress) {
96
+ allPlugins.push(persistent_cursor());
97
+ }
98
+ else {
99
+ console.warn('Skipping cursor imitation plugin for automated testing runs.');
100
+ }
94
101
  if (props.collabProvider) {
95
102
  allPlugins.push(collab({ version: props.collabProvider.currentVersion }));
96
103
  }
@@ -0,0 +1,59 @@
1
+ /*!
2
+ * © 2025 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 { Plugin, PluginKey } from 'prosemirror-state';
17
+ import { Decoration, DecorationSet } from 'prosemirror-view';
18
+ export const persistentCursor = new PluginKey('persistent-cursor');
19
+ export default () => {
20
+ return new Plugin({
21
+ state: {
22
+ init(_, state) {
23
+ return { on: false };
24
+ },
25
+ apply(tr, value) {
26
+ if (tr.getMeta(persistentCursor)) {
27
+ return tr.getMeta(persistentCursor);
28
+ }
29
+ return value;
30
+ },
31
+ },
32
+ props: {
33
+ decorations(state) {
34
+ const selection = state.selection;
35
+ if (this.getState(state)?.on && selection.from === selection.to) {
36
+ const decorations = [
37
+ Decoration.widget(selection.to, (view) => {
38
+ const cursor = document.createElement('span');
39
+ cursor.classList.add('cursor-placeholder');
40
+ return cursor;
41
+ }),
42
+ ];
43
+ return DecorationSet.create(state.doc, decorations);
44
+ }
45
+ return DecorationSet.empty;
46
+ },
47
+ handleDOMEvents: {
48
+ focus(view, event) {
49
+ const newTr = view.state.tr.setMeta(persistentCursor, { on: false });
50
+ view.dispatch(newTr);
51
+ },
52
+ blur(view, event) {
53
+ const newTr = view.state.tr.setMeta(persistentCursor, { on: true });
54
+ view.dispatch(newTr);
55
+ },
56
+ },
57
+ },
58
+ });
59
+ };
@@ -1,2 +1,2 @@
1
- export const VERSION = '3.8.6';
1
+ export const VERSION = '3.8.7';
2
2
  export const MATHJAX_VERSION = '3.2.2';
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * © 2019 Atypon Systems LLC
2
+ * © 2026 Atypon Systems LLC
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -0,0 +1,23 @@
1
+ /*!
2
+ * © 2025 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 { Plugin, PluginKey } from 'prosemirror-state';
17
+ export declare const persistentCursor: PluginKey<{
18
+ on: boolean;
19
+ }>;
20
+ declare const _default: () => Plugin<{
21
+ on: boolean;
22
+ }>;
23
+ export default _default;
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "3.8.6";
1
+ export declare const VERSION = "3.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": "3.8.6",
4
+ "version": "3.8.7",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-body-editor",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",
@@ -2059,4 +2059,14 @@ th:hover > .table-context-menu-button,
2059
2059
  overflow: hidden;
2060
2060
  clip: rect(0, 0, 0, 0);
2061
2061
  border: 0;
2062
- }
2062
+ }
2063
+
2064
+ .cursor-placeholder {
2065
+ display: inline-flex;
2066
+ position: relative;
2067
+ pointer-events: none;
2068
+ height: 1.2em;
2069
+ margin-bottom: -0.2em;
2070
+ margin-right: -1px;
2071
+ border-left: 1px solid black;
2072
+ }