@node-projects/web-component-designer-visualization-addons 0.1.93 → 0.1.95

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.
@@ -1,5 +1,5 @@
1
1
  import { BaseCustomWebComponentConstructorAppend, css, html } from "@node-projects/base-custom-webcomponent";
2
- import { ContextMenu, PropertiesHelper } from "@node-projects/web-component-designer";
2
+ import { ContextMenu, copyTextToClipboard, getTextFromClipboard, PropertiesHelper } from "@node-projects/web-component-designer";
3
3
  import { ParameterEditor } from "./ParameterEditor.js";
4
4
  import { BlocklyScriptEditor } from "../blockly/BlocklyScriptEditor.js";
5
5
  import { SimpleScriptEditor } from "./SimpleScriptEditor.js";
@@ -41,7 +41,7 @@ export class EventAssignment extends BaseCustomWebComponentConstructorAppend {
41
41
  }`;
42
42
  static template = html `
43
43
  <template repeat:item="[[this.events]]">
44
- <div @click="[[this._ctxMenu(event, item)]]" @contextmenu="[[this._ctxMenu(event, item)]]" class="rect" css:background-color="[[this._getScriptTypeColor(item)]]"></div>
44
+ <div @click="[[this._ctxMenu(event, item)]]" @contextmenu="[[this._ctxMenu(event, item)]]" class="rect" title="[[this._getScriptType(item)]]" css:background-color="[[this._getScriptTypeColor(item)]]"></div>
45
45
  <a @click="[[this._showContextMenuAssignScript(event, item, false)]]" @contextmenu="[[this._ctxMenu(event, item)]]" title="[[item.name]]">[[item.name]]</a>
46
46
  <div>[[this._createControlsForScript(item)]]</div>
47
47
  </template>
@@ -209,8 +209,23 @@ export class EventAssignment extends BaseCustomWebComponentConstructorAppend {
209
209
  const evtType = this._getScriptType(eventItem);
210
210
  if (evtType == 'empty')
211
211
  this._showContextMenuAssignScript(e, eventItem, true);
212
- else if (evtType != 'none')
213
- ContextMenu.show([{ title: 'remove', action: () => { this.selectedItems[0].removeAttribute('@' + eventItem.name); this._bindingsRefresh(); } }], e);
212
+ else if (evtType != 'none') {
213
+ let ctxMenu = [
214
+ {
215
+ title: 'remove',
216
+ action: () => { this.selectedItems[0].removeAttribute('@' + eventItem.name); this._bindingsRefresh(); }
217
+ }, {
218
+ title: '-'
219
+ }, {
220
+ title: 'copy',
221
+ action: () => { copyTextToClipboard(this.selectedItems[0].getAttribute('@' + eventItem.name)); }
222
+ }, {
223
+ title: 'paste',
224
+ action: async () => { this.selectedItems[0].setAttribute('@' + eventItem.name, await getTextFromClipboard()); }
225
+ }
226
+ ];
227
+ ContextMenu.show(ctxMenu, e);
228
+ }
214
229
  else
215
230
  this._showContextMenuAssignScript(e, eventItem, true);
216
231
  }
@@ -259,6 +274,17 @@ export class EventAssignment extends BaseCustomWebComponentConstructorAppend {
259
274
  action: () => { this.selectedItems[0].removeAttribute('@' + eventItem.name); this._bindingsRefresh(); }
260
275
  });
261
276
  }
277
+ if (evtType != 'empty') {
278
+ ctxMenu.push({
279
+ title: '-'
280
+ }, {
281
+ title: 'copy',
282
+ action: () => { copyTextToClipboard(this.selectedItems[0].getAttribute('@' + eventItem.name)); }
283
+ }, {
284
+ title: 'paste',
285
+ action: async () => { this.selectedItems[0].setAttribute('@' + eventItem.name, await getTextFromClipboard()); }
286
+ });
287
+ }
262
288
  return ctxMenu;
263
289
  }
264
290
  async _showContextMenuAssignScript(event, eventItem, isCtxMenu) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "description": "web-component-designer addon for visualizations",
3
3
  "name": "@node-projects/web-component-designer-visualization-addons",
4
- "version": "0.1.93",
4
+ "version": "0.1.95",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "author": "jochen.kuehner@gmx.de",