@textbus/platform-browser 3.0.0-y.0 → 3.0.0

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/README.md CHANGED
@@ -11,7 +11,7 @@ API,且提供了更高的抽象层,使 Textbus 不仅易于上手,同时
11
11
  ## 安装
12
12
 
13
13
  ```
14
- npm install @textbus/core @textbus/browser
14
+ npm install @textbus/core @textbus/platform-browser
15
15
  ```
16
16
 
17
17
  ## 创建编辑器
@@ -25,6 +25,7 @@ declare class ExperimentalCaret implements Caret {
25
25
  private _display;
26
26
  private flashing;
27
27
  private subs;
28
+ private subscription;
28
29
  private positionChangeEvent;
29
30
  private styleChangeEvent;
30
31
  private oldRange;
@@ -1373,6 +1373,7 @@ class ExperimentalCaret {
1373
1373
  this._display = true;
1374
1374
  this.flashing = true;
1375
1375
  this.subs = [];
1376
+ this.subscription = new Subscription();
1376
1377
  this.positionChangeEvent = new Subject();
1377
1378
  this.styleChangeEvent = new Subject();
1378
1379
  this.oldRange = null;
@@ -1397,7 +1398,7 @@ class ExperimentalCaret {
1397
1398
  })
1398
1399
  ]
1399
1400
  });
1400
- this.subs.push(fromEvent(document, 'mousedown').subscribe(() => {
1401
+ this.subscription.add(fromEvent(document, 'mousedown').subscribe(() => {
1401
1402
  this.flashing = false;
1402
1403
  }), fromEvent(document, 'mouseup').subscribe(() => {
1403
1404
  this.flashing = true;
@@ -1446,6 +1447,7 @@ class ExperimentalCaret {
1446
1447
  }
1447
1448
  destroy() {
1448
1449
  clearTimeout(this.timer);
1450
+ this.subscription.unsubscribe();
1449
1451
  this.subs.forEach(i => i.unsubscribe());
1450
1452
  }
1451
1453
  correctScrollTop(scroller) {
@@ -1755,9 +1757,11 @@ let MagicInput = class MagicInput extends Input {
1755
1757
  return !isWriting; // || !this.textarea.value
1756
1758
  })).subscribe(ev => {
1757
1759
  let key = ev.key;
1758
- const b = key === 'Process' && ev.code === 'Digit2';
1760
+ const keys = ')!@#$%^Z&*(';
1761
+ const b = key === 'Process' && /Digit\d/.test(ev.code) && ev.shiftKey;
1759
1762
  if (b) {
1760
- key = '@';
1763
+ // 大小写锁定为大写 + 全角 + shift + 数字键,还存在问题
1764
+ key = keys.charAt(+ev.code.substring(5));
1761
1765
  this.isSougouPinYin = true;
1762
1766
  ev.preventDefault();
1763
1767
  }
package/bundles/index.js CHANGED
@@ -1375,6 +1375,7 @@ class ExperimentalCaret {
1375
1375
  this._display = true;
1376
1376
  this.flashing = true;
1377
1377
  this.subs = [];
1378
+ this.subscription = new stream.Subscription();
1378
1379
  this.positionChangeEvent = new stream.Subject();
1379
1380
  this.styleChangeEvent = new stream.Subject();
1380
1381
  this.oldRange = null;
@@ -1399,7 +1400,7 @@ class ExperimentalCaret {
1399
1400
  })
1400
1401
  ]
1401
1402
  });
1402
- this.subs.push(stream.fromEvent(document, 'mousedown').subscribe(() => {
1403
+ this.subscription.add(stream.fromEvent(document, 'mousedown').subscribe(() => {
1403
1404
  this.flashing = false;
1404
1405
  }), stream.fromEvent(document, 'mouseup').subscribe(() => {
1405
1406
  this.flashing = true;
@@ -1448,6 +1449,7 @@ class ExperimentalCaret {
1448
1449
  }
1449
1450
  destroy() {
1450
1451
  clearTimeout(this.timer);
1452
+ this.subscription.unsubscribe();
1451
1453
  this.subs.forEach(i => i.unsubscribe());
1452
1454
  }
1453
1455
  correctScrollTop(scroller) {
@@ -1757,9 +1759,11 @@ exports.MagicInput = class MagicInput extends Input {
1757
1759
  return !isWriting; // || !this.textarea.value
1758
1760
  })).subscribe(ev => {
1759
1761
  let key = ev.key;
1760
- const b = key === 'Process' && ev.code === 'Digit2';
1762
+ const keys = ')!@#$%^Z&*(';
1763
+ const b = key === 'Process' && /Digit\d/.test(ev.code) && ev.shiftKey;
1761
1764
  if (b) {
1762
- key = '@';
1765
+ // 大小写锁定为大写 + 全角 + shift + 数字键,还存在问题
1766
+ key = keys.charAt(+ev.code.substring(5));
1763
1767
  this.isSougouPinYin = true;
1764
1768
  ev.preventDefault();
1765
1769
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@textbus/platform-browser",
3
- "version": "3.0.0-y.0",
3
+ "version": "3.0.0",
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.0.0-y.0",
30
+ "@textbus/core": "^3.0.0",
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": "27059f131ab49e1ca739b91071d2ce52285c4746"
51
+ "gitHead": "1a8732460b4e218117d176277bc18021c90779dc"
52
52
  }