@worktile/theia 2.1.7 → 2.1.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.
- package/bundles/worktile-theia.umd.js +60 -21
- package/bundles/worktile-theia.umd.js.map +1 -1
- package/editor.module.d.ts +2 -2
- package/esm2015/plugins/common/move-selection.plugin.js +2 -2
- package/esm2015/plugins/inline-code/inline-code.component.js +14 -15
- package/esm2015/plugins/inline-code/inline-code.editor.js +7 -3
- package/esm2015/plugins/inline-code/inline-code.plugin.js +40 -2
- package/esm2015/plugins/link/link.component.js +15 -3
- package/fesm2015/worktile-theia.js +71 -20
- package/fesm2015/worktile-theia.js.map +1 -1
- package/package.json +1 -1
- package/plugins/inline-code/inline-code.component.d.ts +2 -7
- package/plugins/inline-code/inline-code.editor.d.ts +2 -2
- package/plugins/link/link.component.d.ts +1 -0
|
@@ -2197,8 +2197,12 @@
|
|
|
2197
2197
|
unwrapInlineCode: function (editor) {
|
|
2198
2198
|
slate.Transforms.unwrapNodes(editor, { match: function (n) { return slate.Element.isElement(n) && n.type === exports.ElementKinds.inlineCode; } });
|
|
2199
2199
|
},
|
|
2200
|
-
isInlineCodeActive: function (editor) {
|
|
2201
|
-
var _a
|
|
2200
|
+
isInlineCodeActive: function (editor, path) {
|
|
2201
|
+
var _a;
|
|
2202
|
+
var _b = __read(slate.Editor.nodes(editor, {
|
|
2203
|
+
at: path ? path : (_a = editor.selection) === null || _a === void 0 ? void 0 : _a.anchor.path,
|
|
2204
|
+
match: function (n) { return slate.Element.isElement(n) && n.type === exports.ElementKinds.inlineCode; }
|
|
2205
|
+
}), 1), inlineCode = _b[0];
|
|
2202
2206
|
return !!inlineCode;
|
|
2203
2207
|
}
|
|
2204
2208
|
};
|
|
@@ -5102,7 +5106,7 @@
|
|
|
5102
5106
|
};
|
|
5103
5107
|
|
|
5104
5108
|
var withMoveSelection = function (editor) {
|
|
5105
|
-
var onClick = editor.onClick, deleteBackward = editor.deleteBackward;
|
|
5109
|
+
var onClick = editor.onClick, deleteBackward = editor.deleteBackward, onKeydown = editor.onKeydown;
|
|
5106
5110
|
editor.onClick = function (event) {
|
|
5107
5111
|
var domSelection = window.getSelection();
|
|
5108
5112
|
if (domSelection && !domSelection.isCollapsed && event.detail >= 2 && editor.selection) {
|
|
@@ -7723,17 +7727,21 @@
|
|
|
7723
7727
|
var TheLinkComponent = /** @class */ (function (_super) {
|
|
7724
7728
|
__extends(TheLinkComponent, _super);
|
|
7725
7729
|
function TheLinkComponent() {
|
|
7726
|
-
|
|
7730
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
7731
|
+
// Put this at the start and end of an inline component to work around this Chromium bug:
|
|
7732
|
+
// https://bugs.chromium.org/p/chromium/issues/detail?id=1249405
|
|
7733
|
+
_this.inlineChromiumBugfix = '$' + String.fromCodePoint(160);
|
|
7734
|
+
return _this;
|
|
7727
7735
|
}
|
|
7728
7736
|
return TheLinkComponent;
|
|
7729
7737
|
}(TheBaseLinkComponent));
|
|
7730
7738
|
TheLinkComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheLinkComponent, deps: null, target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
7731
|
-
TheLinkComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheLinkComponent, selector: "span[theLink]", usesInheritance: true, ngImport: i0__namespace, template: "<slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>", isInline: true, components: [{ type: i1__namespace.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }] });
|
|
7739
|
+
TheLinkComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheLinkComponent, selector: "span[theLink]", usesInheritance: true, ngImport: i0__namespace, template: "\n <span contenteditable=\"false\" style=\"font-size: 0;\">{{ inlineChromiumBugfix }}</span>\n <slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>\n <span contenteditable=\"false\" style=\"font-size: 0;\">{{ inlineChromiumBugfix }}</span>", isInline: true, components: [{ type: i1__namespace.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }] });
|
|
7732
7740
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheLinkComponent, decorators: [{
|
|
7733
7741
|
type: i0.Component,
|
|
7734
7742
|
args: [{
|
|
7735
7743
|
selector: 'span[theLink]',
|
|
7736
|
-
template: "<slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>"
|
|
7744
|
+
template: "\n <span contenteditable=\"false\" style=\"font-size: 0;\">{{ inlineChromiumBugfix }}</span>\n <slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>\n <span contenteditable=\"false\" style=\"font-size: 0;\">{{ inlineChromiumBugfix }}</span>"
|
|
7737
7745
|
}]
|
|
7738
7746
|
}] });
|
|
7739
7747
|
var TheReadonlyLinkComponent = /** @class */ (function (_super) {
|
|
@@ -12076,32 +12084,27 @@
|
|
|
12076
12084
|
|
|
12077
12085
|
var TheInlineCodeComponent = /** @class */ (function (_super) {
|
|
12078
12086
|
__extends(TheInlineCodeComponent, _super);
|
|
12079
|
-
function TheInlineCodeComponent(
|
|
12080
|
-
var _this = _super.
|
|
12081
|
-
|
|
12082
|
-
|
|
12087
|
+
function TheInlineCodeComponent() {
|
|
12088
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
12089
|
+
// Put this at the start and end of an inline component to work around this Chromium bug:
|
|
12090
|
+
// https://bugs.chromium.org/p/chromium/issues/detail?id=1249405
|
|
12091
|
+
_this.inlineChromiumBugfix = '$' + String.fromCodePoint(160);
|
|
12083
12092
|
return _this;
|
|
12084
12093
|
}
|
|
12085
|
-
TheInlineCodeComponent.prototype.ngOnInit = function () {
|
|
12086
|
-
_super.prototype.ngOnInit.call(this);
|
|
12087
|
-
};
|
|
12088
|
-
TheInlineCodeComponent.prototype.ngOnDestroy = function () {
|
|
12089
|
-
_super.prototype.ngOnDestroy.call(this);
|
|
12090
|
-
};
|
|
12091
12094
|
return TheInlineCodeComponent;
|
|
12092
12095
|
}(TheBaseElementComponent));
|
|
12093
|
-
TheInlineCodeComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheInlineCodeComponent, deps:
|
|
12094
|
-
TheInlineCodeComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheInlineCodeComponent, selector: "span[theInlineCode]", usesInheritance: true, ngImport: i0__namespace, template:
|
|
12096
|
+
TheInlineCodeComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheInlineCodeComponent, deps: null, target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
12097
|
+
TheInlineCodeComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheInlineCodeComponent, selector: "span[theInlineCode]", usesInheritance: true, ngImport: i0__namespace, template: " <span contenteditable=\"false\" style=\"font-size: 0;\">{{ inlineChromiumBugfix }}</span>\n <slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>\n <span contenteditable=\"false\" style=\"font-size: 0;\">{{ inlineChromiumBugfix }}</span>", isInline: true, components: [{ type: i1__namespace.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }] });
|
|
12095
12098
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: TheInlineCodeComponent, decorators: [{
|
|
12096
12099
|
type: i0.Component,
|
|
12097
12100
|
args: [{
|
|
12098
12101
|
selector: 'span[theInlineCode]',
|
|
12099
|
-
template:
|
|
12102
|
+
template: " <span contenteditable=\"false\" style=\"font-size: 0;\">{{ inlineChromiumBugfix }}</span>\n <slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>\n <span contenteditable=\"false\" style=\"font-size: 0;\">{{ inlineChromiumBugfix }}</span>"
|
|
12100
12103
|
}]
|
|
12101
|
-
}]
|
|
12104
|
+
}] });
|
|
12102
12105
|
|
|
12103
12106
|
var withInlineCode = function (editor) {
|
|
12104
|
-
var isInline = editor.isInline, renderElement = editor.renderElement, insertText = editor.insertText;
|
|
12107
|
+
var isInline = editor.isInline, renderElement = editor.renderElement, insertText = editor.insertText, onKeydown = editor.onKeydown;
|
|
12105
12108
|
editor.isInline = function (element) {
|
|
12106
12109
|
return element.type === exports.ElementKinds.inlineCode ? true : isInline(element);
|
|
12107
12110
|
};
|
|
@@ -12137,6 +12140,42 @@
|
|
|
12137
12140
|
insertText(text);
|
|
12138
12141
|
}
|
|
12139
12142
|
};
|
|
12143
|
+
editor.onKeydown = function (event) {
|
|
12144
|
+
var selection = editor.selection;
|
|
12145
|
+
if (!selection || !selection.anchor || !selection.focus) {
|
|
12146
|
+
onKeydown(event);
|
|
12147
|
+
return;
|
|
12148
|
+
}
|
|
12149
|
+
var isMoveBackward = i1.hotkeys.isMoveBackward(event);
|
|
12150
|
+
var isMoveForward = i1.hotkeys.isMoveForward(event);
|
|
12151
|
+
var isCollapsed$1 = selection && isCollapsed(selection);
|
|
12152
|
+
var isInlineCode = InlineCodeEditor.isInlineCodeActive(editor);
|
|
12153
|
+
if (isCollapsed$1 && isMoveForward) {
|
|
12154
|
+
var isInlineCodeBefore = false;
|
|
12155
|
+
if (!isInlineCode) {
|
|
12156
|
+
var path = slate.Editor.after(editor, selection).path;
|
|
12157
|
+
isInlineCodeBefore = InlineCodeEditor.isInlineCodeActive(editor, path);
|
|
12158
|
+
}
|
|
12159
|
+
if (isInlineCode || isInlineCodeBefore) {
|
|
12160
|
+
event.preventDefault();
|
|
12161
|
+
slate.Transforms.move(editor, { unit: 'offset' });
|
|
12162
|
+
return;
|
|
12163
|
+
}
|
|
12164
|
+
}
|
|
12165
|
+
if (isCollapsed$1 && isMoveBackward) {
|
|
12166
|
+
var isInlineCodeAfter = false;
|
|
12167
|
+
if (!isInlineCode) {
|
|
12168
|
+
var path = slate.Editor.before(editor, selection).path;
|
|
12169
|
+
isInlineCodeAfter = InlineCodeEditor.isInlineCodeActive(editor, path);
|
|
12170
|
+
}
|
|
12171
|
+
if (isInlineCode || isInlineCodeAfter) {
|
|
12172
|
+
event.preventDefault();
|
|
12173
|
+
slate.Transforms.move(editor, { unit: 'offset', reverse: true });
|
|
12174
|
+
return;
|
|
12175
|
+
}
|
|
12176
|
+
}
|
|
12177
|
+
onKeydown(event);
|
|
12178
|
+
};
|
|
12140
12179
|
editor = withRemoveEmptyNodes({ type: exports.ElementKinds.inlineCode })(editor);
|
|
12141
12180
|
return editor;
|
|
12142
12181
|
};
|