| 348 | } |
| 349 | |
| 350 | get formatOptions() { |
| 351 | const form = new FormData( |
| 352 | document.getElementById(this.getAttribute("for-format")), |
| 353 | ); |
| 354 | const options = {}; |
| 355 | for (const [key, value] of form.entries()) { |
| 356 | if (key === "format" || value === "") continue; |
| 357 | if (key === "indent_width") { |
| 358 | const width = Number(value); |
| 359 | if (Number.isFinite(width)) { |
| 360 | options[key] = width; |
| 361 | } |
| 362 | continue; |
| 363 | } |
| 364 | options[key] = value; |
| 365 | } |
| 366 | return options; |
| 367 | } |
| 368 | |
| 369 | get code() { |
| 370 | return document.getElementById(this.getAttribute("for-editor")).code; |