@jambotron/aria-markdown-editor 0.0.0-stage → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +100 -2
- package/fesm2022/jambotron-aria-markdown-editor.mjs +1122 -0
- package/fesm2022/jambotron-aria-markdown-editor.mjs.map +1 -0
- package/package.json +49 -3
- package/styles/aria-markdown-editor.scss +37 -0
- package/types/jambotron-aria-markdown-editor.d.ts +308 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jambotron-aria-markdown-editor.mjs","names":[],"sources":["../../../projects/aria-markdown-editor/src/lib/labels.ts","../../../projects/aria-markdown-editor/src/lib/config.ts","../../../projects/aria-markdown-editor/src/lib/math.ts","../../../projects/aria-markdown-editor/src/lib/commands.ts","../../../projects/aria-markdown-editor/src/lib/renderer.ts","../../../projects/aria-markdown-editor/src/lib/preview/jt-md-preview.component.ts","../../../projects/aria-markdown-editor/src/lib/editor/jt-md-editor.component.ts","../../../projects/aria-markdown-editor/src/lib/editor/jt-md-editor.component.html"],"sourcesContent":["import { InjectionToken, Provider } from '@angular/core';\n\n/** Every text the editor shows. English by default; an app passes its own with provideJtMdEditorLabels(). */\nexport interface JtMdEditorLabels {\n editor: string;\n toolbar: string;\n write: string;\n preview: string;\n heading: string;\n bold: string;\n italic: string;\n strike: string;\n code: string;\n link: string;\n quote: string;\n bullets: string;\n numbers: string;\n tasks: string;\n codeBlock: string;\n table: string;\n math: string;\n image: string;\n rule: string;\n /** Placeholders the toolbar inserts when nothing is selected */\n sampleText: string;\n sampleUrl: string;\n sampleImage: string;\n sampleCode: string;\n sampleFormula: string;\n sampleColumn: string;\n uploading: string;\n uploadFailed: string;\n emptyPreview: string;\n}\n\nexport const JT_MD_EDITOR_DEFAULT_LABELS: JtMdEditorLabels = {\n editor: 'Markdown',\n toolbar: 'Formatting',\n write: 'Write',\n preview: 'Preview',\n heading: 'Heading',\n bold: 'Bold',\n italic: 'Italic',\n strike: 'Strikethrough',\n code: 'Code',\n link: 'Link',\n quote: 'Quote',\n bullets: 'Bulleted list',\n numbers: 'Numbered list',\n tasks: 'Task list',\n codeBlock: 'Code block',\n table: 'Table',\n math: 'Formula',\n image: 'Image',\n rule: 'Horizontal line',\n sampleText: 'text',\n sampleUrl: 'https://',\n sampleImage: 'image',\n sampleCode: 'code',\n sampleFormula: 'x^2',\n sampleColumn: 'Column',\n uploading: 'Uploading',\n uploadFailed: 'Upload failed',\n emptyPreview: 'Nothing to preview'\n};\n\n/**\n * Labels of the editor. A function is read on every change detection, so it may follow the app's current language:\n * provideJtMdEditorLabels(() => ({ bold: translate('editor.bold'), ... })).\n */\nexport const JT_MD_EDITOR_LABELS = new InjectionToken<() => JtMdEditorLabels>('JT_MD_EDITOR_LABELS', {\n providedIn: 'root',\n factory: () => () => JT_MD_EDITOR_DEFAULT_LABELS\n});\n\nexport function provideJtMdEditorLabels(labels: Partial<JtMdEditorLabels> | (() => Partial<JtMdEditorLabels>)): Provider {\n const read = typeof labels === 'function' ? labels : () => labels;\n return { provide: JT_MD_EDITOR_LABELS, useValue: () => ({ ...JT_MD_EDITOR_DEFAULT_LABELS, ...read() }) };\n}\n","import { InjectionToken, Provider } from '@angular/core';\nimport type { MarkedExtension } from 'marked';\n\n/** The part of KaTeX the editor uses: `import('katex').then(m => m.default)` fits. */\nexport interface JtKatex {\n render(tex: string, element: HTMLElement, options: { displayMode: boolean; throwOnError: boolean }): void;\n}\n\nexport interface JtMarkdownConfig {\n /**\n * Loads KaTeX on the first formula: `() => import('katex').then(m => m.default)`. KaTeX stays out of the main\n * bundle — a lazy chunk. Without it formulas show as TeX source. The app adds KaTeX CSS (`katex/dist/katex.min.css`).\n */\n katex?: () => Promise<JtKatex>;\n /** Formulas `$…$` and `$$…$$`; on by default. */\n math?: boolean;\n /** Single line breaks become <br> (GitHub comments style); off by default — as in documents. */\n breaks?: boolean;\n /** Extra marked extensions (after the built-in ones). */\n extensions?: MarkedExtension[];\n}\n\nexport const JT_MARKDOWN_CONFIG = new InjectionToken<JtMarkdownConfig>('JT_MARKDOWN_CONFIG', {\n providedIn: 'root',\n factory: () => ({})\n});\n\n/** provideJtMarkdown({ katex: () => import('katex').then(m => m.default) }) — in app.config.ts providers. */\nexport function provideJtMarkdown(config: JtMarkdownConfig): Provider {\n return { provide: JT_MARKDOWN_CONFIG, useValue: config };\n}\n","import type { MarkedExtension, Tokens } from 'marked';\nimport type { JtKatex } from './config';\n\nconst MATH = 'jt-math';\nconst DISPLAY = 'jt-math--display';\n\nfunction escapeHtml(text: string): string {\n return text.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');\n}\n\n// Parsing rules from marked-katex-extension 5.1.13 (MIT, © 2021 @markedjs). The package itself is not used:\n// it imports KaTeX statically, and KaTeX (≈350 KB) would land in every page's bundle.\nconst INLINE_RULE = /^(\\${1,2})(?!\\$)((?:\\\\.|[^\\\\\\n])*?(?:\\\\.|[^\\\\\\n$]))\\1(?=[\\s?!.,:?!。,:]|$)/;\nconst BLOCK_RULE = /^(\\${1,2})\\n((?:\\\\[^]|[^\\\\])+?)\\n\\1(?:\\n|$)/;\n\nfunction placeholder(token: Tokens.Generic): string {\n const display = token['displayMode'] === true;\n return `<span class=\"${MATH}${display ? ' ' + DISPLAY : ''}\">${escapeHtml(String(token['text'] ?? ''))}</span>`;\n}\n\nfunction mathToken(type: string, match: RegExpMatchArray): Tokens.Generic {\n return { type, raw: match[0], text: match[2].trim(), displayMode: match[1].length === 2 };\n}\n\n/**\n * Formulas `$…$` and `$$…$$`. Parsed with the rules of marked-katex-extension (so marked keeps `_` and `*` inside\n * a formula), but the HTML gets the TeX source in <span class=\"jt-math\">, not KaTeX markup: Angular's sanitizer drops\n * `style`, and KaTeX fractions and roots fall apart. renderMath() draws KaTeX into the DOM after the sanitizer.\n */\nexport function markdownMathExtension(): MarkedExtension {\n return {\n extensions: [\n {\n name: 'inlineKatex',\n level: 'inline',\n start(src: string) {\n let rest = src;\n let offset = 0;\n while (rest) {\n const index = rest.indexOf('$');\n if (index === -1) {\n return undefined;\n }\n if ((index === 0 || rest.charAt(index - 1) === ' ') && INLINE_RULE.test(rest.substring(index))) {\n return offset + index;\n }\n const next = rest.substring(index + 1);\n const skipped = next.length - next.replace(/^\\$+/, '').length;\n offset += index + 1 + skipped;\n rest = next.substring(skipped);\n }\n return undefined;\n },\n tokenizer(src: string) {\n const match = src.match(INLINE_RULE);\n return match ? mathToken('inlineKatex', match) : undefined;\n },\n renderer: (token: Tokens.Generic) => placeholder(token)\n },\n {\n name: 'blockKatex',\n level: 'block',\n tokenizer(src: string) {\n const match = src.match(BLOCK_RULE);\n return match ? mathToken('blockKatex', match) : undefined;\n },\n renderer: (token: Tokens.Generic) => `<p>${placeholder(token)}</p>\\n`\n }\n ]\n } as MarkedExtension;\n}\n\n/**\n * Draws KaTeX into the formula placeholders inside the element; a broken formula shows red, the page stays.\n * Without a loader formulas stay as TeX source. Browser only (KaTeX needs `document`).\n */\nexport async function renderMath(element: HTMLElement, katex?: () => Promise<JtKatex>): Promise<void> {\n const spans = Array.from(element.querySelectorAll<HTMLElement>(`span.${MATH}`));\n if (spans.length === 0 || !katex) {\n return;\n }\n const engine = await katex();\n spans.forEach(span => {\n if (!span.isConnected || !span.classList.contains(MATH)) {\n return;\n }\n const tex = span.textContent ?? '';\n const displayMode = span.classList.contains(DISPLAY);\n span.classList.remove(MATH);\n span.classList.add('jt-math-rendered');\n engine.render(tex, span, { displayMode, throwOnError: false });\n });\n}\n","/**\n * Text commands of the editor — pure functions over (text, selection), no DOM: easy to test and to reuse\n * (e.g. a plain <textarea> elsewhere). Each returns one edit: replace [from, to) with `insert`, then select\n * [selectionStart, selectionEnd) in the new text.\n */\nexport interface JtMdState {\n text: string;\n start: number;\n end: number;\n}\n\nexport interface JtMdEdit {\n from: number;\n to: number;\n insert: string;\n selectionStart: number;\n selectionEnd: number;\n}\n\n/** Applies an edit to the text (what the textarea will contain after it). */\nexport function applyEdit(text: string, edit: JtMdEdit): string {\n return text.slice(0, edit.from) + edit.insert + text.slice(edit.to);\n}\n\n/**\n * **bold**, _italic_, `code`, ~~strike~~, $formula$: wraps the selection; an already wrapped selection is unwrapped;\n * nothing selected — inserts the placeholder and selects it.\n */\nexport function toggleWrap(state: JtMdState, before: string, after = before, placeholder = ''): JtMdEdit {\n const { text, start, end } = state;\n const selected = text.slice(start, end);\n // Markers outside the selection: **|text|**\n if (text.slice(start - before.length, start) === before && text.slice(end, end + after.length) === after) {\n return { from: start - before.length, to: end + after.length, insert: selected,\n selectionStart: start - before.length, selectionEnd: end - before.length };\n }\n // Markers inside the selection: |**text**|\n if (selected.length >= before.length + after.length && selected.startsWith(before) && selected.endsWith(after)) {\n const inner = selected.slice(before.length, selected.length - after.length);\n return { from: start, to: end, insert: inner, selectionStart: start, selectionEnd: start + inner.length };\n }\n const inner = selected || placeholder;\n return { from: start, to: end, insert: before + inner + after,\n selectionStart: start + before.length, selectionEnd: start + before.length + inner.length };\n}\n\n/** Start and end of the whole lines the selection touches. */\nfunction lineRange(text: string, start: number, end: number): { from: number; to: number } {\n const from = text.lastIndexOf('\\n', start - 1) + 1;\n // A selection that ends right after a line break does not take the next line\n const last = end > start && text.charAt(end - 1) === '\\n' ? end - 1 : end;\n const next = text.indexOf('\\n', last);\n return { from, to: next === -1 ? text.length : next };\n}\n\nexport type JtMdLineKind = 'quote' | 'bullets' | 'numbers' | 'tasks';\n\nconst LINE_MARKERS: Record<JtMdLineKind, RegExp> = {\n quote: /^(\\s*)> ?/,\n bullets: /^(\\s*)[-*+] (?!\\[[ xX]\\] )/,\n numbers: /^(\\s*)\\d+[.)] /,\n tasks: /^(\\s*)[-*+] \\[[ xX]\\] /\n};\n\n// Any list or quote marker — replaced when the line switches to another kind\nconst ANY_MARKER = /^(\\s*)(?:> ?|[-*+] \\[[ xX]\\] |[-*+] |\\d+[.)] )/;\n\nfunction marker(kind: JtMdLineKind, index: number): string {\n switch (kind) {\n case 'quote': return '> ';\n case 'bullets': return '- ';\n case 'numbers': return `${index + 1}. `;\n case 'tasks': return '- [ ] ';\n }\n}\n\n/**\n * Quote / bulleted / numbered / task list on every selected line. All lines already of that kind — markers are\n * removed; otherwise each line gets the marker (a marker of another kind is replaced). Empty lines are kept as they are.\n */\nexport function toggleLines(state: JtMdState, kind: JtMdLineKind): JtMdEdit {\n const { from, to } = lineRange(state.text, state.start, state.end);\n const lines = state.text.slice(from, to).split('\\n');\n const filled = lines.filter(line => line.trim() !== '');\n const remove = filled.length > 0 && filled.every(line => LINE_MARKERS[kind].test(line));\n let index = 0;\n const changed = lines.map(line => {\n if (remove) {\n return line.replace(LINE_MARKERS[kind], '$1');\n }\n if (line.trim() === '' && lines.length > 1) {\n return line;\n }\n const match = line.match(ANY_MARKER);\n const indent = match ? match[1] : (line.match(/^\\s*/)?.[0] ?? '');\n const rest = match ? line.slice(match[0].length) : line.slice(indent.length);\n return indent + marker(kind, index++) + rest;\n });\n const insert = changed.join('\\n');\n // One empty line: caret after the marker; otherwise — the whole block selected\n if (lines.length === 1 && state.start === state.end) {\n const shift = insert.length - lines[0].length;\n const caret = Math.max(from, state.start + shift);\n return { from, to, insert, selectionStart: caret, selectionEnd: caret };\n }\n return { from, to, insert, selectionStart: from, selectionEnd: from + insert.length };\n}\n\n/** Heading of the current line: none → # → ## → ### → none. */\nexport function cycleHeading(state: JtMdState): JtMdEdit {\n const { from, to } = lineRange(state.text, state.start, state.start);\n const line = state.text.slice(from, to);\n const match = line.match(/^(#{1,6}) /);\n const level = match ? match[1].length : 0;\n const content = match ? line.slice(match[0].length) : line;\n const prefix = level >= 3 ? '' : '#'.repeat(level + 1) + ' ';\n const insert = prefix + content;\n const caret = Math.max(from + prefix.length, state.start + insert.length - line.length);\n return { from, to, insert, selectionStart: caret, selectionEnd: caret };\n}\n\nconst URL_LIKE = /^(https?:\\/\\/|mailto:|\\/)\\S*$/;\n\n/** [text](url): selected text → the url is selected; a selected URL → the text is selected. */\nexport function insertLink(state: JtMdState, sampleText: string, sampleUrl: string): JtMdEdit {\n const selected = state.text.slice(state.start, state.end);\n if (URL_LIKE.test(selected)) {\n const insert = `[${sampleText}](${selected})`;\n return { from: state.start, to: state.end, insert, selectionStart: state.start + 1, selectionEnd: state.start + 1 + sampleText.length };\n }\n const label = selected || sampleText;\n const insert = `[${label}](${sampleUrl})`;\n const urlStart = state.start + label.length + 3;\n return { from: state.start, to: state.end, insert,\n selectionStart: selected ? urlStart : state.start + 1,\n selectionEnd: selected ? urlStart + sampleUrl.length : state.start + 1 + label.length };\n}\n\n/** Line break(s) needed so that `insert` at [start, end) stands as its own block. */\nfunction blockPadding(text: string, start: number, end: number): { before: string; after: string } {\n const head = text.slice(0, start);\n const tail = text.slice(end);\n const before = head === '' || head.endsWith('\\n\\n') ? '' : head.endsWith('\\n') ? '\\n' : '\\n\\n';\n const after = tail === '' || tail.startsWith('\\n\\n') ? '' : tail.startsWith('\\n') ? '\\n' : '\\n\\n';\n return { before, after };\n}\n\n/** A block (code, table, image, line, formula) on its own lines; `select` — a part of the block to select. */\nexport function insertBlock(state: JtMdState, block: string, select?: { start: number; end: number }): JtMdEdit {\n const { before, after } = blockPadding(state.text, state.start, state.end);\n const insert = before + block + after;\n const base = state.start + before.length;\n const selectionStart = select ? base + select.start : base + block.length;\n const selectionEnd = select ? base + select.end : selectionStart;\n return { from: state.start, to: state.end, insert, selectionStart, selectionEnd };\n}\n\n/** ``` fenced code: the selection goes inside; nothing selected — the placeholder, selected. */\nexport function insertCodeBlock(state: JtMdState, placeholder: string): JtMdEdit {\n const code = state.text.slice(state.start, state.end).replace(/\\n$/, '') || placeholder;\n return insertBlock(state, '```\\n' + code + '\\n```', { start: 4, end: 4 + code.length });\n}\n\n/** $$ display formula when the selection spans lines, $inline$ otherwise. */\nexport function insertMath(state: JtMdState, placeholder: string): JtMdEdit {\n const selected = state.text.slice(state.start, state.end);\n if (selected.includes('\\n')) {\n const tex = selected.replace(/\\n$/, '');\n return insertBlock(state, '$$\\n' + tex + '\\n$$', { start: 3, end: 3 + tex.length });\n }\n return toggleWrap(state, '$', '$', placeholder);\n}\n\n/** Table 2 × 2 with the first header cell selected. */\nexport function insertTable(state: JtMdState, column: string): JtMdEdit {\n const header = `| ${column} 1 | ${column} 2 |`;\n const block = `${header}\\n| --- | --- |\\n| | |\\n| | |`;\n return insertBlock(state, block, { start: 2, end: 2 + column.length + 2 });\n}\n\n/** Horizontal line. */\nexport function insertRule(state: JtMdState): JtMdEdit {\n return insertBlock(state, '---');\n}\n\n/**  as its own block; `alt` is selected — to be described. */\nexport function insertImage(state: JtMdState, url: string, alt: string): JtMdEdit {\n return insertBlock(state, ``, { start: 2, end: 2 + alt.length });\n}\n\n/**\n * Enter inside a list: the next item gets the same marker (numbers +1, tasks unchecked); Enter on an empty item ends\n * the list (removes the marker). null — not a list, a selection or the caret before the marker: the textarea's own Enter.\n */\nexport function continueList(state: JtMdState): JtMdEdit | null {\n if (state.start !== state.end) {\n return null;\n }\n const from = state.text.lastIndexOf('\\n', state.start - 1) + 1;\n const lineEnd = state.text.indexOf('\\n', state.start);\n const line = state.text.slice(from, lineEnd === -1 ? state.text.length : lineEnd);\n const match = line.match(/^(\\s*)(?:([-*+]) \\[[ xX]\\] |([-*+]) |(\\d+)([.)]) |> ?)/);\n if (!match || state.start - from < match[0].length) {\n return null;\n }\n if (line.slice(match[0].length).trim() === '' && state.start === from + line.length) {\n // Empty item → end of the list\n return { from, to: from + line.length, insert: '', selectionStart: from, selectionEnd: from };\n }\n const [, indent, taskBullet, bullet, number, delimiter] = match;\n const next = taskBullet ? `${taskBullet} [ ] `\n : bullet ? `${bullet} `\n : number ? `${Number(number) + 1}${delimiter} `\n : '> ';\n const insert = '\\n' + indent + next;\n const caret = state.start + insert.length;\n return { from: state.start, to: state.end, insert, selectionStart: caret, selectionEnd: caret };\n}\n\n/**\n * The marker typed by hand right after the one Enter added: «2. » + «2.» → «2.», «- » + «- » → «- ». The caret must\n * stand right after the typed marker; `key` — the key being pressed ('.', ')' or ' '). null — nothing to merge.\n */\nexport function mergeTypedMarker(state: JtMdState, key: string): JtMdEdit | null {\n if (state.start !== state.end) {\n return null;\n }\n const from = state.text.lastIndexOf('\\n', state.start - 1) + 1;\n const head = state.text.slice(from, state.start);\n let match: RegExpMatchArray | null = null;\n if (key === '.' || key === ')') {\n match = head.match(/^(\\s*)\\d+[.)] (\\d{1,3})$/);\n } else if (key === ' ') {\n match = head.match(/^(\\s*)[-*+] ([-*+])$/);\n }\n if (!match) {\n return null;\n }\n const [, indent, typed] = match;\n const insert = indent + typed + key;\n const caret = from + insert.length;\n return { from, to: state.start, insert, selectionStart: caret, selectionEnd: caret };\n}\n","import { inject, Injectable } from '@angular/core';\nimport { Marked, type MarkedExtension } from 'marked';\nimport { JT_MARKDOWN_CONFIG } from './config';\nimport { markdownMathExtension } from './math';\n\n/**\n * Task list items without <input>: Angular's sanitizer removes inputs, and a checkbox in a preview is not clickable\n * anyway — a glyph with role=\"img\" says the same.\n */\nfunction taskExtension(): MarkedExtension {\n return {\n renderer: {\n checkbox({ checked }) {\n return `<span class=\"jt-md-task${checked ? ' jt-md-task--done' : ''}\" role=\"img\" aria-label=\"${checked ? '[x]' : '[ ]'}\">${checked ? '☑' : '☐'}</span> `;\n }\n }\n };\n}\n\n/** Markdown → HTML (not sanitized yet — bind it with [innerHTML], Angular sanitizes). One per app. */\n@Injectable({ providedIn: 'root' })\nexport class JtMarkdownRenderer {\n private readonly config = inject(JT_MARKDOWN_CONFIG);\n private readonly marked = new Marked(\n { gfm: true, breaks: this.config.breaks ?? false },\n taskExtension(),\n ...(this.config.math === false ? [] : [markdownMathExtension()]),\n ...(this.config.extensions ?? [])\n );\n\n render(markdown: string): string {\n return this.marked.parse(markdown ?? '', { async: false });\n }\n}\n","import {\n afterRenderEffect, ChangeDetectionStrategy, Component, computed, ElementRef, inject, input, PLATFORM_ID,\n ViewEncapsulation\n} from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\nimport { JT_MARKDOWN_CONFIG } from '../config';\nimport { renderMath } from '../math';\nimport { JtMarkdownRenderer } from '../renderer';\n\n/**\n * Rendered Markdown: GFM, tables, task lists, formulas (KaTeX, lazy). The HTML goes through Angular's sanitizer.\n * Works in SSR (formulas are drawn by the browser after hydration).\n *\n * <jt-md-preview [markdown]=\"article.body\" />\n */\n@Component({\n selector: 'jt-md-preview',\n template: '',\n styleUrl: './jt-md-preview.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {\n 'class': 'jt-md-preview',\n '[innerHTML]': 'html()'\n }\n})\nexport class JtMdPreviewComponent {\n private readonly element = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly renderer = inject(JtMarkdownRenderer);\n private readonly config = inject(JT_MARKDOWN_CONFIG);\n private readonly browser = isPlatformBrowser(inject(PLATFORM_ID));\n\n readonly markdown = input<string | null | undefined>('');\n\n protected readonly html = computed(() => this.renderer.render(this.markdown() ?? ''));\n\n constructor() {\n afterRenderEffect(() => {\n this.html();\n if (this.browser) {\n void renderMath(this.element.nativeElement, this.config.katex);\n }\n });\n }\n}\n","import {\n afterNextRender, ChangeDetectionStrategy, Component, computed, DestroyRef, ElementRef, forwardRef, inject, input,\n model, signal, viewChild\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { Tab, TabContent, TabList, TabPanel, Tabs } from '@angular/aria/tabs';\nimport { Toolbar, ToolbarWidget, ToolbarWidgetGroup } from '@angular/aria/toolbar';\nimport { NgTemplateOutlet } from '@angular/common';\nimport {\n applyEdit, continueList, cycleHeading, insertCodeBlock, insertImage, insertLink, insertMath, insertRule, insertTable,\n JtMdEdit, JtMdState, mergeTypedMarker, toggleLines, toggleWrap\n} from '../commands';\nimport { JT_MD_EDITOR_LABELS, JtMdEditorLabels } from '../labels';\nimport { JtMdPreviewComponent } from '../preview/jt-md-preview.component';\nimport { JtIconComponent } from '@jambotron/aria-components';\n\n/** A toolbar button; '|' — a separator between groups. */\nexport type JtMdTool =\n | 'heading' | 'bold' | 'italic' | 'strike' | 'code' | 'link'\n | 'quote' | 'bullets' | 'numbers' | 'tasks'\n | 'codeBlock' | 'table' | 'math' | 'image' | 'rule'\n | '|';\n\nexport const JT_MD_DEFAULT_TOOLS: JtMdTool[] = [\n 'heading', 'bold', 'italic', 'strike', '|',\n 'link', 'image', 'code', 'codeBlock', '|',\n 'quote', 'bullets', 'numbers', 'tasks', '|',\n 'table', 'math', 'rule'\n];\n\n/** An image for the text: `url` goes into . */\nexport interface JtMdImage {\n url: string;\n alt?: string;\n}\n\n/** Split — source and preview side by side; tabs — Write / Preview (phones); auto — tabs when narrower than 720px. */\nexport type JtMdLayout = 'auto' | 'split' | 'tabs';\n\ntype ToolName = Exclude<JtMdTool, '|'>;\n\nconst HOTKEYS: Record<string, ToolName> = { b: 'bold', i: 'italic', k: 'link', e: 'code' };\nconst HOTKEY_HINT: Partial<Record<ToolName, string>> = { bold: 'B', italic: 'I', link: 'K', code: 'E' };\nconst NARROW = 720;\n\n/** Toolbar button → icon of @jambotron/aria-components */\nconst ICONS: Record<ToolName, string> = {\n heading: 'title', bold: 'format_bold', italic: 'format_italic', strike: 'format_strikethrough', code: 'code',\n link: 'link', quote: 'format_quote', bullets: 'format_list_bulleted', numbers: 'format_list_numbered',\n tasks: 'checklist', codeBlock: 'code_blocks', table: 'table', math: 'functions', image: 'image', rule: 'horizontal_rule'\n};\n\n/**\n * Markdown editor on Angular Aria: source and preview side by side, a toolbar (`ngToolbar`, arrow keys inside),\n * Write / Preview tabs (`ngTabs`) on narrow screens, formulas, image paste / drop / upload, hotkeys (Ctrl/⌘ + B, I,\n * K, E), Enter continues lists (a marker typed again is merged), the preview scrolls with the text. The value — model() and a ControlValueAccessor: [(value)], [formField] (Signal\n * Forms), formControl, ngModel.\n *\n * <jt-md-editor [(value)]=\"body\" [uploadImage]=\"upload\" />\n */\n@Component({\n selector: 'jt-md-editor',\n imports: [NgTemplateOutlet, Tabs, TabList, Tab, TabPanel, TabContent, Toolbar, ToolbarWidget, ToolbarWidgetGroup, JtMdPreviewComponent,\n JtIconComponent],\n templateUrl: './jt-md-editor.component.html',\n styleUrl: './jt-md-editor.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => JtMdEditorComponent), multi: true }],\n host: {\n 'class': 'jt-md-editor',\n '[class.jt-md-editor--tabs]': 'tabbed()',\n '[class.jt-md-editor--disabled]': 'isDisabled()',\n '[class.jt-md-editor--dragging]': 'dragging()'\n }\n})\nexport class JtMdEditorComponent implements ControlValueAccessor {\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly readLabels = inject(JT_MD_EDITOR_LABELS);\n private readonly destroyRef = inject(DestroyRef);\n\n readonly value = model('');\n readonly placeholder = input('');\n readonly disabled = input(false);\n readonly readonly = input(false);\n /** aria-label of the text area; default — labels.editor */\n readonly label = input('');\n readonly tools = input<JtMdTool[]>(JT_MD_DEFAULT_TOOLS);\n readonly layout = input<JtMdLayout>('auto');\n /** Uploads a pasted / dropped / chosen image file and returns its address. Without it files are not accepted. */\n readonly uploadImage = input<((file: File) => Promise<JtMdImage | string>) | null>(null);\n /** The image button opens the app's own picker (e.g. a gallery dialog); null — cancelled. */\n readonly pickImage = input<(() => Promise<JtMdImage | null>) | null>(null);\n\n protected readonly labels = computed<JtMdEditorLabels>(() => this.readLabels());\n protected readonly textarea = viewChild<ElementRef<HTMLTextAreaElement>>('textarea');\n protected readonly fileInput = viewChild<ElementRef<HTMLInputElement>>('file');\n\n private readonly formDisabled = signal(false);\n protected readonly isDisabled = computed(() => this.disabled() || this.formDisabled());\n protected readonly locked = computed(() => this.isDisabled() || this.readonly());\n\n private readonly width = signal(Number.POSITIVE_INFINITY);\n protected readonly tabbed = computed(() => this.layout() === 'tabs' || (this.layout() === 'auto' && this.width() < NARROW));\n protected readonly tab = signal<string | undefined>('write');\n protected readonly dragging = signal(false);\n protected readonly uploads = signal(0);\n protected readonly error = signal('');\n\n protected readonly groups = computed<ToolName[][]>(() => {\n const groups: ToolName[][] = [[]];\n for (const tool of this.tools()) {\n if (tool === '|') {\n groups.push([]);\n } else {\n groups[groups.length - 1].push(tool);\n }\n }\n return groups.filter(group => group.length > 0);\n });\n\n private onChange: (value: string) => void = () => {};\n private onTouched: () => void = () => {};\n\n constructor() {\n afterNextRender(() => {\n if (typeof ResizeObserver === 'undefined') {\n return;\n }\n const observer = new ResizeObserver(entries => this.width.set(entries[0].contentRect.width));\n observer.observe(this.host.nativeElement);\n this.destroyRef.onDestroy(() => observer.disconnect());\n });\n }\n\n // ControlValueAccessor\n writeValue(value: string | null | undefined): void {\n this.value.set(value ?? '');\n }\n\n registerOnChange(fn: (value: string) => void): void {\n this.onChange = fn;\n }\n\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n setDisabledState(disabled: boolean): void {\n this.formDisabled.set(disabled);\n }\n\n protected icon(tool: ToolName): string {\n return ICONS[tool];\n }\n\n protected title(tool: ToolName): string {\n const key = HOTKEY_HINT[tool];\n const mac = typeof navigator !== 'undefined' && /Mac|iPhone|iPad/.test(navigator.platform ?? '');\n return this.labels()[tool] + (key ? ` (${mac ? '⌘' : 'Ctrl+'}${key})` : '');\n }\n\n protected onInput(event: Event): void {\n this.commit((event.target as HTMLTextAreaElement).value);\n }\n\n protected onBlur(): void {\n this.onTouched();\n }\n\n protected onKeydown(event: KeyboardEvent): void {\n if (this.locked() || event.isComposing) {\n return;\n }\n const mod = event.ctrlKey || event.metaKey;\n if (mod && !event.altKey && !event.shiftKey) {\n const tool = HOTKEYS[event.key.toLowerCase()];\n if (tool) {\n event.preventDefault();\n this.run(tool);\n }\n return;\n }\n if (event.key === 'Enter' && !mod && !event.shiftKey && !event.altKey) {\n const edit = continueList(this.state());\n if (edit) {\n event.preventDefault();\n this.apply(edit);\n }\n return;\n }\n // Enter added «2. », the author types «2.» too — one marker, not «2. 2.»\n if ((event.key === '.' || event.key === ')' || event.key === ' ') && !mod && !event.altKey) {\n const edit = mergeTypedMarker(this.state(), event.key);\n if (edit) {\n event.preventDefault();\n this.apply(edit);\n }\n }\n }\n\n /** Side by side: the preview follows the text — the same share of its height scrolled. */\n protected onScroll(event: Event): void {\n if (this.tabbed()) {\n return;\n }\n const source = event.target as HTMLTextAreaElement;\n const preview = this.host.nativeElement.querySelector<HTMLElement>('.jt-md-editor__preview');\n const range = source.scrollHeight - source.clientHeight;\n if (!preview || range <= 0) {\n return;\n }\n preview.scrollTop = (source.scrollTop / range) * (preview.scrollHeight - preview.clientHeight);\n }\n\n /** A toolbar button or a hotkey. */\n run(tool: ToolName): void {\n if (this.locked()) {\n return;\n }\n const labels = this.labels();\n const state = this.state();\n switch (tool) {\n case 'heading': return this.apply(cycleHeading(state));\n case 'bold': return this.apply(toggleWrap(state, '**', '**', labels.sampleText));\n case 'italic': return this.apply(toggleWrap(state, '_', '_', labels.sampleText));\n case 'strike': return this.apply(toggleWrap(state, '~~', '~~', labels.sampleText));\n case 'code': return this.apply(toggleWrap(state, '`', '`', labels.sampleCode));\n case 'link': return this.apply(insertLink(state, labels.sampleText, labels.sampleUrl));\n case 'quote':\n case 'bullets':\n case 'numbers':\n case 'tasks': return this.apply(toggleLines(state, tool));\n case 'codeBlock': return this.apply(insertCodeBlock(state, labels.sampleCode));\n case 'table': return this.apply(insertTable(state, labels.sampleColumn));\n case 'math': return this.apply(insertMath(state, labels.sampleFormula));\n case 'rule': return this.apply(insertRule(state));\n case 'image': return void this.chooseImage();\n }\n }\n\n private async chooseImage(): Promise<void> {\n const pick = this.pickImage();\n if (pick) {\n const image = await pick();\n if (image) {\n this.apply(insertImage(this.state(), image.url, image.alt ?? this.labels().sampleImage));\n }\n return;\n }\n if (this.uploadImage()) {\n this.fileInput()?.nativeElement.click();\n return;\n }\n // No picker, no upload: a template to fill in, the address selected\n const alt = this.labels().sampleImage;\n const url = this.labels().sampleUrl;\n const edit = insertImage(this.state(), url, alt);\n const urlStart = edit.selectionStart + alt.length + 2;\n this.apply({ ...edit, selectionStart: urlStart, selectionEnd: urlStart + url.length });\n }\n\n protected onFileChosen(event: Event): void {\n const input = event.target as HTMLInputElement;\n const files = Array.from(input.files ?? []);\n input.value = '';\n void this.uploadFiles(files);\n }\n\n protected onPaste(event: ClipboardEvent): void {\n const files = this.imageFiles(event.clipboardData);\n if (files.length && this.uploadImage() && !this.locked()) {\n event.preventDefault();\n void this.uploadFiles(files);\n }\n }\n\n protected onDragOver(event: DragEvent): void {\n if (this.uploadImage() && !this.locked() && Array.from(event.dataTransfer?.types ?? []).includes('Files')) {\n event.preventDefault();\n this.dragging.set(true);\n }\n }\n\n protected onDragLeave(): void {\n this.dragging.set(false);\n }\n\n protected onDrop(event: DragEvent): void {\n this.dragging.set(false);\n const files = this.imageFiles(event.dataTransfer);\n if (files.length && this.uploadImage() && !this.locked()) {\n event.preventDefault();\n void this.uploadFiles(files);\n }\n }\n\n private imageFiles(data: DataTransfer | null): File[] {\n return Array.from(data?.files ?? []).filter(file => file.type.startsWith('image/'));\n }\n\n /**\n * Each file: a placeholder ![Uploading name…]() at the caret at once, replaced with the image when the upload is\n * done (the user keeps typing meanwhile); a failed upload removes the placeholder and shows the error.\n */\n private async uploadFiles(files: File[]): Promise<void> {\n const upload = this.uploadImage();\n if (!upload) {\n return;\n }\n this.error.set('');\n for (const file of files) {\n const marker = `![${this.labels().uploading} ${file.name}…]()`;\n this.apply(insertImage(this.state(), '', `${this.labels().uploading} ${file.name}…`));\n this.uploads.update(count => count + 1);\n try {\n const result = await upload(file);\n const image = typeof result === 'string' ? { url: result } : result;\n this.replaceMarker(marker, `![${image.alt ?? file.name.replace(/\\.[^.]+$/, '')}](${image.url})`);\n } catch {\n this.replaceMarker(marker, '');\n this.error.set(`${this.labels().uploadFailed}: ${file.name}`);\n } finally {\n this.uploads.update(count => count - 1);\n }\n }\n }\n\n private replaceMarker(marker: string, insert: string): void {\n const text = this.value();\n const from = text.indexOf(marker);\n if (from === -1) {\n return;\n }\n const to = from + marker.length;\n const element = this.textarea()?.nativeElement;\n const caret = element ? element.selectionStart : text.length;\n const shift = insert.length - marker.length;\n const next = caret >= to ? caret + shift : caret > from ? from + insert.length : caret;\n this.apply({ from, to, insert, selectionStart: next, selectionEnd: next }, false);\n }\n\n private state(): JtMdState {\n const element = this.textarea()?.nativeElement;\n const text = this.value();\n if (!element) {\n return { text, start: text.length, end: text.length };\n }\n return { text, start: element.selectionStart, end: element.selectionEnd };\n }\n\n /**\n * Applies an edit in the textarea. execCommand('insertText') keeps the browser's undo (Ctrl+Z) working; where it is\n * missing (tests, old browsers) — setRangeText.\n */\n private apply(edit: JtMdEdit, focus = true): void {\n const expected = applyEdit(this.value(), edit);\n const element = this.textarea()?.nativeElement;\n if (!element) {\n this.commit(expected);\n return;\n }\n if (focus) {\n element.focus();\n }\n element.setSelectionRange(edit.from, edit.to);\n let done = false;\n if (focus && typeof document !== 'undefined' && typeof document.execCommand === 'function') {\n try {\n done = edit.insert === '' && edit.from === edit.to ? true\n : document.execCommand(edit.insert === '' ? 'delete' : 'insertText', false, edit.insert);\n } catch {\n done = false;\n }\n }\n if (!done || element.value !== expected) {\n element.value = expected;\n }\n element.setSelectionRange(edit.selectionStart, edit.selectionEnd);\n this.commit(expected);\n }\n\n private commit(text: string): void {\n if (text === this.value()) {\n return;\n }\n this.value.set(text);\n this.onChange(text);\n }\n\n /** Focus the text area (e.g. after the form opens). */\n focus(): void {\n this.textarea()?.nativeElement.focus();\n }\n}\n","@if (tabbed()) {\n <div ngTabs class=\"jt-md-editor__tabs\">\n <ul ngTabList class=\"jt-md-editor__tablist\" [(selectedTab)]=\"tab\">\n <li ngTab class=\"jt-md-editor__tab\" value=\"write\">{{ labels().write }}</li>\n <li ngTab class=\"jt-md-editor__tab\" value=\"preview\">{{ labels().preview }}</li>\n </ul>\n <div ngTabPanel class=\"jt-md-editor__panel\" value=\"write\">\n <ng-template ngTabContent>\n <ng-container [ngTemplateOutlet]=\"source\" />\n </ng-template>\n </div>\n <div ngTabPanel class=\"jt-md-editor__panel\" value=\"preview\">\n <ng-template ngTabContent>\n <ng-container [ngTemplateOutlet]=\"preview\" />\n </ng-template>\n </div>\n </div>\n} @else {\n <div class=\"jt-md-editor__split\">\n <ng-container [ngTemplateOutlet]=\"source\" />\n <ng-container [ngTemplateOutlet]=\"preview\" />\n </div>\n}\n\n<ng-template #source>\n <div class=\"jt-md-editor__source\">\n @if (!readonly()) {\n <div ngToolbar class=\"jt-md-editor__toolbar\" [wrap]=\"true\" [disabled]=\"isDisabled()\" [attr.aria-label]=\"labels().toolbar\">\n @for (group of groups(); track $index) {\n <div ngToolbarWidgetGroup class=\"jt-md-editor__group\" role=\"group\">\n @for (tool of group; track tool) {\n <button ngToolbarWidget type=\"button\" class=\"jt-md-editor__button\" [attr.data-tool]=\"tool\"\n [attr.aria-label]=\"labels()[tool]\" [title]=\"title(tool)\"\n (mousedown)=\"$event.preventDefault()\" (click)=\"run(tool)\">\n <jt-icon [name]=\"icon(tool)\" [size]=\"18\" />\n </button>\n }\n </div>\n }\n @if (uploads()) {\n <span class=\"jt-md-editor__status\" role=\"status\">{{ labels().uploading }}…</span>\n }\n </div>\n }\n <textarea #textarea class=\"jt-md-editor__textarea\" spellcheck=\"true\"\n [value]=\"value()\" [placeholder]=\"placeholder()\" [disabled]=\"isDisabled()\" [readOnly]=\"readonly()\"\n [attr.aria-label]=\"label() || labels().editor\"\n (input)=\"onInput($event)\" (scroll)=\"onScroll($event)\" (blur)=\"onBlur()\" (keydown)=\"onKeydown($event)\" (paste)=\"onPaste($event)\"\n (dragover)=\"onDragOver($event)\" (dragleave)=\"onDragLeave()\" (drop)=\"onDrop($event)\"></textarea>\n @if (error()) {\n <p class=\"jt-md-editor__error\" role=\"alert\">{{ error() }}</p>\n }\n @if (uploadImage()) {\n <input #file type=\"file\" accept=\"image/*\" multiple hidden (change)=\"onFileChosen($event)\">\n }\n </div>\n</ng-template>\n\n<ng-template #preview>\n @if (value().trim()) {\n <jt-md-preview class=\"jt-md-editor__preview\" [markdown]=\"value()\" />\n } @else {\n <p class=\"jt-md-editor__preview jt-md-editor__preview--empty\">{{ labels().emptyPreview }}</p>\n }\n</ng-template>\n"],"mappings":";;;;;;;;AAmCA,MAAa,8BAAgD;CAC3D,QAAQ;CACR,SAAS;CACT,OAAO;CACP,SAAS;CACT,SAAS;CACT,MAAM;CACN,QAAQ;CACR,QAAQ;CACR,MAAM;CACN,MAAM;CACN,OAAO;CACP,SAAS;CACT,SAAS;CACT,OAAO;CACP,WAAW;CACX,OAAO;CACP,MAAM;CACN,OAAO;CACP,MAAM;CACN,YAAY;CACZ,WAAW;CACX,aAAa;CACb,YAAY;CACZ,eAAe;CACf,cAAc;CACd,WAAW;CACX,cAAc;CACd,cAAc;AACf;AAMD,MAAa,sBAAsB,IAAI,eAAuC,uBAAuB;CACnG,YAAY;CACZ,qBAAqB;AACtB,CAAA;AAED,SAAgB,wBAAwB,QAAqE;CAC3G,MAAM,OAAO,OAAO,WAAW,aAAa,eAAe;CAC3D,OAAO;EAAE,SAAS;EAAqB,iBAAiB;GAAE,GAAG;GAA6B,GAAG,KAAI;EAAE;CAAG;AACxG;ACxDA,MAAa,qBAAqB,IAAI,eAAiC,sBAAsB;CAC3F,YAAY;CACZ,gBAAgB,CAAA;AACjB,CAAA;AAGD,SAAgB,kBAAkB,QAAwB;CACxD,OAAO;EAAE,SAAS;EAAoB,UAAU;CAAM;AACxD;AC3BA,MAAM,OAAO;AACb,MAAM,UAAU;AAEhB,SAAS,WAAW,MAAY;CAC9B,OAAO,KAAK,QAAQ,MAAM,OAAO,CAAC,CAAC,QAAQ,MAAM,MAAM,CAAC,CAAC,QAAQ,MAAM,MAAM;AAC/E;AAIA,MAAM,cAAc;AACpB,MAAM,aAAa;AAEnB,SAAS,YAAY,OAAqB;CACxC,MAAM,UAAU,MAAM,mBAAmB;CACzC,OAAO,gBAAgB,OAAO,UAAU,MAAM,UAAU,GAAE,IAAK,WAAW,OAAO,MAAM,WA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A,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,QAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,aAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,WAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,YAAU,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;EAAA,WAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CACZ,QAAM,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,52 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jambotron/aria-markdown-editor",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
|
|
3
|
+
"version": "0.2.4",
|
|
4
|
+
"peerDependencies": {
|
|
5
|
+
"@angular/common": "^22.2.0",
|
|
6
|
+
"@angular/core": "^22.2.0",
|
|
7
|
+
"@angular/forms": "^22.2.0",
|
|
8
|
+
"@angular/aria": "^22.2.0",
|
|
9
|
+
"marked": ">=16.0.0",
|
|
10
|
+
"@jambotron/aria-components": ">=0.1.0 <1.0.0"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"tslib": "^2.3.0"
|
|
14
|
+
},
|
|
15
|
+
"sideEffects": false,
|
|
16
|
+
"description": "Markdown editor for Angular on Angular Aria: source and preview side by side, toolbar, tabs on phones, KaTeX formulas, image paste/drop, hotkeys, forms (ControlValueAccessor + Signal Forms); icons from @jambotron/aria-components",
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/jambotronwp-cell/aria-markdown-editor.git"
|
|
21
|
+
},
|
|
22
|
+
"exports": {
|
|
23
|
+
"./styles/*": {
|
|
24
|
+
"sass": "./styles/*.scss"
|
|
25
|
+
},
|
|
26
|
+
"./package.json": {
|
|
27
|
+
"default": "./package.json"
|
|
28
|
+
},
|
|
29
|
+
".": {
|
|
30
|
+
"types": "./types/jambotron-aria-markdown-editor.d.ts",
|
|
31
|
+
"default": "./fesm2022/jambotron-aria-markdown-editor.mjs"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"homepage": "https://aria-markdown-editor-demo.jambocheck.com",
|
|
35
|
+
"author": "Jambotron (https://jambotron.com)",
|
|
36
|
+
"keywords": [
|
|
37
|
+
"angular",
|
|
38
|
+
"angular-aria",
|
|
39
|
+
"accessibility",
|
|
40
|
+
"a11y",
|
|
41
|
+
"markdown",
|
|
42
|
+
"markdown-editor",
|
|
43
|
+
"katex",
|
|
44
|
+
"editor"
|
|
45
|
+
],
|
|
46
|
+
"bugs": {
|
|
47
|
+
"url": "https://github.com/jambotronwp-cell/aria-markdown-editor/issues"
|
|
48
|
+
},
|
|
49
|
+
"module": "fesm2022/jambotron-aria-markdown-editor.mjs",
|
|
50
|
+
"typings": "types/jambotron-aria-markdown-editor.d.ts",
|
|
51
|
+
"type": "module"
|
|
6
52
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// @jambotron/aria-markdown-editor — theme. Include once in the app's global styles:
|
|
2
|
+
// @use '@jambotron/aria-markdown-editor/styles/aria-markdown-editor';
|
|
3
|
+
// Tokens are defaults on :where(:root) (zero specificity): any --jt-* the app sets wins (same tokens as @jambotron/aria-grid).
|
|
4
|
+
// Formulas: add KaTeX CSS too — @use 'katex/dist/katex.min.css' (or angular.json styles).
|
|
5
|
+
|
|
6
|
+
:where(:root) {
|
|
7
|
+
--jt-accent: #14c8e6;
|
|
8
|
+
--jt-accent-text: #074b5a;
|
|
9
|
+
--jt-on-accent: #050816;
|
|
10
|
+
--jt-danger: #ef4444;
|
|
11
|
+
--jt-danger-text: #8a1414;
|
|
12
|
+
--jt-text: #141a33;
|
|
13
|
+
--jt-text-muted: #39425f;
|
|
14
|
+
--jt-text-disabled: rgba(20, 26, 51, 0.45);
|
|
15
|
+
--jt-divider: rgba(10, 16, 48, 0.12);
|
|
16
|
+
--jt-field-bg: rgba(255, 255, 255, 0.55);
|
|
17
|
+
--jt-field-border: rgba(10, 16, 48, 0.28);
|
|
18
|
+
--jt-focus-ring: 0 0 0 3px rgba(20, 200, 230, 0.45);
|
|
19
|
+
--jt-glow-accent: 0 0 10px rgba(20, 200, 230, 0.35);
|
|
20
|
+
--jt-popup-bg: #eef2f7f2;
|
|
21
|
+
--jt-popup-border: rgba(10, 16, 48, 0.12);
|
|
22
|
+
--jt-shadow-lg: 0 16px 48px rgba(10, 16, 48, 0.2);
|
|
23
|
+
--jt-radius-sm: 6px;
|
|
24
|
+
--jt-radius-md: 10px;
|
|
25
|
+
--jt-radius-pill: 999px;
|
|
26
|
+
--jt-space-1: 4px;
|
|
27
|
+
--jt-space-2: 8px;
|
|
28
|
+
--jt-space-3: 12px;
|
|
29
|
+
--jt-space-4: 16px;
|
|
30
|
+
--jt-duration-fast: 150ms;
|
|
31
|
+
--jt-duration-base: 250ms;
|
|
32
|
+
--jt-duration-slow: 400ms;
|
|
33
|
+
--jt-easing: cubic-bezier(0.2, 0, 0, 1);
|
|
34
|
+
--jt-md-code-bg: rgba(10, 16, 48, 0.07);
|
|
35
|
+
--jt-md-hover-bg: rgba(20, 200, 230, 0.12);
|
|
36
|
+
--jt-md-editor-height: 420px;
|
|
37
|
+
}
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated bundle index. Do not edit.
|
|
3
|
+
*/
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
import { ElementRef, InjectionToken, Provider } from "@angular/core";
|
|
6
|
+
import { MarkedExtension } from "marked";
|
|
7
|
+
import { ControlValueAccessor } from "@angular/forms";
|
|
8
|
+
/** Every text the editor shows. English by default; an app passes its own with provideJtMdEditorLabels(). */
|
|
9
|
+
export interface JtMdEditorLabels {
|
|
10
|
+
editor: string;
|
|
11
|
+
toolbar: string;
|
|
12
|
+
write: string;
|
|
13
|
+
preview: string;
|
|
14
|
+
heading: string;
|
|
15
|
+
bold: string;
|
|
16
|
+
italic: string;
|
|
17
|
+
strike: string;
|
|
18
|
+
code: string;
|
|
19
|
+
link: string;
|
|
20
|
+
quote: string;
|
|
21
|
+
bullets: string;
|
|
22
|
+
numbers: string;
|
|
23
|
+
tasks: string;
|
|
24
|
+
codeBlock: string;
|
|
25
|
+
table: string;
|
|
26
|
+
math: string;
|
|
27
|
+
image: string;
|
|
28
|
+
rule: string;
|
|
29
|
+
/** Placeholders the toolbar inserts when nothing is selected */
|
|
30
|
+
sampleText: string;
|
|
31
|
+
sampleUrl: string;
|
|
32
|
+
sampleImage: string;
|
|
33
|
+
sampleCode: string;
|
|
34
|
+
sampleFormula: string;
|
|
35
|
+
sampleColumn: string;
|
|
36
|
+
uploading: string;
|
|
37
|
+
uploadFailed: string;
|
|
38
|
+
emptyPreview: string;
|
|
39
|
+
}
|
|
40
|
+
export declare const JT_MD_EDITOR_DEFAULT_LABELS: JtMdEditorLabels;
|
|
41
|
+
/**
|
|
42
|
+
* Labels of the editor. A function is read on every change detection, so it may follow the app's current language:
|
|
43
|
+
* provideJtMdEditorLabels(() => ({ bold: translate('editor.bold'), ... })).
|
|
44
|
+
*/
|
|
45
|
+
export declare const JT_MD_EDITOR_LABELS: InjectionToken<() => JtMdEditorLabels>;
|
|
46
|
+
export declare function provideJtMdEditorLabels(labels: Partial<JtMdEditorLabels> | (() => Partial<JtMdEditorLabels>)): Provider;
|
|
47
|
+
/** The part of KaTeX the editor uses: `import('katex').then(m => m.default)` fits. */
|
|
48
|
+
export interface JtKatex {
|
|
49
|
+
render(tex: string, element: HTMLElement, options: {
|
|
50
|
+
displayMode: boolean;
|
|
51
|
+
throwOnError: boolean;
|
|
52
|
+
}): void;
|
|
53
|
+
}
|
|
54
|
+
export interface JtMarkdownConfig {
|
|
55
|
+
/**
|
|
56
|
+
* Loads KaTeX on the first formula: `() => import('katex').then(m => m.default)`. KaTeX stays out of the main
|
|
57
|
+
* bundle — a lazy chunk. Without it formulas show as TeX source. The app adds KaTeX CSS (`katex/dist/katex.min.css`).
|
|
58
|
+
*/
|
|
59
|
+
katex?: () => Promise<JtKatex>;
|
|
60
|
+
/** Formulas `$…$` and `$$…$$`; on by default. */
|
|
61
|
+
math?: boolean;
|
|
62
|
+
/** Single line breaks become <br> (GitHub comments style); off by default — as in documents. */
|
|
63
|
+
breaks?: boolean;
|
|
64
|
+
/** Extra marked extensions (after the built-in ones). */
|
|
65
|
+
extensions?: MarkedExtension[];
|
|
66
|
+
}
|
|
67
|
+
export declare const JT_MARKDOWN_CONFIG: InjectionToken<JtMarkdownConfig>;
|
|
68
|
+
/** provideJtMarkdown({ katex: () => import('katex').then(m => m.default) }) — in app.config.ts providers. */
|
|
69
|
+
export declare function provideJtMarkdown(config: JtMarkdownConfig): Provider;
|
|
70
|
+
/**
|
|
71
|
+
* Formulas `$…$` and `$$…$$`. Parsed with the rules of marked-katex-extension (so marked keeps `_` and `*` inside
|
|
72
|
+
* a formula), but the HTML gets the TeX source in <span class="jt-math">, not KaTeX markup: Angular's sanitizer drops
|
|
73
|
+
* `style`, and KaTeX fractions and roots fall apart. renderMath() draws KaTeX into the DOM after the sanitizer.
|
|
74
|
+
*/
|
|
75
|
+
export declare function markdownMathExtension(): MarkedExtension;
|
|
76
|
+
/**
|
|
77
|
+
* Draws KaTeX into the formula placeholders inside the element; a broken formula shows red, the page stays.
|
|
78
|
+
* Without a loader formulas stay as TeX source. Browser only (KaTeX needs `document`).
|
|
79
|
+
*/
|
|
80
|
+
export declare function renderMath(element: HTMLElement, katex?: () => Promise<JtKatex>): Promise<void>;
|
|
81
|
+
/**
|
|
82
|
+
* Text commands of the editor — pure functions over (text, selection), no DOM: easy to test and to reuse
|
|
83
|
+
* (e.g. a plain <textarea> elsewhere). Each returns one edit: replace [from, to) with `insert`, then select
|
|
84
|
+
* [selectionStart, selectionEnd) in the new text.
|
|
85
|
+
*/
|
|
86
|
+
export interface JtMdState {
|
|
87
|
+
text: string;
|
|
88
|
+
start: number;
|
|
89
|
+
end: number;
|
|
90
|
+
}
|
|
91
|
+
export interface JtMdEdit {
|
|
92
|
+
from: number;
|
|
93
|
+
to: number;
|
|
94
|
+
insert: string;
|
|
95
|
+
selectionStart: number;
|
|
96
|
+
selectionEnd: number;
|
|
97
|
+
}
|
|
98
|
+
/** Applies an edit to the text (what the textarea will contain after it). */
|
|
99
|
+
export declare function applyEdit(text: string, edit: JtMdEdit): string;
|
|
100
|
+
/**
|
|
101
|
+
* **bold**, _italic_, `code`, ~~strike~~, $formula$: wraps the selection; an already wrapped selection is unwrapped;
|
|
102
|
+
* nothing selected — inserts the placeholder and selects it.
|
|
103
|
+
*/
|
|
104
|
+
export declare function toggleWrap(state: JtMdState, before: string, after?: string, placeholder?: string): JtMdEdit;
|
|
105
|
+
export type JtMdLineKind = 'quote' | 'bullets' | 'numbers' | 'tasks';
|
|
106
|
+
/**
|
|
107
|
+
* Quote / bulleted / numbered / task list on every selected line. All lines already of that kind — markers are
|
|
108
|
+
* removed; otherwise each line gets the marker (a marker of another kind is replaced). Empty lines are kept as they are.
|
|
109
|
+
*/
|
|
110
|
+
export declare function toggleLines(state: JtMdState, kind: JtMdLineKind): JtMdEdit;
|
|
111
|
+
/** Heading of the current line: none → # → ## → ### → none. */
|
|
112
|
+
export declare function cycleHeading(state: JtMdState): JtMdEdit;
|
|
113
|
+
/** [text](url): selected text → the url is selected; a selected URL → the text is selected. */
|
|
114
|
+
export declare function insertLink(state: JtMdState, sampleText: string, sampleUrl: string): JtMdEdit;
|
|
115
|
+
/** A block (code, table, image, line, formula) on its own lines; `select` — a part of the block to select. */
|
|
116
|
+
export declare function insertBlock(state: JtMdState, block: string, select?: {
|
|
117
|
+
start: number;
|
|
118
|
+
end: number;
|
|
119
|
+
}): JtMdEdit;
|
|
120
|
+
/** ``` fenced code: the selection goes inside; nothing selected — the placeholder, selected. */
|
|
121
|
+
export declare function insertCodeBlock(state: JtMdState, placeholder: string): JtMdEdit;
|
|
122
|
+
/** $$ display formula when the selection spans lines, $inline$ otherwise. */
|
|
123
|
+
export declare function insertMath(state: JtMdState, placeholder: string): JtMdEdit;
|
|
124
|
+
/** Table 2 × 2 with the first header cell selected. */
|
|
125
|
+
export declare function insertTable(state: JtMdState, column: string): JtMdEdit;
|
|
126
|
+
/** Horizontal line. */
|
|
127
|
+
export declare function insertRule(state: JtMdState): JtMdEdit;
|
|
128
|
+
/**  as its own block; `alt` is selected — to be described. */
|
|
129
|
+
export declare function insertImage(state: JtMdState, url: string, alt: string): JtMdEdit;
|
|
130
|
+
/**
|
|
131
|
+
* Enter inside a list: the next item gets the same marker (numbers +1, tasks unchecked); Enter on an empty item ends
|
|
132
|
+
* the list (removes the marker). null — not a list, a selection or the caret before the marker: the textarea's own Enter.
|
|
133
|
+
*/
|
|
134
|
+
export declare function continueList(state: JtMdState): JtMdEdit | null;
|
|
135
|
+
/**
|
|
136
|
+
* The marker typed by hand right after the one Enter added: «2. » + «2.» → «2.», «- » + «- » → «- ». The caret must
|
|
137
|
+
* stand right after the typed marker; `key` — the key being pressed ('.', ')' or ' '). null — nothing to merge.
|
|
138
|
+
*/
|
|
139
|
+
export declare function mergeTypedMarker(state: JtMdState, key: string): JtMdEdit | null;
|
|
140
|
+
/** Markdown → HTML (not sanitized yet — bind it with [innerHTML], Angular sanitizes). One per app. */
|
|
141
|
+
export declare class JtMarkdownRenderer {
|
|
142
|
+
private readonly config;
|
|
143
|
+
private readonly marked;
|
|
144
|
+
render(markdown: string): string;
|
|
145
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<JtMarkdownRenderer, never>;
|
|
146
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Rendered Markdown: GFM, tables, task lists, formulas (KaTeX, lazy). The HTML goes through Angular's sanitizer.
|
|
150
|
+
* Works in SSR (formulas are drawn by the browser after hydration).
|
|
151
|
+
*
|
|
152
|
+
* <jt-md-preview [markdown]="article.body" />
|
|
153
|
+
*/
|
|
154
|
+
export declare class JtMdPreviewComponent {
|
|
155
|
+
private readonly element;
|
|
156
|
+
private readonly renderer;
|
|
157
|
+
private readonly config;
|
|
158
|
+
private readonly browser;
|
|
159
|
+
readonly markdown: import("@angular/core").InputSignal<string | null | undefined>;
|
|
160
|
+
protected readonly html: import("@angular/core").Signal<string>;
|
|
161
|
+
constructor();
|
|
162
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<JtMdPreviewComponent, never>;
|
|
163
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<JtMdPreviewComponent, "jt-md-preview", never, {
|
|
164
|
+
"markdown": {
|
|
165
|
+
"alias": "markdown";
|
|
166
|
+
"required": false;
|
|
167
|
+
"isSignal": true;
|
|
168
|
+
};
|
|
169
|
+
}, {}, never, never, true, never>;
|
|
170
|
+
}
|
|
171
|
+
/** A toolbar button; '|' — a separator between groups. */
|
|
172
|
+
export type JtMdTool = 'heading' | 'bold' | 'italic' | 'strike' | 'code' | 'link' | 'quote' | 'bullets' | 'numbers' | 'tasks' | 'codeBlock' | 'table' | 'math' | 'image' | 'rule' | '|';
|
|
173
|
+
export declare const JT_MD_DEFAULT_TOOLS: JtMdTool[];
|
|
174
|
+
/** An image for the text: `url` goes into . */
|
|
175
|
+
export interface JtMdImage {
|
|
176
|
+
url: string;
|
|
177
|
+
alt?: string;
|
|
178
|
+
}
|
|
179
|
+
/** Split — source and preview side by side; tabs — Write / Preview (phones); auto — tabs when narrower than 720px. */
|
|
180
|
+
export type JtMdLayout = 'auto' | 'split' | 'tabs';
|
|
181
|
+
type ToolName = Exclude<JtMdTool, '|'>;
|
|
182
|
+
/**
|
|
183
|
+
* Markdown editor on Angular Aria: source and preview side by side, a toolbar (`ngToolbar`, arrow keys inside),
|
|
184
|
+
* Write / Preview tabs (`ngTabs`) on narrow screens, formulas, image paste / drop / upload, hotkeys (Ctrl/⌘ + B, I,
|
|
185
|
+
* K, E), Enter continues lists (a marker typed again is merged), the preview scrolls with the text. The value — model() and a ControlValueAccessor: [(value)], [formField] (Signal
|
|
186
|
+
* Forms), formControl, ngModel.
|
|
187
|
+
*
|
|
188
|
+
* <jt-md-editor [(value)]="body" [uploadImage]="upload" />
|
|
189
|
+
*/
|
|
190
|
+
export declare class JtMdEditorComponent implements ControlValueAccessor {
|
|
191
|
+
private readonly host;
|
|
192
|
+
private readonly readLabels;
|
|
193
|
+
private readonly destroyRef;
|
|
194
|
+
readonly value: import("@angular/core").ModelSignal<string>;
|
|
195
|
+
readonly placeholder: import("@angular/core").InputSignal<string>;
|
|
196
|
+
readonly disabled: import("@angular/core").InputSignal<boolean>;
|
|
197
|
+
readonly readonly: import("@angular/core").InputSignal<boolean>;
|
|
198
|
+
/** aria-label of the text area; default — labels.editor */
|
|
199
|
+
readonly label: import("@angular/core").InputSignal<string>;
|
|
200
|
+
readonly tools: import("@angular/core").InputSignal<JtMdTool[]>;
|
|
201
|
+
readonly layout: import("@angular/core").InputSignal<JtMdLayout>;
|
|
202
|
+
/** Uploads a pasted / dropped / chosen image file and returns its address. Without it files are not accepted. */
|
|
203
|
+
readonly uploadImage: import("@angular/core").InputSignal<((file: File) => Promise<JtMdImage | string>) | null>;
|
|
204
|
+
/** The image button opens the app's own picker (e.g. a gallery dialog); null — cancelled. */
|
|
205
|
+
readonly pickImage: import("@angular/core").InputSignal<(() => Promise<JtMdImage | null>) | null>;
|
|
206
|
+
protected readonly labels: import("@angular/core").Signal<JtMdEditorLabels>;
|
|
207
|
+
protected readonly textarea: import("@angular/core").Signal<ElementRef<HTMLTextAreaElement> | undefined>;
|
|
208
|
+
protected readonly fileInput: import("@angular/core").Signal<ElementRef<HTMLInputElement> | undefined>;
|
|
209
|
+
private readonly formDisabled;
|
|
210
|
+
protected readonly isDisabled: import("@angular/core").Signal<boolean>;
|
|
211
|
+
protected readonly locked: import("@angular/core").Signal<boolean>;
|
|
212
|
+
private readonly width;
|
|
213
|
+
protected readonly tabbed: import("@angular/core").Signal<boolean>;
|
|
214
|
+
protected readonly tab: import("@angular/core").WritableSignal<string | undefined>;
|
|
215
|
+
protected readonly dragging: import("@angular/core").WritableSignal<boolean>;
|
|
216
|
+
protected readonly uploads: import("@angular/core").WritableSignal<number>;
|
|
217
|
+
protected readonly error: import("@angular/core").WritableSignal<string>;
|
|
218
|
+
protected readonly groups: import("@angular/core").Signal<ToolName[][]>;
|
|
219
|
+
private onChange;
|
|
220
|
+
private onTouched;
|
|
221
|
+
constructor();
|
|
222
|
+
writeValue(value: string | null | undefined): void;
|
|
223
|
+
registerOnChange(fn: (value: string) => void): void;
|
|
224
|
+
registerOnTouched(fn: () => void): void;
|
|
225
|
+
setDisabledState(disabled: boolean): void;
|
|
226
|
+
protected icon(tool: ToolName): string;
|
|
227
|
+
protected title(tool: ToolName): string;
|
|
228
|
+
protected onInput(event: Event): void;
|
|
229
|
+
protected onBlur(): void;
|
|
230
|
+
protected onKeydown(event: KeyboardEvent): void;
|
|
231
|
+
/** Side by side: the preview follows the text — the same share of its height scrolled. */
|
|
232
|
+
protected onScroll(event: Event): void;
|
|
233
|
+
/** A toolbar button or a hotkey. */
|
|
234
|
+
run(tool: ToolName): void;
|
|
235
|
+
private chooseImage;
|
|
236
|
+
protected onFileChosen(event: Event): void;
|
|
237
|
+
protected onPaste(event: ClipboardEvent): void;
|
|
238
|
+
protected onDragOver(event: DragEvent): void;
|
|
239
|
+
protected onDragLeave(): void;
|
|
240
|
+
protected onDrop(event: DragEvent): void;
|
|
241
|
+
private imageFiles;
|
|
242
|
+
/**
|
|
243
|
+
* Each file: a placeholder ![Uploading name…]() at the caret at once, replaced with the image when the upload is
|
|
244
|
+
* done (the user keeps typing meanwhile); a failed upload removes the placeholder and shows the error.
|
|
245
|
+
*/
|
|
246
|
+
private uploadFiles;
|
|
247
|
+
private replaceMarker;
|
|
248
|
+
private state;
|
|
249
|
+
/**
|
|
250
|
+
* Applies an edit in the textarea. execCommand('insertText') keeps the browser's undo (Ctrl+Z) working; where it is
|
|
251
|
+
* missing (tests, old browsers) — setRangeText.
|
|
252
|
+
*/
|
|
253
|
+
private apply;
|
|
254
|
+
private commit;
|
|
255
|
+
/** Focus the text area (e.g. after the form opens). */
|
|
256
|
+
focus(): void;
|
|
257
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<JtMdEditorComponent, never>;
|
|
258
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<JtMdEditorComponent, "jt-md-editor", never, {
|
|
259
|
+
"value": {
|
|
260
|
+
"alias": "value";
|
|
261
|
+
"required": false;
|
|
262
|
+
"isSignal": true;
|
|
263
|
+
};
|
|
264
|
+
"placeholder": {
|
|
265
|
+
"alias": "placeholder";
|
|
266
|
+
"required": false;
|
|
267
|
+
"isSignal": true;
|
|
268
|
+
};
|
|
269
|
+
"disabled": {
|
|
270
|
+
"alias": "disabled";
|
|
271
|
+
"required": false;
|
|
272
|
+
"isSignal": true;
|
|
273
|
+
};
|
|
274
|
+
"readonly": {
|
|
275
|
+
"alias": "readonly";
|
|
276
|
+
"required": false;
|
|
277
|
+
"isSignal": true;
|
|
278
|
+
};
|
|
279
|
+
"label": {
|
|
280
|
+
"alias": "label";
|
|
281
|
+
"required": false;
|
|
282
|
+
"isSignal": true;
|
|
283
|
+
};
|
|
284
|
+
"tools": {
|
|
285
|
+
"alias": "tools";
|
|
286
|
+
"required": false;
|
|
287
|
+
"isSignal": true;
|
|
288
|
+
};
|
|
289
|
+
"layout": {
|
|
290
|
+
"alias": "layout";
|
|
291
|
+
"required": false;
|
|
292
|
+
"isSignal": true;
|
|
293
|
+
};
|
|
294
|
+
"uploadImage": {
|
|
295
|
+
"alias": "uploadImage";
|
|
296
|
+
"required": false;
|
|
297
|
+
"isSignal": true;
|
|
298
|
+
};
|
|
299
|
+
"pickImage": {
|
|
300
|
+
"alias": "pickImage";
|
|
301
|
+
"required": false;
|
|
302
|
+
"isSignal": true;
|
|
303
|
+
};
|
|
304
|
+
}, {
|
|
305
|
+
"value": "valueChange";
|
|
306
|
+
}, never, never, true, never>;
|
|
307
|
+
}
|
|
308
|
+
export {};
|