@textbus/platform-browser 4.2.1 → 4.2.3
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/browser-module.d.ts +1 -1
- package/bundles/index.esm.js +26 -10
- package/bundles/index.js +26 -10
- package/bundles/selection-bridge.d.ts +1 -0
- package/package.json +4 -4
@@ -43,7 +43,7 @@ export declare class BrowserModule implements Module {
|
|
43
43
|
* @param textbus
|
44
44
|
*/
|
45
45
|
readDocumentByComponentLiteral(data: ComponentLiteral, rootComponent: ComponentConstructor, textbus: Textbus): Component;
|
46
|
-
setup(textbus: Textbus): () => void
|
46
|
+
setup(textbus: Textbus): Promise<() => void>;
|
47
47
|
onAfterStartup(textbus: Textbus): void;
|
48
48
|
onDestroy(textbus: Textbus): void;
|
49
49
|
private static createLayout;
|
package/bundles/index.esm.js
CHANGED
@@ -150,6 +150,16 @@ function __metadata(metadataKey, metadataValue) {
|
|
150
150
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
151
151
|
}
|
152
152
|
|
153
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
154
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
155
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
156
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
157
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
158
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
159
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
160
|
+
});
|
161
|
+
}
|
162
|
+
|
153
163
|
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
154
164
|
var e = new Error(message);
|
155
165
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
@@ -347,6 +357,7 @@ let SelectionBridge = class SelectionBridge {
|
|
347
357
|
this.input = input;
|
348
358
|
this.domAdapter = domAdapter;
|
349
359
|
this.nativeSelection = document.getSelection();
|
360
|
+
this.syncSelectionFromNativeSelectionChange = true;
|
350
361
|
this.selectionChangeEvent = new Subject();
|
351
362
|
this.subs = [];
|
352
363
|
this.connector = null;
|
@@ -659,7 +670,9 @@ let SelectionBridge = class SelectionBridge {
|
|
659
670
|
}));
|
660
671
|
}
|
661
672
|
this.subs.push(fromEvent(document, 'selectionchange').pipe().subscribe(() => {
|
662
|
-
this.
|
673
|
+
if (this.syncSelectionFromNativeSelectionChange) {
|
674
|
+
this.syncSelection(connector);
|
675
|
+
}
|
663
676
|
}));
|
664
677
|
}
|
665
678
|
syncSelection(connector) {
|
@@ -2247,15 +2260,18 @@ class BrowserModule {
|
|
2247
2260
|
return registry.createComponentByFactory(data, rootComponent);
|
2248
2261
|
}
|
2249
2262
|
setup(textbus) {
|
2250
|
-
this
|
2251
|
-
|
2252
|
-
|
2253
|
-
|
2254
|
-
|
2255
|
-
|
2256
|
-
|
2257
|
-
|
2258
|
-
|
2263
|
+
return __awaiter(this, void 0, void 0, function* () {
|
2264
|
+
this.textbus = textbus;
|
2265
|
+
const host = this.config.renderTo();
|
2266
|
+
if (!(host instanceof HTMLElement)) {
|
2267
|
+
throw browserErrorFn('view container is not a HTMLElement');
|
2268
|
+
}
|
2269
|
+
host.append(this.workbench);
|
2270
|
+
yield textbus.get(Input).onReady;
|
2271
|
+
return () => {
|
2272
|
+
this.workbench.remove();
|
2273
|
+
};
|
2274
|
+
});
|
2259
2275
|
}
|
2260
2276
|
onAfterStartup(textbus) {
|
2261
2277
|
if (this.config.autoFocus) {
|
package/bundles/index.js
CHANGED
@@ -152,6 +152,16 @@ function __metadata(metadataKey, metadataValue) {
|
|
152
152
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
153
153
|
}
|
154
154
|
|
155
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
156
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
157
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
158
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
159
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
160
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
161
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
162
|
+
});
|
163
|
+
}
|
164
|
+
|
155
165
|
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
156
166
|
var e = new Error(message);
|
157
167
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
@@ -349,6 +359,7 @@ exports.SelectionBridge = class SelectionBridge {
|
|
349
359
|
this.input = input;
|
350
360
|
this.domAdapter = domAdapter;
|
351
361
|
this.nativeSelection = document.getSelection();
|
362
|
+
this.syncSelectionFromNativeSelectionChange = true;
|
352
363
|
this.selectionChangeEvent = new stream.Subject();
|
353
364
|
this.subs = [];
|
354
365
|
this.connector = null;
|
@@ -661,7 +672,9 @@ exports.SelectionBridge = class SelectionBridge {
|
|
661
672
|
}));
|
662
673
|
}
|
663
674
|
this.subs.push(stream.fromEvent(document, 'selectionchange').pipe().subscribe(() => {
|
664
|
-
this.
|
675
|
+
if (this.syncSelectionFromNativeSelectionChange) {
|
676
|
+
this.syncSelection(connector);
|
677
|
+
}
|
665
678
|
}));
|
666
679
|
}
|
667
680
|
syncSelection(connector) {
|
@@ -2249,15 +2262,18 @@ class BrowserModule {
|
|
2249
2262
|
return registry.createComponentByFactory(data, rootComponent);
|
2250
2263
|
}
|
2251
2264
|
setup(textbus) {
|
2252
|
-
this
|
2253
|
-
|
2254
|
-
|
2255
|
-
|
2256
|
-
|
2257
|
-
|
2258
|
-
|
2259
|
-
|
2260
|
-
|
2265
|
+
return __awaiter(this, void 0, void 0, function* () {
|
2266
|
+
this.textbus = textbus;
|
2267
|
+
const host = this.config.renderTo();
|
2268
|
+
if (!(host instanceof HTMLElement)) {
|
2269
|
+
throw browserErrorFn('view container is not a HTMLElement');
|
2270
|
+
}
|
2271
|
+
host.append(this.workbench);
|
2272
|
+
yield textbus.get(Input).onReady;
|
2273
|
+
return () => {
|
2274
|
+
this.workbench.remove();
|
2275
|
+
};
|
2276
|
+
});
|
2261
2277
|
}
|
2262
2278
|
onAfterStartup(textbus) {
|
2263
2279
|
if (this.config.autoFocus) {
|
@@ -15,6 +15,7 @@ export declare class SelectionBridge implements NativeSelectionBridge {
|
|
15
15
|
private domAdapter;
|
16
16
|
onSelectionChange: Observable<Range | null>;
|
17
17
|
nativeSelection: globalThis.Selection;
|
18
|
+
syncSelectionFromNativeSelectionChange: boolean;
|
18
19
|
private selectionChangeEvent;
|
19
20
|
private subs;
|
20
21
|
private sub;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@textbus/platform-browser",
|
3
|
-
"version": "4.2.
|
3
|
+
"version": "4.2.3",
|
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/index.js",
|
6
6
|
"module": "./bundles/index.esm.js",
|
@@ -25,8 +25,8 @@
|
|
25
25
|
"typescript editor"
|
26
26
|
],
|
27
27
|
"dependencies": {
|
28
|
-
"@tanbo/stream": "^1.2.
|
29
|
-
"@textbus/core": "^4.2.
|
28
|
+
"@tanbo/stream": "^1.2.6",
|
29
|
+
"@textbus/core": "^4.2.3",
|
30
30
|
"@viewfly/core": "^1.0.5"
|
31
31
|
},
|
32
32
|
"devDependencies": {
|
@@ -47,5 +47,5 @@
|
|
47
47
|
"bugs": {
|
48
48
|
"url": "https://github.com/textbus/textbus.git/issues"
|
49
49
|
},
|
50
|
-
"gitHead": "
|
50
|
+
"gitHead": "d77564bc33b44ff9d04a03e9e69d7fbc2672087b"
|
51
51
|
}
|