Loading app/Resources/js/modules/xml-editor.ts +43 −10 Original line number Diff line number Diff line import { basicSetup } from "@codemirror/basic-setup"; import { indentWithTab } from "@codemirror/commands"; import { xml } from "@codemirror/lang-xml"; import { EditorState } from "@codemirror/state"; import { EditorView } from "@codemirror/view"; import { defaultHighlightStyle, syntaxHighlighting, } from "@codemirror/language"; import { Compartment, EditorState } from "@codemirror/state"; import { keymap } from "@codemirror/view"; import { basicSetup, EditorView } from "codemirror"; import { css, html, LitElement, TemplateResult } from "lit"; import { customElement, queryAssignedNodes, state } from "lit/decorators.js"; import prettifyXML from "xml-formatter"; const language = new Compartment(); @customElement("xml-editor") export class XMLEditor extends LitElement { @queryAssignedNodes("textarea", true) @queryAssignedNodes({ slot: "textarea" }) _textarea!: NodeListOf<HTMLTextAreaElement>; @state() Loading @@ -24,13 +31,39 @@ export class XMLEditor extends LitElement { }, }); this.editorState = EditorState.create({ doc: this._textarea[0].value ? prettifyXML(this._textarea[0].value, { let editorContents = ""; if (this._textarea[0].value) { try { editorContents = prettifyXML(this._textarea[0].value, { indentation: " ", }) : "", extensions: [basicSetup, xml(), minHeightEditor], }); } catch (e) { // xml doesn't have a root node editorContents = prettifyXML( "<root>" + this._textarea[0].value + "</root>", { indentation: " ", } ); // remove root, unnecessary lines and indents editorContents = editorContents .replace(/^<root>/, "") .replace(/<\/root>$/, "") .replace(/^\s*[\r\n]/gm, "") .replace(/[\r\n] {2}/gm, "\r\n") .trim(); } } this.editorState = EditorState.create({ doc: editorContents, extensions: [ basicSetup, keymap.of([indentWithTab]), language.of(xml()), minHeightEditor, syntaxHighlighting(defaultHighlightStyle), ], }); this.editorView = new EditorView({ Loading docs/src/ar/index.md +2 −2 Original line number Diff line number Diff line Loading @@ -29,8 +29,8 @@ podcasters around the world! - 🌱 Free & open-source (AGPL v3 License) - 🔐 Focused on data sovereignty: your content, audience, and analytics belong to you, and you only - 🪄 Podcasting 2.0 features: GUID, locked, transcripts, funding, chapters, location, persons, soundbites, … - 🪄 Podcasting 2.0 features: GUID, locked, transcripts, funding, chapters, location, persons, soundbites, … - 💬 Built-in social network: - 🚀 Castopod is part of the Fediverse, a decentralized social network - ❤️ Create posts, share, favourite, and comment on episodes Loading docs/src/br/index.md +2 −2 Original line number Diff line number Diff line Loading @@ -29,8 +29,8 @@ podcasters around the world! - 🌱 Free & open-source (AGPL v3 License) - 🔐 Focused on data sovereignty: your content, audience, and analytics belong to you, and you only - 🪄 Podcasting 2.0 features: GUID, locked, transcripts, funding, chapters, location, persons, soundbites, … - 🪄 Podcasting 2.0 features: GUID, locked, transcripts, funding, chapters, location, persons, soundbites, … - 💬 Built-in social network: - 🚀 Castopod is part of the Fediverse, a decentralized social network - ❤️ Create posts, share, favourite, and comment on episodes Loading docs/src/de/index.md +2 −2 Original line number Diff line number Diff line Loading @@ -29,8 +29,8 @@ Podcastenden auf der ganzen Welt verwendet! - 🌱 Kostenlos & Open-Source (AGPL v3 Lizenz) - 🔐 Fokussiert auf die Datensouveränität: Ihre Inhalte, Ihr Publikum und Analysen gehören zu Ihnen, und nur Ihnen - 🪄 Podcasting 2.0 features: GUID, locked, transcripts, funding, chapters, location, persons, soundbites, … - 🪄 Podcasting 2.0 features: GUID, locked, transcripts, funding, chapters, location, persons, soundbites, … - 💬 Built-in social network: - 🚀 Castopod is part of the Fediverse, a decentralized social network - ❤️ Create posts, share, favourite, and comment on episodes Loading docs/src/el/index.md +2 −2 Original line number Diff line number Diff line Loading @@ -29,8 +29,8 @@ podcasters around the world! - 🌱 Free & open-source (AGPL v3 License) - 🔐 Focused on data sovereignty: your content, audience, and analytics belong to you, and you only - 🪄 Podcasting 2.0 features: GUID, locked, transcripts, funding, chapters, location, persons, soundbites, … - 🪄 Podcasting 2.0 features: GUID, locked, transcripts, funding, chapters, location, persons, soundbites, … - 💬 Built-in social network: - 🚀 Castopod is part of the Fediverse, a decentralized social network - ❤️ Create posts, share, favourite, and comment on episodes Loading Loading
app/Resources/js/modules/xml-editor.ts +43 −10 Original line number Diff line number Diff line import { basicSetup } from "@codemirror/basic-setup"; import { indentWithTab } from "@codemirror/commands"; import { xml } from "@codemirror/lang-xml"; import { EditorState } from "@codemirror/state"; import { EditorView } from "@codemirror/view"; import { defaultHighlightStyle, syntaxHighlighting, } from "@codemirror/language"; import { Compartment, EditorState } from "@codemirror/state"; import { keymap } from "@codemirror/view"; import { basicSetup, EditorView } from "codemirror"; import { css, html, LitElement, TemplateResult } from "lit"; import { customElement, queryAssignedNodes, state } from "lit/decorators.js"; import prettifyXML from "xml-formatter"; const language = new Compartment(); @customElement("xml-editor") export class XMLEditor extends LitElement { @queryAssignedNodes("textarea", true) @queryAssignedNodes({ slot: "textarea" }) _textarea!: NodeListOf<HTMLTextAreaElement>; @state() Loading @@ -24,13 +31,39 @@ export class XMLEditor extends LitElement { }, }); this.editorState = EditorState.create({ doc: this._textarea[0].value ? prettifyXML(this._textarea[0].value, { let editorContents = ""; if (this._textarea[0].value) { try { editorContents = prettifyXML(this._textarea[0].value, { indentation: " ", }) : "", extensions: [basicSetup, xml(), minHeightEditor], }); } catch (e) { // xml doesn't have a root node editorContents = prettifyXML( "<root>" + this._textarea[0].value + "</root>", { indentation: " ", } ); // remove root, unnecessary lines and indents editorContents = editorContents .replace(/^<root>/, "") .replace(/<\/root>$/, "") .replace(/^\s*[\r\n]/gm, "") .replace(/[\r\n] {2}/gm, "\r\n") .trim(); } } this.editorState = EditorState.create({ doc: editorContents, extensions: [ basicSetup, keymap.of([indentWithTab]), language.of(xml()), minHeightEditor, syntaxHighlighting(defaultHighlightStyle), ], }); this.editorView = new EditorView({ Loading
docs/src/ar/index.md +2 −2 Original line number Diff line number Diff line Loading @@ -29,8 +29,8 @@ podcasters around the world! - 🌱 Free & open-source (AGPL v3 License) - 🔐 Focused on data sovereignty: your content, audience, and analytics belong to you, and you only - 🪄 Podcasting 2.0 features: GUID, locked, transcripts, funding, chapters, location, persons, soundbites, … - 🪄 Podcasting 2.0 features: GUID, locked, transcripts, funding, chapters, location, persons, soundbites, … - 💬 Built-in social network: - 🚀 Castopod is part of the Fediverse, a decentralized social network - ❤️ Create posts, share, favourite, and comment on episodes Loading
docs/src/br/index.md +2 −2 Original line number Diff line number Diff line Loading @@ -29,8 +29,8 @@ podcasters around the world! - 🌱 Free & open-source (AGPL v3 License) - 🔐 Focused on data sovereignty: your content, audience, and analytics belong to you, and you only - 🪄 Podcasting 2.0 features: GUID, locked, transcripts, funding, chapters, location, persons, soundbites, … - 🪄 Podcasting 2.0 features: GUID, locked, transcripts, funding, chapters, location, persons, soundbites, … - 💬 Built-in social network: - 🚀 Castopod is part of the Fediverse, a decentralized social network - ❤️ Create posts, share, favourite, and comment on episodes Loading
docs/src/de/index.md +2 −2 Original line number Diff line number Diff line Loading @@ -29,8 +29,8 @@ Podcastenden auf der ganzen Welt verwendet! - 🌱 Kostenlos & Open-Source (AGPL v3 Lizenz) - 🔐 Fokussiert auf die Datensouveränität: Ihre Inhalte, Ihr Publikum und Analysen gehören zu Ihnen, und nur Ihnen - 🪄 Podcasting 2.0 features: GUID, locked, transcripts, funding, chapters, location, persons, soundbites, … - 🪄 Podcasting 2.0 features: GUID, locked, transcripts, funding, chapters, location, persons, soundbites, … - 💬 Built-in social network: - 🚀 Castopod is part of the Fediverse, a decentralized social network - ❤️ Create posts, share, favourite, and comment on episodes Loading
docs/src/el/index.md +2 −2 Original line number Diff line number Diff line Loading @@ -29,8 +29,8 @@ podcasters around the world! - 🌱 Free & open-source (AGPL v3 License) - 🔐 Focused on data sovereignty: your content, audience, and analytics belong to you, and you only - 🪄 Podcasting 2.0 features: GUID, locked, transcripts, funding, chapters, location, persons, soundbites, … - 🪄 Podcasting 2.0 features: GUID, locked, transcripts, funding, chapters, location, persons, soundbites, … - 💬 Built-in social network: - 🚀 Castopod is part of the Fediverse, a decentralized social network - ❤️ Create posts, share, favourite, and comment on episodes Loading