@meta2d/core 1.0.11 → 1.0.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meta2d/core",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "description": "@meta2d/core: Powerful, Beautiful, Simple, Open - Web-Based 2D At Its Best .",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -360,6 +360,7 @@ export declare class Canvas {
360
360
  private ondblclick;
361
361
  showInput: (pen: Pen, rect?: Rect, background?: string) => void;
362
362
  setInputStyle: (pen: Pen) => void;
363
+ convertSpecialCharacter(str: any): any;
363
364
  hideInput: () => void;
364
365
  private createInput;
365
366
  clearDropdownList(): void;
@@ -2429,6 +2429,7 @@ var Canvas = /** @class */ (function () {
2429
2429
  .replace(/\<br\>/g, '')
2430
2430
  .replace(/&nbsp;/g, ' ')
2431
2431
  .replace(/(<([^>]+)>)/gi, '');
2432
+ _this.inputDiv.dataset.value = _this.convertSpecialCharacter(_this.inputDiv.dataset.value);
2432
2433
  if (pen.onInput) {
2433
2434
  pen.onInput(pen, _this.inputDiv.dataset.value);
2434
2435
  }
@@ -3210,6 +3211,7 @@ var Canvas = /** @class */ (function () {
3210
3211
  setChildrenActive(pen);
3211
3212
  });
3212
3213
  (_b = this.store.active).push.apply(_b, __spreadArray([], __read(pens), false));
3214
+ this.activeRect = undefined;
3213
3215
  this.calcActiveRect();
3214
3216
  this.patchFlags = true;
3215
3217
  emit && this.store.emitter.emit('active', this.store.active);
@@ -3551,6 +3553,9 @@ var Canvas = /** @class */ (function () {
3551
3553
  if (i > -1) {
3552
3554
  _this.store.data.pens.splice(i, 1);
3553
3555
  _this.store.pens[pen.id] = undefined;
3556
+ if (!pen.calculative) {
3557
+ pen.calculative = {};
3558
+ }
3554
3559
  pen.calculative.canvas = _this;
3555
3560
  _this.store.animates.delete(pen);
3556
3561
  _this.store.animateMap.delete(pen);
@@ -3592,8 +3597,12 @@ var Canvas = /** @class */ (function () {
3592
3597
  break;
3593
3598
  case EditType.Delete:
3594
3599
  action.pens.forEach(function (aPen) {
3600
+ var _a;
3595
3601
  var pen = deepClone(aPen, true);
3596
- _this.store.data.pens.splice(pen.calculative.layer, 0, pen);
3602
+ if (!pen.calculative) {
3603
+ pen.calculative = {};
3604
+ }
3605
+ _this.store.data.pens.splice((_a = pen.calculative) === null || _a === void 0 ? void 0 : _a.layer, 0, pen);
3597
3606
  // 先放进去,pens 可能是子节点在前,而父节点在后
3598
3607
  _this.store.pens[pen.id] = pen;
3599
3608
  pen.calculative.canvas = _this;
@@ -5582,6 +5591,12 @@ var Canvas = /** @class */ (function () {
5582
5591
  }
5583
5592
  });
5584
5593
  };
5594
+ Canvas.prototype.convertSpecialCharacter = function (str) {
5595
+ var arrEntities = { lt: '<', gt: '>', nbsp: ' ', amp: '&', quot: '"' };
5596
+ return str.replace(/&(lt|gt|nbsp|amp|quot);/gi, function (all, t) {
5597
+ return arrEntities[t];
5598
+ });
5599
+ };
5585
5600
  Canvas.prototype.createInput = function () {
5586
5601
  var _this = this;
5587
5602
  this.inputParent.classList.add('meta2d-input');