diff --git a/blocks-proc.js b/blocks-proc.js index 8128482..a5894a3 100644 --- a/blocks-proc.js +++ b/blocks-proc.js @@ -25,6 +25,11 @@ const LIB_ICONS = { /** Procedure definition block with inputs/outputs/description/return-style. Lives in the Procedures tab. */ class WCProcedure extends WCBlock { + delete() { + if (this.dataset.readonly) { showError("Cannot delete a library procedure."); return; } + super.delete(); + } + connectedCallback() { super.connectedCallback(); this._el.naturalName = this._require(".proc-natural-name"); diff --git a/wcblock.js b/wcblock.js index 29ac82e..49d38ea 100644 --- a/wcblock.js +++ b/wcblock.js @@ -46,7 +46,7 @@ class WCBlock extends HTMLElement { }); const isAlgoBlock = !!this.closest("#draw-area"); - if (!(this instanceof WCStart) && !(this instanceof WCEnd)) { + if (!(this instanceof WCStart) && !(this instanceof WCEnd) && !this.dataset.readonly) { const btn = document.createElement("button"); btn.className = "delete-btn"; btn.textContent = "\u00D7";