@textbus/platform-browser 3.1.16 → 3.1.17
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/dom-support/parser.d.ts +1 -1
- package/bundles/index.esm.js +47 -28
- package/bundles/index.js +47 -28
- package/package.json +3 -3
| @@ -21,7 +21,7 @@ export interface ComponentLoader { | |
| 21 21 | 
             
                /** 识别组件的匹配方法 */
         | 
| 22 22 | 
             
                match(element: HTMLElement): boolean;
         | 
| 23 23 | 
             
                /** 读取组件内容的方法 */
         | 
| 24 | 
            -
                read(element: HTMLElement,  | 
| 24 | 
            +
                read(element: HTMLElement, injector: Injector, slotParser: SlotParser): ComponentInstance | Slot;
         | 
| 25 25 | 
             
            }
         | 
| 26 26 | 
             
            export interface FormatLoaderReadResult<T extends FormatValue> {
         | 
| 27 27 | 
             
                formatter: Formatter<T>;
         | 
    
        package/bundles/index.esm.js
    CHANGED
    
    | @@ -2182,44 +2182,70 @@ let NativeInput = class NativeInput extends Input { | |
| 2182 2182 | 
             
                handleMobileInput(input) {
         | 
| 2183 2183 | 
             
                    let isCompositionStart = true;
         | 
| 2184 2184 | 
             
                    let startIndex;
         | 
| 2185 | 
            -
                     | 
| 2185 | 
            +
                    const compositionStart = () => {
         | 
| 2186 | 
            +
                        this.composition = true;
         | 
| 2187 | 
            +
                        this.compositionState = null;
         | 
| 2188 | 
            +
                        startIndex = this.selection.startOffset;
         | 
| 2189 | 
            +
                        const startSlot = this.selection.startSlot;
         | 
| 2190 | 
            +
                        const event = new Event(startSlot, {
         | 
| 2191 | 
            +
                            index: startIndex
         | 
| 2192 | 
            +
                        });
         | 
| 2193 | 
            +
                        invokeListener(startSlot.parent, 'onCompositionStart', event);
         | 
| 2194 | 
            +
                    };
         | 
| 2195 | 
            +
                    const compositionUpdate = (data) => {
         | 
| 2196 | 
            +
                        const startSlot = this.selection.startSlot;
         | 
| 2197 | 
            +
                        this.compositionState = {
         | 
| 2198 | 
            +
                            slot: startSlot,
         | 
| 2199 | 
            +
                            index: startIndex,
         | 
| 2200 | 
            +
                            data
         | 
| 2201 | 
            +
                        };
         | 
| 2202 | 
            +
                        const event = new Event(startSlot, {
         | 
| 2203 | 
            +
                            index: startIndex,
         | 
| 2204 | 
            +
                            data
         | 
| 2205 | 
            +
                        });
         | 
| 2206 | 
            +
                        invokeListener(startSlot.parent, 'onCompositionUpdate', event);
         | 
| 2207 | 
            +
                    };
         | 
| 2208 | 
            +
                    const compositionEnd = (data) => {
         | 
| 2209 | 
            +
                        this.composition = false;
         | 
| 2210 | 
            +
                        if (data) {
         | 
| 2211 | 
            +
                            this.commander.write(data);
         | 
| 2212 | 
            +
                        }
         | 
| 2213 | 
            +
                        const startSlot = this.selection.startSlot;
         | 
| 2214 | 
            +
                        if (startSlot) {
         | 
| 2215 | 
            +
                            const event = new Event(startSlot, null);
         | 
| 2216 | 
            +
                            invokeListener(startSlot.parent, 'onCompositionEnd', event);
         | 
| 2217 | 
            +
                        }
         | 
| 2218 | 
            +
                    };
         | 
| 2219 | 
            +
                    this.subscription.add(fromEvent(input, 'compositionstart').subscribe(() => {
         | 
| 2220 | 
            +
                        compositionStart();
         | 
| 2221 | 
            +
                    }), fromEvent(input, 'compositionupdate').subscribe(ev => {
         | 
| 2222 | 
            +
                        compositionUpdate(ev.data);
         | 
| 2223 | 
            +
                    }), fromEvent(input, 'compositionend').subscribe(ev => {
         | 
| 2224 | 
            +
                        compositionEnd(ev.data);
         | 
| 2225 | 
            +
                    }), fromEvent(input, 'beforeinput').subscribe(ev => {
         | 
| 2186 2226 | 
             
                        var _a;
         | 
| 2187 2227 | 
             
                        switch (ev.inputType) {
         | 
| 2188 2228 | 
             
                            case 'insertText':
         | 
| 2189 2229 | 
             
                                if (ev.data) {
         | 
| 2190 2230 | 
             
                                    this.commander.write(ev.data);
         | 
| 2231 | 
            +
                                    ev.preventDefault();
         | 
| 2191 2232 | 
             
                                }
         | 
| 2192 2233 | 
             
                                break;
         | 
| 2193 2234 | 
             
                            case 'insertCompositionText':
         | 
| 2194 2235 | 
             
                                if (isCompositionStart) {
         | 
| 2195 2236 | 
             
                                    isCompositionStart = false;
         | 
| 2196 | 
            -
                                     | 
| 2197 | 
            -
                                    this.compositionState = null;
         | 
| 2198 | 
            -
                                    startIndex = this.selection.startOffset;
         | 
| 2199 | 
            -
                                    const startSlot = this.selection.startSlot;
         | 
| 2200 | 
            -
                                    const event = new Event(startSlot, {
         | 
| 2201 | 
            -
                                        index: startIndex
         | 
| 2202 | 
            -
                                    });
         | 
| 2203 | 
            -
                                    invokeListener(startSlot.parent, 'onCompositionStart', event);
         | 
| 2237 | 
            +
                                    compositionStart();
         | 
| 2204 2238 | 
             
                                }
         | 
| 2205 2239 | 
             
                                else {
         | 
| 2206 | 
            -
                                     | 
| 2207 | 
            -
                                    this.compositionState = {
         | 
| 2208 | 
            -
                                        slot: startSlot,
         | 
| 2209 | 
            -
                                        index: startIndex,
         | 
| 2210 | 
            -
                                        data: ev.data
         | 
| 2211 | 
            -
                                    };
         | 
| 2212 | 
            -
                                    const event = new Event(startSlot, {
         | 
| 2213 | 
            -
                                        index: startIndex,
         | 
| 2214 | 
            -
                                        data: ev.data
         | 
| 2215 | 
            -
                                    });
         | 
| 2216 | 
            -
                                    invokeListener(startSlot.parent, 'onCompositionUpdate', event);
         | 
| 2240 | 
            +
                                    compositionUpdate(ev.data || '');
         | 
| 2217 2241 | 
             
                                }
         | 
| 2218 2242 | 
             
                                break;
         | 
| 2219 2243 | 
             
                            case 'deleteCompositionText':
         | 
| 2244 | 
            +
                                this.composition = false;
         | 
| 2220 2245 | 
             
                                break;
         | 
| 2221 2246 | 
             
                            case 'deleteContentBackward':
         | 
| 2222 2247 | 
             
                            case 'insertReplacementText': {
         | 
| 2248 | 
            +
                                this.composition = false;
         | 
| 2223 2249 | 
             
                                const range = ev.getTargetRanges()[0];
         | 
| 2224 2250 | 
             
                                const location = this.renderer.getLocationByNativeNode(range.startContainer);
         | 
| 2225 2251 | 
             
                                const startSlot = this.selection.startSlot;
         | 
| @@ -2234,14 +2260,7 @@ let NativeInput = class NativeInput extends Input { | |
| 2234 2260 | 
             
                                break;
         | 
| 2235 2261 | 
             
                            }
         | 
| 2236 2262 | 
             
                            case 'insertFromComposition': {
         | 
| 2237 | 
            -
                                 | 
| 2238 | 
            -
                                    this.commander.write(ev.data);
         | 
| 2239 | 
            -
                                }
         | 
| 2240 | 
            -
                                const startSlot = this.selection.startSlot;
         | 
| 2241 | 
            -
                                if (startSlot) {
         | 
| 2242 | 
            -
                                    const event = new Event(startSlot, null);
         | 
| 2243 | 
            -
                                    invokeListener(startSlot.parent, 'onCompositionEnd', event);
         | 
| 2244 | 
            -
                                }
         | 
| 2263 | 
            +
                                compositionEnd(ev.data || '');
         | 
| 2245 2264 | 
             
                                break;
         | 
| 2246 2265 | 
             
                            }
         | 
| 2247 2266 | 
             
                        }
         | 
    
        package/bundles/index.js
    CHANGED
    
    | @@ -2184,44 +2184,70 @@ exports.NativeInput = class NativeInput extends Input { | |
| 2184 2184 | 
             
                handleMobileInput(input) {
         | 
| 2185 2185 | 
             
                    let isCompositionStart = true;
         | 
| 2186 2186 | 
             
                    let startIndex;
         | 
| 2187 | 
            -
                     | 
| 2187 | 
            +
                    const compositionStart = () => {
         | 
| 2188 | 
            +
                        this.composition = true;
         | 
| 2189 | 
            +
                        this.compositionState = null;
         | 
| 2190 | 
            +
                        startIndex = this.selection.startOffset;
         | 
| 2191 | 
            +
                        const startSlot = this.selection.startSlot;
         | 
| 2192 | 
            +
                        const event = new core.Event(startSlot, {
         | 
| 2193 | 
            +
                            index: startIndex
         | 
| 2194 | 
            +
                        });
         | 
| 2195 | 
            +
                        core.invokeListener(startSlot.parent, 'onCompositionStart', event);
         | 
| 2196 | 
            +
                    };
         | 
| 2197 | 
            +
                    const compositionUpdate = (data) => {
         | 
| 2198 | 
            +
                        const startSlot = this.selection.startSlot;
         | 
| 2199 | 
            +
                        this.compositionState = {
         | 
| 2200 | 
            +
                            slot: startSlot,
         | 
| 2201 | 
            +
                            index: startIndex,
         | 
| 2202 | 
            +
                            data
         | 
| 2203 | 
            +
                        };
         | 
| 2204 | 
            +
                        const event = new core.Event(startSlot, {
         | 
| 2205 | 
            +
                            index: startIndex,
         | 
| 2206 | 
            +
                            data
         | 
| 2207 | 
            +
                        });
         | 
| 2208 | 
            +
                        core.invokeListener(startSlot.parent, 'onCompositionUpdate', event);
         | 
| 2209 | 
            +
                    };
         | 
| 2210 | 
            +
                    const compositionEnd = (data) => {
         | 
| 2211 | 
            +
                        this.composition = false;
         | 
| 2212 | 
            +
                        if (data) {
         | 
| 2213 | 
            +
                            this.commander.write(data);
         | 
| 2214 | 
            +
                        }
         | 
| 2215 | 
            +
                        const startSlot = this.selection.startSlot;
         | 
| 2216 | 
            +
                        if (startSlot) {
         | 
| 2217 | 
            +
                            const event = new core.Event(startSlot, null);
         | 
| 2218 | 
            +
                            core.invokeListener(startSlot.parent, 'onCompositionEnd', event);
         | 
| 2219 | 
            +
                        }
         | 
| 2220 | 
            +
                    };
         | 
| 2221 | 
            +
                    this.subscription.add(stream.fromEvent(input, 'compositionstart').subscribe(() => {
         | 
| 2222 | 
            +
                        compositionStart();
         | 
| 2223 | 
            +
                    }), stream.fromEvent(input, 'compositionupdate').subscribe(ev => {
         | 
| 2224 | 
            +
                        compositionUpdate(ev.data);
         | 
| 2225 | 
            +
                    }), stream.fromEvent(input, 'compositionend').subscribe(ev => {
         | 
| 2226 | 
            +
                        compositionEnd(ev.data);
         | 
| 2227 | 
            +
                    }), stream.fromEvent(input, 'beforeinput').subscribe(ev => {
         | 
| 2188 2228 | 
             
                        var _a;
         | 
| 2189 2229 | 
             
                        switch (ev.inputType) {
         | 
| 2190 2230 | 
             
                            case 'insertText':
         | 
| 2191 2231 | 
             
                                if (ev.data) {
         | 
| 2192 2232 | 
             
                                    this.commander.write(ev.data);
         | 
| 2233 | 
            +
                                    ev.preventDefault();
         | 
| 2193 2234 | 
             
                                }
         | 
| 2194 2235 | 
             
                                break;
         | 
| 2195 2236 | 
             
                            case 'insertCompositionText':
         | 
| 2196 2237 | 
             
                                if (isCompositionStart) {
         | 
| 2197 2238 | 
             
                                    isCompositionStart = false;
         | 
| 2198 | 
            -
                                     | 
| 2199 | 
            -
                                    this.compositionState = null;
         | 
| 2200 | 
            -
                                    startIndex = this.selection.startOffset;
         | 
| 2201 | 
            -
                                    const startSlot = this.selection.startSlot;
         | 
| 2202 | 
            -
                                    const event = new core.Event(startSlot, {
         | 
| 2203 | 
            -
                                        index: startIndex
         | 
| 2204 | 
            -
                                    });
         | 
| 2205 | 
            -
                                    core.invokeListener(startSlot.parent, 'onCompositionStart', event);
         | 
| 2239 | 
            +
                                    compositionStart();
         | 
| 2206 2240 | 
             
                                }
         | 
| 2207 2241 | 
             
                                else {
         | 
| 2208 | 
            -
                                     | 
| 2209 | 
            -
                                    this.compositionState = {
         | 
| 2210 | 
            -
                                        slot: startSlot,
         | 
| 2211 | 
            -
                                        index: startIndex,
         | 
| 2212 | 
            -
                                        data: ev.data
         | 
| 2213 | 
            -
                                    };
         | 
| 2214 | 
            -
                                    const event = new core.Event(startSlot, {
         | 
| 2215 | 
            -
                                        index: startIndex,
         | 
| 2216 | 
            -
                                        data: ev.data
         | 
| 2217 | 
            -
                                    });
         | 
| 2218 | 
            -
                                    core.invokeListener(startSlot.parent, 'onCompositionUpdate', event);
         | 
| 2242 | 
            +
                                    compositionUpdate(ev.data || '');
         | 
| 2219 2243 | 
             
                                }
         | 
| 2220 2244 | 
             
                                break;
         | 
| 2221 2245 | 
             
                            case 'deleteCompositionText':
         | 
| 2246 | 
            +
                                this.composition = false;
         | 
| 2222 2247 | 
             
                                break;
         | 
| 2223 2248 | 
             
                            case 'deleteContentBackward':
         | 
| 2224 2249 | 
             
                            case 'insertReplacementText': {
         | 
| 2250 | 
            +
                                this.composition = false;
         | 
| 2225 2251 | 
             
                                const range = ev.getTargetRanges()[0];
         | 
| 2226 2252 | 
             
                                const location = this.renderer.getLocationByNativeNode(range.startContainer);
         | 
| 2227 2253 | 
             
                                const startSlot = this.selection.startSlot;
         | 
| @@ -2236,14 +2262,7 @@ exports.NativeInput = class NativeInput extends Input { | |
| 2236 2262 | 
             
                                break;
         | 
| 2237 2263 | 
             
                            }
         | 
| 2238 2264 | 
             
                            case 'insertFromComposition': {
         | 
| 2239 | 
            -
                                 | 
| 2240 | 
            -
                                    this.commander.write(ev.data);
         | 
| 2241 | 
            -
                                }
         | 
| 2242 | 
            -
                                const startSlot = this.selection.startSlot;
         | 
| 2243 | 
            -
                                if (startSlot) {
         | 
| 2244 | 
            -
                                    const event = new core.Event(startSlot, null);
         | 
| 2245 | 
            -
                                    core.invokeListener(startSlot.parent, 'onCompositionEnd', event);
         | 
| 2246 | 
            -
                                }
         | 
| 2265 | 
            +
                                compositionEnd(ev.data || '');
         | 
| 2247 2266 | 
             
                                break;
         | 
| 2248 2267 | 
             
                            }
         | 
| 2249 2268 | 
             
                        }
         | 
    
        package/package.json
    CHANGED
    
    | @@ -1,6 +1,6 @@ | |
| 1 1 | 
             
            {
         | 
| 2 2 | 
             
              "name": "@textbus/platform-browser",
         | 
| 3 | 
            -
              "version": "3.1. | 
| 3 | 
            +
              "version": "3.1.17",
         | 
| 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",
         | 
| @@ -27,7 +27,7 @@ | |
| 27 27 | 
             
              "dependencies": {
         | 
| 28 28 | 
             
                "@tanbo/di": "^1.1.4",
         | 
| 29 29 | 
             
                "@tanbo/stream": "^1.1.9",
         | 
| 30 | 
            -
                "@textbus/core": "^3.1. | 
| 30 | 
            +
                "@textbus/core": "^3.1.17",
         | 
| 31 31 | 
             
                "reflect-metadata": "^0.1.13"
         | 
| 32 32 | 
             
              },
         | 
| 33 33 | 
             
              "devDependencies": {
         | 
| @@ -48,5 +48,5 @@ | |
| 48 48 | 
             
              "bugs": {
         | 
| 49 49 | 
             
                "url": "https://github.com/textbus/textbus.git/issues"
         | 
| 50 50 | 
             
              },
         | 
| 51 | 
            -
              "gitHead": " | 
| 51 | 
            +
              "gitHead": "30df4bdca5b13b6765d4e208ebb2e491ed3529f7"
         | 
| 52 52 | 
             
            }
         |