@textbus/collaborate 2.0.0-alpha.71 → 2.0.0-alpha.74
Sign up to get free protection for your applications and to get access to all the features.
@@ -84,18 +84,24 @@ export class RemoteToLocal {
|
|
84
84
|
}
|
85
85
|
applySharedSlotToSlot(ev, path, slot) {
|
86
86
|
if (path.length) {
|
87
|
-
path.shift();
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
87
|
+
const childPath = path.shift();
|
88
|
+
if (childPath.length === 1) {
|
89
|
+
const delta = ev.target.parent.toDelta();
|
90
|
+
let componentIndex = 0;
|
91
|
+
for (let i = 0; i < delta.length; i++) {
|
92
|
+
const action = delta[i];
|
93
|
+
if (action.insert === ev.target) {
|
94
|
+
break;
|
95
|
+
}
|
96
|
+
componentIndex += typeof action.insert === 'string' ? action.insert.length : 1;
|
94
97
|
}
|
95
|
-
|
98
|
+
const component = slot.getContentAtIndex(componentIndex);
|
99
|
+
this.applySharedComponentToComponent(ev, path, component);
|
100
|
+
}
|
101
|
+
else {
|
102
|
+
const component = slot.getContentAtIndex(childPath[0]);
|
103
|
+
this.applySharedComponentToComponent(ev, path, component);
|
96
104
|
}
|
97
|
-
const component = slot.getContentAtIndex(componentIndex);
|
98
|
-
this.applySharedComponentToComponent(ev, path, component);
|
99
105
|
return;
|
100
106
|
}
|
101
107
|
if (ev instanceof YTextEvent) {
|
@@ -192,4 +198,4 @@ export class RemoteToLocal {
|
|
192
198
|
return slot;
|
193
199
|
}
|
194
200
|
}
|
195
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVtb3RlLXRvLWxvY2FsLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NvbGxhYi9yZW1vdGUtdG8tbG9jYWwudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUdMLFdBQVcsRUFFWCxTQUFTLEVBRVQsVUFBVSxHQUVYLE1BQU0sS0F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RTbG90LmdldCgnc2NoZW1hJyksXG4gICAgICBzdGF0ZTogc2hhcmVkU2xvdC5nZXQoJ3N0YXRlJyksXG4gICAgICBmb3JtYXRzOiB7fSxcbiAgICAgIGNvbnRlbnQ6IFtdXG4gICAgfSlcblxuICAgIGZvciAoY29uc3QgYWN0aW9uIG9mIGRlbHRhKSB7XG4gICAgICBpZiAoYWN0aW9uLmluc2VydCkge1xuICAgICAgICBpZiAodHlwZW9mIGFjdGlvbi5pbnNlcnQgPT09ICdzdHJpbmcnKSB7XG4gICAgICAgICAgc2xvdC5pbnNlcnQoYWN0aW9uLmluc2VydCwgYWN0aW9uLmF0dHJpYnV0ZXMgPyBPYmplY3Qua2V5cyhhY3Rpb24uYXR0cmlidXRlcykubWFwKGtleSA9PiB7XG4gICAgICAgICAgICByZXR1cm4gW3RoaXMucmVnaXN0cnkuZ2V0Rm9ybWF0dGVyKGtleSkhLCBhY3Rpb24uYXR0cmlidXRlcyFba2V5XV1cbiAgICAgICAgICB9KSA6IFtdKVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIHNsb3QuaW5zZXJ0KHRoaXMuY3JlYXRlQ29tcG9uZW50QnlTaGFyZWRDb21wb25lbnQoYWN0aW9uLmluc2VydCkpXG4gICAgICAgIH1cbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIHRocm93IGNvbGxhYm9yYXRlRXJyb3JGbignVW5leHBlY3RlZCBkZWx0YSBhY3Rpb24uJylcbiAgICAgIH1cbiAgICB9XG4gICAgcmV0dXJuIHNsb3RcbiAgfVxufVxuIl19
|
201
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVtb3RlLXRvLWxvY2FsLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NvbGxhYi9yZW1vdGUtdG8tbG9jYWwudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUdMLFdBQVc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3J0IGNsYXNzIFJlbW90ZVRvTG9jYWwge1xuICBjb25zdHJ1Y3Rvcihwcml2YXRlIHlEb2M6IFlEb2MsXG4gICAgICAgICAgICAgIHByaXZhdGUgdHJhbnNsYXRvcjogVHJhbnNsYXRvcixcbiAgICAgICAgICAgICAgcHJpdmF0ZSBzZWxlY3Rpb246IFNlbGVjdGlvbixcbiAgICAgICAgICAgICAgcHJpdmF0ZSByZWdpc3RyeTogUmVnaXN0cnkpIHtcbiAgfVxuXG4gIHRyYW5zZm9ybShldmVudHM6IFlFdmVudFtdLCByb290Q29tcG9uZW50OiBDb21wb25lbnRJbnN0YW5jZSkge1xuICAgIGV2ZW50cy5mb3JFYWNoKGV2ID0+IHtcbiAgICAgIGNvbnN0IHBhdGg6IFlQYXRoID0gW11cblxuICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCBldi5wYXRoLmxlbmd0aDsgaSArPSAyKSB7XG4gICAgICAgIHBhdGgucHVzaChldi5wYXRoLnNsaWNlKGksIGkgKyAyKSBhcyBbbnVtYmVyLCBzdHJpbmddKVxuICAgICAgfVxuXG4gICAgICBjb25zdCBzbG90ID0gcm9vdENvbXBvbmVudC5zbG90cy5nZXQoMClcblxuICAgICAgaWYgKCFzbG90KSB7XG4gICAgICAgIHRocm93IGNvbGxhYm9yYXRlRXJyb3JGbignY2Fubm90IGZpbmQgY2hpbGQgc2xvdCBpbiByb290IGNvbXBvbmVudCEnKVxuICAgICAgfVxuXG4gICAgICBpZiAocGF0aC5sZW5ndGgpIHtcbiAgICAgICAgY29uc3QgY29tcG9uZW50SW5kZXggPSBwYXRoLnNoaWZ0KCkhWzBdIGFzIG51bWJlclxuICAgICAgICBjb25zdCBjb21wb25lbnQgPSBzbG90LmdldENvbnRlbnRBdEluZGV4KGNvbXBvbmVudEluZGV4KSBhcyBDb21wb25lbnRJbnN0YW5jZVxuICAgICAgICB0aGlzLmFwcGx5U2hhcmVkQ29tcG9uZW50VG9Db21wb25lbnQoZXYsIHBhdGgsI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a2V5ID0+IHtcbiAgICAgICAgICAgIHJldHVybiBbdGhpcy5yZWdpc3RyeS5nZXRGb3JtYXR0ZXIoa2V5KSEsIGFjdGlvbi5hdHRyaWJ1dGVzIVtrZXldXVxuICAgICAgICAgIH0pIDogW10pXG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgc2xvdC5pbnNlcnQodGhpcy5jcmVhdGVDb21wb25lbnRCeVNoYXJlZENvbXBvbmVudChhY3Rpb24uaW5zZXJ0KSlcbiAgICAgICAgfVxuICAgICAgfSBlbHNlIHtcbiAgICAgICAgdGhyb3cgY29sbGFib3JhdGVFcnJvckZuKCdVbmV4cGVjdGVkIGRlbHRhIGFjdGlvbi4nKVxuICAgICAgfVxuICAgIH1cbiAgICByZXR1cm4gc2xvdFxuICB9XG59XG4iXX0=
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@textbus/collaborate",
|
3
|
-
"version": "2.0.0-alpha.
|
3
|
+
"version": "2.0.0-alpha.74",
|
4
4
|
"description": "Textbus is a rich text editor and framework that is highly customizable and extensible to achieve rich wysiwyg effects.",
|
5
5
|
"main": "./bundles/public-api.js",
|
6
6
|
"module": "./bundles/public-api.js",
|
@@ -27,8 +27,8 @@
|
|
27
27
|
"dependencies": {
|
28
28
|
"@tanbo/di": "^1.0.7",
|
29
29
|
"@tanbo/stream": "^1.0.0",
|
30
|
-
"@textbus/browser": "^2.0.0-alpha.
|
31
|
-
"@textbus/core": "^2.0.0-alpha.
|
30
|
+
"@textbus/browser": "^2.0.0-alpha.74",
|
31
|
+
"@textbus/core": "^2.0.0-alpha.74",
|
32
32
|
"reflect-metadata": "^0.1.13",
|
33
33
|
"y-protocols": "^1.0.5",
|
34
34
|
"yjs": "^13.5.27"
|
@@ -44,5 +44,5 @@
|
|
44
44
|
"bugs": {
|
45
45
|
"url": "https://github.com/textbus/textbus.git/issues"
|
46
46
|
},
|
47
|
-
"gitHead": "
|
47
|
+
"gitHead": "9841abde33e279b20e3cd524c61c26dd84fc017c"
|
48
48
|
}
|
@@ -80,18 +80,23 @@ export class RemoteToLocal {
|
|
80
80
|
|
81
81
|
private applySharedSlotToSlot(ev: YEvent, path: YPath, slot: Slot) {
|
82
82
|
if (path.length) {
|
83
|
-
path.shift()
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
83
|
+
const childPath = path.shift()!
|
84
|
+
if ((childPath as any[]).length === 1) {
|
85
|
+
const delta = (ev.target.parent as YText).toDelta()
|
86
|
+
let componentIndex = 0
|
87
|
+
for (let i = 0; i < delta.length; i++) {
|
88
|
+
const action = delta[i]
|
89
|
+
if (action.insert === ev.target) {
|
90
|
+
break
|
91
|
+
}
|
92
|
+
componentIndex += typeof action.insert === 'string' ? action.insert.length : 1
|
90
93
|
}
|
91
|
-
|
94
|
+
const component = slot.getContentAtIndex(componentIndex) as ComponentInstance
|
95
|
+
this.applySharedComponentToComponent(ev, path, component)
|
96
|
+
} else {
|
97
|
+
const component = slot.getContentAtIndex(childPath[0]) as ComponentInstance
|
98
|
+
this.applySharedComponentToComponent(ev, path, component)
|
92
99
|
}
|
93
|
-
const component = slot.getContentAtIndex(componentIndex) as ComponentInstance
|
94
|
-
this.applySharedComponentToComponent(ev, path, component)
|
95
100
|
return
|
96
101
|
}
|
97
102
|
if (ev instanceof YTextEvent) {
|