@gravity-ui/markdown-editor 14.10.5 → 14.11.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.
- package/build/cjs/bundle/MarkdownEditorView.d.ts +1 -1
- package/build/cjs/bundle/MarkupEditorView.d.ts +2 -2
- package/build/cjs/bundle/WysiwygEditorView.d.ts +2 -2
- package/build/cjs/bundle/config/action-names.d.ts +1 -1
- package/build/cjs/bundle/config/markup.d.ts +3 -13
- package/build/cjs/bundle/config/markup.js +1 -1
- package/build/cjs/bundle/config/w-heading-config.d.ts +9 -0
- package/build/cjs/bundle/config/w-heading-config.js +85 -0
- package/build/cjs/bundle/config/wysiwyg.d.ts +3 -24
- package/build/cjs/bundle/config/wysiwyg.js +110 -183
- package/build/cjs/bundle/index.d.ts +1 -0
- package/build/cjs/bundle/index.js +2 -0
- package/build/cjs/bundle/toolbar/ToolbarSelect.d.ts +2 -3
- package/build/cjs/bundle/toolbar/markup/MToolbarColors.d.ts +2 -2
- package/build/cjs/bundle/toolbar/markup/MToolbarImagePopup.d.ts +1 -1
- package/build/cjs/bundle/toolbar/types.d.ts +21 -0
- package/build/cjs/bundle/toolbar/types.js +4 -0
- package/build/cjs/bundle/toolbar/utils/flattenPreset.d.ts +2 -2
- package/build/cjs/bundle/toolbar/utils/flattenPreset.js +1 -1
- package/build/cjs/bundle/toolbar/utils/toolbarsConfigs.d.ts +5 -5
- package/build/cjs/bundle/toolbar/utils/toolbarsConfigs.js +3 -3
- package/build/cjs/bundle/toolbar/wysiwyg/WToolbarColors.d.ts +2 -2
- package/build/cjs/bundle/toolbar/wysiwyg/WToolbarTextSelect.d.ts +2 -2
- package/build/cjs/bundle/toolbar/wysiwyg/WToolbarTextSelect.js +2 -2
- package/build/cjs/extensions/additional/GPT/MarkupGpt/toolbar.d.ts +1 -1
- package/build/cjs/extensions/additional/GPT/MarkupGpt/toolbar.js +2 -2
- package/build/cjs/extensions/additional/GPT/wGptItemData.d.ts +1 -1
- package/build/cjs/extensions/additional/GPT/wGptItemData.js +2 -2
- package/build/cjs/extensions/additional/Mermaid/MermaidSpecs/index.js +3 -2
- package/build/cjs/extensions/base/BaseSchema/BaseSchemaSpecs/index.js +13 -1
- package/build/cjs/extensions/behavior/SelectionContext/tooltip.d.ts +5 -5
- package/build/cjs/extensions/markdown/Image/index.d.ts +1 -1
- package/build/cjs/extensions/markdown/Link/LinkSpecs/index.js +1 -1
- package/build/cjs/extensions/markdown/Link/PlaceholderWidget/descriptor.d.ts +3 -3
- package/build/cjs/extensions/markdown/Link/PlaceholderWidget/descriptor.js +4 -3
- package/build/cjs/extensions/markdown/Link/actions/linkEnhanceActions.d.ts +2 -2
- package/build/cjs/extensions/markdown/Link/actions/linkEnhanceActions.js +10 -8
- package/build/cjs/extensions/markdown/Link/commands.js +2 -2
- package/build/cjs/extensions/markdown/Table/actions/innerActions.d.ts +1 -1
- package/build/cjs/extensions/markdown/Table/plugins/TableCellContextPlugin/index.js +3 -3
- package/build/cjs/extensions/yfm/ImgSize/index.d.ts +3 -3
- package/build/cjs/extensions/yfm/YfmCut/YfmCutSpecs/index.d.ts +2 -10
- package/build/cjs/extensions/yfm/YfmCut/YfmCutSpecs/schema.d.ts +11 -2
- package/build/cjs/extensions/yfm/YfmTable/YfmTableSpecs/index.d.ts +2 -7
- package/build/cjs/extensions/yfm/YfmTable/YfmTableSpecs/schema.d.ts +7 -2
- package/build/cjs/extensions/yfm/YfmTabs/YfmTabsSpecs/index.d.ts +2 -6
- package/build/cjs/extensions/yfm/YfmTabs/YfmTabsSpecs/schema.d.ts +8 -3
- package/build/cjs/extensions/yfm/YfmTabs/actions.js +7 -9
- package/build/cjs/extensions/yfm/YfmTabs/const.d.ts +5 -2
- package/build/cjs/extensions/yfm/YfmTabs/const.js +7 -4
- package/build/cjs/extensions/yfm/YfmTabs/plugins.d.ts +2 -2
- package/build/cjs/extensions/yfm/YfmTabs/plugins.js +15 -96
- package/build/cjs/extensions/yfm/YfmTabs/utils.d.ts +4 -1
- package/build/cjs/extensions/yfm/YfmTabs/utils.js +23 -3
- package/build/cjs/extensions/yfm/YfmTabs/views.d.ts +1 -1
- package/build/cjs/extensions/yfm/YfmTabs/views.js +26 -6
- package/build/cjs/i18n/menubar/index.d.ts +1 -1
- package/build/cjs/i18n/placeholder/index.d.ts +1 -1
- package/build/cjs/i18n/yfm-note/index.d.ts +1 -1
- package/build/cjs/markup/codemirror/html-to-markdown/handlers.d.ts +1 -1
- package/build/cjs/markup/codemirror/search-plugin/plugin.d.ts +6 -16
- package/build/cjs/markup/codemirror/search-plugin/plugin.js +7 -8
- package/build/cjs/markup/codemirror/search-plugin/view/SearchPopup.d.ts +6 -10
- package/build/cjs/markup/codemirror/search-plugin/view/SearchPopup.js +13 -13
- package/build/cjs/markup/codemirror/yfm.d.ts +1 -1
- package/build/cjs/markup/editor.d.ts +1 -1
- package/build/cjs/react-utils/react-node-view.d.ts +2 -2
- package/build/cjs/react-utils/react-node-view.js +2 -2
- package/build/cjs/table-utils/commands/appendColumn.js +2 -2
- package/build/cjs/table-utils/commands/appendRow.js +2 -2
- package/build/cjs/table-utils/commands/removeRow.js +2 -2
- package/build/cjs/toolbar/FlexToolbar.d.ts +2 -2
- package/build/cjs/toolbar/Toolbar.d.ts +2 -3
- package/build/cjs/toolbar/ToolbarGroup.d.ts +2 -2
- package/build/cjs/toolbar/ToolbarListButton.d.ts +2 -9
- package/build/cjs/toolbar/flexible.d.ts +1 -2
- package/build/cjs/toolbar/index.d.ts +0 -1
- package/build/cjs/toolbar/index.js +0 -1
- package/build/cjs/toolbar/types.d.ts +10 -1
- package/build/cjs/version.js +1 -1
- package/build/esm/bundle/MarkdownEditorView.d.ts +1 -1
- package/build/esm/bundle/MarkupEditorView.d.ts +2 -2
- package/build/esm/bundle/WysiwygEditorView.d.ts +2 -2
- package/build/esm/bundle/config/action-names.d.ts +1 -1
- package/build/esm/bundle/config/markup.d.ts +3 -13
- package/build/esm/bundle/config/markup.js +1 -1
- package/build/esm/bundle/config/w-heading-config.d.ts +9 -0
- package/build/esm/bundle/config/w-heading-config.js +82 -0
- package/build/esm/bundle/config/wysiwyg.d.ts +3 -24
- package/build/esm/bundle/config/wysiwyg.js +6 -79
- package/build/esm/bundle/index.d.ts +1 -0
- package/build/esm/bundle/index.js +2 -0
- package/build/esm/bundle/toolbar/ToolbarSelect.d.ts +2 -3
- package/build/esm/bundle/toolbar/markup/MToolbarColors.d.ts +2 -2
- package/build/esm/bundle/toolbar/markup/MToolbarImagePopup.d.ts +1 -1
- package/build/esm/bundle/toolbar/types.d.ts +21 -0
- package/build/esm/bundle/toolbar/types.js +1 -0
- package/build/esm/bundle/toolbar/utils/flattenPreset.d.ts +2 -2
- package/build/esm/bundle/toolbar/utils/flattenPreset.js +1 -1
- package/build/esm/bundle/toolbar/utils/toolbarsConfigs.d.ts +5 -5
- package/build/esm/bundle/toolbar/utils/toolbarsConfigs.js +1 -1
- package/build/esm/bundle/toolbar/wysiwyg/WToolbarColors.d.ts +2 -2
- package/build/esm/bundle/toolbar/wysiwyg/WToolbarTextSelect.d.ts +2 -2
- package/build/esm/bundle/toolbar/wysiwyg/WToolbarTextSelect.js +1 -1
- package/build/esm/extensions/additional/GPT/MarkupGpt/toolbar.d.ts +1 -1
- package/build/esm/extensions/additional/GPT/MarkupGpt/toolbar.js +1 -1
- package/build/esm/extensions/additional/GPT/wGptItemData.d.ts +1 -1
- package/build/esm/extensions/additional/GPT/wGptItemData.js +1 -1
- package/build/esm/extensions/additional/Mermaid/MermaidSpecs/index.js +4 -3
- package/build/esm/extensions/base/BaseSchema/BaseSchemaSpecs/index.js +13 -1
- package/build/esm/extensions/behavior/SelectionContext/tooltip.d.ts +5 -5
- package/build/esm/extensions/behavior/SelectionContext/tooltip.js +1 -1
- package/build/esm/extensions/markdown/Image/index.d.ts +1 -1
- package/build/esm/extensions/markdown/Link/LinkSpecs/index.js +1 -1
- package/build/esm/extensions/markdown/Link/PlaceholderWidget/descriptor.d.ts +3 -3
- package/build/esm/extensions/markdown/Link/PlaceholderWidget/descriptor.js +2 -1
- package/build/esm/extensions/markdown/Link/actions/linkEnhanceActions.d.ts +2 -2
- package/build/esm/extensions/markdown/Link/actions/linkEnhanceActions.js +3 -1
- package/build/esm/extensions/markdown/Link/commands.js +1 -1
- package/build/esm/extensions/markdown/Table/actions/innerActions.d.ts +1 -1
- package/build/esm/extensions/markdown/Table/plugins/TableCellContextPlugin/index.js +1 -1
- package/build/esm/extensions/yfm/ImgSize/index.d.ts +3 -3
- package/build/esm/extensions/yfm/YfmCut/YfmCutSpecs/index.d.ts +2 -10
- package/build/esm/extensions/yfm/YfmCut/YfmCutSpecs/schema.d.ts +11 -2
- package/build/esm/extensions/yfm/YfmTable/YfmTableSpecs/index.d.ts +2 -7
- package/build/esm/extensions/yfm/YfmTable/YfmTableSpecs/schema.d.ts +7 -2
- package/build/esm/extensions/yfm/YfmTabs/YfmTabsSpecs/index.d.ts +2 -6
- package/build/esm/extensions/yfm/YfmTabs/YfmTabsSpecs/schema.d.ts +8 -3
- package/build/esm/extensions/yfm/YfmTabs/actions.js +1 -3
- package/build/esm/extensions/yfm/YfmTabs/const.d.ts +5 -2
- package/build/esm/extensions/yfm/YfmTabs/const.js +6 -3
- package/build/esm/extensions/yfm/YfmTabs/plugins.d.ts +2 -2
- package/build/esm/extensions/yfm/YfmTabs/plugins.js +17 -98
- package/build/esm/extensions/yfm/YfmTabs/utils.d.ts +4 -1
- package/build/esm/extensions/yfm/YfmTabs/utils.js +18 -1
- package/build/esm/extensions/yfm/YfmTabs/views.d.ts +1 -1
- package/build/esm/extensions/yfm/YfmTabs/views.js +24 -4
- package/build/esm/i18n/menubar/index.d.ts +1 -1
- package/build/esm/i18n/placeholder/index.d.ts +1 -1
- package/build/esm/i18n/yfm-note/index.d.ts +1 -1
- package/build/esm/markup/codemirror/html-to-markdown/handlers.d.ts +1 -1
- package/build/esm/markup/codemirror/search-plugin/plugin.d.ts +6 -16
- package/build/esm/markup/codemirror/search-plugin/plugin.js +8 -9
- package/build/esm/markup/codemirror/search-plugin/view/SearchPopup.d.ts +6 -10
- package/build/esm/markup/codemirror/search-plugin/view/SearchPopup.js +13 -13
- package/build/esm/markup/codemirror/yfm.d.ts +1 -1
- package/build/esm/markup/editor.d.ts +1 -1
- package/build/esm/react-utils/react-node-view.d.ts +2 -2
- package/build/esm/react-utils/react-node-view.js +1 -1
- package/build/esm/table-utils/commands/appendColumn.js +1 -1
- package/build/esm/table-utils/commands/appendRow.js +1 -1
- package/build/esm/table-utils/commands/removeRow.js +1 -1
- package/build/esm/toolbar/FlexToolbar.d.ts +2 -2
- package/build/esm/toolbar/Toolbar.d.ts +2 -3
- package/build/esm/toolbar/ToolbarGroup.d.ts +2 -2
- package/build/esm/toolbar/ToolbarListButton.d.ts +2 -9
- package/build/esm/toolbar/flexible.d.ts +1 -2
- package/build/esm/toolbar/index.d.ts +0 -1
- package/build/esm/toolbar/index.js +0 -1
- package/build/esm/toolbar/types.d.ts +10 -1
- package/build/esm/version.js +1 -1
- package/package.json +3 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ActionStorage } from '../../core';
|
|
2
|
+
import type { CodeEditor } from '../../markup';
|
|
3
|
+
import type { ToolbarListButtonData } from '../../toolbar';
|
|
4
|
+
import type { ToolbarButtonPopupData, ToolbarData, ToolbarGroupData, ToolbarGroupItemData, ToolbarItemData, ToolbarListButtonItemData, ToolbarListItemData, ToolbarReactComponentData, ToolbarSingleItemData } from '../../toolbar/types';
|
|
5
|
+
export * from '../../toolbar/types';
|
|
6
|
+
export declare type WToolbarData = ToolbarData<ActionStorage>;
|
|
7
|
+
export declare type WToolbarItemData = ToolbarItemData<ActionStorage>;
|
|
8
|
+
export declare type WToolbarSingleItemData = ToolbarSingleItemData<ActionStorage>;
|
|
9
|
+
export declare type WToolbarGroupData = ToolbarGroupData<ActionStorage>;
|
|
10
|
+
export declare type WToolbarGroupItemData = ToolbarGroupItemData<ActionStorage>;
|
|
11
|
+
export declare type WToolbarListButtonData = ToolbarListButtonData<ActionStorage>;
|
|
12
|
+
export declare type WToolbarListItemData = ToolbarListItemData<ActionStorage>;
|
|
13
|
+
export declare type WToolbarListButtonItemData = ToolbarListButtonItemData<ActionStorage>;
|
|
14
|
+
export declare type MToolbarData = ToolbarData<CodeEditor>;
|
|
15
|
+
export declare type MToolbarItemData = ToolbarItemData<CodeEditor>;
|
|
16
|
+
export declare type MToolbarSingleItemData = ToolbarSingleItemData<CodeEditor>;
|
|
17
|
+
export declare type MToolbarGroupData = ToolbarGroupData<CodeEditor>;
|
|
18
|
+
export declare type MToolbarReactComponentData = ToolbarReactComponentData<CodeEditor>;
|
|
19
|
+
export declare type MToolbarListButtonData = ToolbarListButtonData<CodeEditor>;
|
|
20
|
+
export declare type MToolbarListItemData = ToolbarListItemData<CodeEditor>;
|
|
21
|
+
export declare type MToolbarButtonPopupData = ToolbarButtonPopupData<CodeEditor>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { MToolbarData, MToolbarItemData, WToolbarData, WToolbarItemData } from '
|
|
2
|
-
export declare const flattenPreset: <T extends
|
|
1
|
+
import type { MToolbarData, MToolbarItemData, WToolbarData, WToolbarItemData } from '../types';
|
|
2
|
+
export declare const flattenPreset: <T extends WToolbarData | MToolbarData>(config: T) => T extends WToolbarData ? WToolbarItemData[] : MToolbarItemData[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.flattenPreset = void 0;
|
|
4
|
-
const types_1 = require("
|
|
4
|
+
const types_1 = require("../types");
|
|
5
5
|
const flattenPreset = (config) => {
|
|
6
6
|
return config.flat().reduce((acc, item) => {
|
|
7
7
|
if (item.type === types_1.ToolbarDataType.ListButton && Array.isArray(item.data)) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { ToolbarsPreset } from '../../../modules/toolbars/types';
|
|
2
|
-
import type { MToolbarData, WToolbarData } from '../../../toolbar';
|
|
3
2
|
import type { MarkdownEditorViewProps } from '../../MarkdownEditorView';
|
|
4
|
-
import { MarkdownEditorPreset } from '../../types';
|
|
5
|
-
|
|
3
|
+
import type { MarkdownEditorPreset } from '../../types';
|
|
4
|
+
import type { MToolbarData, WToolbarData } from '../types';
|
|
5
|
+
export declare const createToolbarConfig: <T extends WToolbarData | MToolbarData>(editorType: 'wysiwyg' | 'markup', toolbarPreset: ToolbarsPreset | MarkdownEditorPreset, toolbarName: string) => T;
|
|
6
6
|
interface GetToolbarsConfigsArgs {
|
|
7
7
|
toolbarsPreset?: ToolbarsPreset;
|
|
8
8
|
props: Pick<MarkdownEditorViewProps, 'markupToolbarConfig' | 'wysiwygToolbarConfig' | 'wysiwygHiddenActionsConfig' | 'markupHiddenActionsConfig'>;
|
|
@@ -11,7 +11,7 @@ interface GetToolbarsConfigsArgs {
|
|
|
11
11
|
export declare const getToolbarsConfigs: ({ toolbarsPreset, props, preset }: GetToolbarsConfigsArgs) => {
|
|
12
12
|
wysiwygToolbarConfig: WToolbarData;
|
|
13
13
|
markupToolbarConfig: MToolbarData;
|
|
14
|
-
wysiwygHiddenActionsConfig: import("
|
|
15
|
-
markupHiddenActionsConfig: import("
|
|
14
|
+
wysiwygHiddenActionsConfig: import("../types").WToolbarItemData[];
|
|
15
|
+
markupHiddenActionsConfig: import("../types").MToolbarItemData[];
|
|
16
16
|
};
|
|
17
17
|
export {};
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getToolbarsConfigs = exports.createToolbarConfig = void 0;
|
|
4
4
|
const constants_1 = require("../../../modules/toolbars/constants");
|
|
5
5
|
const presets_1 = require("../../../modules/toolbars/presets");
|
|
6
|
-
const
|
|
6
|
+
const types_1 = require("../types");
|
|
7
7
|
const flattenPreset_1 = require("./flattenPreset");
|
|
8
8
|
const defaultPresets = {
|
|
9
9
|
zero: presets_1.zero,
|
|
@@ -18,8 +18,8 @@ const transformItem = (type, item, id = 'unknown') => {
|
|
|
18
18
|
console.warn(`Toolbar item "${id}" not found, it might not have been added to the items dictionary.`);
|
|
19
19
|
return {};
|
|
20
20
|
}
|
|
21
|
-
const isListButton = item.view.type ===
|
|
22
|
-
return Object.assign(Object.assign(Object.assign({ type: (_a = item.view.type) !== null && _a !== void 0 ? _a :
|
|
21
|
+
const isListButton = item.view.type === types_1.ToolbarDataType.ListButton;
|
|
22
|
+
return Object.assign(Object.assign(Object.assign({ type: (_a = item.view.type) !== null && _a !== void 0 ? _a : types_1.ToolbarDataType.SingleButton, id, title: item.view.title, hint: item.view.hint, icon: item.view.icon, hotkey: item.view.hotkey }, (isListButton && { withArrow: item.view.withArrow })), (type === 'wysiwyg' && item.wysiwyg && Object.assign({}, item.wysiwyg))), (type === 'markup' && item.markup && Object.assign({}, item.markup)));
|
|
23
23
|
};
|
|
24
24
|
const createToolbarConfig = (editorType, toolbarPreset, toolbarName) => {
|
|
25
25
|
var _a;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ActionStorage } from '../../../core';
|
|
3
|
-
import { ToolbarBaseProps } from '
|
|
2
|
+
import type { ActionStorage } from '../../../core';
|
|
3
|
+
import type { ToolbarBaseProps } from '../types';
|
|
4
4
|
export declare type WToolbarColorsProps = ToolbarBaseProps<ActionStorage>;
|
|
5
5
|
export declare const WToolbarColors: React.FC<WToolbarColorsProps>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ActionStorage } from '../../../core';
|
|
3
|
-
import { ToolbarBaseProps } from '../../../toolbar';
|
|
2
|
+
import type { ActionStorage } from '../../../core';
|
|
3
|
+
import type { ToolbarBaseProps } from '../../../toolbar/types';
|
|
4
4
|
export declare type WToolbarTextSelectProps = ToolbarBaseProps<ActionStorage> & {};
|
|
5
5
|
export declare const WToolbarTextSelect: React.FC<WToolbarTextSelectProps>;
|
|
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.WToolbarTextSelect = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
-
const
|
|
6
|
+
const w_heading_config_1 = require("../../config/w-heading-config");
|
|
7
7
|
const ToolbarSelect_1 = require("../ToolbarSelect");
|
|
8
8
|
const WToolbarTextSelect = ({ focus, onClick, editor, className, }) => {
|
|
9
|
-
const items = react_1.default.useMemo(() =>
|
|
9
|
+
const items = react_1.default.useMemo(() => w_heading_config_1.wHeadingListConfig.data, []);
|
|
10
10
|
return (react_1.default.createElement(ToolbarSelect_1.ToolbarSelect, { items: items, focus: focus, editor: editor, onClick: onClick, className: className }));
|
|
11
11
|
};
|
|
12
12
|
exports.WToolbarTextSelect = WToolbarTextSelect;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { MToolbarSingleItemData } from '../../../../bundle/
|
|
1
|
+
import { type MToolbarSingleItemData } from '../../../../bundle/toolbar/types';
|
|
2
2
|
export declare const mGptToolbarItem: MToolbarSingleItemData;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.mGptToolbarItem = void 0;
|
|
4
|
+
const types_1 = require("../../../../bundle/toolbar/types");
|
|
4
5
|
const extension_1 = require("../../../../i18n/gpt/extension");
|
|
5
6
|
const icons_1 = require("../../../../icons");
|
|
6
|
-
const toolbar_1 = require("../../../../toolbar");
|
|
7
7
|
const constants_1 = require("../constants");
|
|
8
8
|
const commands_1 = require("./commands");
|
|
9
9
|
exports.mGptToolbarItem = {
|
|
10
10
|
id: 'gpt',
|
|
11
|
-
type:
|
|
11
|
+
type: types_1.ToolbarDataType.SingleButton,
|
|
12
12
|
hotkey: constants_1.gptHotKeys.openGptKeyTooltip,
|
|
13
13
|
title: () => `${(0, extension_1.i18n)('help-with-text')}`,
|
|
14
14
|
icon: { data: icons_1.GPTIcon },
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { WToolbarSingleItemData } from '../../../bundle/toolbar/types';
|
|
2
2
|
export declare const cnGptButton: import("@bem-react/classname").ClassNameFormatter;
|
|
3
3
|
export declare const wGptItemData: WToolbarSingleItemData;
|
|
@@ -5,11 +5,11 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const classname_1 = require("@bem-react/classname");
|
|
6
6
|
const extension_1 = require("../../../i18n/gpt/extension");
|
|
7
7
|
const GPT_1 = tslib_1.__importDefault(require("../../../icons/GPT"));
|
|
8
|
-
const
|
|
8
|
+
const types_1 = require("../../../toolbar/types");
|
|
9
9
|
const constants_1 = require("./constants");
|
|
10
10
|
exports.cnGptButton = (0, classname_1.cn)('gpt-button');
|
|
11
11
|
exports.wGptItemData = {
|
|
12
|
-
type:
|
|
12
|
+
type: types_1.ToolbarDataType.SingleButton,
|
|
13
13
|
id: 'gpt',
|
|
14
14
|
title: () => `${(0, extension_1.i18n)('help-with-text')}`,
|
|
15
15
|
hotkey: constants_1.gptHotKeys.openGptKeyTooltip,
|
|
@@ -33,9 +33,10 @@ const MermaidSpecsExtension = (builder, { nodeView }) => {
|
|
|
33
33
|
dnd: { props: { offset: [8, 1] } },
|
|
34
34
|
},
|
|
35
35
|
toMd: (state, node) => {
|
|
36
|
-
|
|
36
|
+
const content = node.attrs[const_1.MermaidConsts.NodeAttrs.content] || '';
|
|
37
|
+
state.write('```mermaid');
|
|
37
38
|
state.ensureNewLine();
|
|
38
|
-
state.
|
|
39
|
+
state.text(content.trim(), false);
|
|
39
40
|
state.ensureNewLine();
|
|
40
41
|
state.write('```');
|
|
41
42
|
state.ensureNewLine();
|
|
@@ -59,7 +59,7 @@ const BaseSchemaSpecs = (builder, opts) => {
|
|
|
59
59
|
An empty line is added only if there is some content in the parent element.
|
|
60
60
|
This is necessary in order to prevent an empty document with empty lines
|
|
61
61
|
*/
|
|
62
|
-
if (opts.preserveEmptyRows &&
|
|
62
|
+
if (opts.preserveEmptyRows && isEmptyString(node)) {
|
|
63
63
|
let isParentEmpty = true;
|
|
64
64
|
for (let index = 0; index < parent.content.childCount; index++) {
|
|
65
65
|
const parentChild = parent.content.child(index);
|
|
@@ -80,3 +80,15 @@ const BaseSchemaSpecs = (builder, opts) => {
|
|
|
80
80
|
}));
|
|
81
81
|
};
|
|
82
82
|
exports.BaseSchemaSpecs = BaseSchemaSpecs;
|
|
83
|
+
const isEmptyString = (node) => {
|
|
84
|
+
var _a;
|
|
85
|
+
if (!node.content.size) {
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
if (node.childCount === 1 &&
|
|
89
|
+
node.child(0).type.name === 'text' &&
|
|
90
|
+
((_a = node.child(0).text) === null || _a === void 0 ? void 0 : _a.trim()) === '') {
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
return false;
|
|
94
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { PopupProps } from '@gravity-ui/uikit';
|
|
2
|
-
import { EditorState } from 'prosemirror-state';
|
|
3
|
-
import { EditorView } from 'prosemirror-view';
|
|
4
|
-
import { ActionStorage } from '../../../core';
|
|
5
|
-
import { ToolbarButtonPopupData, ToolbarGroupItemData, ToolbarSingleItemData } from '../../../toolbar';
|
|
1
|
+
import { type PopupProps } from '@gravity-ui/uikit';
|
|
2
|
+
import type { EditorState } from 'prosemirror-state';
|
|
3
|
+
import type { EditorView } from 'prosemirror-view';
|
|
4
|
+
import type { ActionStorage } from '../../../core';
|
|
5
|
+
import type { ToolbarButtonPopupData, ToolbarGroupItemData, ToolbarSingleItemData } from '../../../toolbar';
|
|
6
6
|
export declare type ContextGroupItemData = (ToolbarGroupItemData<ActionStorage> & {
|
|
7
7
|
condition?: (state: EditorState) => void;
|
|
8
8
|
}) | ((ToolbarSingleItemData<ActionStorage> | ToolbarButtonPopupData<ActionStorage>) & {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Action, ExtensionAuto } from '../../../core';
|
|
2
2
|
import { AddImageAttrs } from './actions';
|
|
3
3
|
import { addImageAction } from './const';
|
|
4
|
-
import { ImageUrlPasteOptions } from './imageUrlPaste';
|
|
4
|
+
import { type ImageUrlPasteOptions } from './imageUrlPaste';
|
|
5
5
|
export { imageNodeName, imageType, ImageAttr } from './ImageSpecs';
|
|
6
6
|
/** @deprecated Use `imageType` instead */
|
|
7
7
|
export declare const imgType: (schema: import("prosemirror-model").Schema<any, any>) => import("prosemirror-model").NodeType;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Transaction } from 'prosemirror-state';
|
|
3
|
-
import { EditorView } from 'prosemirror-view';
|
|
4
|
-
import { ExtensionDeps } from '../../../../core';
|
|
2
|
+
import type { Transaction } from 'prosemirror-state';
|
|
3
|
+
import type { EditorView } from 'prosemirror-view';
|
|
4
|
+
import type { ExtensionDeps } from '../../../../core';
|
|
5
5
|
import { ReactWidgetDescriptor } from '../../../behavior/WidgetDecoration/ReactWidgetDescriptor';
|
|
6
6
|
import { LinkPlaceholderWidgetProps } from './widget';
|
|
7
7
|
export declare const addPlaceholder: (tr: Transaction, deps: ExtensionDeps) => Transaction;
|
|
@@ -6,7 +6,8 @@ const tslib_1 = require("tslib");
|
|
|
6
6
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
7
7
|
const WidgetDecoration_1 = require("../../../behavior/WidgetDecoration");
|
|
8
8
|
const ReactWidgetDescriptor_1 = require("../../../behavior/WidgetDecoration/ReactWidgetDescriptor");
|
|
9
|
-
const
|
|
9
|
+
const LinkSpecs_1 = require("../LinkSpecs");
|
|
10
|
+
const utils_1 = require("../utils");
|
|
10
11
|
const widget_1 = require("./widget");
|
|
11
12
|
const addPlaceholder = (tr, deps) => {
|
|
12
13
|
return new LinkWidgetDescriptor(tr.selection.from, deps).applyTo(tr);
|
|
@@ -34,13 +35,13 @@ class LinkWidgetDescriptor extends ReactWidgetDescriptor_1.ReactWidgetDescriptor
|
|
|
34
35
|
const to = from + text.length;
|
|
35
36
|
let tr = tslib_1.__classPrivateFieldGet(this, _LinkWidgetDescriptor_view, "f").state.tr;
|
|
36
37
|
tr = tr.insertText(text, from);
|
|
37
|
-
tr = tr.addMark(from, to, (0,
|
|
38
|
+
tr = tr.addMark(from, to, (0, LinkSpecs_1.linkType)(tslib_1.__classPrivateFieldGet(this, _LinkWidgetDescriptor_view, "f").state.schema).create({ [LinkSpecs_1.LinkAttr.Href]: url }));
|
|
38
39
|
tr = (0, WidgetDecoration_1.removeDecoration)(tr, this.id);
|
|
39
40
|
tslib_1.__classPrivateFieldGet(this, _LinkWidgetDescriptor_view, "f").dispatch(tr);
|
|
40
41
|
tslib_1.__classPrivateFieldGet(this, _LinkWidgetDescriptor_view, "f").focus();
|
|
41
42
|
};
|
|
42
43
|
tslib_1.__classPrivateFieldSet(this, _LinkWidgetDescriptor_domElem, document.createElement('span'), "f");
|
|
43
|
-
this.normalizeUrl = (0,
|
|
44
|
+
this.normalizeUrl = (0, utils_1.normalizeUrlFactory)(deps);
|
|
44
45
|
}
|
|
45
46
|
getDomElem() {
|
|
46
47
|
return tslib_1.__classPrivateFieldGet(this, _LinkWidgetDescriptor_domElem, "f");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Command } from 'prosemirror-state';
|
|
2
|
-
import { ActionSpec, ExtensionDeps } from '../../../../core';
|
|
1
|
+
import { type Command } from 'prosemirror-state';
|
|
2
|
+
import type { ActionSpec, ExtensionDeps } from '../../../../core';
|
|
3
3
|
export declare const addEmptyLink: Command;
|
|
4
4
|
export declare const addLinkCmd2: (deps: ExtensionDeps) => Command;
|
|
5
5
|
export declare const linkActionSpec2: (deps: ExtensionDeps) => ActionSpec;
|
|
@@ -6,14 +6,16 @@ const prosemirror_state_1 = require("prosemirror-state");
|
|
|
6
6
|
const prosemirror_utils_1 = require("prosemirror-utils");
|
|
7
7
|
const marks_1 = require("../../../../utils/marks");
|
|
8
8
|
const const_1 = require("../../../yfm/ImgSize/const");
|
|
9
|
-
const
|
|
9
|
+
const ImageSpecs_1 = require("../../Image/ImageSpecs");
|
|
10
|
+
const LinkSpecs_1 = require("../LinkSpecs");
|
|
10
11
|
const commands_1 = require("../PlaceholderWidget/commands");
|
|
12
|
+
const commands_2 = require("../commands");
|
|
11
13
|
const addEmptyLink = (state, dispatch) => {
|
|
12
|
-
const linkMarkType = (0,
|
|
14
|
+
const linkMarkType = (0, LinkSpecs_1.linkType)(state.schema);
|
|
13
15
|
const { selection } = state;
|
|
14
16
|
const { nodeAfter } = selection.$from;
|
|
15
17
|
if (selection.empty ||
|
|
16
|
-
((0, prosemirror_utils_1.isNodeSelection)(selection) && selection.node.type !== (0,
|
|
18
|
+
((0, prosemirror_utils_1.isNodeSelection)(selection) && selection.node.type !== (0, ImageSpecs_1.imageType)(state.schema)) ||
|
|
17
19
|
(!((nodeAfter === null || nodeAfter === void 0 ? void 0 : nodeAfter.isInline) && (nodeAfter === null || nodeAfter === void 0 ? void 0 : nodeAfter.isAtom)) && !(nodeAfter === null || nodeAfter === void 0 ? void 0 : nodeAfter.isText)))
|
|
18
20
|
return false;
|
|
19
21
|
const { $from, $to } = selection;
|
|
@@ -22,15 +24,15 @@ const addEmptyLink = (state, dispatch) => {
|
|
|
22
24
|
return false;
|
|
23
25
|
let tr = state.tr;
|
|
24
26
|
(0, prosemirror_commands_1.toggleMark)(linkMarkType, {
|
|
25
|
-
[
|
|
26
|
-
[
|
|
27
|
+
[LinkSpecs_1.LinkAttr.Href]: '',
|
|
28
|
+
[LinkSpecs_1.LinkAttr.IsPlaceholder]: true,
|
|
27
29
|
})(state, (_tr) => {
|
|
28
30
|
tr = _tr;
|
|
29
31
|
});
|
|
30
32
|
tr.scrollIntoView();
|
|
31
33
|
if (selection instanceof prosemirror_state_1.NodeSelection) {
|
|
32
34
|
tr.setSelection(prosemirror_state_1.NodeSelection.create(tr.doc, $to.pos - 1));
|
|
33
|
-
if (selection.node.type === (0,
|
|
35
|
+
if (selection.node.type === (0, ImageSpecs_1.imageType)(state.schema)) {
|
|
34
36
|
const meta = { linkAdded: true };
|
|
35
37
|
tr.setMeta(const_1.imageRendererKey, meta);
|
|
36
38
|
}
|
|
@@ -44,10 +46,10 @@ const addEmptyLink = (state, dispatch) => {
|
|
|
44
46
|
return true;
|
|
45
47
|
};
|
|
46
48
|
exports.addEmptyLink = addEmptyLink;
|
|
47
|
-
const addLinkCmd2 = (deps) => (0, prosemirror_commands_1.chainCommands)(
|
|
49
|
+
const addLinkCmd2 = (deps) => (0, prosemirror_commands_1.chainCommands)(commands_2.removeLink, exports.addEmptyLink, (0, commands_1.addLinkPlaceholder)(deps));
|
|
48
50
|
exports.addLinkCmd2 = addLinkCmd2;
|
|
49
51
|
const linkActionSpec2 = (deps) => ({
|
|
50
|
-
isActive: (state) => Boolean((0, marks_1.isMarkActive)(state, (0,
|
|
52
|
+
isActive: (state) => Boolean((0, marks_1.isMarkActive)(state, (0, LinkSpecs_1.linkType)(state.schema))),
|
|
51
53
|
isEnable: (0, exports.addLinkCmd2)(deps),
|
|
52
54
|
run: (0, exports.addLinkCmd2)(deps),
|
|
53
55
|
});
|
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.removeLink = void 0;
|
|
4
4
|
const prosemirror_commands_1 = require("prosemirror-commands");
|
|
5
5
|
const marks_1 = require("../../../utils/marks");
|
|
6
|
-
const
|
|
6
|
+
const LinkSpecs_1 = require("./LinkSpecs");
|
|
7
7
|
const removeLink = (state, dispatch) => {
|
|
8
|
-
const linkMarkType = (0,
|
|
8
|
+
const linkMarkType = (0, LinkSpecs_1.linkType)(state.schema);
|
|
9
9
|
if ((0, marks_1.isMarkActive)(state, linkMarkType))
|
|
10
10
|
return (0, prosemirror_commands_1.toggleMark)(linkMarkType)(state, dispatch);
|
|
11
11
|
return false;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ActionSpec } from '../../../../core';
|
|
2
|
-
export declare const innerActions: Record<"
|
|
2
|
+
export declare const innerActions: Record<"setCellLeftAlign" | "setCellCenterAlign" | "setCellRightAlign" | "addRow" | "deleteRow" | "addColumn" | "deleteColumn", ActionSpec>;
|
|
@@ -4,7 +4,7 @@ exports.tableCellContextPlugin = void 0;
|
|
|
4
4
|
const prosemirror_state_1 = require("prosemirror-state");
|
|
5
5
|
const core_1 = require("../../../../../core");
|
|
6
6
|
const yfm_table_1 = require("../../../../../i18n/yfm-table");
|
|
7
|
-
const
|
|
7
|
+
const convert_table_1 = require("../../../../yfm/YfmTable/commands/convert-table");
|
|
8
8
|
const TableSpecs_1 = require("../../TableSpecs");
|
|
9
9
|
const innerActions_1 = require("../../actions/innerActions");
|
|
10
10
|
const tableActions_1 = require("../../actions/tableActions");
|
|
@@ -13,8 +13,8 @@ const tableCellContextPlugin = () => new prosemirror_state_1.Plugin({
|
|
|
13
13
|
view(view) {
|
|
14
14
|
const { schema } = view.state;
|
|
15
15
|
const actions = (0, core_1.bindActions)(Object.assign(Object.assign({}, innerActions_1.innerActions), { deleteTable: tableActions_1.deleteTableAction, convert: {
|
|
16
|
-
isEnable:
|
|
17
|
-
run:
|
|
16
|
+
isEnable: convert_table_1.convertToYfmTable,
|
|
17
|
+
run: convert_table_1.convertToYfmTable,
|
|
18
18
|
} }))(view);
|
|
19
19
|
return new view_1.TableCellContextView(view, [
|
|
20
20
|
[
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Action, ExtensionAuto } from '../../../core';
|
|
2
|
-
import { ImagePasteOptions } from './ImagePaste';
|
|
3
|
-
import { ImgSizeSpecsOptions } from './ImgSizeSpecs';
|
|
4
|
-
import { AddImageAttrs } from './actions';
|
|
2
|
+
import { type ImagePasteOptions } from './ImagePaste';
|
|
3
|
+
import { type ImgSizeSpecsOptions } from './ImgSizeSpecs';
|
|
4
|
+
import { type AddImageAttrs } from './actions';
|
|
5
5
|
import { addImageAction } from './const';
|
|
6
6
|
export declare type ImgSizeOptions = ImgSizeSpecsOptions & {
|
|
7
7
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { NodeSpec } from 'prosemirror-model';
|
|
2
1
|
import type { ExtensionAuto, ExtensionNodeSpec } from '../../../../core';
|
|
2
|
+
import { type YfmCutSchemaOptions } from './schema';
|
|
3
3
|
export { CutAttr, CutNode, cutType, cutTitleType, cutContentType } from './const';
|
|
4
4
|
declare global {
|
|
5
5
|
namespace MarkdownEditor {
|
|
@@ -8,17 +8,9 @@ declare global {
|
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
export declare type YfmCutSpecsOptions = {
|
|
11
|
+
export declare type YfmCutSpecsOptions = YfmCutSchemaOptions & {
|
|
12
12
|
cutView?: ExtensionNodeSpec['view'];
|
|
13
13
|
cutTitleView?: ExtensionNodeSpec['view'];
|
|
14
14
|
cutContentView?: ExtensionNodeSpec['view'];
|
|
15
|
-
/**
|
|
16
|
-
* @deprecated: use placeholder option in BehaviorPreset instead.
|
|
17
|
-
*/
|
|
18
|
-
yfmCutTitlePlaceholder?: NonNullable<NodeSpec['placeholder']>['content'];
|
|
19
|
-
/**
|
|
20
|
-
* @deprecated: use placeholder option in BehaviorPreset instead.
|
|
21
|
-
*/
|
|
22
|
-
yfmCutContentPlaceholder?: NonNullable<NodeSpec['placeholder']>['content'];
|
|
23
15
|
};
|
|
24
16
|
export declare const YfmCutSpecs: ExtensionAuto<YfmCutSpecsOptions>;
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import type { NodeSpec } from 'prosemirror-model';
|
|
2
2
|
import type { PlaceholderOptions } from '../../../../utils/placeholder';
|
|
3
3
|
import { CutNode } from './const';
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
export declare type YfmCutSchemaOptions = {
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated: use placeholder option in BehaviorPreset instead.
|
|
7
|
+
*/
|
|
8
|
+
yfmCutTitlePlaceholder?: NonNullable<NodeSpec['placeholder']>['content'];
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated: use placeholder option in BehaviorPreset instead.
|
|
11
|
+
*/
|
|
12
|
+
yfmCutContentPlaceholder?: NonNullable<NodeSpec['placeholder']>['content'];
|
|
13
|
+
};
|
|
14
|
+
export declare const getSchemaSpecs: (opts?: YfmCutSchemaOptions, placeholder?: PlaceholderOptions) => Record<CutNode, NodeSpec>;
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import type { NodeSpec } from 'prosemirror-model';
|
|
2
1
|
import type { ExtensionWithOptions } from '../../../../core';
|
|
2
|
+
import { type YfmTableSchemaOptions } from './schema';
|
|
3
3
|
export { YfmTableNode } from './const';
|
|
4
4
|
export { yfmTableType, yfmTableBodyType, yfmTableRowType, yfmTableCellType } from './utils';
|
|
5
|
-
export declare type YfmTableSpecsOptions = {
|
|
6
|
-
/**
|
|
7
|
-
* @deprecated: use placeholder option in BehaviorPreset instead.
|
|
8
|
-
*/
|
|
9
|
-
yfmTableCellPlaceholder?: NonNullable<NodeSpec['placeholder']>['content'];
|
|
10
|
-
};
|
|
5
|
+
export declare type YfmTableSpecsOptions = YfmTableSchemaOptions & {};
|
|
11
6
|
export declare const YfmTableSpecs: ExtensionWithOptions<YfmTableSpecsOptions>;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import type { NodeSpec } from 'prosemirror-model';
|
|
2
2
|
import { PlaceholderOptions } from '../../../../utils/placeholder';
|
|
3
3
|
import { YfmTableNode } from './const';
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
export declare type YfmTableSchemaOptions = {
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated: use placeholder option in BehaviorPreset instead.
|
|
7
|
+
*/
|
|
8
|
+
yfmTableCellPlaceholder?: NonNullable<NodeSpec['placeholder']>['content'];
|
|
9
|
+
};
|
|
10
|
+
export declare const getSchemaSpecs: (opts?: YfmTableSchemaOptions, placeholder?: PlaceholderOptions) => Record<YfmTableNode, NodeSpec>;
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import { NodeSpec } from 'prosemirror-model';
|
|
2
1
|
import type { ExtensionAuto, ExtensionNodeSpec } from '../../../../core';
|
|
2
|
+
import { type YfmTabsSchemaOptions } from './schema';
|
|
3
3
|
export { TabsNode } from './const';
|
|
4
4
|
export declare const tabPanelType: (schema: import("prosemirror-model").Schema<any, any>) => import("prosemirror-model").NodeType;
|
|
5
5
|
export declare const tabType: (schema: import("prosemirror-model").Schema<any, any>) => import("prosemirror-model").NodeType;
|
|
6
6
|
export declare const tabsType: (schema: import("prosemirror-model").Schema<any, any>) => import("prosemirror-model").NodeType;
|
|
7
7
|
export declare const tabsListType: (schema: import("prosemirror-model").Schema<any, any>) => import("prosemirror-model").NodeType;
|
|
8
|
-
export declare type YfmTabsSpecsOptions = {
|
|
9
|
-
/**
|
|
10
|
-
* @deprecated: use placeholder option in BehaviorPreset instead.
|
|
11
|
-
*/
|
|
12
|
-
tabPlaceholder?: NonNullable<NodeSpec['placeholder']>['content'];
|
|
8
|
+
export declare type YfmTabsSpecsOptions = YfmTabsSchemaOptions & {
|
|
13
9
|
tabView?: ExtensionNodeSpec['view'];
|
|
14
10
|
tabsListView?: ExtensionNodeSpec['view'];
|
|
15
11
|
tabPanelView?: ExtensionNodeSpec['view'];
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import type { NodeSpec } from 'prosemirror-model';
|
|
2
|
-
import { PlaceholderOptions } from '../../../../utils/placeholder';
|
|
2
|
+
import type { PlaceholderOptions } from '../../../../utils/placeholder';
|
|
3
3
|
import { TabsNode } from './const';
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
export declare type YfmTabsSchemaOptions = {
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated: use placeholder option in BehaviorPreset instead.
|
|
7
|
+
*/
|
|
8
|
+
tabPlaceholder?: NonNullable<NodeSpec['placeholder']>['content'];
|
|
9
|
+
};
|
|
10
|
+
export declare const getSchemaSpecs: (opts: YfmTabsSchemaOptions, placeholder?: PlaceholderOptions) => Record<TabsNode, NodeSpec>;
|
|
@@ -3,24 +3,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createYfmTabs = exports.createYfmTabsCommand = void 0;
|
|
4
4
|
const utils_1 = require("@diplodoc/transform/lib/plugins/utils");
|
|
5
5
|
const BaseSchema_1 = require("../../base/BaseSchema");
|
|
6
|
-
const const_1 = require("./
|
|
7
|
-
const const_2 = require("./const");
|
|
8
|
-
const _1 = require(".");
|
|
6
|
+
const const_1 = require("./const");
|
|
9
7
|
const createYfmTabsCommand = (state, dispatch) => {
|
|
10
8
|
if (dispatch) {
|
|
11
9
|
const { schema } = state;
|
|
12
10
|
const tabId = (0, utils_1.generateID)();
|
|
13
11
|
const panelId = (0, utils_1.generateID)();
|
|
14
|
-
const yfmTabsList = (0,
|
|
15
|
-
const yfmTabs = (0,
|
|
16
|
-
const yfmTabPanel = (0,
|
|
12
|
+
const yfmTabsList = (0, const_1.tabsListType)(schema);
|
|
13
|
+
const yfmTabs = (0, const_1.tabsType)(schema);
|
|
14
|
+
const yfmTabPanel = (0, const_1.tabPanelType)(state.schema).create({
|
|
17
15
|
[const_1.TabPanelAttrs.ariaLabelledby]: tabId,
|
|
18
16
|
[const_1.TabPanelAttrs.id]: panelId,
|
|
19
|
-
[const_1.TabPanelAttrs.class]:
|
|
17
|
+
[const_1.TabPanelAttrs.class]: const_1.tabPanelActiveClassname,
|
|
20
18
|
}, (0, BaseSchema_1.pType)(state.schema).createAndFill());
|
|
21
|
-
const yfmTab = (0,
|
|
19
|
+
const yfmTab = (0, const_1.tabType)(state.schema).create({
|
|
22
20
|
[const_1.TabAttrs.id]: tabId,
|
|
23
|
-
[const_1.TabAttrs.class]:
|
|
21
|
+
[const_1.TabAttrs.class]: const_1.tabActiveClassname,
|
|
24
22
|
[const_1.TabAttrs.ariaControls]: panelId,
|
|
25
23
|
[const_1.TabAttrs.dataDiplodocIsActive]: 'true',
|
|
26
24
|
[const_1.TabAttrs.dataDiplodocid]: tabId,
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export * from './YfmTabsSpecs/const';
|
|
2
|
+
export { tabType, tabPanelType, tabsListType, tabsType } from './YfmTabsSpecs';
|
|
3
|
+
export declare const YFM_TAB_CLASSNAME = "yfm-tab";
|
|
4
|
+
export declare const DIPLODOC_ID_ATTR = "data-diplodoc-id";
|
|
5
|
+
export declare const tabActiveClassname: string;
|
|
3
6
|
export declare const tabInactiveClassname = "yfm-tab";
|
|
4
7
|
export declare const tabPanelActiveClassname = "yfm-tab-panel active";
|
|
5
8
|
export declare const tabPanelInactiveClassname = "yfm-tab-panel";
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.tabPanelInactiveClassname = exports.tabPanelActiveClassname = exports.tabInactiveClassname = exports.tabActiveClassname = exports.
|
|
3
|
+
exports.tabPanelInactiveClassname = exports.tabPanelActiveClassname = exports.tabInactiveClassname = exports.tabActiveClassname = exports.DIPLODOC_ID_ATTR = exports.YFM_TAB_CLASSNAME = exports.tabsType = exports.tabsListType = exports.tabPanelType = exports.tabType = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
tslib_1.__exportStar(require("./YfmTabsSpecs/const"), exports);
|
|
4
6
|
var YfmTabsSpecs_1 = require("./YfmTabsSpecs");
|
|
5
|
-
Object.defineProperty(exports, "TabsNode", { enumerable: true, get: function () { return YfmTabsSpecs_1.TabsNode; } });
|
|
6
7
|
Object.defineProperty(exports, "tabType", { enumerable: true, get: function () { return YfmTabsSpecs_1.tabType; } });
|
|
7
8
|
Object.defineProperty(exports, "tabPanelType", { enumerable: true, get: function () { return YfmTabsSpecs_1.tabPanelType; } });
|
|
8
9
|
Object.defineProperty(exports, "tabsListType", { enumerable: true, get: function () { return YfmTabsSpecs_1.tabsListType; } });
|
|
9
10
|
Object.defineProperty(exports, "tabsType", { enumerable: true, get: function () { return YfmTabsSpecs_1.tabsType; } });
|
|
10
|
-
exports.
|
|
11
|
-
exports.
|
|
11
|
+
exports.YFM_TAB_CLASSNAME = 'yfm-tab';
|
|
12
|
+
exports.DIPLODOC_ID_ATTR = 'data-diplodoc-id';
|
|
13
|
+
exports.tabActiveClassname = `${exports.YFM_TAB_CLASSNAME} active`;
|
|
14
|
+
exports.tabInactiveClassname = exports.YFM_TAB_CLASSNAME;
|
|
12
15
|
exports.tabPanelActiveClassname = 'yfm-tab-panel active';
|
|
13
16
|
exports.tabPanelInactiveClassname = 'yfm-tab-panel';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Command, Plugin } from 'prosemirror-state';
|
|
2
|
-
import { NodeWithPos } from 'prosemirror-utils';
|
|
1
|
+
import { type Command, Plugin } from 'prosemirror-state';
|
|
2
|
+
import { type NodeWithPos } from 'prosemirror-utils';
|
|
3
3
|
export declare const dragAutoSwitch: () => Plugin<any>;
|
|
4
4
|
export declare const tabPanelArrowDown: Command;
|
|
5
5
|
export declare const tabEnter: Command;
|