@gravity-ui/markdown-editor 14.10.2 → 14.10.3

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,5 +1,6 @@
1
1
  import type { StateCommand } from '@codemirror/state';
2
2
  export declare const insertLink: StateCommand;
3
+ /** @deprecated */
3
4
  export declare const insertAnchor: StateCommand;
4
5
  export declare type ImageItem = {
5
6
  url?: string;
@@ -13,7 +13,9 @@ const insertLink = ({ state, dispatch }) => {
13
13
  return true;
14
14
  };
15
15
  exports.insertLink = insertLink;
16
+ // [major] TODO: remove insertAnchor
16
17
  const defaultAnchorSnippet = (0, autocomplete_1.snippet)(`#[#{2:text}](#{1:anchor} "#{3:title}")`);
18
+ /** @deprecated */
17
19
  const insertAnchor = ({ state, dispatch }) => {
18
20
  const { from, to, empty } = state.selection.main;
19
21
  const anchorSnippet = empty
@@ -1,7 +1,8 @@
1
1
  export declare enum ListName {
2
+ code = "code",
2
3
  heading = "heading",
3
4
  lists = "lists",
4
- code = "code"
5
+ math = "math"
5
6
  }
6
7
  export declare enum ToolbarName {
7
8
  markupHidden = "markupHidden",
@@ -3,9 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ToolbarName = exports.ListName = void 0;
4
4
  var ListName;
5
5
  (function (ListName) {
6
+ ListName["code"] = "code";
6
7
  ListName["heading"] = "heading";
7
8
  ListName["lists"] = "lists";
8
- ListName["code"] = "code";
9
+ ListName["math"] = "math";
9
10
  })(ListName = exports.ListName || (exports.ListName = {}));
10
11
  var ToolbarName;
11
12
  (function (ToolbarName) {
@@ -21,7 +21,8 @@ function findFirstTextblockChild(parent) {
21
21
  }
22
22
  exports.findFirstTextblockChild = findFirstTextblockChild;
23
23
  const isNodeEmpty = (node) => {
24
- const emptyChildren = (0, prosemirror_utils_1.findChildren)(node, (n) => (!n.isText && !n.isAtom && n.content.size === 0) || (n.isText && !n.textContent), true);
24
+ const emptyChildren = (0, prosemirror_utils_1.findChildren)(node, (n) => (!n.isText && !n.isAtom && n.content.size === 0 && n.type.name === 'paragraph') ||
25
+ (n.isText && !n.textContent), true);
25
26
  let descendantsCount = 0;
26
27
  node.descendants(() => {
27
28
  descendantsCount++;
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
4
  /** During build process, the current version will be injected here */
5
- exports.VERSION = typeof '14.10.2' !== 'undefined' ? '14.10.2' : 'unknown';
5
+ exports.VERSION = typeof '14.10.3' !== 'undefined' ? '14.10.3' : 'unknown';
@@ -1,5 +1,6 @@
1
1
  import type { StateCommand } from '@codemirror/state';
2
2
  export declare const insertLink: StateCommand;
3
+ /** @deprecated */
3
4
  export declare const insertAnchor: StateCommand;
4
5
  export declare type ImageItem = {
5
6
  url?: string;
@@ -9,7 +9,9 @@ export const insertLink = ({ state, dispatch }) => {
9
9
  linkSnippet({ state, dispatch }, null, from, to);
10
10
  return true;
11
11
  };
12
+ // [major] TODO: remove insertAnchor
12
13
  const defaultAnchorSnippet = snippet(`#[#{2:text}](#{1:anchor} "#{3:title}")`);
14
+ /** @deprecated */
13
15
  export const insertAnchor = ({ state, dispatch }) => {
14
16
  const { from, to, empty } = state.selection.main;
15
17
  const anchorSnippet = empty
@@ -1,7 +1,8 @@
1
1
  export declare enum ListName {
2
+ code = "code",
2
3
  heading = "heading",
3
4
  lists = "lists",
4
- code = "code"
5
+ math = "math"
5
6
  }
6
7
  export declare enum ToolbarName {
7
8
  markupHidden = "markupHidden",
@@ -1,8 +1,9 @@
1
1
  export var ListName;
2
2
  (function (ListName) {
3
+ ListName["code"] = "code";
3
4
  ListName["heading"] = "heading";
4
5
  ListName["lists"] = "lists";
5
- ListName["code"] = "code";
6
+ ListName["math"] = "math";
6
7
  })(ListName || (ListName = {}));
7
8
  export var ToolbarName;
8
9
  (function (ToolbarName) {
@@ -17,7 +17,8 @@ export function findFirstTextblockChild(parent) {
17
17
  return null;
18
18
  }
19
19
  export const isNodeEmpty = (node) => {
20
- const emptyChildren = findChildren(node, (n) => (!n.isText && !n.isAtom && n.content.size === 0) || (n.isText && !n.textContent), true);
20
+ const emptyChildren = findChildren(node, (n) => (!n.isText && !n.isAtom && n.content.size === 0 && n.type.name === 'paragraph') ||
21
+ (n.isText && !n.textContent), true);
21
22
  let descendantsCount = 0;
22
23
  node.descendants(() => {
23
24
  descendantsCount++;
@@ -1,2 +1,2 @@
1
1
  /** During build process, the current version will be injected here */
2
- export const VERSION = typeof '14.10.2' !== 'undefined' ? '14.10.2' : 'unknown';
2
+ export const VERSION = typeof '14.10.3' !== 'undefined' ? '14.10.3' : 'unknown';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/markdown-editor",
3
- "version": "14.10.2",
3
+ "version": "14.10.3",
4
4
  "description": "Markdown wysiwyg and markup editor",
5
5
  "license": "MIT",
6
6
  "repository": {