diff --git a/src/lib/ae_elements/AE_MetadataFooter.svelte b/src/lib/ae_elements/AE_MetadataFooter_not_ref.svelte similarity index 100% rename from src/lib/ae_elements/AE_MetadataFooter.svelte rename to src/lib/ae_elements/AE_MetadataFooter_not_ref.svelte diff --git a/src/lib/ae_utils/ae_utils.ts b/src/lib/ae_utils/ae_utils.ts index b2f9964a..6f241ac4 100644 --- a/src/lib/ae_utils/ae_utils.ts +++ b/src/lib/ae_utils/ae_utils.ts @@ -16,6 +16,7 @@ import { to_title_case } from './ae_utils__to_title_case'; import { process_data_string } from './ae_utils__process_data_string'; import { set_obj_prop_display_name } from './ae_utils__set_obj_prop_display_name'; import { return_obj_type_path } from './ae_utils__return_obj_type_path'; +import { format_html } from './ae_utils__format_html'; import { combine_iv_and_base64, encrypt_content, @@ -336,6 +337,7 @@ export const ae_util = { shorten_string: shorten_string, shorten_filename: shorten_filename, file_extension_icon: file_extension_icon, + format_html: format_html, set_obj_prop_display_name: set_obj_prop_display_name, return_obj_type_path: return_obj_type_path, combine_iv_and_base64: combine_iv_and_base64, diff --git a/src/lib/ae_utils/ae_utils__format_html.ts b/src/lib/ae_utils/ae_utils__format_html.ts new file mode 100644 index 00000000..88435c95 --- /dev/null +++ b/src/lib/ae_utils/ae_utils__format_html.ts @@ -0,0 +1,21 @@ +/** + * Simple Regex-based HTML Formatter for Aether Platform. + * Adds newlines and indentation to raw HTML strings. + */ +export function format_html(html: string): string { + if (!html) return ''; + + let indent = 0; + const tab = ' '; + return html + .replace(/>\s*\n<') // Add newlines between tags + .split('\n') + .map(line => { + line = line.trim(); + if (line.match(/<\//)) indent--; // Decrease indent for closing tags + const out = tab.repeat(Math.max(0, indent)) + line; + if (line.match(/<[^\/!]/) && !line.match(/\/>/) && !line.match(/<\//)) indent++; // Increase indent for opening tags + return out; + }) + .join('\n'); +} diff --git a/src/lib/elements/AE_Comp_Editor_TipTap.svelte b/src/lib/elements/AE_Comp_Editor_TipTap.svelte new file mode 100644 index 00000000..be7d1d15 --- /dev/null +++ b/src/lib/elements/AE_Comp_Editor_TipTap.svelte @@ -0,0 +1,157 @@ + + +
+ {#if !readonly} +
+ + +
+ + +
+ + + + +
+ + Visual +
+
+ {/if} + +
+ {#if !content && !is_focused} +
+ {placeholder} +
+ {/if} + +
is_focused = true} + onblur={handle_blur} + onkeydown={handle_keydown} + role="textbox" + tabindex="0" + aria-multiline="true" + >
+
+
+ + diff --git a/src/routes/testing/editor_test/+page.svelte b/src/routes/testing/editor_test/+page.svelte new file mode 100644 index 00000000..b9404d63 --- /dev/null +++ b/src/routes/testing/editor_test/+page.svelte @@ -0,0 +1,51 @@ + + +
+
+

Rich Text Editor Test

+

Testing the Zero-Dependency "TipTap" replacement.

+
+ +
+ +
+

+ + Visual Editor (AE_Comp_Editor_TipTap) +

+
+ +
+
+ + +
+

+ + Source View (AE_Comp_Editor_CodeMirror) +

+
+ +
+
+
+ + +
+

Raw Bound Content (Saved to DB)

+
{test_content}
+
+