inline-style-editor 1.2.15 → 1.2.16

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": "inline-style-editor",
3
- "version": "1.2.15",
3
+ "version": "1.2.16",
4
4
  "description": "Update CSS rules or add inline style to elements visualy",
5
5
  "scripts": {
6
6
  "build": "rollup --config",
@@ -91,6 +91,9 @@
91
91
  &.active {
92
92
  background-color: #4d84bf;
93
93
  }
94
+ &.delete-elem {
95
+ background-color: #d13737;
96
+ }
94
97
  margin: 0 5px;
95
98
  background-color: #3333330d;
96
99
  border-radius: 4px;
@@ -34,6 +34,7 @@
34
34
  export let listenOnClick = false;
35
35
  export let onStyleChanged = () => {};
36
36
  export let customProps = {};
37
+ export let inlineDeletable = () => true;
37
38
 
38
39
  const typeText = "text";
39
40
  const typeBorder = "border";
@@ -371,6 +372,10 @@
371
372
  onStyleChanged(currentElement, currentRule, 'bringtofront', null);
372
373
  }
373
374
 
375
+ function deleteElem() {
376
+ currentElement.remove();
377
+ close();
378
+ }
374
379
  function deleteProp(propName) {
375
380
  if (currentRule === 'inline') {
376
381
  currentElement.style.removeProperty(propName)
@@ -479,6 +484,11 @@ on:click={overlayClicked}>
479
484
  Bring to front
480
485
  </div>
481
486
  {/if}
487
+ {#if currentRule === 'inline' && inlineDeletable(currentElement)}
488
+ <div class="btn delete-elem" on:click="{deleteElem}">
489
+ Delete element
490
+ </div>
491
+ {/if}
482
492
  </div>
483
493
  {/if}
484
494
  </div>