@worktile/theia 1.2.10 → 1.2.11
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/bundles/worktile-theia.umd.js +30 -6
- package/bundles/worktile-theia.umd.js.map +1 -1
- package/components/inline-toolbar/inline-toolbar.component.d.ts +1 -1
- package/esm2015/components/inline-toolbar/inline-toolbar.component.js +19 -6
- package/esm2015/editor.component.js +2 -2
- package/fesm2015/worktile-theia.js +18 -5
- package/fesm2015/worktile-theia.js.map +1 -1
- package/package.json +1 -1
- package/styles/editor.scss +1 -1
|
@@ -12039,7 +12039,10 @@
|
|
|
12039
12039
|
}
|
|
12040
12040
|
var editor = this.editor;
|
|
12041
12041
|
var selection = editor.selection;
|
|
12042
|
-
if (!selection ||
|
|
12042
|
+
if (!selection ||
|
|
12043
|
+
!i1.AngularEditor.isFocused(editor) ||
|
|
12044
|
+
slate.Range.isCollapsed(selection) ||
|
|
12045
|
+
slate.Editor.string(editor, selection) === '') {
|
|
12043
12046
|
inlineToolbar.removeAttribute('style');
|
|
12044
12047
|
return;
|
|
12045
12048
|
}
|
|
@@ -12053,6 +12056,7 @@
|
|
|
12053
12056
|
}
|
|
12054
12057
|
};
|
|
12055
12058
|
TheInlineToolbarComponent.prototype.updatePosition = function (toolbarElement, range) {
|
|
12059
|
+
var e_1, _b;
|
|
12056
12060
|
var boundary = range.getBoundingClientRect();
|
|
12057
12061
|
if (!boundary || (boundary.height === 0 && boundary.width === 0 && range.startContainer === range.endContainer)) {
|
|
12058
12062
|
if (range.startContainer.nodeType === 1 && range.startContainer.querySelector('img')) {
|
|
@@ -12062,17 +12066,37 @@
|
|
|
12062
12066
|
boundary = range.startContainer.getBoundingClientRect();
|
|
12063
12067
|
}
|
|
12064
12068
|
}
|
|
12069
|
+
var editableRect = document.querySelector('.the-editor-typo').getBoundingClientRect();
|
|
12065
12070
|
var toolbarHeight = toolbarElement.offsetHeight;
|
|
12066
12071
|
var toolbarWidth = toolbarElement.offsetWidth;
|
|
12067
12072
|
var halfOffsetWidth = toolbarWidth / 2;
|
|
12068
12073
|
var defaultLeft = -halfOffsetWidth;
|
|
12074
|
+
var offsetLeft = boundary.left - editableRect.left;
|
|
12075
|
+
var isTopLeft = offsetLeft - 30 > halfOffsetWidth; // 30: editable padding left
|
|
12076
|
+
var isTopRight = editableRect.width - offsetLeft - boundary.width / 2 < halfOffsetWidth;
|
|
12069
12077
|
var positions = {};
|
|
12070
12078
|
positions.top = boundary.top - toolbarHeight;
|
|
12071
|
-
positions.left = boundary.left + boundary.width / 2 + defaultLeft;
|
|
12072
12079
|
positions.right = 'initial';
|
|
12073
|
-
|
|
12074
|
-
|
|
12075
|
-
|
|
12080
|
+
positions.left = boundary.left;
|
|
12081
|
+
if (isTopLeft) {
|
|
12082
|
+
positions.left = boundary.left + boundary.width / 2 + defaultLeft;
|
|
12083
|
+
}
|
|
12084
|
+
if (isTopRight) {
|
|
12085
|
+
positions.left = boundary.right - toolbarWidth;
|
|
12086
|
+
}
|
|
12087
|
+
try {
|
|
12088
|
+
for (var _c = __values(Object.keys(positions)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
12089
|
+
var key = _d.value;
|
|
12090
|
+
toolbarElement.style[key] = positions[key] + (isNaN(positions[key]) ? '' : 'px');
|
|
12091
|
+
}
|
|
12092
|
+
}
|
|
12093
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
12094
|
+
finally {
|
|
12095
|
+
try {
|
|
12096
|
+
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
12097
|
+
}
|
|
12098
|
+
finally { if (e_1) throw e_1.error; }
|
|
12099
|
+
}
|
|
12076
12100
|
toolbarElement.style.opacity = '1';
|
|
12077
12101
|
};
|
|
12078
12102
|
TheInlineToolbarComponent.prototype.ngOnDestroy = function () {
|
|
@@ -12649,7 +12673,7 @@
|
|
|
12649
12673
|
useExisting: i0.forwardRef(function () { return TheEditorComponent; }),
|
|
12650
12674
|
multi: true
|
|
12651
12675
|
}
|
|
12652
|
-
], viewQueries: [{ propertyName: "templateInstance", first: true, predicate: ["templateInstance"], descendants: true, static: true }, { propertyName: "globalToolbarInstance", first: true, predicate: ["globalToolbar"], descendants: true }, { propertyName: "quickInsertInstance", first: true, predicate: ["quickInsert"], descendants: true }, { propertyName: "placeholderInstance", first: true, predicate: ["placeholder"], descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0__namespace, template: "<the-toolbar\n *ngIf=\"!theOptions?.readonly && !theGlobalToolbar\"\n [ngClass]=\"{\n 'the-toolbar-disabled': theOptions?.disabled\n }\"\n #globalToolbar\n [editor]=\"editor\"\n [toolbarItems]=\"toolbarEntity.global\"\n [align]=\"theOptions?.toolbar?.align\"\n></the-toolbar>\n\n<div\n class=\"the-editable-container\"\n [ngClass]=\"{\n 'the-editor-disabled': theOptions?.disabled,\n 'max-height': maxHeight\n }\"\n [ngStyle]=\"{ 'max-height': maxHeight }\"\n>\n <slate-editable\n class=\"the-editor-typo\"\n [editor]=\"editor\"\n [ngModel]=\"editorValue\"\n (ngModelChange)=\"valueChange($event)\"\n [decorate]=\"decorate\"\n [renderElement]=\"renderElement\"\n [renderText]=\"renderText\"\n [renderLeaf]=\"renderLeaf\"\n [readonly]=\"theOptions?.readonly || theOptions?.disabled\"\n [keydown]=\"onKeyDown\"\n [click]=\"onClick\"\n [paste]=\"onSlaPaste\"\n [beforeInput]=\"onSlaBeforeInput\"\n [blur]=\"onSlaBlur\"\n [focus]=\"onSlaFocus\"\n [copy]=\"onSlaCopy\"\n [cut]=\"onSlaCut\"\n [isStrictDecorate]=\"false\"\n [compositionStart]=\"onSlaCompositionStart\"\n [compositionEnd]=\"onSlaCompositionEnd\"\n [dragStart]=\"onSlaDragStart\"\n [dragOver]=\"onSlaDragOver\"\n (mousedown)=\"mousedown($event)\"\n ></slate-editable>\n <the-inline-toolbar *ngIf=\"!theOptions.readonly\" [editor]=\"editor\" [toolbarItems]=\"toolbarEntity.inline\"></the-inline-toolbar>\n <div #quickInsert theQuickInsert [editor]=\"editor\" [quickToolbarItems]=\"quickToolbarItems\"></div>\n <div #placeholder thePlaceholder [editor]=\"editor\" [options]=\"theOptions\"></div>\n <the-template #templateInstance></the-template>\n</div>\n", components: [{ type: TheToolbarComponent, selector: "the-toolbar", inputs: ["editor", "toolbarItems", "align", "isMore", "afterTemplate"] }, { type: i1__namespace.SlateEditableComponent, selector: "slate-editable", inputs: ["editor", "renderElement", "renderLeaf", "renderText", "decorate", "isStrictDecorate", "trackBy", "readonly", "beforeInput", "blur", "click", "compositionEnd", "compositionStart", "copy", "cut", "dragOver", "dragStart", "dragEnd", "drop", "focus", "keydown", "paste", "spellCheck", "autoCorrect", "autoCapitalize"] }, { type: TheInlineToolbarComponent, selector: "the-inline-toolbar", inputs: ["editor", "toolbarItems"] }, { type: TheQuickInsertComponent, selector: "[theQuickInsert]", inputs: ["editor", "quickToolbarItems"] }, { type: ThePlaceholderComponent, selector: "div[thePlaceholder]", inputs: ["editor", "options"] }, { type: TheTemplateComponent, selector: "the-template,[theTemplate]" }], directives: [{ type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i6__namespace.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i4__namespace$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4__namespace$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
|
|
12676
|
+
], viewQueries: [{ propertyName: "templateInstance", first: true, predicate: ["templateInstance"], descendants: true, static: true }, { propertyName: "globalToolbarInstance", first: true, predicate: ["globalToolbar"], descendants: true }, { propertyName: "quickInsertInstance", first: true, predicate: ["quickInsert"], descendants: true }, { propertyName: "placeholderInstance", first: true, predicate: ["placeholder"], descendants: true }], usesInheritance: true, usesOnChanges: true, ngImport: i0__namespace, template: "<the-toolbar\n *ngIf=\"!theOptions?.readonly && !theGlobalToolbar\"\n class=\"the-global-toolbar\"\n [ngClass]=\"{\n 'the-toolbar-disabled': theOptions?.disabled\n }\"\n #globalToolbar\n [editor]=\"editor\"\n [toolbarItems]=\"toolbarEntity.global\"\n [align]=\"theOptions?.toolbar?.align\"\n></the-toolbar>\n\n<div\n class=\"the-editable-container\"\n [ngClass]=\"{\n 'the-editor-disabled': theOptions?.disabled,\n 'max-height': maxHeight\n }\"\n [ngStyle]=\"{ 'max-height': maxHeight }\"\n>\n <slate-editable\n class=\"the-editor-typo\"\n [editor]=\"editor\"\n [ngModel]=\"editorValue\"\n (ngModelChange)=\"valueChange($event)\"\n [decorate]=\"decorate\"\n [renderElement]=\"renderElement\"\n [renderText]=\"renderText\"\n [renderLeaf]=\"renderLeaf\"\n [readonly]=\"theOptions?.readonly || theOptions?.disabled\"\n [keydown]=\"onKeyDown\"\n [click]=\"onClick\"\n [paste]=\"onSlaPaste\"\n [beforeInput]=\"onSlaBeforeInput\"\n [blur]=\"onSlaBlur\"\n [focus]=\"onSlaFocus\"\n [copy]=\"onSlaCopy\"\n [cut]=\"onSlaCut\"\n [isStrictDecorate]=\"false\"\n [compositionStart]=\"onSlaCompositionStart\"\n [compositionEnd]=\"onSlaCompositionEnd\"\n [dragStart]=\"onSlaDragStart\"\n [dragOver]=\"onSlaDragOver\"\n (mousedown)=\"mousedown($event)\"\n ></slate-editable>\n <the-inline-toolbar *ngIf=\"!theOptions.readonly\" [editor]=\"editor\" [toolbarItems]=\"toolbarEntity.inline\"></the-inline-toolbar>\n <div #quickInsert theQuickInsert [editor]=\"editor\" [quickToolbarItems]=\"quickToolbarItems\"></div>\n <div #placeholder thePlaceholder [editor]=\"editor\" [options]=\"theOptions\"></div>\n <the-template #templateInstance></the-template>\n</div>\n", components: [{ type: TheToolbarComponent, selector: "the-toolbar", inputs: ["editor", "toolbarItems", "align", "isMore", "afterTemplate"] }, { type: i1__namespace.SlateEditableComponent, selector: "slate-editable", inputs: ["editor", "renderElement", "renderLeaf", "renderText", "decorate", "isStrictDecorate", "trackBy", "readonly", "beforeInput", "blur", "click", "compositionEnd", "compositionStart", "copy", "cut", "dragOver", "dragStart", "dragEnd", "drop", "focus", "keydown", "paste", "spellCheck", "autoCorrect", "autoCapitalize"] }, { type: TheInlineToolbarComponent, selector: "the-inline-toolbar", inputs: ["editor", "toolbarItems"] }, { type: TheQuickInsertComponent, selector: "[theQuickInsert]", inputs: ["editor", "quickToolbarItems"] }, { type: ThePlaceholderComponent, selector: "div[thePlaceholder]", inputs: ["editor", "options"] }, { type: TheTemplateComponent, selector: "the-template,[theTemplate]" }], directives: [{ type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i6__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i6__namespace.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i4__namespace$2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4__namespace$2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
|
|
12653
12677
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.7", ngImport: i0__namespace, type: TheEditorComponent, decorators: [{
|
|
12654
12678
|
type: i0.Component,
|
|
12655
12679
|
args: [{
|