@worktile/theia 20.0.0-next.8 → 20.0.0
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/fesm2022/worktile-theia.mjs +311 -421
- package/fesm2022/worktile-theia.mjs.map +1 -1
- package/index.d.ts +3 -2
- package/package.json +4 -4
- package/styles/editor.scss +1 -1
- package/styles/typo.scss +2 -2
|
@@ -10,7 +10,7 @@ import { cloneDeep, map, assign, defaults, groupBy, uniq, isEqual } from 'lodash
|
|
|
10
10
|
export { assign, cloneDeep, debounce, defaults, groupBy, isEqual, map, uniq } from 'lodash';
|
|
11
11
|
import { Editor, Element, Span, Range, Path, Node, Point, Text, Transforms, Operation, createEditor } from 'slate';
|
|
12
12
|
import * as i4 from 'slate-angular';
|
|
13
|
-
import { FAKE_LEFT_BLOCK_CARD_OFFSET, FAKE_RIGHT_BLOCK_CARD_OFFSET, getClipboardData, AngularEditor, hotkeys, getPlainText as getPlainText$1, createClipboardData, setClipboardData, BaseElementComponent, IS_SAFARI, ELEMENT_TO_COMPONENT, SlateModule, hasBlockCard, isCardLeft,
|
|
13
|
+
import { FAKE_LEFT_BLOCK_CARD_OFFSET, FAKE_RIGHT_BLOCK_CARD_OFFSET, getClipboardData, AngularEditor, hotkeys, getPlainText as getPlainText$1, createClipboardData, setClipboardData, BaseElementComponent, IS_SAFARI, ELEMENT_TO_COMPONENT, SlateModule, BaseElementFlavour, hasBlockCard, isCardLeft, DefaultTextFlavour, defaultScrollSelectionIntoView, getDataTransferClipboard, withAngular } from 'slate-angular';
|
|
14
14
|
import { HistoryEditor, withHistory } from 'slate-history';
|
|
15
15
|
import { NODE_TO_PARENT, NODE_TO_INDEX, NODE_TO_ELEMENT, DOMEditor, EDITOR_TO_ELEMENT } from 'slate-dom';
|
|
16
16
|
import { TheiaConverter } from '@atinc/selene';
|
|
@@ -2462,6 +2462,16 @@ function toggleHeadingRelatedElement(editor, element, isVisible) {
|
|
|
2462
2462
|
}
|
|
2463
2463
|
}
|
|
2464
2464
|
}
|
|
2465
|
+
function createBreakBarChar() {
|
|
2466
|
+
const span = document.createElement('span');
|
|
2467
|
+
span.contentEditable = 'false';
|
|
2468
|
+
span.classList.add('the-break-char');
|
|
2469
|
+
// Put this at the start and end of an inline component to work around this Chromium bug:
|
|
2470
|
+
// https://bugs.chromium.org/p/chromium/issues/detail?id=1249405
|
|
2471
|
+
const inlineChromiumBugfix = String.fromCodePoint(160);
|
|
2472
|
+
span.textContent = inlineChromiumBugfix;
|
|
2473
|
+
return span;
|
|
2474
|
+
}
|
|
2465
2475
|
|
|
2466
2476
|
class TheBaseElement extends BaseElementComponent {
|
|
2467
2477
|
onContextChange() {
|
|
@@ -12438,7 +12448,7 @@ const defaultAutoFormatRules = [
|
|
|
12438
12448
|
format: (editor, markup) => {
|
|
12439
12449
|
let startIndex = 1;
|
|
12440
12450
|
if (markup) {
|
|
12441
|
-
startIndex = markup[0].split('.')[0];
|
|
12451
|
+
startIndex = Number(markup[0].split('.')[0]);
|
|
12442
12452
|
if (startIndex === 0) {
|
|
12443
12453
|
startIndex = 1;
|
|
12444
12454
|
}
|
|
@@ -12655,24 +12665,108 @@ const createAutoFormatPlugin = createPluginFactory({
|
|
|
12655
12665
|
}
|
|
12656
12666
|
});
|
|
12657
12667
|
|
|
12658
|
-
class
|
|
12659
|
-
|
|
12660
|
-
|
|
12668
|
+
class TheBaseFlavourElement extends BaseElementFlavour {
|
|
12669
|
+
constructor() {
|
|
12670
|
+
super(...arguments);
|
|
12671
|
+
this.destroy$ = new Subject();
|
|
12672
|
+
}
|
|
12673
|
+
takeUntilDestroyed() {
|
|
12674
|
+
return takeUntil(this.destroy$);
|
|
12675
|
+
}
|
|
12676
|
+
toggleClassNames() {
|
|
12677
|
+
if (this.selection && this.editor && this.editor.isVoid(this.element)) {
|
|
12678
|
+
this.nativeElement.classList.add(`slate-selected-element`);
|
|
12679
|
+
if (this.isCollapsed && isGlobalCollapsed(this.editor)) {
|
|
12680
|
+
this.nativeElement.classList.add(`slate-focus-element`);
|
|
12681
|
+
}
|
|
12682
|
+
else {
|
|
12683
|
+
this.nativeElement.classList.remove(`slate-focus-element`);
|
|
12684
|
+
}
|
|
12685
|
+
}
|
|
12686
|
+
else {
|
|
12687
|
+
this.nativeElement.classList.remove(`slate-selected-element`);
|
|
12688
|
+
this.nativeElement.classList.remove(`slate-focus-element`);
|
|
12689
|
+
}
|
|
12690
|
+
}
|
|
12691
|
+
toggleIndent() {
|
|
12692
|
+
if (this.element?.indent) {
|
|
12693
|
+
this.nativeElement.setAttribute('the-indent', this.element.indent.toString());
|
|
12694
|
+
}
|
|
12695
|
+
else {
|
|
12696
|
+
this.nativeElement.removeAttribute('the-indent');
|
|
12697
|
+
}
|
|
12698
|
+
}
|
|
12699
|
+
toggleStyles() {
|
|
12700
|
+
if (this.element?.align) {
|
|
12701
|
+
this.nativeElement.style.textAlign = this.element.align;
|
|
12702
|
+
}
|
|
12703
|
+
else {
|
|
12704
|
+
this.nativeElement.style.textAlign = '';
|
|
12705
|
+
}
|
|
12706
|
+
if (this.element?.textIndent) {
|
|
12707
|
+
this.nativeElement.style.textIndent = this.element.textIndent + 'em';
|
|
12708
|
+
}
|
|
12709
|
+
else {
|
|
12710
|
+
this.nativeElement.style.textIndent = '';
|
|
12711
|
+
}
|
|
12712
|
+
}
|
|
12713
|
+
render() {
|
|
12714
|
+
this.context.attributes['data-slate-key'] = this.context.element.key;
|
|
12715
|
+
const nativeElement = this.createNativeElement();
|
|
12716
|
+
this.nativeElement = nativeElement;
|
|
12717
|
+
const blockClass = this.editor.isInline(this.element) ? 'slate-inline-block' : 'slate-block';
|
|
12718
|
+
this.nativeElement.classList.add(`slate-element-${this.element.type}`, blockClass);
|
|
12719
|
+
this.toggleClassNames();
|
|
12720
|
+
this.toggleStyles();
|
|
12721
|
+
}
|
|
12722
|
+
onInit() {
|
|
12723
|
+
super.onInit();
|
|
12724
|
+
if (this.editor) {
|
|
12725
|
+
const isVisible = this.editor.isVisible(this.element);
|
|
12726
|
+
const isBlockCard = this.editor.isBlockCard(this.element);
|
|
12727
|
+
if (!isVisible) {
|
|
12728
|
+
if (isBlockCard) {
|
|
12729
|
+
setTimeout(() => {
|
|
12730
|
+
toggleHeadingRelatedElement(this.editor, this.element, isVisible);
|
|
12731
|
+
}, 0);
|
|
12732
|
+
}
|
|
12733
|
+
else {
|
|
12734
|
+
toggleHeadingRelatedElement(this.editor, this.element, isVisible);
|
|
12735
|
+
}
|
|
12736
|
+
}
|
|
12737
|
+
}
|
|
12738
|
+
}
|
|
12739
|
+
rerender() {
|
|
12740
|
+
this.toggleClassNames();
|
|
12741
|
+
this.toggleStyles();
|
|
12742
|
+
}
|
|
12743
|
+
onDestroy() {
|
|
12744
|
+
super.onDestroy();
|
|
12745
|
+
this.destroy$.next();
|
|
12746
|
+
this.destroy$.complete();
|
|
12747
|
+
}
|
|
12748
|
+
afterViewInit() {
|
|
12749
|
+
super.afterViewInit();
|
|
12750
|
+
const isBlockCard = this.editor.isBlockCard(this.element);
|
|
12751
|
+
if (isBlockCard) {
|
|
12752
|
+
const blockCardElement = this.nativeElement.closest('slate-block-card');
|
|
12753
|
+
blockCardElement.classList.add(`slate-block-card-${this.element.type}`);
|
|
12754
|
+
}
|
|
12755
|
+
}
|
|
12756
|
+
}
|
|
12757
|
+
|
|
12758
|
+
class TheBlockquoteFlavour extends TheBaseFlavourElement {
|
|
12759
|
+
createNativeElement() {
|
|
12760
|
+
const element = document.createElement('blockquote');
|
|
12761
|
+
return element;
|
|
12762
|
+
}
|
|
12661
12763
|
}
|
|
12662
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TheBlockquote, decorators: [{
|
|
12663
|
-
type: Component,
|
|
12664
|
-
args: [{
|
|
12665
|
-
selector: 'blockquote[theBlockquote]',
|
|
12666
|
-
template: ``,
|
|
12667
|
-
standalone: true
|
|
12668
|
-
}]
|
|
12669
|
-
}] });
|
|
12670
12764
|
|
|
12671
12765
|
const withBlockquote = (editor) => {
|
|
12672
12766
|
const { renderElement, deleteBackward, insertBreak, isContainer } = editor;
|
|
12673
12767
|
editor.renderElement = (element) => {
|
|
12674
12768
|
if (element.type === ElementKinds.blockquote) {
|
|
12675
|
-
return
|
|
12769
|
+
return TheBlockquoteFlavour;
|
|
12676
12770
|
}
|
|
12677
12771
|
return renderElement(element);
|
|
12678
12772
|
};
|
|
@@ -14041,36 +14135,23 @@ const createHeadingPlugin = (locale) => createPluginFactory({
|
|
|
14041
14135
|
options: headingOptions
|
|
14042
14136
|
})();
|
|
14043
14137
|
|
|
14044
|
-
class
|
|
14045
|
-
|
|
14046
|
-
|
|
14047
|
-
|
|
14048
|
-
|
|
14049
|
-
|
|
14050
|
-
|
|
14051
|
-
|
|
14138
|
+
class TheHrFlavour extends TheBaseFlavourElement {
|
|
14139
|
+
createNativeElement() {
|
|
14140
|
+
const element = document.createElement('div');
|
|
14141
|
+
return element;
|
|
14142
|
+
}
|
|
14143
|
+
onInit() {
|
|
14144
|
+
super.onInit();
|
|
14145
|
+
const hrElement = document.createElement('hr');
|
|
14146
|
+
this.nativeElement.appendChild(hrElement);
|
|
14147
|
+
}
|
|
14148
|
+
render() {
|
|
14149
|
+
super.render();
|
|
14150
|
+
}
|
|
14151
|
+
rerender() {
|
|
14152
|
+
super.rerender();
|
|
14052
14153
|
}
|
|
14053
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TheHr, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
14054
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.12", type: TheHr, isStandalone: true, selector: "the-hr, [theHr]", usesInheritance: true, ngImport: i0, template: `
|
|
14055
|
-
<div class="the-hr" contenteditable="false" [ngClass]="{ active: isCollapsedAndNonReadonly }">
|
|
14056
|
-
<hr class="the-hr" />
|
|
14057
|
-
<slate-children-outlet></slate-children-outlet>
|
|
14058
|
-
</div>
|
|
14059
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: SlateChildrenOutlet, selector: "slate-children-outlet" }] }); }
|
|
14060
14154
|
}
|
|
14061
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TheHr, decorators: [{
|
|
14062
|
-
type: Component,
|
|
14063
|
-
args: [{
|
|
14064
|
-
selector: 'the-hr, [theHr]',
|
|
14065
|
-
template: `
|
|
14066
|
-
<div class="the-hr" contenteditable="false" [ngClass]="{ active: isCollapsedAndNonReadonly }">
|
|
14067
|
-
<hr class="the-hr" />
|
|
14068
|
-
<slate-children-outlet></slate-children-outlet>
|
|
14069
|
-
</div>
|
|
14070
|
-
`,
|
|
14071
|
-
imports: [NgClass, SlateChildrenOutlet]
|
|
14072
|
-
}]
|
|
14073
|
-
}] });
|
|
14074
14155
|
|
|
14075
14156
|
const withHr = (editor) => {
|
|
14076
14157
|
const { isVoid, isBlockCard, renderElement } = editor;
|
|
@@ -14085,7 +14166,7 @@ const withHr = (editor) => {
|
|
|
14085
14166
|
};
|
|
14086
14167
|
editor.renderElement = (element) => {
|
|
14087
14168
|
if (element.type === ElementKinds.hr) {
|
|
14088
|
-
return
|
|
14169
|
+
return TheHrFlavour;
|
|
14089
14170
|
}
|
|
14090
14171
|
return renderElement(element);
|
|
14091
14172
|
};
|
|
@@ -14763,28 +14844,18 @@ const withRemoveEmptyNodes = (options) => (editor) => {
|
|
|
14763
14844
|
return editor;
|
|
14764
14845
|
};
|
|
14765
14846
|
|
|
14766
|
-
class
|
|
14767
|
-
|
|
14768
|
-
|
|
14769
|
-
|
|
14770
|
-
|
|
14771
|
-
|
|
14772
|
-
|
|
14773
|
-
|
|
14774
|
-
|
|
14775
|
-
|
|
14776
|
-
|
|
14847
|
+
class TheInlineCodeFlavour extends TheBaseFlavourElement {
|
|
14848
|
+
createNativeElement() {
|
|
14849
|
+
return document.createElement('span');
|
|
14850
|
+
}
|
|
14851
|
+
onInit() {
|
|
14852
|
+
super.onInit();
|
|
14853
|
+
const before = createBreakBarChar();
|
|
14854
|
+
const after = createBreakBarChar();
|
|
14855
|
+
this.nativeElement.prepend(before);
|
|
14856
|
+
this.nativeElement.appendChild(after);
|
|
14857
|
+
}
|
|
14777
14858
|
}
|
|
14778
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TheInlineCode, decorators: [{
|
|
14779
|
-
type: Component,
|
|
14780
|
-
args: [{
|
|
14781
|
-
selector: 'span[theInlineCode]',
|
|
14782
|
-
template: `<span contenteditable="false" class="the-break-char">{{ inlineChromiumBugfix }}</span>
|
|
14783
|
-
<slate-children-outlet></slate-children-outlet>
|
|
14784
|
-
<span contenteditable="false" class="the-break-char">{{ inlineChromiumBugfix }}</span>`,
|
|
14785
|
-
imports: [SlateChildrenOutlet]
|
|
14786
|
-
}]
|
|
14787
|
-
}] });
|
|
14788
14859
|
|
|
14789
14860
|
const withInlineCode = (editor) => {
|
|
14790
14861
|
const { isInline, renderElement, insertText } = editor;
|
|
@@ -14793,7 +14864,7 @@ const withInlineCode = (editor) => {
|
|
|
14793
14864
|
};
|
|
14794
14865
|
editor.renderElement = (element) => {
|
|
14795
14866
|
if (element.type === ElementKinds.inlineCode) {
|
|
14796
|
-
return
|
|
14867
|
+
return TheInlineCodeFlavour;
|
|
14797
14868
|
}
|
|
14798
14869
|
return renderElement(element);
|
|
14799
14870
|
};
|
|
@@ -14845,6 +14916,38 @@ const createInlineCodePlugin = (locale) => createPluginFactory({
|
|
|
14845
14916
|
}
|
|
14846
14917
|
})();
|
|
14847
14918
|
|
|
14919
|
+
class TheLinkHover {
|
|
14920
|
+
constructor() {
|
|
14921
|
+
this.link = '';
|
|
14922
|
+
this.aTagRelAttr = A_TAG_REL_ATTR;
|
|
14923
|
+
}
|
|
14924
|
+
ngOnInit() { }
|
|
14925
|
+
editLink(event) {
|
|
14926
|
+
event.preventDefault();
|
|
14927
|
+
this.editHandle();
|
|
14928
|
+
event.stopPropagation();
|
|
14929
|
+
}
|
|
14930
|
+
removeLink(event) {
|
|
14931
|
+
event.preventDefault();
|
|
14932
|
+
this.deleteHandle();
|
|
14933
|
+
event.stopPropagation();
|
|
14934
|
+
}
|
|
14935
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TheLinkHover, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
14936
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.12", type: TheLinkHover, isStandalone: true, selector: "the-link-hover", inputs: { link: "link", dom: "dom", editHandle: "editHandle", deleteHandle: "deleteHandle" }, ngImport: i0, template: "<div class=\"link-hover-card px-1\">\n <a readonly href=\"{{ link }}\" target=\"_blank\" rel=\"{{ aTagRelAttr }}\" class=\"hover-control-plaintext text-truncate mx-2\">\n {{ link }}\n </a>\n <thy-divider class=\"mx-2\" [thyVertical]=\"true\" thyColor=\"light\"></thy-divider>\n <a href=\"javascript:;\" thyAction thyActionIcon=\"edit\" thePreventDefault (click)=\"editLink($event)\"></a>\n <thy-divider class=\"mx-2\" [thyVertical]=\"true\" thyColor=\"light\"></thy-divider>\n <a href=\"javascript:;\" thyAction thyActionIcon=\"unlink-insert\" thePreventDefault (click)=\"removeLink($event)\"></a>\n</div>\n", dependencies: [{ kind: "component", type: ThyDivider, selector: "thy-divider", inputs: ["thyVertical", "thyStyle", "thyColor", "thyText", "thyTextDirection", "thyDeeper"] }, { kind: "component", type: ThyAction, selector: "thy-action, [thyAction]", inputs: ["thyType", "thyIcon", "thyActionIcon", "thyActive", "thyActionActive", "thyTheme", "thyHoverIcon", "thyDisabled"] }, { kind: "directive", type: ThePreventDefaultDirective, selector: "[thePreventDefault]", exportAs: ["thePreventDefault"] }] }); }
|
|
14937
|
+
}
|
|
14938
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TheLinkHover, decorators: [{
|
|
14939
|
+
type: Component,
|
|
14940
|
+
args: [{ selector: 'the-link-hover', imports: [ThyDivider, ThyAction, ThePreventDefaultDirective], template: "<div class=\"link-hover-card px-1\">\n <a readonly href=\"{{ link }}\" target=\"_blank\" rel=\"{{ aTagRelAttr }}\" class=\"hover-control-plaintext text-truncate mx-2\">\n {{ link }}\n </a>\n <thy-divider class=\"mx-2\" [thyVertical]=\"true\" thyColor=\"light\"></thy-divider>\n <a href=\"javascript:;\" thyAction thyActionIcon=\"edit\" thePreventDefault (click)=\"editLink($event)\"></a>\n <thy-divider class=\"mx-2\" [thyVertical]=\"true\" thyColor=\"light\"></thy-divider>\n <a href=\"javascript:;\" thyAction thyActionIcon=\"unlink-insert\" thePreventDefault (click)=\"removeLink($event)\"></a>\n</div>\n" }]
|
|
14941
|
+
}], ctorParameters: () => [], propDecorators: { link: [{
|
|
14942
|
+
type: Input
|
|
14943
|
+
}], dom: [{
|
|
14944
|
+
type: Input
|
|
14945
|
+
}], editHandle: [{
|
|
14946
|
+
type: Input
|
|
14947
|
+
}], deleteHandle: [{
|
|
14948
|
+
type: Input
|
|
14949
|
+
}] } });
|
|
14950
|
+
|
|
14848
14951
|
class TheLinkEdit {
|
|
14849
14952
|
handleDocumentMouseDown(event) {
|
|
14850
14953
|
if (!document.querySelector('.the-link-edit-container').contains(event.target)) {
|
|
@@ -14934,89 +15037,34 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImpo
|
|
|
14934
15037
|
args: ['document: mousedown', ['$event']]
|
|
14935
15038
|
}] } });
|
|
14936
15039
|
|
|
14937
|
-
class
|
|
14938
|
-
constructor() {
|
|
14939
|
-
this.link = '';
|
|
14940
|
-
this.aTagRelAttr = A_TAG_REL_ATTR;
|
|
14941
|
-
}
|
|
14942
|
-
ngOnInit() { }
|
|
14943
|
-
editLink(event) {
|
|
14944
|
-
event.preventDefault();
|
|
14945
|
-
this.editHandle();
|
|
14946
|
-
event.stopPropagation();
|
|
14947
|
-
}
|
|
14948
|
-
removeLink(event) {
|
|
14949
|
-
event.preventDefault();
|
|
14950
|
-
this.deleteHandle();
|
|
14951
|
-
event.stopPropagation();
|
|
14952
|
-
}
|
|
14953
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TheLinkHover, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
14954
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.12", type: TheLinkHover, isStandalone: true, selector: "the-link-hover", inputs: { link: "link", dom: "dom", editHandle: "editHandle", deleteHandle: "deleteHandle" }, ngImport: i0, template: "<div class=\"link-hover-card px-1\">\n <a readonly href=\"{{ link }}\" target=\"_blank\" rel=\"{{ aTagRelAttr }}\" class=\"hover-control-plaintext text-truncate mx-2\">\n {{ link }}\n </a>\n <thy-divider class=\"mx-2\" [thyVertical]=\"true\" thyColor=\"light\"></thy-divider>\n <a href=\"javascript:;\" thyAction thyActionIcon=\"edit\" thePreventDefault (click)=\"editLink($event)\"></a>\n <thy-divider class=\"mx-2\" [thyVertical]=\"true\" thyColor=\"light\"></thy-divider>\n <a href=\"javascript:;\" thyAction thyActionIcon=\"unlink-insert\" thePreventDefault (click)=\"removeLink($event)\"></a>\n</div>\n", dependencies: [{ kind: "component", type: ThyDivider, selector: "thy-divider", inputs: ["thyVertical", "thyStyle", "thyColor", "thyText", "thyTextDirection", "thyDeeper"] }, { kind: "component", type: ThyAction, selector: "thy-action, [thyAction]", inputs: ["thyType", "thyIcon", "thyActionIcon", "thyActive", "thyActionActive", "thyTheme", "thyHoverIcon", "thyDisabled"] }, { kind: "directive", type: ThePreventDefaultDirective, selector: "[thePreventDefault]", exportAs: ["thePreventDefault"] }] }); }
|
|
14955
|
-
}
|
|
14956
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TheLinkHover, decorators: [{
|
|
14957
|
-
type: Component,
|
|
14958
|
-
args: [{ selector: 'the-link-hover', imports: [ThyDivider, ThyAction, ThePreventDefaultDirective], template: "<div class=\"link-hover-card px-1\">\n <a readonly href=\"{{ link }}\" target=\"_blank\" rel=\"{{ aTagRelAttr }}\" class=\"hover-control-plaintext text-truncate mx-2\">\n {{ link }}\n </a>\n <thy-divider class=\"mx-2\" [thyVertical]=\"true\" thyColor=\"light\"></thy-divider>\n <a href=\"javascript:;\" thyAction thyActionIcon=\"edit\" thePreventDefault (click)=\"editLink($event)\"></a>\n <thy-divider class=\"mx-2\" [thyVertical]=\"true\" thyColor=\"light\"></thy-divider>\n <a href=\"javascript:;\" thyAction thyActionIcon=\"unlink-insert\" thePreventDefault (click)=\"removeLink($event)\"></a>\n</div>\n" }]
|
|
14959
|
-
}], ctorParameters: () => [], propDecorators: { link: [{
|
|
14960
|
-
type: Input
|
|
14961
|
-
}], dom: [{
|
|
14962
|
-
type: Input
|
|
14963
|
-
}], editHandle: [{
|
|
14964
|
-
type: Input
|
|
14965
|
-
}], deleteHandle: [{
|
|
14966
|
-
type: Input
|
|
14967
|
-
}] } });
|
|
14968
|
-
|
|
14969
|
-
class TheBaseLink extends TheBaseElement {
|
|
14970
|
-
constructor() {
|
|
14971
|
-
super(...arguments);
|
|
14972
|
-
this.thyPopover = inject(ThyPopover);
|
|
14973
|
-
this.overlay = inject(Overlay);
|
|
14974
|
-
this.beforeContextChange = (value) => {
|
|
14975
|
-
if (this.thyPopoverEditRef && this.thyPopoverEditRef.componentInstance) {
|
|
14976
|
-
let { originText } = this.thyPopoverEditRef.componentInstance;
|
|
14977
|
-
if (originText && originText !== value.element.children[0].text) {
|
|
14978
|
-
this.thyPopoverEditRef.componentInstance.originText = value.element.children[0].text;
|
|
14979
|
-
}
|
|
14980
|
-
}
|
|
14981
|
-
};
|
|
14982
|
-
}
|
|
15040
|
+
class TheLinkFlavour extends TheBaseFlavourElement {
|
|
14983
15041
|
get linkHoverOpened() {
|
|
14984
15042
|
return this.thyPopoverHoverRef && this.thyPopoverHoverRef.componentInstance;
|
|
14985
15043
|
}
|
|
14986
15044
|
get linkEditOpened() {
|
|
14987
15045
|
return this.thyPopoverEditRef && this.thyPopoverEditRef.componentInstance;
|
|
14988
15046
|
}
|
|
14989
|
-
|
|
14990
|
-
|
|
14991
|
-
|
|
14992
|
-
|
|
14993
|
-
|
|
14994
|
-
this.thyPopoverHoverRef.close();
|
|
14995
|
-
}
|
|
14996
|
-
}
|
|
14997
|
-
mousedownHandle(event) {
|
|
14998
|
-
if (!this.readonly && !this.editor.disabled && !isMobileMode(this.editor)) {
|
|
14999
|
-
this.openLinkHover();
|
|
15000
|
-
}
|
|
15001
|
-
}
|
|
15002
|
-
openLinkEdit(tag) {
|
|
15003
|
-
if (this.linkHoverOpened) {
|
|
15004
|
-
this.thyPopoverHoverRef.afterClosed().subscribe(() => {
|
|
15005
|
-
this.internalOpenLinkEdit(tag);
|
|
15006
|
-
});
|
|
15007
|
-
this.thyPopover.close();
|
|
15008
|
-
}
|
|
15009
|
-
else {
|
|
15010
|
-
this.internalOpenLinkEdit(tag);
|
|
15011
|
-
}
|
|
15012
|
-
}
|
|
15013
|
-
isLinkEditOpenedByDom(dom) {
|
|
15014
|
-
return this.linkEditOpened && this.thyPopoverEditRef.componentInstance.dom === dom;
|
|
15047
|
+
createNativeElement() {
|
|
15048
|
+
const element = document.createElement('a');
|
|
15049
|
+
element.href = this.element.url;
|
|
15050
|
+
element.target = '_blank';
|
|
15051
|
+
return element;
|
|
15015
15052
|
}
|
|
15016
|
-
|
|
15017
|
-
|
|
15018
|
-
|
|
15019
|
-
|
|
15053
|
+
onInit() {
|
|
15054
|
+
super.onInit();
|
|
15055
|
+
const before = createBreakBarChar();
|
|
15056
|
+
const after = createBreakBarChar();
|
|
15057
|
+
this.nativeElement.prepend(before);
|
|
15058
|
+
this.nativeElement.appendChild(after);
|
|
15059
|
+
this.thyPopover = this.viewContainerRef.injector.get(ThyPopover);
|
|
15060
|
+
this.overlay = this.viewContainerRef.injector.get(Overlay);
|
|
15061
|
+
fromEvent(this.nativeElement, 'click')
|
|
15062
|
+
.pipe(this.takeUntilDestroyed())
|
|
15063
|
+
.subscribe(() => {
|
|
15064
|
+
if (!this.readonly && !this.editor.disabled && !isMobileMode(this.editor)) {
|
|
15065
|
+
this.openLinkHover();
|
|
15066
|
+
}
|
|
15067
|
+
});
|
|
15020
15068
|
}
|
|
15021
15069
|
openLinkHover() {
|
|
15022
15070
|
const dom = this.nativeElement;
|
|
@@ -15047,6 +15095,17 @@ class TheBaseLink extends TheBaseElement {
|
|
|
15047
15095
|
panelClass: 'the-link-over'
|
|
15048
15096
|
});
|
|
15049
15097
|
}
|
|
15098
|
+
openLinkEdit(tag) {
|
|
15099
|
+
if (this.linkHoverOpened) {
|
|
15100
|
+
this.thyPopoverHoverRef.afterClosed().subscribe(() => {
|
|
15101
|
+
this.internalOpenLinkEdit(tag);
|
|
15102
|
+
});
|
|
15103
|
+
this.thyPopover.close();
|
|
15104
|
+
}
|
|
15105
|
+
else {
|
|
15106
|
+
this.internalOpenLinkEdit(tag);
|
|
15107
|
+
}
|
|
15108
|
+
}
|
|
15050
15109
|
internalOpenLinkEdit(tag) {
|
|
15051
15110
|
const link = this.element.url;
|
|
15052
15111
|
Node.get(this.editor, this.editor.selection.focus.path);
|
|
@@ -15060,7 +15119,7 @@ class TheBaseLink extends TheBaseElement {
|
|
|
15060
15119
|
originSelection: this.editor.selection
|
|
15061
15120
|
},
|
|
15062
15121
|
minWidth: 0,
|
|
15063
|
-
origin: this.
|
|
15122
|
+
origin: this.nativeElement,
|
|
15064
15123
|
backdropClosable: true,
|
|
15065
15124
|
placement: 'bottomLeft',
|
|
15066
15125
|
offset: 4,
|
|
@@ -15070,60 +15129,13 @@ class TheBaseLink extends TheBaseElement {
|
|
|
15070
15129
|
scrollStrategy: this.overlay.scrollStrategies.reposition(),
|
|
15071
15130
|
panelClass: 'the-link-edit'
|
|
15072
15131
|
});
|
|
15073
|
-
this.cdr.markForCheck();
|
|
15074
15132
|
}
|
|
15075
|
-
|
|
15076
|
-
this.
|
|
15077
|
-
|
|
15078
|
-
|
|
15079
|
-
ngOnDestroy() {
|
|
15080
|
-
super.ngOnDestroy();
|
|
15081
|
-
this.close(LinkCloseTypes.destroy);
|
|
15133
|
+
closeHoverPopover() {
|
|
15134
|
+
if (this.linkHoverOpened) {
|
|
15135
|
+
this.thyPopoverHoverRef.close();
|
|
15136
|
+
}
|
|
15082
15137
|
}
|
|
15083
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TheBaseLink, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
15084
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.12", type: TheBaseLink, isStandalone: true, selector: "ng-component", host: { listeners: { "click": "mousedownHandle($event)" } }, usesInheritance: true, ngImport: i0, template: '', isInline: true }); }
|
|
15085
15138
|
}
|
|
15086
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TheBaseLink, decorators: [{
|
|
15087
|
-
type: Component,
|
|
15088
|
-
args: [{
|
|
15089
|
-
template: ''
|
|
15090
|
-
}]
|
|
15091
|
-
}], propDecorators: { mousedownHandle: [{
|
|
15092
|
-
type: HostListener,
|
|
15093
|
-
args: ['click', ['$event']]
|
|
15094
|
-
}] } });
|
|
15095
|
-
class TheLink extends TheBaseLink {
|
|
15096
|
-
constructor() {
|
|
15097
|
-
super(...arguments);
|
|
15098
|
-
this.getOutletParent = () => {
|
|
15099
|
-
return this.outletParent.nativeElement;
|
|
15100
|
-
};
|
|
15101
|
-
// Put this at the start and end of an inline component to work around this Chromium bug:
|
|
15102
|
-
// https://bugs.chromium.org/p/chromium/issues/detail?id=1249405
|
|
15103
|
-
this.inlineChromiumBugfix = String.fromCodePoint(160);
|
|
15104
|
-
}
|
|
15105
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TheLink, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
15106
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.12", type: TheLink, isStandalone: true, selector: "a[theLink]", host: { attributes: { "target": "_blank" }, properties: { "attr.href": "element.url" } }, viewQueries: [{ propertyName: "outletParent", first: true, predicate: ["outletParent"], descendants: true, read: ElementRef, static: true }], usesInheritance: true, ngImport: i0, template: ` <span contenteditable="false" class="the-break-char">{{ inlineChromiumBugfix }}</span>
|
|
15107
|
-
<span #outletParent></span>
|
|
15108
|
-
<span contenteditable="false" class="the-break-char">{{ inlineChromiumBugfix }}</span>`, isInline: true }); }
|
|
15109
|
-
}
|
|
15110
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TheLink, decorators: [{
|
|
15111
|
-
type: Component,
|
|
15112
|
-
args: [{
|
|
15113
|
-
selector: 'a[theLink]',
|
|
15114
|
-
template: ` <span contenteditable="false" class="the-break-char">{{ inlineChromiumBugfix }}</span>
|
|
15115
|
-
<span #outletParent></span>
|
|
15116
|
-
<span contenteditable="false" class="the-break-char">{{ inlineChromiumBugfix }}</span>`,
|
|
15117
|
-
host: {
|
|
15118
|
-
'[attr.href]': 'element.url',
|
|
15119
|
-
target: '_blank'
|
|
15120
|
-
},
|
|
15121
|
-
standalone: true
|
|
15122
|
-
}]
|
|
15123
|
-
}], propDecorators: { outletParent: [{
|
|
15124
|
-
type: ViewChild,
|
|
15125
|
-
args: ['outletParent', { read: ElementRef, static: true }]
|
|
15126
|
-
}] } });
|
|
15127
15139
|
|
|
15128
15140
|
const withLink = (editor) => {
|
|
15129
15141
|
const { insertText, isInline, customInsertFragmentData, renderElement } = editor;
|
|
@@ -15164,7 +15176,7 @@ const withLink = (editor) => {
|
|
|
15164
15176
|
};
|
|
15165
15177
|
editor.renderElement = (element) => {
|
|
15166
15178
|
if (element.type === ElementKinds.link) {
|
|
15167
|
-
return
|
|
15179
|
+
return TheLinkFlavour;
|
|
15168
15180
|
}
|
|
15169
15181
|
return renderElement(element);
|
|
15170
15182
|
};
|
|
@@ -15203,147 +15215,6 @@ const createLinkPlugin = (locale) => createPluginFactory({
|
|
|
15203
15215
|
}
|
|
15204
15216
|
})();
|
|
15205
15217
|
|
|
15206
|
-
class TheBulletedList extends TheBaseElement {
|
|
15207
|
-
get level() {
|
|
15208
|
-
return this.element?.indent || null;
|
|
15209
|
-
}
|
|
15210
|
-
ngOnInit() {
|
|
15211
|
-
super.ngOnInit();
|
|
15212
|
-
}
|
|
15213
|
-
ngOnDestroy() {
|
|
15214
|
-
super.ngOnDestroy();
|
|
15215
|
-
}
|
|
15216
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TheBulletedList, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
15217
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.12", type: TheBulletedList, isStandalone: true, selector: "ul[theUl]", host: { properties: { "attr.the-level": "this.level" } }, usesInheritance: true, ngImport: i0, template: ``, isInline: true }); }
|
|
15218
|
-
}
|
|
15219
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TheBulletedList, decorators: [{
|
|
15220
|
-
type: Component,
|
|
15221
|
-
args: [{
|
|
15222
|
-
selector: 'ul[theUl]',
|
|
15223
|
-
template: ``,
|
|
15224
|
-
standalone: true
|
|
15225
|
-
}]
|
|
15226
|
-
}], propDecorators: { level: [{
|
|
15227
|
-
type: HostBinding,
|
|
15228
|
-
args: ['attr.the-level']
|
|
15229
|
-
}] } });
|
|
15230
|
-
|
|
15231
|
-
class TheListItem extends TheBaseElement {
|
|
15232
|
-
ngOnInit() {
|
|
15233
|
-
super.ngOnInit();
|
|
15234
|
-
}
|
|
15235
|
-
onContextChange() {
|
|
15236
|
-
super.onContextChange();
|
|
15237
|
-
this.addFontSize();
|
|
15238
|
-
this.addMultiDigit();
|
|
15239
|
-
}
|
|
15240
|
-
ngOnDestroy() {
|
|
15241
|
-
super.ngOnDestroy();
|
|
15242
|
-
}
|
|
15243
|
-
addFontSize() {
|
|
15244
|
-
let firstText;
|
|
15245
|
-
for (const entry of Node.descendants(this.element)) {
|
|
15246
|
-
const node = entry[0];
|
|
15247
|
-
if (Text.isText(node) && !firstText) {
|
|
15248
|
-
firstText = node;
|
|
15249
|
-
break;
|
|
15250
|
-
}
|
|
15251
|
-
}
|
|
15252
|
-
if (!firstText) {
|
|
15253
|
-
return;
|
|
15254
|
-
}
|
|
15255
|
-
const { text, ...rest } = firstText;
|
|
15256
|
-
const size = rest[MarkTypes.fontSize];
|
|
15257
|
-
if (size) {
|
|
15258
|
-
const sizeClass = `font-size-${size}`;
|
|
15259
|
-
const isContains = this.elementRef.nativeElement?.classList?.contains(sizeClass);
|
|
15260
|
-
if (isContains) {
|
|
15261
|
-
return;
|
|
15262
|
-
}
|
|
15263
|
-
this.clearFontSize();
|
|
15264
|
-
this.elementRef.nativeElement.classList.add(sizeClass);
|
|
15265
|
-
this.fontSizeClass = sizeClass;
|
|
15266
|
-
}
|
|
15267
|
-
else {
|
|
15268
|
-
this.clearFontSize();
|
|
15269
|
-
}
|
|
15270
|
-
}
|
|
15271
|
-
clearFontSize() {
|
|
15272
|
-
if (this.fontSizeClass) {
|
|
15273
|
-
this.elementRef.nativeElement.classList.remove(this.fontSizeClass);
|
|
15274
|
-
this.fontSizeClass = null;
|
|
15275
|
-
}
|
|
15276
|
-
}
|
|
15277
|
-
getStart() {
|
|
15278
|
-
const parent = this.elementRef.nativeElement.closest('.slate-element-numbered-list');
|
|
15279
|
-
const start = parent?.getAttribute('start') || 1;
|
|
15280
|
-
return Number(start);
|
|
15281
|
-
}
|
|
15282
|
-
getLiIndex() {
|
|
15283
|
-
const path = findPath(this.editor, this.element);
|
|
15284
|
-
const index = path[path.length - 1];
|
|
15285
|
-
return index || 0;
|
|
15286
|
-
}
|
|
15287
|
-
addMultiDigit() {
|
|
15288
|
-
const start = this.getStart();
|
|
15289
|
-
const index = this.getLiIndex();
|
|
15290
|
-
const multiDigit = 'data-multi-digit';
|
|
15291
|
-
// start number + index
|
|
15292
|
-
// when it is greater than 9, it is a multi-digit serial number
|
|
15293
|
-
// exclude Font size >= 20
|
|
15294
|
-
if (start + index > 9) {
|
|
15295
|
-
this.elementRef.nativeElement.setAttribute(multiDigit, true);
|
|
15296
|
-
}
|
|
15297
|
-
else {
|
|
15298
|
-
this.elementRef.nativeElement.removeAttribute(multiDigit);
|
|
15299
|
-
}
|
|
15300
|
-
}
|
|
15301
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TheListItem, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
15302
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.12", type: TheListItem, isStandalone: true, selector: "li[theLi]", usesInheritance: true, ngImport: i0, template: ``, isInline: true }); }
|
|
15303
|
-
}
|
|
15304
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TheListItem, decorators: [{
|
|
15305
|
-
type: Component,
|
|
15306
|
-
args: [{
|
|
15307
|
-
selector: 'li[theLi]',
|
|
15308
|
-
template: ``,
|
|
15309
|
-
standalone: true
|
|
15310
|
-
}]
|
|
15311
|
-
}] });
|
|
15312
|
-
|
|
15313
|
-
class TheNumberedList extends TheBaseElement {
|
|
15314
|
-
get start() {
|
|
15315
|
-
return this.element.start;
|
|
15316
|
-
}
|
|
15317
|
-
get level() {
|
|
15318
|
-
return this.element?.indent || null;
|
|
15319
|
-
}
|
|
15320
|
-
constructor() {
|
|
15321
|
-
super();
|
|
15322
|
-
}
|
|
15323
|
-
ngOnInit() {
|
|
15324
|
-
super.ngOnInit();
|
|
15325
|
-
}
|
|
15326
|
-
ngOnDestroy() {
|
|
15327
|
-
super.ngOnDestroy();
|
|
15328
|
-
}
|
|
15329
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TheNumberedList, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
15330
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.12", type: TheNumberedList, isStandalone: true, selector: "ol[theOl]", host: { properties: { "attr.start": "this.start", "attr.the-level": "this.level" } }, usesInheritance: true, ngImport: i0, template: ``, isInline: true }); }
|
|
15331
|
-
}
|
|
15332
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.12", ngImport: i0, type: TheNumberedList, decorators: [{
|
|
15333
|
-
type: Component,
|
|
15334
|
-
args: [{
|
|
15335
|
-
selector: 'ol[theOl]',
|
|
15336
|
-
template: ``,
|
|
15337
|
-
standalone: true
|
|
15338
|
-
}]
|
|
15339
|
-
}], ctorParameters: () => [], propDecorators: { start: [{
|
|
15340
|
-
type: HostBinding,
|
|
15341
|
-
args: ['attr.start']
|
|
15342
|
-
}], level: [{
|
|
15343
|
-
type: HostBinding,
|
|
15344
|
-
args: ['attr.the-level']
|
|
15345
|
-
}] } });
|
|
15346
|
-
|
|
15347
15218
|
const getListTypes = () => {
|
|
15348
15219
|
return [ElementKinds.bulletedList, ElementKinds.numberedList];
|
|
15349
15220
|
};
|
|
@@ -15916,6 +15787,107 @@ const unwrapList = (editor) => {
|
|
|
15916
15787
|
});
|
|
15917
15788
|
};
|
|
15918
15789
|
|
|
15790
|
+
class TheULFlavour extends TheBaseFlavourElement {
|
|
15791
|
+
createNativeElement() {
|
|
15792
|
+
const element = document.createElement('ul');
|
|
15793
|
+
return element;
|
|
15794
|
+
}
|
|
15795
|
+
render() {
|
|
15796
|
+
super.render();
|
|
15797
|
+
toggleProperty(this.nativeElement, 'the-level', this.element.indent || null);
|
|
15798
|
+
}
|
|
15799
|
+
rerender() {
|
|
15800
|
+
super.rerender();
|
|
15801
|
+
toggleProperty(this.nativeElement, 'the-level', this.element.indent || null);
|
|
15802
|
+
}
|
|
15803
|
+
}
|
|
15804
|
+
class TheOLFlavour extends TheBaseFlavourElement {
|
|
15805
|
+
createNativeElement() {
|
|
15806
|
+
const element = document.createElement('ol');
|
|
15807
|
+
return element;
|
|
15808
|
+
}
|
|
15809
|
+
render() {
|
|
15810
|
+
super.render();
|
|
15811
|
+
toggleProperty(this.nativeElement, 'the-level', this.element.indent || null);
|
|
15812
|
+
toggleProperty(this.nativeElement, 'start', this.element.start || null);
|
|
15813
|
+
}
|
|
15814
|
+
rerender() {
|
|
15815
|
+
super.rerender();
|
|
15816
|
+
toggleProperty(this.nativeElement, 'the-level', this.element.indent || null);
|
|
15817
|
+
toggleProperty(this.nativeElement, 'start', this.element.start || null);
|
|
15818
|
+
}
|
|
15819
|
+
}
|
|
15820
|
+
class TheLIFlavour extends TheBaseFlavourElement {
|
|
15821
|
+
constructor() {
|
|
15822
|
+
super(...arguments);
|
|
15823
|
+
this.currentFontSizeClass = '';
|
|
15824
|
+
}
|
|
15825
|
+
createNativeElement() {
|
|
15826
|
+
const element = document.createElement('li');
|
|
15827
|
+
return element;
|
|
15828
|
+
}
|
|
15829
|
+
render() {
|
|
15830
|
+
super.render();
|
|
15831
|
+
this.addFontSize();
|
|
15832
|
+
this.addMultiDigit();
|
|
15833
|
+
}
|
|
15834
|
+
rerender() {
|
|
15835
|
+
super.rerender();
|
|
15836
|
+
this.addFontSize();
|
|
15837
|
+
this.addMultiDigit();
|
|
15838
|
+
}
|
|
15839
|
+
addFontSize() {
|
|
15840
|
+
let firstText;
|
|
15841
|
+
for (const entry of Node.descendants(this.element)) {
|
|
15842
|
+
const node = entry[0];
|
|
15843
|
+
if (Text.isText(node) && !firstText) {
|
|
15844
|
+
firstText = node;
|
|
15845
|
+
break;
|
|
15846
|
+
}
|
|
15847
|
+
}
|
|
15848
|
+
if (!firstText) {
|
|
15849
|
+
return;
|
|
15850
|
+
}
|
|
15851
|
+
const { text, ...rest } = firstText;
|
|
15852
|
+
const size = rest[MarkTypes.fontSize];
|
|
15853
|
+
if (size) {
|
|
15854
|
+
const sizeClass = `font-size-${size}`;
|
|
15855
|
+
const isContains = this.nativeElement?.classList?.contains(sizeClass);
|
|
15856
|
+
if (isContains) {
|
|
15857
|
+
return;
|
|
15858
|
+
}
|
|
15859
|
+
this.clearFontSize();
|
|
15860
|
+
this.nativeElement.classList.add(sizeClass);
|
|
15861
|
+
this.currentFontSizeClass = sizeClass;
|
|
15862
|
+
}
|
|
15863
|
+
else {
|
|
15864
|
+
this.clearFontSize();
|
|
15865
|
+
}
|
|
15866
|
+
}
|
|
15867
|
+
clearFontSize() {
|
|
15868
|
+
if (this.currentFontSizeClass) {
|
|
15869
|
+
this.nativeElement.classList.remove(this.currentFontSizeClass);
|
|
15870
|
+
this.currentFontSizeClass = '';
|
|
15871
|
+
}
|
|
15872
|
+
}
|
|
15873
|
+
getParentStartAndCurrentIndex() {
|
|
15874
|
+
const path = findPath(this.editor, this.element);
|
|
15875
|
+
const currentIndex = path[path.length - 1];
|
|
15876
|
+
const parentElement = Node.get(this.editor, Path.parent(path));
|
|
15877
|
+
const start = Number((parentElement.type === ElementKinds.numberedList && parentElement.start) || 1);
|
|
15878
|
+
return { start, currentIndex };
|
|
15879
|
+
}
|
|
15880
|
+
addMultiDigit() {
|
|
15881
|
+
const { start, currentIndex } = this.getParentStartAndCurrentIndex();
|
|
15882
|
+
const multiDigit = 'data-multi-digit';
|
|
15883
|
+
console.log('start', start, 'currentIndex', currentIndex);
|
|
15884
|
+
// start number + index
|
|
15885
|
+
// when it is greater than 9, it is a multi-digit serial number
|
|
15886
|
+
// exclude Font size >= 20
|
|
15887
|
+
toggleProperty(this.nativeElement, multiDigit, start + currentIndex > 9 ? 'true' : null);
|
|
15888
|
+
}
|
|
15889
|
+
}
|
|
15890
|
+
|
|
15919
15891
|
const withList = (editor) => {
|
|
15920
15892
|
const { insertBreak, deleteBackward, onKeydown, customInsertFragmentData, setFragmentData, renderElement } = editor;
|
|
15921
15893
|
const validLiChildrenTypes = getPluginOptions(editor, PluginKeys.list)?.validLiChildrenTypes ?? [];
|
|
@@ -16111,13 +16083,13 @@ const withList = (editor) => {
|
|
|
16111
16083
|
editor.normalizeNode = getListNormalizer(editor, { validLiChildrenTypes: validLiChildrenTypes });
|
|
16112
16084
|
editor.renderElement = (element) => {
|
|
16113
16085
|
if (element.type === ElementKinds.numberedList) {
|
|
16114
|
-
return
|
|
16086
|
+
return TheOLFlavour;
|
|
16115
16087
|
}
|
|
16116
16088
|
if (element.type === ElementKinds.bulletedList) {
|
|
16117
|
-
return
|
|
16089
|
+
return TheULFlavour;
|
|
16118
16090
|
}
|
|
16119
16091
|
if (element.type === ElementKinds.listItem) {
|
|
16120
|
-
return
|
|
16092
|
+
return TheLIFlavour;
|
|
16121
16093
|
}
|
|
16122
16094
|
return renderElement(element);
|
|
16123
16095
|
};
|
|
@@ -16813,88 +16785,6 @@ const normalizeTable = (table) => {
|
|
|
16813
16785
|
return table;
|
|
16814
16786
|
};
|
|
16815
16787
|
|
|
16816
|
-
class TheBaseFlavourElement extends BaseElementFlavour {
|
|
16817
|
-
constructor() {
|
|
16818
|
-
super(...arguments);
|
|
16819
|
-
this.destroy$ = new Subject();
|
|
16820
|
-
}
|
|
16821
|
-
takeUntilDestroyed() {
|
|
16822
|
-
return takeUntil(this.destroy$);
|
|
16823
|
-
}
|
|
16824
|
-
toggleClassNames() {
|
|
16825
|
-
if (this.selection && this.editor && this.editor.isVoid(this.element)) {
|
|
16826
|
-
this.nativeElement.classList.add(`slate-selected-element`);
|
|
16827
|
-
if (this.isCollapsed && isGlobalCollapsed(this.editor)) {
|
|
16828
|
-
this.nativeElement.classList.add(`slate-focus-element`);
|
|
16829
|
-
}
|
|
16830
|
-
else {
|
|
16831
|
-
this.nativeElement.classList.remove(`slate-focus-element`);
|
|
16832
|
-
}
|
|
16833
|
-
}
|
|
16834
|
-
else {
|
|
16835
|
-
this.nativeElement.classList.remove(`slate-selected-element`);
|
|
16836
|
-
this.nativeElement.classList.remove(`slate-focus-element`);
|
|
16837
|
-
}
|
|
16838
|
-
}
|
|
16839
|
-
toggleIndent() {
|
|
16840
|
-
if (this.element?.indent) {
|
|
16841
|
-
this.nativeElement.setAttribute('the-indent', this.element.indent.toString());
|
|
16842
|
-
}
|
|
16843
|
-
else {
|
|
16844
|
-
this.nativeElement.removeAttribute('the-indent');
|
|
16845
|
-
}
|
|
16846
|
-
}
|
|
16847
|
-
toggleStyles() {
|
|
16848
|
-
if (this.element?.align) {
|
|
16849
|
-
this.nativeElement.style.textAlign = this.element.align;
|
|
16850
|
-
}
|
|
16851
|
-
else {
|
|
16852
|
-
this.nativeElement.style.textAlign = '';
|
|
16853
|
-
}
|
|
16854
|
-
if (this.element?.textIndent) {
|
|
16855
|
-
this.nativeElement.style.textIndent = this.element.textIndent + 'em';
|
|
16856
|
-
}
|
|
16857
|
-
else {
|
|
16858
|
-
this.nativeElement.style.textIndent = '';
|
|
16859
|
-
}
|
|
16860
|
-
}
|
|
16861
|
-
render() {
|
|
16862
|
-
this.context.attributes['data-slate-key'] = this.context.element.key;
|
|
16863
|
-
const nativeElement = this.createNativeElement();
|
|
16864
|
-
this.nativeElement = nativeElement;
|
|
16865
|
-
const blockClass = this.editor.isInline(this.element) ? 'slate-inline-block' : 'slate-block';
|
|
16866
|
-
this.nativeElement.classList.add(`slate-element-${this.element.type}`, blockClass);
|
|
16867
|
-
this.toggleClassNames();
|
|
16868
|
-
this.toggleStyles();
|
|
16869
|
-
}
|
|
16870
|
-
onInit() {
|
|
16871
|
-
super.onInit();
|
|
16872
|
-
if (this.editor) {
|
|
16873
|
-
const isVisible = this.editor.isVisible(this.element);
|
|
16874
|
-
const isBlockCard = this.editor.isBlockCard(this.element);
|
|
16875
|
-
if (!isVisible) {
|
|
16876
|
-
if (isBlockCard) {
|
|
16877
|
-
setTimeout(() => {
|
|
16878
|
-
toggleHeadingRelatedElement(this.editor, this.element, isVisible);
|
|
16879
|
-
}, 0);
|
|
16880
|
-
}
|
|
16881
|
-
else {
|
|
16882
|
-
toggleHeadingRelatedElement(this.editor, this.element, isVisible);
|
|
16883
|
-
}
|
|
16884
|
-
}
|
|
16885
|
-
}
|
|
16886
|
-
}
|
|
16887
|
-
rerender() {
|
|
16888
|
-
this.toggleClassNames();
|
|
16889
|
-
this.toggleStyles();
|
|
16890
|
-
}
|
|
16891
|
-
onDestroy() {
|
|
16892
|
-
super.onDestroy();
|
|
16893
|
-
this.destroy$.next();
|
|
16894
|
-
this.destroy$.complete();
|
|
16895
|
-
}
|
|
16896
|
-
}
|
|
16897
|
-
|
|
16898
16788
|
class TableRowFlavour extends TheBaseFlavourElement {
|
|
16899
16789
|
createNativeElement() {
|
|
16900
16790
|
return document.createElement('tr');
|
|
@@ -18954,5 +18844,5 @@ const withTestPlugin = (plugins, initValue) => {
|
|
|
18954
18844
|
* Generated bundle index. Do not edit.
|
|
18955
18845
|
*/
|
|
18956
18846
|
|
|
18957
|
-
export { ALIGN_BLOCK_TYPES, A_TAG_REL_ATTR, AlignEditor, Alignment, BLOCK_DELETE_BACKWARD_TYPES, BLOCK_HIDDEN_CLASS, BasicTest, BlockquoteEditor, CLIPBOARD_FORMAT_KEY, CODEMIRROR_PADDING_TOP, CODE_MODES, CONTAINER_BLOCKS, CONTROL_KEY, CodeEditor, ColorEditor, ColumnResizeNotifierSource, ColumnResizingStore, DEFAULT_LANGUAGE, DEFAULT_SCROLL_CONTAINER, DISABLED_OPERATE_TYPES, DataTransferFaker, DefaultElementOptions, DefaultGlobalToolbarDefinition, DefaultInlineToolbarDefinition, DropdownMode, ELEMENT_UNIQUE_ID, EditorPresetConfigFactoryMock, ElementKinds, ErrorCodes, FontSizeTypes, FontSizes, HEADING_TYPES, HeaderLevelMap, HeadingEditor, HoveredCellInfo, HrEditor, IS_MAC, ImageEditor, IndentEditor, Indents, InlineCodeEditor, LINK_DEFAULT_TEXT, LIST_BLOCK_TYPES, LOWEST_TEXT_CONTAINER_TYPES, LayoutTypes, LinkEditor, ListEditor, MarkEditor, MarkProps, MarkTypes, MentionEditor, PICTURE_ACCEPTED_UPLOAD_MIME, PICTURE_ACCEPTED_UPLOAD_SIZE, PluginKeys, PluginMenuIcons, PluginMenuSvgs, Position, QUICK_INSERT_HOTKEY, QuickInsertEditor, ResizeRef, SLA_TABLE_CELL_SELECTOR, SLA_TABLE_SELECTOR, STANDARD_HEADING_TYPES, ScrollDirection, SpecialBackgroundColor, TAB_SPACE, THE_EDITOR_BG_COLOR, THE_EDITOR_COLOR, THE_EDITOR_CONVERSION_HINT_REF, THE_EDITOR_ORIGIN_ANCHOR, THE_EDITOR_POPOVER_REF, THE_EDITOR_PREVIOUS_SELECTION, THE_EDITOR_UUID, THE_I18N_DE_DE, THE_I18N_EN_US, THE_I18N_JA_JP, THE_I18N_LOCALE_ID, THE_I18N_RU_RU, THE_I18N_ZH_HANS, THE_I18N_ZH_HANT, THE_IMAGE_SERVICE_TOKEN, THE_LISTBOX_PARENT_GROUP_TOKEN, THE_LISTBOX_PARENT_OPTION_TOKEN, THE_LISTBOX_TOKEN, THE_MODE_PROVIDER, THE_MODE_TOKEN, THE_PLUGIN_MENU_REF, THE_PRESET_CONFIG_TOKEN, TableCellEventDispatcher, TableEditor, TableHeaderBackgroundColor, TablePosition, TheBaseElement, TheBaseSuggestion, TheBaseToolbarDropdown, TheBaseToolbarItem, TheCode, TheColumnResizeDirective, TheColumnResizeOverlayHandle, TheContextMenu, TheContextService, TheConversionHint, TheDataMode, TheEditor, TheEditorComponent, TheEditorModule, TheI18nService, TheImage, TheInlineToolbar, TheListboxDirective, TheListboxGroupDirective, TheListboxOptionDirective, TheLocaleType, TheMode, TheModeConfig, ThePluginMenu, ThePluginMenuComponent, ThePluginMenuItemType, ThePreventDefaultDirective, index$1 as TheQueries, TheQuickInsert, TheTable, TheTableSelect, TheToolbarComponent, TheToolbarDropdown, TheToolbarGroup, TheToolbarGroupToken, TheToolbarItem, TheToolbarService, index as TheTransforms, TodoItemEditor, ToolbarActionTypes, ToolbarAlignment, ToolbarItemType, ToolbarMoreGroup, VOID_BLOCK_TYPES, VerticalAlignEditor, VerticalAlignment, ZERO_WIDTH_CHAR, autoFocus, base64toBlob, bottomLeftPosition, bottomRightPosition, buildPluginMenu, buildPluginMenuItemMap, buildQuickInsertMenus, calcPrintColumnWidth, calcSpanForColumn, calcSpanForRow, calculateHeaderRowHeight, calculateRowControls, coercePixelsFromCssValue, combinePlugins, copyNode, createCell, createEmptyContent, createEmptyParagraph, createMentionPlugin, createPluginFactory, createRow, createTable, createTablePosition, createTest1Plugin, createTestPlugin, createToolbar, createVerticalAlignPlugin, customPluginMock, customPluginMockKey, dataDeserialize, dataSerializing, deDeLocale, deleteElementKey, enUsLocale, errorImageUrlMock, expandPreviousHeadings, extractFragment, extractFragmentByHTML, filterTextFormat, fixBlockWithoutParagraph, fixBlockWithoutText, flattenDeepPlugins, getCellPositionsFromRange, getCollapsedStandardHeadingAbove, getColsTotalWidth, getColumnsWidth, getDirtyElements, getEditorScrollContainer, getEditorUUID, getElementClassByPrefix, getElementHeight, getElementWidth, getEndBlock, getFollowElements, getGridColumns, getMode, getNextCell, getOriginCell, getPlugin, getPluginOptions, getPlugins, getPreviousRelatedHeadingElements, getRowsTotalHeight, getSelectCellNode, getSelectedCellPositions, getStartBlock, getTableByCell, getTableByRow, getTheDefaultPluginMenu, getToolbarClass, hasHeaderRow, hasNumberedColumn, headingOptions, htmlToTheia, idCreator, inValidTypes, initializeDefaultMenuIcons, injectTranslations, insertDataByInvalidType, internalPlugins, isCleanEmptyParagraph, isColorIndicator, isColorInput, isColorPanel, isDirectionKeydown, isHeadingElement, isInside, isMobileMode, isPrintMode, isPureEmptyParagraph, isRangeInTable, isRectangularInTableCells, isSelectedAllCell, isSelectionInTable, isStandardHeadingElement, isStandardHeadingElementByType, isUrl, isVirtualKey, jaJpLocale, matchOptions, mergeArray, mergeDeepPlugins, mergeElementOptions, mergeOptions, nestedStructureByKey, normalizeValue, originOptions, plainToTheia, pluginKey, pluginKey1, pluginsByKey, reSelection, recursionNodes, refocus, ruRuLocale, setClipboardDataByDom, setEditorUUID, theTethysIconRegistryFaker, toggleClass, toggleHeadingRelatedElement, toggleProperty, toggleStyle, topLeftPosition, topRightPosition, uniqueCellPosition, updatePopoverPosition, withMention, withTestPlugin, withTheia, zhHansLocale, zhHantLocale };
|
|
18847
|
+
export { ALIGN_BLOCK_TYPES, A_TAG_REL_ATTR, AlignEditor, Alignment, BLOCK_DELETE_BACKWARD_TYPES, BLOCK_HIDDEN_CLASS, BasicTest, BlockquoteEditor, CLIPBOARD_FORMAT_KEY, CODEMIRROR_PADDING_TOP, CODE_MODES, CONTAINER_BLOCKS, CONTROL_KEY, CodeEditor, ColorEditor, ColumnResizeNotifierSource, ColumnResizingStore, DEFAULT_LANGUAGE, DEFAULT_SCROLL_CONTAINER, DISABLED_OPERATE_TYPES, DataTransferFaker, DefaultElementOptions, DefaultGlobalToolbarDefinition, DefaultInlineToolbarDefinition, DropdownMode, ELEMENT_UNIQUE_ID, EditorPresetConfigFactoryMock, ElementKinds, ErrorCodes, FontSizeTypes, FontSizes, HEADING_TYPES, HeaderLevelMap, HeadingEditor, HoveredCellInfo, HrEditor, IS_MAC, ImageEditor, IndentEditor, Indents, InlineCodeEditor, LINK_DEFAULT_TEXT, LIST_BLOCK_TYPES, LOWEST_TEXT_CONTAINER_TYPES, LayoutTypes, LinkEditor, ListEditor, MarkEditor, MarkProps, MarkTypes, MentionEditor, PICTURE_ACCEPTED_UPLOAD_MIME, PICTURE_ACCEPTED_UPLOAD_SIZE, PluginKeys, PluginMenuIcons, PluginMenuSvgs, Position, QUICK_INSERT_HOTKEY, QuickInsertEditor, ResizeRef, SLA_TABLE_CELL_SELECTOR, SLA_TABLE_SELECTOR, STANDARD_HEADING_TYPES, ScrollDirection, SpecialBackgroundColor, TAB_SPACE, THE_EDITOR_BG_COLOR, THE_EDITOR_COLOR, THE_EDITOR_CONVERSION_HINT_REF, THE_EDITOR_ORIGIN_ANCHOR, THE_EDITOR_POPOVER_REF, THE_EDITOR_PREVIOUS_SELECTION, THE_EDITOR_UUID, THE_I18N_DE_DE, THE_I18N_EN_US, THE_I18N_JA_JP, THE_I18N_LOCALE_ID, THE_I18N_RU_RU, THE_I18N_ZH_HANS, THE_I18N_ZH_HANT, THE_IMAGE_SERVICE_TOKEN, THE_LISTBOX_PARENT_GROUP_TOKEN, THE_LISTBOX_PARENT_OPTION_TOKEN, THE_LISTBOX_TOKEN, THE_MODE_PROVIDER, THE_MODE_TOKEN, THE_PLUGIN_MENU_REF, THE_PRESET_CONFIG_TOKEN, TableCellEventDispatcher, TableEditor, TableHeaderBackgroundColor, TablePosition, TheBaseElement, TheBaseSuggestion, TheBaseToolbarDropdown, TheBaseToolbarItem, TheCode, TheColumnResizeDirective, TheColumnResizeOverlayHandle, TheContextMenu, TheContextService, TheConversionHint, TheDataMode, TheEditor, TheEditorComponent, TheEditorModule, TheI18nService, TheImage, TheInlineToolbar, TheListboxDirective, TheListboxGroupDirective, TheListboxOptionDirective, TheLocaleType, TheMode, TheModeConfig, ThePluginMenu, ThePluginMenuComponent, ThePluginMenuItemType, ThePreventDefaultDirective, index$1 as TheQueries, TheQuickInsert, TheTable, TheTableSelect, TheToolbarComponent, TheToolbarDropdown, TheToolbarGroup, TheToolbarGroupToken, TheToolbarItem, TheToolbarService, index as TheTransforms, TodoItemEditor, ToolbarActionTypes, ToolbarAlignment, ToolbarItemType, ToolbarMoreGroup, VOID_BLOCK_TYPES, VerticalAlignEditor, VerticalAlignment, ZERO_WIDTH_CHAR, autoFocus, base64toBlob, bottomLeftPosition, bottomRightPosition, buildPluginMenu, buildPluginMenuItemMap, buildQuickInsertMenus, calcPrintColumnWidth, calcSpanForColumn, calcSpanForRow, calculateHeaderRowHeight, calculateRowControls, coercePixelsFromCssValue, combinePlugins, copyNode, createBreakBarChar, createCell, createEmptyContent, createEmptyParagraph, createMentionPlugin, createPluginFactory, createRow, createTable, createTablePosition, createTest1Plugin, createTestPlugin, createToolbar, createVerticalAlignPlugin, customPluginMock, customPluginMockKey, dataDeserialize, dataSerializing, deDeLocale, deleteElementKey, enUsLocale, errorImageUrlMock, expandPreviousHeadings, extractFragment, extractFragmentByHTML, filterTextFormat, fixBlockWithoutParagraph, fixBlockWithoutText, flattenDeepPlugins, getCellPositionsFromRange, getCollapsedStandardHeadingAbove, getColsTotalWidth, getColumnsWidth, getDirtyElements, getEditorScrollContainer, getEditorUUID, getElementClassByPrefix, getElementHeight, getElementWidth, getEndBlock, getFollowElements, getGridColumns, getMode, getNextCell, getOriginCell, getPlugin, getPluginOptions, getPlugins, getPreviousRelatedHeadingElements, getRowsTotalHeight, getSelectCellNode, getSelectedCellPositions, getStartBlock, getTableByCell, getTableByRow, getTheDefaultPluginMenu, getToolbarClass, hasHeaderRow, hasNumberedColumn, headingOptions, htmlToTheia, idCreator, inValidTypes, initializeDefaultMenuIcons, injectTranslations, insertDataByInvalidType, internalPlugins, isCleanEmptyParagraph, isColorIndicator, isColorInput, isColorPanel, isDirectionKeydown, isHeadingElement, isInside, isMobileMode, isPrintMode, isPureEmptyParagraph, isRangeInTable, isRectangularInTableCells, isSelectedAllCell, isSelectionInTable, isStandardHeadingElement, isStandardHeadingElementByType, isUrl, isVirtualKey, jaJpLocale, matchOptions, mergeArray, mergeDeepPlugins, mergeElementOptions, mergeOptions, nestedStructureByKey, normalizeValue, originOptions, plainToTheia, pluginKey, pluginKey1, pluginsByKey, reSelection, recursionNodes, refocus, ruRuLocale, setClipboardDataByDom, setEditorUUID, theTethysIconRegistryFaker, toggleClass, toggleHeadingRelatedElement, toggleProperty, toggleStyle, topLeftPosition, topRightPosition, uniqueCellPosition, updatePopoverPosition, withMention, withTestPlugin, withTheia, zhHansLocale, zhHantLocale };
|
|
18958
18848
|
//# sourceMappingURL=worktile-theia.mjs.map
|