anki/ts/editor/codable.ts
2021-06-17 15:30:05 +02:00

20 lines
500 B
TypeScript

// Copyright: Ankitects Pty Ltd and contributors
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import CodeMirror from "codemirror/src/codemirror"
const codables: Codable[] = [];
export function toggleHtmlEdit() {
for (const codable of codables) {
CodeMirror.fromTextArea(codable);
}
}
export class Codable extends HTMLTextAreaElement {
connectedCallback(): void {
this.setAttribute("hidden", "");
codables.push(this);
}
}