@gravity-ui/markdown-editor 14.10.2 → 14.10.4

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) {
@@ -289,9 +289,9 @@ exports.yfm = {
289
289
  wysiwyg: items_1.checkboxItemWysiwyg,
290
290
  markup: items_1.checkboxItemMarkup,
291
291
  }, [action_names_1.ActionName.tabs]: {
292
- view: items_1.tableItemView,
293
- wysiwyg: items_1.tableItemWysiwyg,
294
- markup: items_1.tableItemMarkup,
292
+ view: items_1.tabsItemView,
293
+ wysiwyg: items_1.tabsItemWysiwyg,
294
+ markup: items_1.tabsItemMarkup,
295
295
  } }),
296
296
  orders: {
297
297
  [constants_1.ToolbarName.wysiwygMain]: [
@@ -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.4' !== 'undefined' ? '14.10.4' : '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) {
@@ -1,6 +1,6 @@
1
1
  import { ActionName as Action } from '../../bundle/config/action-names';
2
2
  import { ListName as List, ToolbarName as Toolbar } from './constants';
3
- import { boldItemMarkup, boldItemView, boldItemWysiwyg, bulletListItemMarkup, bulletListItemView, bulletListItemWysiwyg, checkboxItemMarkup, checkboxItemView, checkboxItemWysiwyg, codeBlockItemMarkup, codeBlockItemView, codeBlockItemWysiwyg, codeBlocksListItemView, codeItemMarkup, codeItemView, codeItemWysiwyg, colorifyItemMarkup, colorifyItemView, colorifyItemWysiwyg, cutItemMarkup, cutItemView, cutItemWysiwyg, emojiItemMarkup, emojiItemView, emojiItemWysiwyg, fileItemMarkup, fileItemView, fileItemWysiwyg, filePopupItemView, heading1ItemMarkup, heading1ItemView, heading1ItemWysiwyg, heading2ItemMarkup, heading2ItemView, heading2ItemWysiwyg, heading3ItemMarkup, heading3ItemView, heading3ItemWysiwyg, heading4ItemMarkup, heading4ItemView, heading4ItemWysiwyg, heading5ItemMarkup, heading5ItemView, heading5ItemWysiwyg, heading6ItemMarkup, heading6ItemView, heading6ItemWysiwyg, headingListItemView, hruleItemMarkup, hruleItemView, hruleItemWysiwyg, imageItemMarkup, imageItemView, imageItemWysiwyg, imagePopupItemView, italicItemMarkup, italicItemView, italicItemWysiwyg, liftListItemMarkup, liftListItemView, liftListItemWysiwyg, linkItemMarkup, linkItemView, linkItemWysiwyg, listsListItemView, markedItemMarkup, markedItemView, markedItemWysiwyg, monospaceItemMarkup, monospaceItemView, monospaceItemWysiwyg, noteItemMarkup, noteItemView, noteItemWysiwyg, orderedListItemMarkup, orderedListItemView, orderedListItemWysiwyg, paragraphItemMarkup, paragraphItemView, paragraphItemWisywig, quoteItemMarkup, quoteItemView, quoteItemWysiwyg, redoItemMarkup, redoItemView, redoItemWysiwyg, sinkListItemMarkup, sinkListItemView, sinkListItemWysiwyg, strikethroughItemMarkup, strikethroughItemView, tableItemMarkup, tableItemView, tableItemWysiwyg, underlineItemMarkup, underlineItemView, underlineItemWysiwyg, undoItemMarkup, undoItemView, undoItemWysiwyg, } from './items';
3
+ import { boldItemMarkup, boldItemView, boldItemWysiwyg, bulletListItemMarkup, bulletListItemView, bulletListItemWysiwyg, checkboxItemMarkup, checkboxItemView, checkboxItemWysiwyg, codeBlockItemMarkup, codeBlockItemView, codeBlockItemWysiwyg, codeBlocksListItemView, codeItemMarkup, codeItemView, codeItemWysiwyg, colorifyItemMarkup, colorifyItemView, colorifyItemWysiwyg, cutItemMarkup, cutItemView, cutItemWysiwyg, emojiItemMarkup, emojiItemView, emojiItemWysiwyg, fileItemMarkup, fileItemView, fileItemWysiwyg, filePopupItemView, heading1ItemMarkup, heading1ItemView, heading1ItemWysiwyg, heading2ItemMarkup, heading2ItemView, heading2ItemWysiwyg, heading3ItemMarkup, heading3ItemView, heading3ItemWysiwyg, heading4ItemMarkup, heading4ItemView, heading4ItemWysiwyg, heading5ItemMarkup, heading5ItemView, heading5ItemWysiwyg, heading6ItemMarkup, heading6ItemView, heading6ItemWysiwyg, headingListItemView, hruleItemMarkup, hruleItemView, hruleItemWysiwyg, imageItemMarkup, imageItemView, imageItemWysiwyg, imagePopupItemView, italicItemMarkup, italicItemView, italicItemWysiwyg, liftListItemMarkup, liftListItemView, liftListItemWysiwyg, linkItemMarkup, linkItemView, linkItemWysiwyg, listsListItemView, markedItemMarkup, markedItemView, markedItemWysiwyg, monospaceItemMarkup, monospaceItemView, monospaceItemWysiwyg, noteItemMarkup, noteItemView, noteItemWysiwyg, orderedListItemMarkup, orderedListItemView, orderedListItemWysiwyg, paragraphItemMarkup, paragraphItemView, paragraphItemWisywig, quoteItemMarkup, quoteItemView, quoteItemWysiwyg, redoItemMarkup, redoItemView, redoItemWysiwyg, sinkListItemMarkup, sinkListItemView, sinkListItemWysiwyg, strikethroughItemMarkup, strikethroughItemView, tableItemMarkup, tableItemView, tableItemWysiwyg, tabsItemMarkup, tabsItemView, tabsItemWysiwyg, underlineItemMarkup, underlineItemView, underlineItemWysiwyg, undoItemMarkup, undoItemView, undoItemWysiwyg, } from './items';
4
4
  // presets
5
5
  export const zero = {
6
6
  items: {
@@ -286,9 +286,9 @@ export const yfm = {
286
286
  wysiwyg: checkboxItemWysiwyg,
287
287
  markup: checkboxItemMarkup,
288
288
  }, [Action.tabs]: {
289
- view: tableItemView,
290
- wysiwyg: tableItemWysiwyg,
291
- markup: tableItemMarkup,
289
+ view: tabsItemView,
290
+ wysiwyg: tabsItemWysiwyg,
291
+ markup: tabsItemMarkup,
292
292
  } }),
293
293
  orders: {
294
294
  [Toolbar.wysiwygMain]: [
@@ -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.4' !== 'undefined' ? '14.10.4' : '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.4",
4
4
  "description": "Markdown wysiwyg and markup editor",
5
5
  "license": "MIT",
6
6
  "repository": {