(x = state)
| 85 | pattern = this.getAttribute("pattern") ?? "(<script-block state=').+('>)", |
| 86 | patternRe = new RegExp(pattern); |
| 87 | const saveState = (x = state) => { |
| 88 | const json = JSON.stringify(x), |
| 89 | block = this.closest("[blockid]"), |
| 90 | blockId = block.getAttribute("blockid"); |
| 91 | |
| 92 | requestAnimationFrame(() => { |
| 93 | const textarea = document.getElementById("edit-block-1-" + blockId), |
| 94 | escaped = json.replace(/&/g, "&").replace(/'/g, "'") |
| 95 | .replace(/</g, "<").replace(/>/g, ">") |
| 96 | .replace(/\r\n/g, " ").replace(/[\r\n]/g, " "); |
| 97 | |
| 98 | textarea.value = textarea.value.replace( |
| 99 | pattern, |
| 100 | (_, before, after) => before + escaped + after, |
| 101 | ); |
| 102 | setTimeout(() => { |
| 103 | textarea.dispatchEvent(new KeyboardEvent("keydown", { keyCode: 27 })); |
| 104 | }, 100); |
| 105 | }); |
| 106 | block.click(); |
| 107 | }; |
| 108 | |
| 109 | const body = this.innerHTML.slice(4, this.innerHTML.length - 3), |
| 110 | f = Function("save", "html", "svg", body), |
nothing calls this directly
no outgoing calls
no test coverage detected