feat(static-pages): rich text extensions + HTML-mode validation

Milestone 3 of the Static Pages Module sprint.

- MarketplaceHtmlEditorComponent toolbar: horizontal rule
  (insertHorizontalRule), code block (formatBlock -> PRE), embed (prompt for
  a URL, insert a sandboxed <iframe sandbox="allow-scripts allow-same-origin"
  loading="lazy">, same prompt-based UX as the existing link/image commands -
  no new dependency, consistent with the documented no-external-rich-text-
  library decision).
- toggleCode() now validates raw HTML via schema/validators/primitives'
  validateHtml (added in M1) before committing it back to the visual surface;
  on failure it stays in code mode with an inline error instead of silently
  writing malformed markup into the contenteditable surface. Error clears on
  the next edit.
- i18n: builder.promptEmbedUrl, builder.htmlEditorInvalidHtml in interface +
  en/ru/hy.

Gate: tsc --noEmit, npm test (57/57), arch:check, build all green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
sdarbinyan
2026-07-17 10:00:33 +04:00
parent cb3dff819e
commit bfee935798
7 changed files with 66 additions and 7 deletions

View File

@@ -551,6 +551,8 @@ export const en: Translations = {
confirmLeaveUnsaved: 'You have unsaved changes. Leave anyway?',
promptLinkUrl: 'URL',
promptImageUrl: 'Image URL',
promptEmbedUrl: 'Embed URL',
htmlEditorInvalidHtml: 'This HTML has an unclosed or mismatched tag. Fix it before switching back to the visual editor.',
htmlEditorCode: 'Code',
htmlEditorPreview: 'Preview',
lastSaved: 'Last saved',

View File

@@ -551,6 +551,8 @@ export const hy: Translations = {
confirmLeaveUnsaved: 'Կան չպահված փոփոխություններ։ Այնուամենայնիվ դուրս գա՞լ։',
promptLinkUrl: 'URL',
promptImageUrl: 'Նկարի URL',
promptEmbedUrl: 'Ներդրման URL',
htmlEditorInvalidHtml: 'Այս HTML-ը ունի չփակված կամ չհամընկնող թեգ։ Ուղղեք նախքան տեսողական խմբագրիչին վերադառնալը։',
htmlEditorCode: 'Կոդ',
htmlEditorPreview: 'Նախադիտում',
lastSaved: 'Վերջին պահպանումը',

View File

@@ -551,6 +551,8 @@ export const ru: Translations = {
confirmLeaveUnsaved: 'Есть несохранённые изменения. Всё равно уйти?',
promptLinkUrl: 'URL',
promptImageUrl: 'URL изображения',
promptEmbedUrl: 'URL для встраивания',
htmlEditorInvalidHtml: 'В этом HTML есть незакрытый или несовпадающий тег. Исправьте перед возвратом к визуальному редактору.',
htmlEditorCode: 'Код',
htmlEditorPreview: 'Предпросмотр',
lastSaved: 'Последнее сохранение',

View File

@@ -549,6 +549,8 @@ export interface Translations {
confirmLeaveUnsaved: string;
promptLinkUrl: string;
promptImageUrl: string;
promptEmbedUrl: string;
htmlEditorInvalidHtml: string;
htmlEditorCode: string;
htmlEditorPreview: string;
lastSaved: string;