inline-style-editor 1.2.14 → 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.14",
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";
@@ -270,6 +271,7 @@
270
271
  const popupDimension = self.getBoundingClientRect();
271
272
  x = (x + popupDimension.width + 20 > pageDimensions.width) ? x - popupDimension.width - 20: x + 20;
272
273
  y = (y + popupDimension.height + 20 > pageDimensions.height) ? y - popupDimension.height - 20 : y + 20;
274
+ y = Math.max(y, 0);
273
275
  self.style.left = x + "px";
274
276
  self.style.top = y + "px";
275
277
  helperElemWrapper.style.display = "block";
@@ -370,6 +372,10 @@
370
372
  onStyleChanged(currentElement, currentRule, 'bringtofront', null);
371
373
  }
372
374
 
375
+ function deleteElem() {
376
+ currentElement.remove();
377
+ close();
378
+ }
373
379
  function deleteProp(propName) {
374
380
  if (currentRule === 'inline') {
375
381
  currentElement.style.removeProperty(propName)
@@ -478,6 +484,11 @@ on:click={overlayClicked}>
478
484
  Bring to front
479
485
  </div>
480
486
  {/if}
487
+ {#if currentRule === 'inline' && inlineDeletable(currentElement)}
488
+ <div class="btn delete-elem" on:click="{deleteElem}">
489
+ Delete element
490
+ </div>
491
+ {/if}
481
492
  </div>
482
493
  {/if}
483
494
  </div>