@textbus/platform-browser 3.0.0-alpha.40 → 3.0.0-alpha.41
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/index.esm.js +137 -138
- package/bundles/index.js +137 -138
- package/bundles/preset/default-shortcut.d.ts +1 -4
- package/package.json +2 -2
    
        package/bundles/index.esm.js
    CHANGED
    
    | @@ -2199,142 +2199,140 @@ OutputTranslator = OutputTranslator_1 = __decorate([ | |
| 2199 2199 | 
             
            /**
         | 
| 2200 2200 | 
             
             * Textbus PC 端默认按键绑定
         | 
| 2201 2201 | 
             
             */
         | 
| 2202 | 
            -
             | 
| 2203 | 
            -
                 | 
| 2204 | 
            -
             | 
| 2205 | 
            -
             | 
| 2206 | 
            -
             | 
| 2207 | 
            -
             | 
| 2208 | 
            -
                     | 
| 2209 | 
            -
                         | 
| 2210 | 
            -
             | 
| 2211 | 
            -
             | 
| 2212 | 
            -
                         | 
| 2213 | 
            -
             | 
| 2214 | 
            -
             | 
| 2215 | 
            -
             | 
| 2216 | 
            -
                     | 
| 2217 | 
            -
                         | 
| 2218 | 
            -
             | 
| 2219 | 
            -
             | 
| 2220 | 
            -
             | 
| 2221 | 
            -
                         | 
| 2222 | 
            -
             | 
| 2223 | 
            -
             | 
| 2224 | 
            -
             | 
| 2225 | 
            -
             | 
| 2226 | 
            -
             | 
| 2227 | 
            -
                             | 
| 2228 | 
            -
             | 
| 2229 | 
            -
             | 
| 2230 | 
            -
             | 
| 2231 | 
            -
             | 
| 2232 | 
            -
                     | 
| 2233 | 
            -
                         | 
| 2234 | 
            -
             | 
| 2235 | 
            -
             | 
| 2236 | 
            -
                         | 
| 2237 | 
            -
             | 
| 2238 | 
            -
             | 
| 2239 | 
            -
             | 
| 2240 | 
            -
                     | 
| 2241 | 
            -
                         | 
| 2242 | 
            -
             | 
| 2243 | 
            -
             | 
| 2244 | 
            -
                         | 
| 2245 | 
            -
                             | 
| 2246 | 
            -
                                 | 
| 2247 | 
            -
             | 
| 2248 | 
            -
             | 
| 2249 | 
            -
                                 | 
| 2250 | 
            -
             | 
| 2251 | 
            -
             | 
| 2252 | 
            -
                                 | 
| 2253 | 
            -
             | 
| 2254 | 
            -
             | 
| 2255 | 
            -
                                 | 
| 2256 | 
            -
             | 
| 2257 | 
            -
             | 
| 2258 | 
            -
             | 
| 2259 | 
            -
             | 
| 2260 | 
            -
             | 
| 2261 | 
            -
                     | 
| 2262 | 
            -
                         | 
| 2263 | 
            -
             | 
| 2264 | 
            -
             | 
| 2265 | 
            -
             | 
| 2266 | 
            -
                         | 
| 2267 | 
            -
                             | 
| 2268 | 
            -
                                 | 
| 2269 | 
            -
             | 
| 2270 | 
            -
             | 
| 2271 | 
            -
                                 | 
| 2272 | 
            -
             | 
| 2273 | 
            -
             | 
| 2274 | 
            -
                                 | 
| 2275 | 
            -
             | 
| 2276 | 
            -
             | 
| 2277 | 
            -
                                 | 
| 2278 | 
            -
             | 
| 2279 | 
            -
             | 
| 2280 | 
            -
             | 
| 2281 | 
            -
             | 
| 2282 | 
            -
             | 
| 2283 | 
            -
                     | 
| 2284 | 
            -
                         | 
| 2285 | 
            -
             | 
| 2286 | 
            -
             | 
| 2287 | 
            -
                         | 
| 2288 | 
            -
             | 
| 2289 | 
            -
             | 
| 2290 | 
            -
             | 
| 2291 | 
            -
                     | 
| 2292 | 
            -
                         | 
| 2293 | 
            -
             | 
| 2294 | 
            -
             | 
| 2295 | 
            -
             | 
| 2296 | 
            -
                         | 
| 2297 | 
            -
             | 
| 2298 | 
            -
             | 
| 2299 | 
            -
             | 
| 2300 | 
            -
                     | 
| 2301 | 
            -
                         | 
| 2302 | 
            -
             | 
| 2303 | 
            -
             | 
| 2304 | 
            -
             | 
| 2305 | 
            -
                         | 
| 2306 | 
            -
             | 
| 2307 | 
            -
             | 
| 2308 | 
            -
             | 
| 2309 | 
            -
                     | 
| 2310 | 
            -
                         | 
| 2311 | 
            -
             | 
| 2312 | 
            -
             | 
| 2313 | 
            -
             | 
| 2314 | 
            -
                         | 
| 2315 | 
            -
             | 
| 2316 | 
            -
             | 
| 2317 | 
            -
             | 
| 2318 | 
            -
                     | 
| 2319 | 
            -
                         | 
| 2320 | 
            -
             | 
| 2321 | 
            -
             | 
| 2322 | 
            -
             | 
| 2323 | 
            -
                         | 
| 2324 | 
            -
             | 
| 2325 | 
            -
             | 
| 2326 | 
            -
             | 
| 2327 | 
            -
                     | 
| 2328 | 
            -
                         | 
| 2329 | 
            -
             | 
| 2330 | 
            -
             | 
| 2331 | 
            -
             | 
| 2332 | 
            -
             | 
| 2333 | 
            -
                         | 
| 2334 | 
            -
             | 
| 2335 | 
            -
             | 
| 2336 | 
            -
                    });
         | 
| 2337 | 
            -
                }
         | 
| 2202 | 
            +
            function setDefaultShortcut(injector) {
         | 
| 2203 | 
            +
                const selection = injector.get(Selection);
         | 
| 2204 | 
            +
                const keyboard = injector.get(Keyboard);
         | 
| 2205 | 
            +
                const history = injector.get(History);
         | 
| 2206 | 
            +
                const commander = injector.get(Commander);
         | 
| 2207 | 
            +
                keyboard.addShortcut({
         | 
| 2208 | 
            +
                    keymap: {
         | 
| 2209 | 
            +
                        key: 'Enter'
         | 
| 2210 | 
            +
                    },
         | 
| 2211 | 
            +
                    action: () => {
         | 
| 2212 | 
            +
                        commander.break();
         | 
| 2213 | 
            +
                    }
         | 
| 2214 | 
            +
                });
         | 
| 2215 | 
            +
                keyboard.addShortcut({
         | 
| 2216 | 
            +
                    keymap: {
         | 
| 2217 | 
            +
                        key: 'Enter',
         | 
| 2218 | 
            +
                        shiftKey: true
         | 
| 2219 | 
            +
                    },
         | 
| 2220 | 
            +
                    action: () => {
         | 
| 2221 | 
            +
                        const startOffset = selection.startOffset;
         | 
| 2222 | 
            +
                        const startSlot = selection.startSlot;
         | 
| 2223 | 
            +
                        const isToEnd = startOffset === startSlot.length || startSlot.isEmpty;
         | 
| 2224 | 
            +
                        const content = isToEnd ? '\n\n' : '\n';
         | 
| 2225 | 
            +
                        const isInserted = commander.insert(content);
         | 
| 2226 | 
            +
                        if (isInserted && isToEnd) {
         | 
| 2227 | 
            +
                            selection.setPosition(startSlot, startOffset + 1);
         | 
| 2228 | 
            +
                        }
         | 
| 2229 | 
            +
                    }
         | 
| 2230 | 
            +
                });
         | 
| 2231 | 
            +
                keyboard.addShortcut({
         | 
| 2232 | 
            +
                    keymap: {
         | 
| 2233 | 
            +
                        key: ['Delete', 'Backspace']
         | 
| 2234 | 
            +
                    },
         | 
| 2235 | 
            +
                    action: (key) => {
         | 
| 2236 | 
            +
                        commander.delete(key === 'Backspace');
         | 
| 2237 | 
            +
                    }
         | 
| 2238 | 
            +
                });
         | 
| 2239 | 
            +
                keyboard.addShortcut({
         | 
| 2240 | 
            +
                    keymap: {
         | 
| 2241 | 
            +
                        key: ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown']
         | 
| 2242 | 
            +
                    },
         | 
| 2243 | 
            +
                    action: (key) => {
         | 
| 2244 | 
            +
                        switch (key) {
         | 
| 2245 | 
            +
                            case 'ArrowLeft':
         | 
| 2246 | 
            +
                                selection.toPrevious();
         | 
| 2247 | 
            +
                                break;
         | 
| 2248 | 
            +
                            case 'ArrowRight':
         | 
| 2249 | 
            +
                                selection.toNext();
         | 
| 2250 | 
            +
                                break;
         | 
| 2251 | 
            +
                            case 'ArrowUp':
         | 
| 2252 | 
            +
                                selection.toPreviousLine();
         | 
| 2253 | 
            +
                                break;
         | 
| 2254 | 
            +
                            case 'ArrowDown':
         | 
| 2255 | 
            +
                                selection.toNextLine();
         | 
| 2256 | 
            +
                                break;
         | 
| 2257 | 
            +
                        }
         | 
| 2258 | 
            +
                    }
         | 
| 2259 | 
            +
                });
         | 
| 2260 | 
            +
                keyboard.addShortcut({
         | 
| 2261 | 
            +
                    keymap: {
         | 
| 2262 | 
            +
                        key: ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown'],
         | 
| 2263 | 
            +
                        shiftKey: true
         | 
| 2264 | 
            +
                    },
         | 
| 2265 | 
            +
                    action: (key) => {
         | 
| 2266 | 
            +
                        switch (key) {
         | 
| 2267 | 
            +
                            case 'ArrowLeft':
         | 
| 2268 | 
            +
                                selection.wrapToBefore();
         | 
| 2269 | 
            +
                                break;
         | 
| 2270 | 
            +
                            case 'ArrowRight':
         | 
| 2271 | 
            +
                                selection.wrapToAfter();
         | 
| 2272 | 
            +
                                break;
         | 
| 2273 | 
            +
                            case 'ArrowUp':
         | 
| 2274 | 
            +
                                selection.wrapToPreviousLine();
         | 
| 2275 | 
            +
                                break;
         | 
| 2276 | 
            +
                            case 'ArrowDown':
         | 
| 2277 | 
            +
                                selection.wrapToNextLine();
         | 
| 2278 | 
            +
                                break;
         | 
| 2279 | 
            +
                        }
         | 
| 2280 | 
            +
                    }
         | 
| 2281 | 
            +
                });
         | 
| 2282 | 
            +
                keyboard.addShortcut({
         | 
| 2283 | 
            +
                    keymap: {
         | 
| 2284 | 
            +
                        key: 'Tab'
         | 
| 2285 | 
            +
                    },
         | 
| 2286 | 
            +
                    action: () => {
         | 
| 2287 | 
            +
                        commander.insert('    ');
         | 
| 2288 | 
            +
                    }
         | 
| 2289 | 
            +
                });
         | 
| 2290 | 
            +
                keyboard.addShortcut({
         | 
| 2291 | 
            +
                    keymap: {
         | 
| 2292 | 
            +
                        key: 'a',
         | 
| 2293 | 
            +
                        ctrlKey: true
         | 
| 2294 | 
            +
                    },
         | 
| 2295 | 
            +
                    action: () => {
         | 
| 2296 | 
            +
                        selection.selectAll();
         | 
| 2297 | 
            +
                    }
         | 
| 2298 | 
            +
                });
         | 
| 2299 | 
            +
                keyboard.addShortcut({
         | 
| 2300 | 
            +
                    keymap: {
         | 
| 2301 | 
            +
                        key: 'c',
         | 
| 2302 | 
            +
                        ctrlKey: true
         | 
| 2303 | 
            +
                    },
         | 
| 2304 | 
            +
                    action: () => {
         | 
| 2305 | 
            +
                        commander.copy();
         | 
| 2306 | 
            +
                    }
         | 
| 2307 | 
            +
                });
         | 
| 2308 | 
            +
                keyboard.addShortcut({
         | 
| 2309 | 
            +
                    keymap: {
         | 
| 2310 | 
            +
                        key: 'x',
         | 
| 2311 | 
            +
                        ctrlKey: true
         | 
| 2312 | 
            +
                    },
         | 
| 2313 | 
            +
                    action: () => {
         | 
| 2314 | 
            +
                        commander.cut();
         | 
| 2315 | 
            +
                    }
         | 
| 2316 | 
            +
                });
         | 
| 2317 | 
            +
                keyboard.addShortcut({
         | 
| 2318 | 
            +
                    keymap: {
         | 
| 2319 | 
            +
                        key: 'z',
         | 
| 2320 | 
            +
                        ctrlKey: true
         | 
| 2321 | 
            +
                    },
         | 
| 2322 | 
            +
                    action: () => {
         | 
| 2323 | 
            +
                        history.back();
         | 
| 2324 | 
            +
                    }
         | 
| 2325 | 
            +
                });
         | 
| 2326 | 
            +
                keyboard.addShortcut({
         | 
| 2327 | 
            +
                    keymap: {
         | 
| 2328 | 
            +
                        key: 'z',
         | 
| 2329 | 
            +
                        ctrlKey: true,
         | 
| 2330 | 
            +
                        shiftKey: true
         | 
| 2331 | 
            +
                    },
         | 
| 2332 | 
            +
                    action: () => {
         | 
| 2333 | 
            +
                        history.forward();
         | 
| 2334 | 
            +
                    }
         | 
| 2335 | 
            +
                });
         | 
| 2338 2336 | 
             
            }
         | 
| 2339 2337 |  | 
| 2340 2338 | 
             
            const editorError = makeError('CoreEditor');
         | 
| @@ -2370,7 +2368,7 @@ class Viewer extends Starter { | |
| 2370 2368 | 
             
                            provide: Viewer,
         | 
| 2371 2369 | 
             
                            useFactory: () => this
         | 
| 2372 2370 | 
             
                        }];
         | 
| 2373 | 
            -
                    super(Object.assign(Object.assign({}, options), { plugins:  | 
| 2371 | 
            +
                    super(Object.assign(Object.assign({}, options), { plugins: options.plugins || [], providers: [
         | 
| 2374 2372 | 
             
                            ...(options.providers || []),
         | 
| 2375 2373 | 
             
                            ...staticProviders,
         | 
| 2376 2374 | 
             
                            DomRenderer,
         | 
| @@ -2441,6 +2439,7 @@ class Viewer extends Starter { | |
| 2441 2439 | 
             
                                this.saveEvent.next();
         | 
| 2442 2440 | 
             
                            }
         | 
| 2443 2441 | 
             
                        });
         | 
| 2442 | 
            +
                        setDefaultShortcut(this);
         | 
| 2444 2443 | 
             
                        let component;
         | 
| 2445 2444 | 
             
                        const content = this.options.content;
         | 
| 2446 2445 | 
             
                        if (content) {
         | 
| @@ -2688,4 +2687,4 @@ class Viewer extends Starter { | |
| 2688 2687 | 
             
                }
         | 
| 2689 2688 | 
             
            }
         | 
| 2690 2689 |  | 
| 2691 | 
            -
            export { CollaborateCursor, CollaborateSelectionAwarenessDelegate,  | 
| 2690 | 
            +
            export { CollaborateCursor, CollaborateSelectionAwarenessDelegate, DomRenderer, EDITOR_OPTIONS, Input, MagicInput, NativeInput, OutputTranslator, Parser, SelectionBridge, VIEW_CONTAINER, VIEW_DOCUMENT, VIEW_MASK, Viewer, createElement, createTextNode, getLayoutRectByRange, isMac, isSafari, isWindows, setDefaultShortcut };
         | 
    
        package/bundles/index.js
    CHANGED
    
    | @@ -2201,142 +2201,140 @@ exports.OutputTranslator = OutputTranslator_1 = __decorate([ | |
| 2201 2201 | 
             
            /**
         | 
| 2202 2202 | 
             
             * Textbus PC 端默认按键绑定
         | 
| 2203 2203 | 
             
             */
         | 
| 2204 | 
            -
             | 
| 2205 | 
            -
                 | 
| 2206 | 
            -
             | 
| 2207 | 
            -
             | 
| 2208 | 
            -
             | 
| 2209 | 
            -
             | 
| 2210 | 
            -
                     | 
| 2211 | 
            -
                         | 
| 2212 | 
            -
             | 
| 2213 | 
            -
             | 
| 2214 | 
            -
                         | 
| 2215 | 
            -
             | 
| 2216 | 
            -
             | 
| 2217 | 
            -
             | 
| 2218 | 
            -
                     | 
| 2219 | 
            -
                         | 
| 2220 | 
            -
             | 
| 2221 | 
            -
             | 
| 2222 | 
            -
             | 
| 2223 | 
            -
                         | 
| 2224 | 
            -
             | 
| 2225 | 
            -
             | 
| 2226 | 
            -
             | 
| 2227 | 
            -
             | 
| 2228 | 
            -
             | 
| 2229 | 
            -
                             | 
| 2230 | 
            -
             | 
| 2231 | 
            -
             | 
| 2232 | 
            -
             | 
| 2233 | 
            -
             | 
| 2234 | 
            -
                     | 
| 2235 | 
            -
                         | 
| 2236 | 
            -
             | 
| 2237 | 
            -
             | 
| 2238 | 
            -
                         | 
| 2239 | 
            -
             | 
| 2240 | 
            -
             | 
| 2241 | 
            -
             | 
| 2242 | 
            -
                     | 
| 2243 | 
            -
                         | 
| 2244 | 
            -
             | 
| 2245 | 
            -
             | 
| 2246 | 
            -
                         | 
| 2247 | 
            -
                             | 
| 2248 | 
            -
                                 | 
| 2249 | 
            -
             | 
| 2250 | 
            -
             | 
| 2251 | 
            -
                                 | 
| 2252 | 
            -
             | 
| 2253 | 
            -
             | 
| 2254 | 
            -
                                 | 
| 2255 | 
            -
             | 
| 2256 | 
            -
             | 
| 2257 | 
            -
                                 | 
| 2258 | 
            -
             | 
| 2259 | 
            -
             | 
| 2260 | 
            -
             | 
| 2261 | 
            -
             | 
| 2262 | 
            -
             | 
| 2263 | 
            -
                     | 
| 2264 | 
            -
                         | 
| 2265 | 
            -
             | 
| 2266 | 
            -
             | 
| 2267 | 
            -
             | 
| 2268 | 
            -
                         | 
| 2269 | 
            -
                             | 
| 2270 | 
            -
                                 | 
| 2271 | 
            -
             | 
| 2272 | 
            -
             | 
| 2273 | 
            -
                                 | 
| 2274 | 
            -
             | 
| 2275 | 
            -
             | 
| 2276 | 
            -
                                 | 
| 2277 | 
            -
             | 
| 2278 | 
            -
             | 
| 2279 | 
            -
                                 | 
| 2280 | 
            -
             | 
| 2281 | 
            -
             | 
| 2282 | 
            -
             | 
| 2283 | 
            -
             | 
| 2284 | 
            -
             | 
| 2285 | 
            -
                     | 
| 2286 | 
            -
                         | 
| 2287 | 
            -
             | 
| 2288 | 
            -
             | 
| 2289 | 
            -
                         | 
| 2290 | 
            -
             | 
| 2291 | 
            -
             | 
| 2292 | 
            -
             | 
| 2293 | 
            -
                     | 
| 2294 | 
            -
                         | 
| 2295 | 
            -
             | 
| 2296 | 
            -
             | 
| 2297 | 
            -
             | 
| 2298 | 
            -
                         | 
| 2299 | 
            -
             | 
| 2300 | 
            -
             | 
| 2301 | 
            -
             | 
| 2302 | 
            -
                     | 
| 2303 | 
            -
                         | 
| 2304 | 
            -
             | 
| 2305 | 
            -
             | 
| 2306 | 
            -
             | 
| 2307 | 
            -
                         | 
| 2308 | 
            -
             | 
| 2309 | 
            -
             | 
| 2310 | 
            -
             | 
| 2311 | 
            -
                     | 
| 2312 | 
            -
                         | 
| 2313 | 
            -
             | 
| 2314 | 
            -
             | 
| 2315 | 
            -
             | 
| 2316 | 
            -
                         | 
| 2317 | 
            -
             | 
| 2318 | 
            -
             | 
| 2319 | 
            -
             | 
| 2320 | 
            -
                     | 
| 2321 | 
            -
                         | 
| 2322 | 
            -
             | 
| 2323 | 
            -
             | 
| 2324 | 
            -
             | 
| 2325 | 
            -
                         | 
| 2326 | 
            -
             | 
| 2327 | 
            -
             | 
| 2328 | 
            -
             | 
| 2329 | 
            -
                     | 
| 2330 | 
            -
                         | 
| 2331 | 
            -
             | 
| 2332 | 
            -
             | 
| 2333 | 
            -
             | 
| 2334 | 
            -
             | 
| 2335 | 
            -
                         | 
| 2336 | 
            -
             | 
| 2337 | 
            -
             | 
| 2338 | 
            -
                    });
         | 
| 2339 | 
            -
                }
         | 
| 2204 | 
            +
            function setDefaultShortcut(injector) {
         | 
| 2205 | 
            +
                const selection = injector.get(core.Selection);
         | 
| 2206 | 
            +
                const keyboard = injector.get(core.Keyboard);
         | 
| 2207 | 
            +
                const history = injector.get(core.History);
         | 
| 2208 | 
            +
                const commander = injector.get(core.Commander);
         | 
| 2209 | 
            +
                keyboard.addShortcut({
         | 
| 2210 | 
            +
                    keymap: {
         | 
| 2211 | 
            +
                        key: 'Enter'
         | 
| 2212 | 
            +
                    },
         | 
| 2213 | 
            +
                    action: () => {
         | 
| 2214 | 
            +
                        commander.break();
         | 
| 2215 | 
            +
                    }
         | 
| 2216 | 
            +
                });
         | 
| 2217 | 
            +
                keyboard.addShortcut({
         | 
| 2218 | 
            +
                    keymap: {
         | 
| 2219 | 
            +
                        key: 'Enter',
         | 
| 2220 | 
            +
                        shiftKey: true
         | 
| 2221 | 
            +
                    },
         | 
| 2222 | 
            +
                    action: () => {
         | 
| 2223 | 
            +
                        const startOffset = selection.startOffset;
         | 
| 2224 | 
            +
                        const startSlot = selection.startSlot;
         | 
| 2225 | 
            +
                        const isToEnd = startOffset === startSlot.length || startSlot.isEmpty;
         | 
| 2226 | 
            +
                        const content = isToEnd ? '\n\n' : '\n';
         | 
| 2227 | 
            +
                        const isInserted = commander.insert(content);
         | 
| 2228 | 
            +
                        if (isInserted && isToEnd) {
         | 
| 2229 | 
            +
                            selection.setPosition(startSlot, startOffset + 1);
         | 
| 2230 | 
            +
                        }
         | 
| 2231 | 
            +
                    }
         | 
| 2232 | 
            +
                });
         | 
| 2233 | 
            +
                keyboard.addShortcut({
         | 
| 2234 | 
            +
                    keymap: {
         | 
| 2235 | 
            +
                        key: ['Delete', 'Backspace']
         | 
| 2236 | 
            +
                    },
         | 
| 2237 | 
            +
                    action: (key) => {
         | 
| 2238 | 
            +
                        commander.delete(key === 'Backspace');
         | 
| 2239 | 
            +
                    }
         | 
| 2240 | 
            +
                });
         | 
| 2241 | 
            +
                keyboard.addShortcut({
         | 
| 2242 | 
            +
                    keymap: {
         | 
| 2243 | 
            +
                        key: ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown']
         | 
| 2244 | 
            +
                    },
         | 
| 2245 | 
            +
                    action: (key) => {
         | 
| 2246 | 
            +
                        switch (key) {
         | 
| 2247 | 
            +
                            case 'ArrowLeft':
         | 
| 2248 | 
            +
                                selection.toPrevious();
         | 
| 2249 | 
            +
                                break;
         | 
| 2250 | 
            +
                            case 'ArrowRight':
         | 
| 2251 | 
            +
                                selection.toNext();
         | 
| 2252 | 
            +
                                break;
         | 
| 2253 | 
            +
                            case 'ArrowUp':
         | 
| 2254 | 
            +
                                selection.toPreviousLine();
         | 
| 2255 | 
            +
                                break;
         | 
| 2256 | 
            +
                            case 'ArrowDown':
         | 
| 2257 | 
            +
                                selection.toNextLine();
         | 
| 2258 | 
            +
                                break;
         | 
| 2259 | 
            +
                        }
         | 
| 2260 | 
            +
                    }
         | 
| 2261 | 
            +
                });
         | 
| 2262 | 
            +
                keyboard.addShortcut({
         | 
| 2263 | 
            +
                    keymap: {
         | 
| 2264 | 
            +
                        key: ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown'],
         | 
| 2265 | 
            +
                        shiftKey: true
         | 
| 2266 | 
            +
                    },
         | 
| 2267 | 
            +
                    action: (key) => {
         | 
| 2268 | 
            +
                        switch (key) {
         | 
| 2269 | 
            +
                            case 'ArrowLeft':
         | 
| 2270 | 
            +
                                selection.wrapToBefore();
         | 
| 2271 | 
            +
                                break;
         | 
| 2272 | 
            +
                            case 'ArrowRight':
         | 
| 2273 | 
            +
                                selection.wrapToAfter();
         | 
| 2274 | 
            +
                                break;
         | 
| 2275 | 
            +
                            case 'ArrowUp':
         | 
| 2276 | 
            +
                                selection.wrapToPreviousLine();
         | 
| 2277 | 
            +
                                break;
         | 
| 2278 | 
            +
                            case 'ArrowDown':
         | 
| 2279 | 
            +
                                selection.wrapToNextLine();
         | 
| 2280 | 
            +
                                break;
         | 
| 2281 | 
            +
                        }
         | 
| 2282 | 
            +
                    }
         | 
| 2283 | 
            +
                });
         | 
| 2284 | 
            +
                keyboard.addShortcut({
         | 
| 2285 | 
            +
                    keymap: {
         | 
| 2286 | 
            +
                        key: 'Tab'
         | 
| 2287 | 
            +
                    },
         | 
| 2288 | 
            +
                    action: () => {
         | 
| 2289 | 
            +
                        commander.insert('    ');
         | 
| 2290 | 
            +
                    }
         | 
| 2291 | 
            +
                });
         | 
| 2292 | 
            +
                keyboard.addShortcut({
         | 
| 2293 | 
            +
                    keymap: {
         | 
| 2294 | 
            +
                        key: 'a',
         | 
| 2295 | 
            +
                        ctrlKey: true
         | 
| 2296 | 
            +
                    },
         | 
| 2297 | 
            +
                    action: () => {
         | 
| 2298 | 
            +
                        selection.selectAll();
         | 
| 2299 | 
            +
                    }
         | 
| 2300 | 
            +
                });
         | 
| 2301 | 
            +
                keyboard.addShortcut({
         | 
| 2302 | 
            +
                    keymap: {
         | 
| 2303 | 
            +
                        key: 'c',
         | 
| 2304 | 
            +
                        ctrlKey: true
         | 
| 2305 | 
            +
                    },
         | 
| 2306 | 
            +
                    action: () => {
         | 
| 2307 | 
            +
                        commander.copy();
         | 
| 2308 | 
            +
                    }
         | 
| 2309 | 
            +
                });
         | 
| 2310 | 
            +
                keyboard.addShortcut({
         | 
| 2311 | 
            +
                    keymap: {
         | 
| 2312 | 
            +
                        key: 'x',
         | 
| 2313 | 
            +
                        ctrlKey: true
         | 
| 2314 | 
            +
                    },
         | 
| 2315 | 
            +
                    action: () => {
         | 
| 2316 | 
            +
                        commander.cut();
         | 
| 2317 | 
            +
                    }
         | 
| 2318 | 
            +
                });
         | 
| 2319 | 
            +
                keyboard.addShortcut({
         | 
| 2320 | 
            +
                    keymap: {
         | 
| 2321 | 
            +
                        key: 'z',
         | 
| 2322 | 
            +
                        ctrlKey: true
         | 
| 2323 | 
            +
                    },
         | 
| 2324 | 
            +
                    action: () => {
         | 
| 2325 | 
            +
                        history.back();
         | 
| 2326 | 
            +
                    }
         | 
| 2327 | 
            +
                });
         | 
| 2328 | 
            +
                keyboard.addShortcut({
         | 
| 2329 | 
            +
                    keymap: {
         | 
| 2330 | 
            +
                        key: 'z',
         | 
| 2331 | 
            +
                        ctrlKey: true,
         | 
| 2332 | 
            +
                        shiftKey: true
         | 
| 2333 | 
            +
                    },
         | 
| 2334 | 
            +
                    action: () => {
         | 
| 2335 | 
            +
                        history.forward();
         | 
| 2336 | 
            +
                    }
         | 
| 2337 | 
            +
                });
         | 
| 2340 2338 | 
             
            }
         | 
| 2341 2339 |  | 
| 2342 2340 | 
             
            const editorError = core.makeError('CoreEditor');
         | 
| @@ -2372,7 +2370,7 @@ class Viewer extends core.Starter { | |
| 2372 2370 | 
             
                            provide: Viewer,
         | 
| 2373 2371 | 
             
                            useFactory: () => this
         | 
| 2374 2372 | 
             
                        }];
         | 
| 2375 | 
            -
                    super(Object.assign(Object.assign({}, options), { plugins:  | 
| 2373 | 
            +
                    super(Object.assign(Object.assign({}, options), { plugins: options.plugins || [], providers: [
         | 
| 2376 2374 | 
             
                            ...(options.providers || []),
         | 
| 2377 2375 | 
             
                            ...staticProviders,
         | 
| 2378 2376 | 
             
                            exports.DomRenderer,
         | 
| @@ -2443,6 +2441,7 @@ class Viewer extends core.Starter { | |
| 2443 2441 | 
             
                                this.saveEvent.next();
         | 
| 2444 2442 | 
             
                            }
         | 
| 2445 2443 | 
             
                        });
         | 
| 2444 | 
            +
                        setDefaultShortcut(this);
         | 
| 2446 2445 | 
             
                        let component;
         | 
| 2447 2446 | 
             
                        const content = this.options.content;
         | 
| 2448 2447 | 
             
                        if (content) {
         | 
| @@ -2691,7 +2690,6 @@ class Viewer extends core.Starter { | |
| 2691 2690 | 
             
            }
         | 
| 2692 2691 |  | 
| 2693 2692 | 
             
            exports.CollaborateSelectionAwarenessDelegate = CollaborateSelectionAwarenessDelegate;
         | 
| 2694 | 
            -
            exports.DefaultShortcut = DefaultShortcut;
         | 
| 2695 2693 | 
             
            exports.EDITOR_OPTIONS = EDITOR_OPTIONS;
         | 
| 2696 2694 | 
             
            exports.Input = Input;
         | 
| 2697 2695 | 
             
            exports.VIEW_CONTAINER = VIEW_CONTAINER;
         | 
| @@ -2704,3 +2702,4 @@ exports.getLayoutRectByRange = getLayoutRectByRange; | |
| 2704 2702 | 
             
            exports.isMac = isMac;
         | 
| 2705 2703 | 
             
            exports.isSafari = isSafari;
         | 
| 2706 2704 | 
             
            exports.isWindows = isWindows;
         | 
| 2705 | 
            +
            exports.setDefaultShortcut = setDefaultShortcut;
         | 
| @@ -1,8 +1,5 @@ | |
| 1 1 | 
             
            import { Injector } from '@tanbo/di';
         | 
| 2 | 
            -
            import { Plugin } from '@textbus/core';
         | 
| 3 2 | 
             
            /**
         | 
| 4 3 | 
             
             * Textbus PC 端默认按键绑定
         | 
| 5 4 | 
             
             */
         | 
| 6 | 
            -
            export declare  | 
| 7 | 
            -
                setup(injector: Injector): void;
         | 
| 8 | 
            -
            }
         | 
| 5 | 
            +
            export declare function setDefaultShortcut(injector: Injector): void;
         | 
    
        package/package.json
    CHANGED
    
    | @@ -1,6 +1,6 @@ | |
| 1 1 | 
             
            {
         | 
| 2 2 | 
             
              "name": "@textbus/platform-browser",
         | 
| 3 | 
            -
              "version": "3.0.0-alpha. | 
| 3 | 
            +
              "version": "3.0.0-alpha.41",
         | 
| 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",
         | 
| @@ -48,5 +48,5 @@ | |
| 48 48 | 
             
              "bugs": {
         | 
| 49 49 | 
             
                "url": "https://github.com/textbus/textbus.git/issues"
         | 
| 50 50 | 
             
              },
         | 
| 51 | 
            -
              "gitHead": " | 
| 51 | 
            +
              "gitHead": "646cc933c5ab2f0fe0d4f28c4fb95d8a11b88891"
         | 
| 52 52 | 
             
            }
         |