@inditextech/weave-sdk 0.24.0 → 0.25.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/dist/sdk.js CHANGED
@@ -16376,7 +16376,6 @@ var WeaveCopyPasteNodesPlugin = class extends WeavePlugin {
16376
16376
  const items = await navigator.clipboard.read();
16377
16377
  if (items && items.length === 1) {
16378
16378
  const item = items[0];
16379
- this.instance.getStage().setPointersPositions(e);
16380
16379
  const position = this.instance.getStage().getPointerPosition();
16381
16380
  if (position) this.instance.emitEvent("onPasteExternal", {
16382
16381
  position,
@@ -18133,7 +18132,7 @@ var WeaveRegisterManager = class {
18133
18132
 
18134
18133
  //#endregion
18135
18134
  //#region package.json
18136
- var version = "0.24.0";
18135
+ var version = "0.25.0";
18137
18136
 
18138
18137
  //#endregion
18139
18138
  //#region src/managers/setup.ts
@@ -19317,6 +19316,14 @@ var WeaveTextNode = class extends WeaveNode {
19317
19316
  textArea.style.resize = "none";
19318
19317
  textArea.style.lineHeight = `${textNode.lineHeight()}`;
19319
19318
  textArea.style.fontFamily = textNode.fontFamily();
19319
+ let fontWeight = "normal";
19320
+ let fontStyle = "normal";
19321
+ if ((textNode.fontStyle() ?? "normal").indexOf("bold") !== -1) fontWeight = "bold";
19322
+ if ((textNode.fontStyle() ?? "normal").indexOf("italic") !== -1) fontStyle = "italic";
19323
+ textArea.style.fontWeight = fontWeight;
19324
+ textArea.style.fontStyle = fontStyle;
19325
+ textArea.style.fontVariant = textNode.fontVariant();
19326
+ textArea.style.textDecoration = textNode.textDecoration();
19320
19327
  textAreaContainer.style.transformOrigin = "left top";
19321
19328
  textArea.style.textAlign = textNode.align();
19322
19329
  textArea.style.color = `${textNode.fill()}`;
@@ -22286,10 +22293,23 @@ var WeaveTextToolAction = class extends WeaveAction {
22286
22293
  this.textId = null;
22287
22294
  this.container = void 0;
22288
22295
  this.clickPoint = null;
22296
+ this.props = this.initProps();
22289
22297
  }
22290
22298
  getName() {
22291
22299
  return TEXT_TOOL_ACTION_NAME;
22292
22300
  }
22301
+ initProps() {
22302
+ return {
22303
+ text: "",
22304
+ layout: TEXT_LAYOUT.AUTO_ALL,
22305
+ fontSize: 20,
22306
+ fontFamily: "Arial, sans-serif",
22307
+ fill: "#000000",
22308
+ align: "left",
22309
+ verticalAlign: "top",
22310
+ strokeEnabled: false
22311
+ };
22312
+ }
22293
22313
  setupEvents() {
22294
22314
  const stage = this.instance.getStage();
22295
22315
  stage.container().addEventListener("keydown", (e) => {
@@ -22332,21 +22352,9 @@ var WeaveTextToolAction = class extends WeaveAction {
22332
22352
  this.textId = v4_default();
22333
22353
  const nodeHandler = this.instance.getNodeHandler("text");
22334
22354
  const node = nodeHandler.create(this.textId, {
22355
+ ...this.props,
22335
22356
  x: this.clickPoint?.x ?? 0,
22336
22357
  y: this.clickPoint?.y ?? 0,
22337
- text: "",
22338
- layout: TEXT_LAYOUT.AUTO_ALL,
22339
- width: 10,
22340
- fontSize: 20,
22341
- fontFamily: "Arial, sans-serif",
22342
- fill: "#000000ff",
22343
- strokeEnabled: false,
22344
- stroke: "#000000ff",
22345
- strokeWidth: 1,
22346
- strokeScaleEnabled: true,
22347
- align: "left",
22348
- verticalAlign: "top",
22349
- opacity: 1,
22350
22358
  draggable: true
22351
22359
  });
22352
22360
  this.instance.addNode(node, this.container?.getAttrs().id);
@@ -22359,6 +22367,7 @@ var WeaveTextToolAction = class extends WeaveAction {
22359
22367
  this.cancelAction = cancelAction;
22360
22368
  const selectionPlugin = this.instance.getPlugin("nodesSelection");
22361
22369
  if (selectionPlugin) selectionPlugin.setSelectedNodes([]);
22370
+ this.props = this.initProps();
22362
22371
  this.addText();
22363
22372
  }
22364
22373
  cleanup() {