@worktile/theia 3.0.5 → 3.0.6

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,7 @@
1
1
  import { ComponentType } from '@angular/cdk/portal';
2
2
  import { Editor } from 'slate';
3
3
  import { ElementKinds, MarkTypes, DropdownMode } from '../constants';
4
+ import { PluginKey } from './plugins';
4
5
  export declare type ToolbarKey = MarkTypes | ElementKinds | string;
5
6
  export declare enum ToolbarItemType {
6
7
  default = "default",
@@ -18,6 +19,7 @@ export declare type ToolbarDefinition = {
18
19
  };
19
20
  interface ToolbarItemBase {
20
21
  key: ToolbarKey;
22
+ pluginKey?: PluginKey;
21
23
  execute?: (editor: Editor) => void;
22
24
  active?: (editor: Editor) => boolean | string;
23
25
  disable?: (editor: Editor) => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@worktile/theia",
3
- "version": "3.0.5",
3
+ "version": "3.0.6",
4
4
  "description": "theia editor",
5
5
  "author": "YanDong <nanianqiumo@foxmail.com>",
6
6
  "homepage": "https://github.com/atinc/theia#readme",
@@ -0,0 +1,3 @@
1
+ import { Editor } from 'slate';
2
+ import { ThePlugin, ToolbarItem } from '../interfaces';
3
+ export declare const getPluginByToolbarItem: (editor: Editor, toolbarItem: ToolbarItem) => ThePlugin;
@@ -1,4 +1,4 @@
1
1
  import { Editor } from 'slate';
2
- import { PluginKeys } from '../interfaces';
2
+ import { PluginKey } from '../interfaces';
3
3
  import { CustomElementKinds } from '../custom-types';
4
- export declare const getToolbarItemDisabled: (editor: Editor, key: PluginKeys, customTypes?: CustomElementKinds[]) => boolean;
4
+ export declare const getToolbarItemDisabled: (editor: Editor, key: PluginKey, customTypes?: CustomElementKinds[]) => boolean;
@@ -53,5 +53,5 @@ import { getDirectlyParent } from './get-directly-parent';
53
53
  import { getInsertElementsPath } from './get-insert-elements-path';
54
54
  import { isContainNestedType } from './is-contain-nested-type';
55
55
  import { getToolbarItemDisabled } from './get-toolbar-disabled';
56
- import { getPluginKeyByToolbarKey } from './get-plugin-key-by-toolbar-key';
57
- export { getLastNode, getAnchorBlockEntry, getAboveByType, getNodes, getNodesByType, getBlockAbove, getPreviousPath, getNode, getParent, getLastChild, getLastChildPath, getNextSiblingNodes, getAbove, getPointBefore, getSelectionNodesByType, getText, getPointFromLocation, getRangeFromBlockStart, getRangeBefore, getBlockCardCenterCursor, getBlockCardAbove, getPlainText, getSelectionMarks, getContainerBlocks, getDirectlyParent, isAncestor, isCollapsed, isEmptyParagraph, isParagraph, isBlockActive, isIncludeTypes, isAncestorEmpty, isBlockAboveEmpty, isNodeTypeIn, isFirstChild, isPointAtRoot, isRangeAtRoot, isBlockTextEmptyAfterSelection, isStart, isRangeAcrossBlocks, isDescendant, isNodeType, isAcrossBlocks, isBlockCardCursor, isEmptyParagraphByPath, isContainer, getInsertElementsPath, isContainNestedType, anchorBlock, anchorBlockEntry, anchorInlineEntry, findPath, findNode, findDescendant, someNode, getToolbarItemDisabled, getPluginKeyByToolbarKey };
56
+ import { getPluginByToolbarItem } from './get-plugin-by-toolbar';
57
+ export { getLastNode, getAnchorBlockEntry, getAboveByType, getNodes, getNodesByType, getBlockAbove, getPreviousPath, getNode, getParent, getLastChild, getLastChildPath, getNextSiblingNodes, getAbove, getPointBefore, getSelectionNodesByType, getText, getPointFromLocation, getRangeFromBlockStart, getRangeBefore, getBlockCardCenterCursor, getBlockCardAbove, getPlainText, getSelectionMarks, getContainerBlocks, getDirectlyParent, isAncestor, isCollapsed, isEmptyParagraph, isParagraph, isBlockActive, isIncludeTypes, isAncestorEmpty, isBlockAboveEmpty, isNodeTypeIn, isFirstChild, isPointAtRoot, isRangeAtRoot, isBlockTextEmptyAfterSelection, isStart, isRangeAcrossBlocks, isDescendant, isNodeType, isAcrossBlocks, isBlockCardCursor, isEmptyParagraphByPath, isContainer, getInsertElementsPath, isContainNestedType, anchorBlock, anchorBlockEntry, anchorInlineEntry, findPath, findNode, findDescendant, someNode, getToolbarItemDisabled, getPluginByToolbarItem };
@@ -1,10 +0,0 @@
1
- export const getPluginKeyByToolbarKey = (editor, toolbarKey) => {
2
- for (let key in editor.pluginsByKey) {
3
- const toolbarItems = editor.pluginsByKey[key].toolbarItems;
4
- if (toolbarItems && toolbarItems.some(item => item.key === toolbarKey)) {
5
- toolbarKey = key;
6
- }
7
- }
8
- return toolbarKey;
9
- };
10
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0LXBsdWdpbi1rZXktYnktdG9vbGJhci1rZXkuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wYWNrYWdlcy9zcmMvcXVlcmllcy9nZXQtcGx1Z2luLWtleS1ieS10b29sYmFyLWtleS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFHQSxNQUFNLENBQUMsTUFBTSx3QkFBd0IsR0FBRyxDQUFDLE1BQWMsRUFBRSxVQUFzQixFQUFjLEVBQUU7SUFDM0YsS0FBSyxJQUFJLEdBQUcsSUFBSSxNQUFNLENBQUMsWUFBWSxFQUFFO1FBQ2pDLE1BQU0sWUFBWSxHQUFHLE1BQU0sQ0FBQyxZQUFZLENBQUMsR0FBRyxDQUFDLENBQUMsWUFBWSxDQUFDO1FBQzNELElBQUksWUFBWSxJQUFJLFlBQVksQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLEVBQUUsQ0FBQyxJQUFJLENBQUMsR0FBRyxLQUFLLFVBQVUsQ0FBQyxFQUFFO1lBQ3BFLFVBQVUsR0FBRyxHQUFpQixDQUFDO1NBQ2xDO0tBQ0o7SUFDRCxPQUFPLFVBQXdCLENBQUM7QUFDcEMsQ0FBQyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgRWRpdG9yIH0gZnJvbSAnc2xhdGUnO1xuaW1wb3J0IHsgUGx1Z2luS2V5cywgVG9vbGJhcktleSB9IGZyb20gJy4uL2ludGVyZmFjZXMnO1xuXG5leHBvcnQgY29uc3QgZ2V0UGx1Z2luS2V5QnlUb29sYmFyS2V5ID0gKGVkaXRvcjogRWRpdG9yLCB0b29sYmFyS2V5OiBUb29sYmFyS2V5KTogUGx1Z2luS2V5cyA9PiB7XG4gICAgZm9yIChsZXQga2V5IGluIGVkaXRvci5wbHVnaW5zQnlLZXkpIHtcbiAgICAgICAgY29uc3QgdG9vbGJhckl0ZW1zID0gZWRpdG9yLnBsdWdpbnNCeUtleVtrZXldLnRvb2xiYXJJdGVtcztcbiAgICAgICAgaWYgKHRvb2xiYXJJdGVtcyAmJiB0b29sYmFySXRlbXMuc29tZShpdGVtID0+IGl0ZW0ua2V5ID09PSB0b29sYmFyS2V5KSkge1xuICAgICAgICAgICAgdG9vbGJhcktleSA9IGtleSBhcyBQbHVnaW5LZXlzO1xuICAgICAgICB9XG4gICAgfVxuICAgIHJldHVybiB0b29sYmFyS2V5IGFzIFBsdWdpbktleXM7XG59O1xuIl19
@@ -1,3 +0,0 @@
1
- import { Editor } from 'slate';
2
- import { PluginKeys, ToolbarKey } from '../interfaces';
3
- export declare const getPluginKeyByToolbarKey: (editor: Editor, toolbarKey: ToolbarKey) => PluginKeys;