@worktile/theia 3.0.5 → 3.0.8

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.
Files changed (36) hide show
  1. package/bundles/worktile-theia.umd.js +64 -27
  2. package/bundles/worktile-theia.umd.js.map +1 -1
  3. package/editor.component.d.ts +2 -1
  4. package/esm2015/components/toolbar-dropdown/toolbar-dropdown.component.js +3 -2
  5. package/esm2015/components/toolbar-group/toolbar-group.component.js +2 -1
  6. package/esm2015/core/toolbar-item/base-toolbar-item.js +4 -4
  7. package/esm2015/editor.component.js +15 -2
  8. package/esm2015/interfaces/toolbar.js +1 -1
  9. package/esm2015/plugins/code/code.component.js +6 -3
  10. package/esm2015/plugins/color/toolbar-item.component.js +2 -1
  11. package/esm2015/plugins/deserializers/deserialize-md.plugin.js +2 -1
  12. package/esm2015/plugins/image/image.component.js +13 -8
  13. package/esm2015/plugins/image/image.editor.js +3 -5
  14. package/esm2015/plugins/link/link.component.js +3 -1
  15. package/esm2015/plugins/quick-insert/quick-insert.editor.js +2 -1
  16. package/esm2015/plugins/table/components/toolbar/table-toolbar.component.js +2 -1
  17. package/esm2015/plugins/table/table.service.js +2 -1
  18. package/esm2015/plugins/table/toolbar-item.component.js +2 -1
  19. package/esm2015/plugins/vertical-align/toolbar-item.component.js +2 -1
  20. package/esm2015/queries/get-plugin-by-toolbar.js +13 -0
  21. package/esm2015/queries/get-toolbar-disabled.js +1 -1
  22. package/esm2015/queries/index.js +3 -3
  23. package/esm2015/services/color-select.service.js +2 -1
  24. package/esm2015/services/context.service.js +7 -6
  25. package/esm2015/services/table-contextmenu.service.js +2 -1
  26. package/fesm2015/worktile-theia.js +64 -28
  27. package/fesm2015/worktile-theia.js.map +1 -1
  28. package/interfaces/toolbar.d.ts +2 -0
  29. package/package.json +1 -1
  30. package/plugins/image/image.component.d.ts +4 -1
  31. package/queries/get-plugin-by-toolbar.d.ts +3 -0
  32. package/queries/get-toolbar-disabled.d.ts +2 -2
  33. package/queries/index.d.ts +2 -2
  34. package/services/context.service.d.ts +8 -4
  35. package/esm2015/queries/get-plugin-key-by-toolbar-key.js +0 -10
  36. package/queries/get-plugin-key-by-toolbar-key.d.ts +0 -3
@@ -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.8",
4
4
  "description": "theia editor",
5
5
  "author": "YanDong <nanianqiumo@foxmail.com>",
6
6
  "homepage": "https://github.com/atinc/theia#readme",
@@ -22,7 +22,10 @@ export declare class TheImageComponent extends TheBaseElementComponent<ImageElem
22
22
  imageEntry: ImageEntry;
23
23
  uploading: boolean;
24
24
  percentage: number;
25
- file: File;
25
+ fileItem: {
26
+ url: string;
27
+ file: File;
28
+ };
26
29
  layoutDefaultWidth: number;
27
30
  layoutOptions: LayoutOption[];
28
31
  private uploadingSubscription;
@@ -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,5 +1,5 @@
1
1
  import { NgZone, ViewContainerRef } from '@angular/core';
2
- import { Observable } from 'rxjs';
2
+ import { Observable, Subject } from 'rxjs';
3
3
  import { TheOptions } from '../interfaces/editor';
4
4
  import { FontSizes, MarkTypes } from '../constants/node-types';
5
5
  import * as i0 from "@angular/core";
@@ -18,7 +18,7 @@ interface PaintFormatStatus {
18
18
  export declare class TheContextService {
19
19
  private ngZone;
20
20
  private options;
21
- fileList: {
21
+ uploadingFiles: {
22
22
  url: string;
23
23
  file: File;
24
24
  }[];
@@ -26,6 +26,7 @@ export declare class TheContextService {
26
26
  onMouseUp$: Observable<MouseEvent>;
27
27
  onMouseMove$: Observable<MouseEvent>;
28
28
  onMouseDown$: Observable<MouseEvent>;
29
+ uploadingStatus$: Subject<boolean>;
29
30
  constructor(ngZone: NgZone);
30
31
  initialize(options: TheContextOptions): void;
31
32
  getOptions(): TheContextOptions;
@@ -34,11 +35,14 @@ export declare class TheContextService {
34
35
  getEditableElement(): Element;
35
36
  getFirstElementChild(): HTMLElement;
36
37
  layoutDefaultWidth(): number;
37
- setUploadFileList(file: {
38
+ addUploadingFiles(file: {
39
+ url: string;
40
+ file: File;
41
+ }): void;
42
+ removeUploadImage(file: {
38
43
  url: string;
39
44
  file: File;
40
45
  }): void;
41
- removeUploadImage(file: File): void;
42
46
  static ɵfac: i0.ɵɵFactoryDeclaration<TheContextService, never>;
43
47
  static ɵprov: i0.ɵɵInjectableDeclaration<TheContextService>;
44
48
  }
@@ -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;