* Set custom syntax processor for extending markdown parsing * @param {Function|null} processor - Function that takes (html) and returns modified HTML * @example * OverType.setCustomSyntax((html) => { * // Highlight footnote references [^1] * return html.replace(/\[\^(\w
(processor)
| 1949 | * }); |
| 1950 | */ |
| 1951 | static setCustomSyntax(processor) { |
| 1952 | MarkdownParser.setCustomSyntax(processor); |
| 1953 | |
| 1954 | // Update all existing instances |
| 1955 | document.querySelectorAll('.overtype-wrapper').forEach(wrapper => { |
| 1956 | const instance = wrapper._instance; |
| 1957 | if (instance && instance.updatePreview) { |
| 1958 | instance.updatePreview(); |
| 1959 | } |
| 1960 | }); |
| 1961 | |
| 1962 | document.querySelectorAll('overtype-editor').forEach(webComponent => { |
| 1963 | if (typeof webComponent.getEditor === 'function') { |
| 1964 | const instance = webComponent.getEditor(); |
| 1965 | if (instance && instance.updatePreview) { |
| 1966 | instance.updatePreview(); |
| 1967 | } |
| 1968 | } |
| 1969 | }); |
| 1970 | } |
| 1971 | |
| 1972 | /** |
| 1973 | * Initialize global event listeners |