reactjs-tiptap-editor 0.1.14 → 0.1.15
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/lib/RichTextEditor-BFCJg7ap.cjs +138 -0
- package/lib/RichTextEditor-CqUsKvdf.js +4887 -0
- package/lib/extension-bundle.cjs +15 -0
- package/lib/extension-bundle.d.cts +919 -0
- package/lib/extension-bundle.d.ts +919 -0
- package/lib/extension-bundle.js +8501 -0
- package/lib/{locales--osbCzs-.js → index-BQSRMhtZ.js} +229 -181
- package/lib/index-CHZh3C0I.cjs +1 -0
- package/lib/index.cjs +1 -1
- package/lib/index.d.cts +45 -1583
- package/lib/index.d.ts +45 -1583
- package/lib/index.js +12 -67
- package/lib/locale-bundle.cjs +1 -0
- package/lib/locale-bundle.d.cts +1145 -0
- package/lib/locale-bundle.d.ts +1145 -0
- package/lib/locale-bundle.js +9 -0
- package/lib/style.css +1 -1
- package/lib/{tiptap-CibBmg3k.js → tiptap-CB5MO02_.js} +1453 -1401
- package/lib/tiptap-DkTOfBkj.cjs +116 -0
- package/lib/vendor-BH8HYOJ4.cjs +354 -0
- package/lib/{vendor-CDx3V-R7.js → vendor-DiKgVtSS.js} +23737 -23443
- package/package.json +95 -82
- package/lib/bundle-full.cjs +0 -650
- package/lib/bundle-full.js +0 -82900
- package/lib/locales-DNzXvsXe.cjs +0 -1
- package/lib/tiptap-BWShr3Ps.cjs +0 -116
- package/lib/utils-CpXb61kA.cjs +0 -152
- package/lib/utils-DvW-fR8u.js +0 -13374
- package/lib/vendor-DhcRzB9P.cjs +0 -354
package/lib/locales-DNzXvsXe.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var k=Object.defineProperty;var _=(e,t,o)=>t in e?k(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o;var a=(e,t,o)=>_(e,typeof t!="symbol"?t+"":t,o);const n=require("react"),p=require("./vendor-DhcRzB9P.cjs"),T=require("./utils-CpXb61kA.cjs"),F={"editor.remove":"Remove","editor.copy":"Copy","editor.words":"WORDS","editor.characters":"CHARACTERS","editor.default":"Default","editor.recent":"Recently Used","editor.nofill":"No Fill","editor.format":"Format Painter","editor.delete":"Delete","editor.edit":"Edit","editor.settings":"Settings","editor.table_of_content":"Table of Content","editor.draghandle.tooltip":"Modify","editor.copyToClipboard":"CopyToClipboard","editor.slash":"Press '/' for commands","editor.slash.empty":"No Result","editor.slash.format":"Format","editor.slash.insert":"Insert","editor.slash.embed":"Embed Services","editor.content":"Please input content","editor.fontFamily.tooltip":"Font Family","editor.fontFamily.default.tooltip":"Default","editor.moremark":"More Text Styles","editor.size.small.tooltip":"Small","editor.size.medium.tooltip":"Medium","editor.size.large.tooltip":"Cover","editor.bold.tooltip":"Bold","editor.italic.tooltip":"Italic","editor.underline.tooltip":"Underline","editor.strike.tooltip":"Strike","editor.color.tooltip":"Color","editor.color.more":"More Colors","editor.highlight.tooltip":"Highlight","editor.lineheight.tooltip":"Line Height","editor.heading.tooltip":"Headings","editor.heading.h1.tooltip":"Heading 1","editor.heading.h2.tooltip":"Heading 2","editor.heading.h3.tooltip":"Heading 3","editor.heading.h4.tooltip":"Heading 4","editor.heading.h5.tooltip":"Heading 5","editor.heading.h6.tooltip":"Heading 6","editor.paragraph.tooltip":"Paragraph","editor.textalign.tooltip":"Align","editor.textalign.left.tooltip":"Left","editor.textalign.center.tooltip":"Center","editor.textalign.right.tooltip":"Right","editor.textalign.justify.tooltip":"Justify","editor.indent":"Indent","editor.indent.indent":"Increase Indent","editor.indent.outdent":"Decrease Indent","editor.fontSize.tooltip":"Font size","editor.fontSize.default.tooltip":"Default","editor.superscript.tooltip":"Superscript","editor.subscript.tooltip":"Subscript","editor.bulletlist.tooltip":"Bullet List","editor.orderedlist.tooltip":"Ordered List","editor.tasklist.tooltip":"Task List","editor.indent.tooltip":"Indent","editor.outdent.tooltip":"Outdent","editor.columns.tooltip":"Columns","editor.link.tooltip":"Link","editor.link.unlink.tooltip":"UnLink","editor.link.open.tooltip":"Open Link","editor.link.edit.tooltip":"Edit Link","editor.link.dialog.title":"Insert Link","editor.link.dialog.link":"Link","editor.link.dialog.text":"Text","editor.link.dialog.openInNewTab":"Open In New Tab","editor.link.dialog.link.placeholder":"Link Address","editor.link.dialog.text.placeholder":"Add Description","editor.link.dialog.button.apply":"Apply","editor.image.tooltip":"Image","editor.image.dragger.tooltip":"Click or drag the image to the area to upload","editor.image.float.left.tooltip":"Float left","editor.image.float.none.tooltip":"Float none","editor.image.float.right.tooltip":"Float right","editor.image.dialog.title":"Add an image","editor.image.dialog.tab.url":"Url","editor.image.dialog.tab.upload":"Upload","editor.image.dialog.tab.uploadCrop":"Upload & Crop","editor.image.dialog.uploading":"Uploading","editor.link.dialog.inline":"Inline","editor.image.dialog.form.link":"Link","editor.image.dialog.placeholder":"Link","editor.image.dialog.form.alt":"Alt","editor.image.dialog.form.aspectRatio":"Lock original aspect ratio","editor.image.dialog.form.file":"File","editor.image.dialog.button.apply":"Apply","editor.video.tooltip":"Video","editor.video.dialog.tab.upload":"Upload","editor.video.dialog.uploading":"Uploading","editor.video.dialog.title":"Embed or upload a video","editor.video.dialog.link":"Link","editor.video.dialog.placeholder":"Link","editor.video.dialog.button.apply":"Apply","editor.table.tooltip":"Table","editor.table.menu.insert_table":"Insert Table","editor.table.menu.insert_table.with_header_row":"With header row","editor.table.menu.add_column_before":"Add Column Before","editor.table.menu.add_column_after":"Add Column After","editor.table.menu.delete_column":"Delete Column","editor.table.menu.add_row_before":"Add Row Before","editor.table.menu.add_row_after":"Add Row After","editor.table.menu.delete_row":"Delete Row","editor.table.menu.merge_or_split_cells":"Merge Or Split Cells","editor.table.menu.delete_table":"Delete Table","editor.blockquote.tooltip":"Blockquote","editor.horizontalrule.tooltip":"Horizontal Rule","editor.code.tooltip":"Code","editor.codeblock.tooltip":"Code Block","editor.clear.tooltip":"Clear Format","editor.undo.tooltip":"Undo","editor.redo.tooltip":"Redo","editor.fullscreen.tooltip.fullscreen":"Fullscreen","editor.fullscreen.tooltip.exit":"Fullscreen Exit","editor.imageUpload.cancel":"Cancel","editor.imageUpload.crop":"Crop","editor.imageUpload.fileTypeNotSupported":"File type not supported","editor.imageUpload.fileSizeTooBig":"File size too big, Maximum size is","editor.table.menu.insertColumnBefore":"Insert Column Before","editor.table.menu.insertColumnAfter":"Insert Column After","editor.table.menu.deleteColumn":"Delete Column","editor.table.menu.insertRowAbove":"Insert Row Above","editor.table.menu.insertRowBelow":"Insert Row Below","editor.table.menu.deleteRow":"Delete Row","editor.table.menu.mergeCells":"Merge Cells","editor.table.menu.splitCells":"Split Cells","editor.table.menu.deleteTable":"Delete Table","editor.table.menu.setCellsBgColor":"Cell Background Color","editor.emoji.tooltip":"Emoji","editor.iframe.tooltip":"Iframe","editor.searchAndReplace.tooltip":"Search and Replace","editor.search.dialog.text":"Search","editor.replace.dialog.text":"Replace","editor.replaceAll.dialog.text":"Replace All","editor.previous.dialog.text":"Previous","editor.next.dialog.text":"Next",no_result_found:"No results found","Smileys & People":"Smileys & People","Animals & Nature":"Animals & Nature","Food & Drink":"Food & Drink",Activity:"Activity","Travel & Places":"Travel & Places",Object:"Objects",Symbol:"Symbols",Flags:"Flags","Frequently used":"Frequently used","editor.formula.dialog.text":"Formula","editor.katex.tooltip":"Math Formula","editor.exportPdf.tooltip":"Export PDF","editor.exportWord.tooltip":"Export Word","editor.importWord.tooltip":"Import Word","editor.importWord.limitSize":"File size cannot exceed","editor.importWord.converting":"Converting Word document, please wait...","editor.importWord.convertError":"Error parsing Word document","editor.importWord.importError":"Error importing Word document","editor.textDirection.tooltip":"Text Direction","editor.textDirection.auto.tooltip":"Auto","editor.textDirection.ltr.tooltip":"Left to Right","editor.textDirection.rtl.tooltip":"Right to Left","editor.attachment.tooltip":"Attachment","editor.attachment.uploading":"Uploading","editor.attachment.please_upload":"Please upload the file","editor.imageGif.tooltip":"Gif","editor.replace.caseSensitive":"Case Sensitive","editor.mermaid.tooltip":"Mermaid","editor.twitter.tooltip":"Twitter","editor.tooltip.flipX":"Flip Horizontal","editor.tooltip.flipY":"Flip Vertical"},s=F,A={"editor.remove":"Remover","editor.copy":"Copiar","editor.words":"PALAVRAS","editor.characters":"CARACTERES","editor.default":"Padrão","editor.recent":"Usado recentemente","editor.nofill":"Sem preenchimento","editor.format":"Format Painter","editor.delete":"Deletar","editor.edit":"Editar","editor.settings":"Configurações","editor.table_of_content":"Tabela de conteúdos","editor.draghandle.tooltip":"Modificar","editor.copyToClipboard":"Copiar para a área de transferência","editor.slash":"Pressione '/' para comandos","editor.slash.empty":"Nenhum resultado","editor.slash.format":"Formato","editor.slash.insert":"Inserir","editor.slash.embed":"Incorporar serviços","editor.content":"Por favor, insira o conteúdo","editor.fontFamily.tooltip":"Fonte","editor.fontFamily.default.tooltip":"Padrão","editor.moremark":"Mais estilos de texto","editor.size.small.tooltip":"Pequeno","editor.size.medium.tooltip":"Médio","editor.size.large.tooltip":"Grande","editor.bold.tooltip":"Negrito","editor.italic.tooltip":"Itálico","editor.underline.tooltip":"Sublinhado","editor.strike.tooltip":"Riscado","editor.color.tooltip":"Cor","editor.color.more":"Mais cores","editor.highlight.tooltip":"Destaque","editor.lineheight.tooltip":"Altura da linha","editor.heading.tooltip":"Cabeçalhos","editor.heading.h1.tooltip":"Cabeçalho 1","editor.heading.h2.tooltip":"Cabeçalho 2","editor.heading.h3.tooltip":"Cabeçalho 3","editor.heading.h4.tooltip":"Cabeçalho 4","editor.heading.h5.tooltip":"Cabeçalho 5","editor.heading.h6.tooltip":"Cabeçalho 6","editor.paragraph.tooltip":"Parágrafo","editor.textalign.tooltip":"Alinhar","editor.textalign.left.tooltip":"Esquerda","editor.textalign.center.tooltip":"Centro","editor.textalign.right.tooltip":"Direita","editor.textalign.justify.tooltip":"Justificar","editor.indent":"Recuo","editor.indent.indent":"Aumentar recuo","editor.indent.outdent":"Diminuir recuo","editor.fontSize.tooltip":"Tamanho da fonte","editor.fontSize.default.tooltip":"Padrão","editor.superscript.tooltip":"Sobrescrito","editor.subscript.tooltip":"Subscrito","editor.bulletlist.tooltip":"Lista de marcadores","editor.orderedlist.tooltip":"Lista numerada","editor.tasklist.tooltip":"Lista de tarefas","editor.indent.tooltip":"Recuo","editor.outdent.tooltip":"Diminuir recuo","editor.columns.tooltip":"Colunas","editor.link.tooltip":"Link","editor.link.unlink.tooltip":"Desvincular","editor.link.open.tooltip":"Abrir link","editor.link.edit.tooltip":"Editar link","editor.link.dialog.title":"Inserir link","editor.link.dialog.link":"Link","editor.link.dialog.text":"Texto","editor.link.dialog.openInNewTab":"Abrir em nova guia","editor.link.dialog.link.placeholder":"Endereço do link","editor.link.dialog.text.placeholder":"Texto do link","editor.link.dialog.button.apply":"Aplicar","editor.image.tooltip":"Imagem","editor.image.dragger.tooltip":"Clique ou arraste a imagem para a área de upload","editor.image.float.left.tooltip":"Flutuar à esquerda","editor.image.float.none.tooltip":"Nenhum flutuante","editor.image.float.right.tooltip":"Flutuar à direita","editor.image.dialog.title":"Adicionar uma imagem","editor.image.dialog.tab.url":"Url","editor.image.dialog.tab.upload":"Enviar","editor.link.dialog.inline":"Inline","editor.image.dialog.tab.uploadCrop":"Enviar e cortar","editor.image.dialog.uploading":"Enviando","editor.image.dialog.form.link":"Link","editor.image.dialog.placeholder":"Link","editor.image.dialog.form.alt":"Alt","editor.image.dialog.form.aspectRatio":"Bloquear proporção original","editor.image.dialog.form.file":"Arquivo","editor.image.dialog.button.apply":"Aplicar","editor.video.tooltip":"Vídeo","editor.video.dialog.tab.upload":"Enviar","editor.video.dialog.uploading":"Enviando","editor.video.dialog.title":"Incorporar ou enviar um vídeo","editor.video.dialog.link":"Link","editor.video.dialog.placeholder":"Link","editor.video.dialog.button.apply":"Aplicar","editor.table.tooltip":"Tabela","editor.table.menu.insert_table":"Inserir tabela","editor.table.menu.insert_table.with_header_row":"Com linha de cabeçalho","editor.table.menu.add_column_before":"Adicionar coluna antes","editor.table.menu.add_column_after":"Adicionar coluna depois","editor.table.menu.delete_column":"Excluir coluna","editor.table.menu.add_row_before":"Adicionar linha antes","editor.table.menu.add_row_after":"Adicionar linha depois","editor.table.menu.delete_row":"Deletar linha","editor.table.menu.merge_or_split_cells":"Mesclar ou dividir células","editor.table.menu.delete_table":"Deletar tabela","editor.blockquote.tooltip":"Citação","editor.horizontalrule.tooltip":"Regra horizontal","editor.code.tooltip":"Código","editor.codeblock.tooltip":"Bloco de código","editor.clear.tooltip":"Limpar formato","editor.undo.tooltip":"Desfazer","editor.redo.tooltip":"Refazer","editor.fullscreen.tooltip.fullscreen":"Tela cheia","editor.fullscreen.tooltip.exit":"Sair da tela cheia","editor.imageUpload.cancel":"Cancelar","editor.imageUpload.crop":"Cortar","editor.imageUpload.fileTypeNotSupported":"Tipo de arquivo não suportado","editor.imageUpload.fileSizeTooBig":"Tamanho do arquivo muito grande, tamanho máximo é","editor.table.menu.insertColumnBefore":"Inserir coluna antes","editor.table.menu.insertColumnAfter":"Inserir coluna depois","editor.table.menu.deleteColumn":"Excluir coluna","editor.table.menu.insertRowAbove":"Inserir linha acima","editor.table.menu.insertRowBelow":"Inserir linha abaixo","editor.table.menu.deleteRow":"Deletar linha","editor.table.menu.mergeCells":"Mesclar células","editor.table.menu.splitCells":"Dividir células","editor.table.menu.deleteTable":"Deletar tabela","editor.table.menu.setCellsBgColor":"Cor de fundo da célula","editor.emoji.tooltip":"Emoji","editor.iframe.tooltip":"Iframe","editor.searchAndReplace.tooltip":"Pesquisar e substituir","editor.search.dialog.text":"Pesquisar","editor.replace.dialog.text":"Substituir","editor.replaceAll.dialog.text":"Substituir tudo","editor.previous.dialog.text":"Anterior","editor.next.dialog.text":"Próximo",no_result_found:"Nenhum resultado encontrado","Smileys & People":"Emoticons & Pessoas","Animals & Nature":"Animais & Natureza","Food & Drink":"Comida & Bebida",Activity:"Atividade","Travel & Places":"Viagem & Lugares",Object:"Objetos",Symbol:"Símbolos",Flags:"Bandeiras","Frequently used":"Frequentemente usado","editor.formula.dialog.text":"Fórmula","editor.katex.tooltip":"Fórmula matemática","editor.exportPdf.tooltip":"Exportar PDF","editor.exportWord.tooltip":"Exportar Word","editor.importWord.tooltip":"Importar Word","editor.importWord.limitSize":"O tamanho do arquivo não pode exceder","editor.importWord.converting":"Convertendo documento do Word, aguarde...","editor.importWord.convertError":"Erro ao analisar documento do Word","editor.importWord.importError":"Erro ao importar documento do Word","editor.textDirection.tooltip":"Direção do texto","editor.textDirection.auto.tooltip":"Automático","editor.textDirection.ltr.tooltip":"Esquerda para Direita","editor.textDirection.rtl.tooltip":"Direita para Esquerda","editor.attachment.tooltip":"Anexo","editor.attachment.uploading":"Enviando","editor.attachment.please_upload":"Por favor, envie o arquivo","editor.imageGif.tooltip":"Gif","editor.replace.caseSensitive":"Sensível a maiúsculas e minúsculas","editor.mermaid.tooltip":"Mermaid","editor.twitter.tooltip":"Twitter","editor.tooltip.flipX":"Inverter Horizontal","editor.tooltip.flipY":"Inverter Vertical"},m=A,C={"editor.remove":"Xóa","editor.copy":"Sao chép","editor.words":"TỪ","editor.characters":"KÝ TỰ","editor.default":"Mặc định","editor.recent":"Đã sử dụng gần đây","editor.nofill":"Không tô","editor.format":"Format Painter","editor.delete":"Xóa","editor.edit":"Chỉnh sửa","editor.settings":"Cài đặt","editor.table_of_content":"Mục lục","editor.draghandle.tooltip":"Sửa đổi","editor.copyToClipboard":"CopyToClipboard","editor.slash":"Nhấn '/' để biết lệnh","editor.slash.empty":"Không có kết quả","editor.slash.format":"Định dạng","editor.slash.insert":"Chèn","editor.slash.embed":"Dịch vụ nhúng","editor.content":"Vui lòng nhập nội dung","editor.moremark":"Nhiều kiểu văn bản hơn","editor.size.small.tooltip":"Nhỏ","editor.fontFamily.tooltip":"Phông chữ","editor.fontFamily.default.tooltip":"Mặc định","editor.size.medium.tooltip":"Trung bình","editor.size.large.tooltip":"Lớn","editor.bold.tooltip":"Đậm","editor.italic.tooltip":"In nghiêng","editor.underline.tooltip":"Gạch chân","editor.strike.tooltip":"Gạch","editor.color.tooltip":"Màu","editor.color.more":"Nhiều màu hơn","editor.highlight.tooltip":"Đánh dấu","editor.lineheight.tooltip":"Chiều cao dòng","editor.heading.tooltip":"Tiêu đề","editor.heading.h1.tooltip":"Tiêu đề 1","editor.heading.h2.tooltip":"Tiêu đề 2","editor.heading.h3.tooltip":"Tiêu đề 3","editor.heading.h4.tooltip":"Tiêu đề 4","editor.heading.h5.tooltip":"Tiêu đề 5","editor.heading.h6.tooltip":"Tiêu đề 6","editor.paragraph.tooltip":"Đoạn văn","editor.textalign.tooltip":"Căn chỉnh","editor.textalign.left.tooltip":"Trái","editor.textalign.center.tooltip":"Giữa","editor.textalign.right.tooltip":"Phải","editor.textalign.justify.tooltip":"Căn đều","editor.indent":"Thụt lề","editor.indent.indent":"Tăng thụt lề","editor.indent.outdent":"Giảm thụt lề","editor.fontSize.tooltip":"Kích thước phông chữ","editor.fontSize.default.tooltip":"Mặc định","editor.superscript.tooltip":"Chỉ số trên","editor.subscript.tooltip":"Chỉ số dưới","editor.bulletlist.tooltip":"Danh sách dấu đầu dòng","editor.orderedlist.tooltip":"Danh sách có thứ tự","editor.tasklist.tooltip":"Danh sách tác vụ","editor.indent.tooltip":"Tăng thụt lề","editor.outdent.tooltip":"Giảm thụt lề","editor.columns.tooltip":"Cột","editor.link.tooltip":"Liên kết","editor.link.unlink.tooltip":"Hủy liên kết","editor.link.open.tooltip":"Mở liên kết","editor.link.edit.tooltip":"Chỉnh sửa liên kết","editor.link.dialog.title":"Chèn liên kết","editor.link.dialog.link":"Liên kết","editor.link.dialog.text":"Văn bản","editor.link.dialog.openInNewTab":"Mở trong tab mới","editor.link.dialog.link.placeholder":"Địa chỉ liên kết","editor.link.dialog.text.placeholder":"Thêm mô tả","editor.link.dialog.button.apply":"Áp dụng","editor.image.tooltip":"Hình ảnh","editor.image.dragger.tooltip":"Nhấp hoặc kéo hình ảnh đến khu vực để tải lên","editor.image.float.left.tooltip":"Trôi sang trái","editor.image.float.none.tooltip":"Trôi không","editor.image.float.right.tooltip":"Trôi sang phải","editor.image.dialog.title":"Thêm hình ảnh","editor.image.dialog.tab.url":"Url","editor.image.dialog.tab.upload":"Tải lên","editor.link.dialog.inline":"Inline","editor.image.dialog.tab.uploadCrop":"Tải lên & Cắt","editor.image.dialog.uploading":"Đang tải lên","editor.image.dialog.form.link":"Liên kết","editor.image.dialog.placeholder":"Liên kết","editor.image.dialog.form.alt":"Alt","editor.image.dialog.form.aspectRatio":"Khóa tỷ lệ khung hình gốc","editor.image.dialog.form.file":"Tệp","editor.image.dialog.button.apply":"Áp dụng","editor.video.tooltip":"Video","editor.video.dialog.tab.upload":"Tải lên","editor.video.dialog.uploading":"Đang tải lên","editor.video.dialog.title":"Nhúng hoặc tải lên video","editor.video.dialog.link":"Liên kết","editor.video.dialog.placeholder":"Liên kết","editor.video.dialog.button.apply":"Áp dụng","editor.table.tooltip":"Bảng","editor.table.menu.insert_table":"Chèn Bảng","editor.table.menu.insert_table.with_header_row":"Có hàng tiêu đề","editor.table.menu.add_column_before":"Thêm Cột Trước","editor.table.menu.add_column_after":"Thêm Cột Sau","editor.table.menu.delete_column":"Xóa Cột","editor.table.menu.add_row_before":"Thêm Hàng Trước","editor.table.menu.add_row_after":"Thêm Hàng Sau","editor.table.menu.delete_row":"Xóa Hàng","editor.table.menu.merge_or_split_cells":"Gộp Hoặc Tách Ô","editor.table.menu.delete_table":"Xóa Bảng","editor.blockquote.tooltip":"Blockquote","editor.horizontalrule.tooltip":"Quy tắc ngang","editor.code.tooltip":"Mã","editor.codeblock.tooltip":"Khối mã","editor.clear.tooltip":"Xóa định dạng","editor.undo.tooltip":"Hoàn tác","editor.redo.tooltip":"Làm lại","editor.fullscreen.tooltip.fullscreen":"Toàn màn hình","editor.fullscreen.tooltip.exit":"Thoát toàn màn hình","editor.imageUpload.cancel":"Hủy","editor.imageUpload.crop":"Cắt","editor.imageUpload.fileTypeNotSupported":"Loại tệp không được hỗ trợ","editor.imageUpload.fileSizeTooBig":"Kích thước tệp quá lớn, Kích thước tối đa là","editor.table.menu.insertColumnBefore":"Chèn cột trước","editor.table.menu.insertColumnAfter":"Chèn cột sau","editor.table.menu.deleteColumn":"Xóa cột","editor.table.menu.insertRowAbove":"Chèn hàng ở trên","editor.table.menu.insertRowBelow":"Chèn hàng ở dưới","editor.table.menu.deleteRow":"Xóa hàng","editor.table.menu.mergeCells":"Gộp các ô","editor.table.menu.splitCells":"Chia ô","editor.table.menu.deleteTable":"Xóa bảng","editor.table.menu.setCellsBgColor":"Màu nền ô","editor.emoji.tooltip":"Biểu tượng","editor.iframe.tooltip":"Iframe","editor.searchAndReplace.tooltip":"Tìm kiếm và thay thế","editor.search.dialog.text":"Tìm kiếm","editor.replace.dialog.text":"Thay thế","editor.replaceAll.dialog.text":"Thay thế tất cả","editor.previous.dialog.text":"Trước","editor.next.dialog.text":"Tiếp theo",no_result_found:"Không tìm thấy kết quả","Smileys & People":"Cười & Mọi người","Animals & Nature":"Động vật & Thiên nhiên","Food & Drink":"Thức ăn & Đồ uống",Activity:"Hoạt động","Travel & Places":"Du lịch & Địa điểm",Object:"Vật",Symbol:"Ký hiệu",Flags:"Cờ","Frequently used":"Thường xuyên sử dụng","editor.formula.dialog.text":"Công thức","editor.katex.tooltip":"Công thức toán học","editor.exportPdf.tooltip":"Xuất PDF","editor.exportWord.tooltip":"Xuất Word","editor.importWord.tooltip":"Nhập Word","editor.importWord.limitSize":"Kích thước tệp không được vượt quá","editor.importWord.converting":"Đang chuyển đổi tài liệu Word, vui lòng đợi...","editor.importWord.convertError":"Lỗi khi phân tích tài liệu Word","editor.importWord.importError":"Lỗi khi nhập tài liệu Word","editor.textDirection.tooltip":"Hướng văn bản","editor.textDirection.auto.tooltip":"Tự động","editor.textDirection.ltr.tooltip":"Trái sang Phải","editor.textDirection.rtl.tooltip":"Phải sang Trái","editor.attachment.tooltip":"Đính kèm","editor.attachment.uploading":"Đang tải lên","editor.attachment.please_upload":"Vui lòng tải lên tệp","editor.imageGif.tooltip":"Gif","editor.replace.caseSensitive":"Phân biệt chữ hoa chữ thường","editor.mermaid.tooltip":"Mermaid","editor.twitter.tooltip":"Twitter","editor.tooltip.flipX":"Lật Ngang","editor.tooltip.flipY":"Lật Dọc"},g=C,E={"editor.remove":"移除","editor.copy":"复制","editor.words":"字数","editor.characters":"字符数","editor.default":"默认","editor.recent":"最近使用","editor.nofill":"无填充","editor.format":"格式刷","editor.delete":"删除","editor.edit":"编辑","editor.settings":"设置","editor.table_of_content":"目录","editor.draghandle.tooltip":"修改","editor.copyToClipboard":"复制到剪贴板","editor.slash":"按 '/' 使用命令","editor.slash.empty":"无结果","editor.slash.format":"格式","editor.slash.insert":"插入","editor.slash.embed":"嵌入服务","editor.content":"请输入内容","editor.fontFamily.tooltip":"字体","editor.fontFamily.default.tooltip":"默认","editor.moremark":"更多文本样式","editor.size.small.tooltip":"小","editor.size.medium.tooltip":"中","editor.size.large.tooltip":"封面","editor.bold.tooltip":"粗体","editor.italic.tooltip":"斜体","editor.underline.tooltip":"下划线","editor.strike.tooltip":"删除线","editor.color.tooltip":"颜色","editor.color.more":"更多颜色","editor.highlight.tooltip":"高亮","editor.lineheight.tooltip":"行高","editor.heading.tooltip":"标题","editor.heading.h1.tooltip":"标题 1","editor.heading.h2.tooltip":"标题 2","editor.heading.h3.tooltip":"标题 3","editor.heading.h4.tooltip":"标题 4","editor.heading.h5.tooltip":"标题 5","editor.heading.h6.tooltip":"标题 6","editor.paragraph.tooltip":"段落","editor.textalign.tooltip":"对齐","editor.textalign.left.tooltip":"左对齐","editor.textalign.center.tooltip":"居中","editor.textalign.right.tooltip":"右对齐","editor.textalign.justify.tooltip":"两端对齐","editor.indent":"缩进","editor.indent.indent":"增加缩进","editor.indent.outdent":"减少缩进","editor.fontSize.tooltip":"字号","editor.fontSize.default.tooltip":"默认","editor.superscript.tooltip":"上标","editor.subscript.tooltip":"下标","editor.bulletlist.tooltip":"无序列表","editor.orderedlist.tooltip":"有序列表","editor.tasklist.tooltip":"任务列表","editor.indent.tooltip":"缩进","editor.outdent.tooltip":"减少缩进","editor.columns.tooltip":"列","editor.link.tooltip":"链接","editor.link.unlink.tooltip":"取消链接","editor.link.open.tooltip":"打开链接","editor.link.edit.tooltip":"编辑链接","editor.link.dialog.title":"插入链接","editor.link.dialog.link":"链接","editor.link.dialog.text":"文本","editor.link.dialog.openInNewTab":"在新标签页中打开","editor.link.dialog.link.placeholder":"链接地址","editor.link.dialog.text.placeholder":"添加描述","editor.link.dialog.button.apply":"应用","editor.image.tooltip":"图片","editor.image.dragger.tooltip":"点击或拖拽图片到此区域上传","editor.image.float.left.tooltip":"左浮动","editor.image.float.none.tooltip":"无浮动","editor.image.float.right.tooltip":"右浮动","editor.image.dialog.title":"添加图片","editor.image.dialog.tab.url":"链接","editor.image.dialog.tab.upload":"上传","editor.link.dialog.inline":"Inline","editor.image.dialog.uploading":"上传中","editor.image.dialog.form.link":"链接","editor.image.dialog.placeholder":"链接","editor.image.dialog.form.alt":"替代文本","editor.image.dialog.form.aspectRatio":"锁定原始宽高比","editor.image.dialog.form.file":"文件","editor.image.dialog.button.apply":"应用","editor.video.tooltip":"视频","editor.video.dialog.tab.upload":"上传","editor.image.dialog.tab.uploadCrop":"上传并裁剪","editor.video.dialog.uploading":"上传中","editor.video.dialog.title":"嵌入或上传视频","editor.video.dialog.link":"链接","editor.video.dialog.placeholder":"链接","editor.video.dialog.button.apply":"应用","editor.table.tooltip":"表格","editor.table.menu.insert_table":"插入表格","editor.table.menu.insert_table.with_header_row":"带标题行","editor.table.menu.add_column_before":"在前面插入列","editor.table.menu.add_column_after":"在后面插入列","editor.table.menu.delete_column":"删除列","editor.table.menu.add_row_before":"在上方插入行","editor.table.menu.add_row_after":"在下方插入行","editor.table.menu.delete_row":"删除行","editor.table.menu.merge_or_split_cells":"合并或拆分单元格","editor.table.menu.delete_table":"删除表格","editor.blockquote.tooltip":"引用","editor.horizontalrule.tooltip":"水平线","editor.code.tooltip":"代码","editor.codeblock.tooltip":"代码块","editor.clear.tooltip":"清除格式","editor.undo.tooltip":"撤销","editor.redo.tooltip":"重做","editor.fullscreen.tooltip.fullscreen":"全屏","editor.fullscreen.tooltip.exit":"退出全屏","editor.imageUpload.cancel":"取消","editor.imageUpload.crop":"裁剪","editor.imageUpload.fileTypeNotSupported":"不支持的文件类型","editor.imageUpload.fileSizeTooBig":"文件大小超出限制,最大大小为","editor.table.menu.insertColumnBefore":"在前面插入列","editor.table.menu.insertColumnAfter":"在后面插入列","editor.table.menu.deleteColumn":"删除列","editor.table.menu.insertRowAbove":"在上方插入行","editor.table.menu.insertRowBelow":"在下方插入行","editor.table.menu.deleteRow":"删除行","editor.table.menu.mergeCells":"合并单元格","editor.table.menu.splitCells":"拆分单元格","editor.table.menu.deleteTable":"删除表格","editor.table.menu.setCellsBgColor":"设置单元格背景色","editor.emoji.tooltip":"表情","editor.iframe.tooltip":"内嵌框架","editor.searchAndReplace.tooltip":"搜索和替换","editor.search.dialog.text":"搜索","editor.replace.dialog.text":"替换","editor.replaceAll.dialog.text":"全部替换","editor.previous.dialog.text":"上一个","editor.next.dialog.text":"下一个",no_result_found:"未找到结果","Smileys & People":"笑脸和人","Animals & Nature":"动物和自然","Food & Drink":"食物和饮料",Activity:"活动","Travel & Places":"旅行和地点",Object:"物体",Symbol:"符号",Flags:"旗帜","Frequently used":"常用","editor.formula.dialog.text":"公式","editor.katex.tooltip":"数学公式","editor.exportPdf.tooltip":"导出 PDF","editor.exportWord.tooltip":"导出 Word","editor.importWord.tooltip":"导入 Word","editor.importWord.limitSize":"文件大小不能超过","editor.importWord.converting":"正在转换 Word 文档,请稍后...","editor.importWord.convertError":"解析 Word 文档出错","editor.importWord.importError":"导入 Word 文档出错","editor.textDirection.tooltip":"文本方向","editor.textDirection.auto.tooltip":"自动","editor.textDirection.ltr.tooltip":"从左到右","editor.textDirection.rtl.tooltip":"从右到左","editor.attachment.tooltip":"附件","editor.attachment.uploading":"上传中","editor.attachment.please_upload":"请上传文件","editor.imageGif.tooltip":"Gif","editor.replace.caseSensitive":"区分大小写","editor.mermaid.tooltip":"Mermaid","editor.twitter.tooltip":"Twitter","editor.tooltip.flipX":"水平翻转","editor.tooltip.flipY":"垂直翻转"},u=E,v={"editor.remove":"Eltávolítás","editor.copy":"Másolás","editor.words":"SZAVAK","editor.characters":"KARAKTEREK","editor.default":"Alapértelmezett","editor.recent":"Gyakran használt","editor.nofill":"Kitöltés törlése","editor.format":"Formátummásoló","editor.delete":"Törlés","editor.edit":"Szerkesztés","editor.settings":"Beállítások","editor.table_of_content":"Tartalomjegyzék","editor.draghandle.tooltip":"Módosítás","editor.copyToClipboard":"Másolás vágólapra","editor.slash":"Nyomja meg a '/' gombot a parancsokhoz","editor.slash.empty":"Nincs találat","editor.slash.format":"Formátum","editor.slash.insert":"Beszúrás","editor.slash.embed":"Szolgáltatások beágyazása","editor.content":"Írjon be tartalmat","editor.fontFamily.tooltip":"Betűtípus","editor.fontFamily.default.tooltip":"Alapértelmezett","editor.moremark":"Több betűstílus","editor.size.small.tooltip":"Kicsi","editor.size.medium.tooltip":"Közepes","editor.size.large.tooltip":"Borítókép","editor.bold.tooltip":"Félkövér","editor.italic.tooltip":"Dőlt betű","editor.underline.tooltip":"Aláhúzott","editor.strike.tooltip":"Áthúzott","editor.color.tooltip":"Szín","editor.color.more":"Több szín","editor.highlight.tooltip":"Kiemelés","editor.lineheight.tooltip":"Sorköz","editor.heading.tooltip":"Fejlécek","editor.heading.h1.tooltip":"Fejléc 1","editor.heading.h2.tooltip":"Fejléc 2","editor.heading.h3.tooltip":"Fejléc 3","editor.heading.h4.tooltip":"Fejléc 4","editor.heading.h5.tooltip":"Fejléc 5","editor.heading.h6.tooltip":"Fejléc 6","editor.paragraph.tooltip":"Bekezdés","editor.textalign.tooltip":"Igazítás","editor.textalign.left.tooltip":"Bal","editor.textalign.center.tooltip":"Közép","editor.textalign.right.tooltip":"Jobb","editor.textalign.justify.tooltip":"Sorkizárt","editor.indent":"Behúzás","editor.indent.indent":"Behúzás Növelése","editor.indent.outdent":"Behúzás Csökkentése","editor.fontSize.tooltip":"Betűméret","editor.fontSize.default.tooltip":"Alapértelmezett","editor.superscript.tooltip":"Felső index","editor.subscript.tooltip":"Alsó index","editor.bulletlist.tooltip":"Felsorolás","editor.orderedlist.tooltip":"Rendezett lista","editor.tasklist.tooltip":"Feladat lista","editor.indent.tooltip":"Behúzás növelése","editor.outdent.tooltip":"Behúzás csökkentése","editor.columns.tooltip":"Oszlopok","editor.link.tooltip":"Link","editor.link.unlink.tooltip":"Link törlése","editor.link.open.tooltip":"Link megnyitása","editor.link.edit.tooltip":"Link szerkesztése","editor.link.dialog.title":"Link beszúrása","editor.link.dialog.link":"Link","editor.link.dialog.text":"Szöveg","editor.link.dialog.openInNewTab":"Megnyitás új lapon","editor.link.dialog.link.placeholder":"Link célpont","editor.link.dialog.text.placeholder":"Szöveg","editor.link.dialog.button.apply":"Alkalmaz","editor.image.tooltip":"Kép","editor.image.dragger.tooltip":"Kattintson vagy húzza a feltölteni kívánt képet a területre","editor.image.float.left.tooltip":"Lebegtetés balra","editor.image.float.none.tooltip":"Lebegtetés törlése","editor.image.float.right.tooltip":"Lebegtetés jobbra","editor.image.dialog.title":"Kép hozzáadása","editor.image.dialog.tab.url":"URL","editor.image.dialog.tab.upload":"Feltöltés","editor.image.dialog.tab.uploadCrop":"Feltöltés és körbevágás","editor.image.dialog.uploading":"Feltöltés alatt","editor.link.dialog.inline":"Soron belüli","editor.image.dialog.form.link":"Link","editor.image.dialog.placeholder":"Link","editor.image.dialog.form.alt":"Alternatív szöveg","editor.image.dialog.form.aspectRatio":"Eredeti képarány megtartása","editor.image.dialog.form.file":"Fájl","editor.image.dialog.button.apply":"Alkalmaz","editor.video.tooltip":"Videó","editor.video.dialog.tab.upload":"Feltöltés","editor.video.dialog.uploading":"Feltöltés alatt","editor.video.dialog.title":"Videó beágyazása vagy feltöltése","editor.video.dialog.link":"Link","editor.video.dialog.placeholder":"Link","editor.video.dialog.button.apply":"Alkalmaz","editor.table.tooltip":"Táblázat","editor.table.menu.insert_table":"Táblázat beszúrása","editor.table.menu.insert_table.with_header_row":"Fejléc sorral","editor.table.menu.add_column_before":"Oszlop beszúrása balra","editor.table.menu.add_column_after":"Oszlop beszúrása jobbra","editor.table.menu.delete_column":"Oszlop törlése","editor.table.menu.add_row_before":"Sor beszúrása felülre","editor.table.menu.add_row_after":"Sor beszúrása alulra","editor.table.menu.delete_row":"Sor törlése","editor.table.menu.merge_or_split_cells":"Cellák egyesítése vagy szétválasztása","editor.table.menu.delete_table":"Táblázat törlése","editor.blockquote.tooltip":"Blokkidézet","editor.horizontalrule.tooltip":"Vízszintes vonal","editor.code.tooltip":"Kód","editor.codeblock.tooltip":"Kód Blokk","editor.clear.tooltip":"Formatálás Törlése","editor.undo.tooltip":"Visszavonás","editor.redo.tooltip":"Visszaállítás","editor.fullscreen.tooltip.fullscreen":"Teljes képernyős mód","editor.fullscreen.tooltip.exit":"Kilépés teljes képernyős módból","editor.imageUpload.cancel":"Mégsem","editor.imageUpload.crop":"Körbevágás","editor.imageUpload.fileTypeNotSupported":"Fájltípus nem támogatott","editor.imageUpload.fileSizeTooBig":"A fájlméret túl nagy, a maximum méret","editor.table.menu.insertColumnBefore":"Oszlop beszúrása balra","editor.table.menu.insertColumnAfter":"Oszlop beszúrása jobbra","editor.table.menu.deleteColumn":"Oszlop törlése","editor.table.menu.insertRowAbove":"Sor beszúrása felülre","editor.table.menu.insertRowBelow":"Sor beszúrása alulra","editor.table.menu.deleteRow":"Sor törlése","editor.table.menu.mergeCells":"Cellák egyesítése","editor.table.menu.splitCells":"Cellék szétválasztása","editor.table.menu.deleteTable":"Táblázat törlése","editor.table.menu.setCellsBgColor":"Cella háttérszín","editor.emoji.tooltip":"Emoji","editor.iframe.tooltip":"Beágyazás","editor.searchAndReplace.tooltip":"Keresés és csere","editor.search.dialog.text":"Keres","editor.replace.dialog.text":"Csere","editor.replaceAll.dialog.text":"Összes cseréje","editor.previous.dialog.text":"Előző","editor.next.dialog.text":"Következő",no_result_found:"Nincs találat","Smileys & People":"Arcok és emberek","Animals & Nature":"Állatok és természet","Food & Drink":"Étel és ital",Activity:"Aktivitás","Travel & Places":"Utazás és helyek",Object:"Tárgyak",Symbol:"Szimbólumok",Flags:"Zászlók","Frequently used":"Gyakran használt","editor.formula.dialog.text":"Formula","editor.katex.tooltip":"Matematikai formula","editor.exportPdf.tooltip":"PDF exportálása","editor.exportWord.tooltip":"Word exportálása","editor.importWord.tooltip":"Word importálása","editor.importWord.limitSize":"A fájl mérete nem haladhatja meg","editor.importWord.converting":"Word dokumentum konvertálása, kérjük, várjon...","editor.importWord.convertError":"Hiba a Word-dokumentum elemzésekor","editor.importWord.importError":"Hiba a Word dokumentum importálásakor","editor.textDirection.tooltip":"Szövegirány","editor.textDirection.auto.tooltip":"Automatikus","editor.textDirection.ltr.tooltip":"Balról jobbra","editor.textDirection.rtl.tooltip":"Jobbról balra","editor.attachment.tooltip":"Csatolmány","editor.attachment.uploading":"Feltöltés alatt","editor.attachment.please_upload":"Töltse fel a fájlt","editor.imageGif.tooltip":"Gif","editor.replace.caseSensitive":"Kisbetű-nagybetű érzékenység","editor.mermaid.tooltip":"Mermaid","editor.twitter.tooltip":"Twitter","editor.tooltip.flipX":"Vízszintes tükrözés","editor.tooltip.flipY":"Függőleges tükrözés"},c=v,x="en",z=200,L=z-80,D=20,y=1e5,S=16,I=10,B=10,w=2,R=["#000000","#262626","#595959","#8C8C8C","#BFBFBF","#D9D9D9","#E9E9E9","#F5F5F5","#FAFAFA","#FFFFFF","#F5222D","#FA541C","#FA8C16","#FADB14","#52C41A","#13C2C2","#1890FF","#2F54EB","#722ED1","#EB2F96","#FFE8E6","#FFECE0","#FFEFD1","#FCFCCA","#E4F7D2","#D3F5F0","#D4EEFC","#DEE8FC","#EFE1FA","#FAE1EB","#FFA39E","#FFBB96","#FFD591","#FFFB8F","#B7EB8F","#87E8DE","#91D5FF","#ADC6FF","#D3ADF7","#FFADD2","#FF4D4F","#FF7A45","#FFA940","#FFEC3D","#73D13D","#36CFC9","#40A9FF","#597EF7","#9254DE","#F759AB","#CF1322","#D4380D","#D46B08","#D4B106","#389E0D","#08979C","#096DD9","#1D39C4","#531DAB","#C41D7F","#820014","#871400","#873800","#614700","#135200","#00474F","#003A8C","#061178","#22075E","#780650"],U=["Inter","Comic Sans MS, Comic Sans","serif","cursive","Arial","Arial Black","Georgia","Impact","Tahoma","Times New Roman","Verdana","Courier New","Lucida Console","Monaco","monospace"],W=["html","css","js","ts","bash"],N={html:"HTML",css:"CSS",js:"JavaScript",ts:"TypeScript",bash:"Bash"},M=["10px","11px","12px","14px","16px","18px","20px","22px","24px","26px","28px","36px","48px","72px"],P="default";var h=(e=>(e[e["size-small"]=200]="size-small",e[e["size-medium"]=500]="size-medium",e["size-large"]="100%",e))(h||{}),b=(e=>(e[e["size-small"]=480]="size-small",e[e["size-medium"]=640]="size-medium",e["size-large"]="100%",e))(b||{});const j=["100%","115%","150%","200%","250%","300%"],H="1",O=["bold","italic","underline","strike","code","link","divider","color","highlight","textAlign"],i={lang:x,message:{en:s,hu_HU:c,vi:g,zh_CN:u,pt_BR:m}};class G{constructor(){a(this,"emitter");this.emitter=T.mitt()}get lang(){return i.lang}set lang(t){if(!this.isLangSupported(t)){console.warn(`Can't find the current language "${t}", Using language "${i.lang}" by default`);return}i.lang=t,this.emitter.emit("lang",t)}get message(){return i.message}set message(t){i.message=t}loadLangMessage(t){return this.message[t]}isLangSupported(t){return Object.keys(this.message).includes(t)}setLang(t){this.lang=t}registerWatchLang(t){return this.emitter.on("lang",t),{unsubscribe:()=>{this.emitter.off("lang",t)}}}setMessage(t,o){this.message[t]=o}buildLocalesHandler(t){t||(t=this.lang);const o=this.loadLangMessage(t);return function(r){return o[r]||r}}}const l=new G,f=p.g(i.lang);function q(){const[e,t]=p.A(f),o=n.useMemo(()=>l.buildLocalesHandler(e),[e]);return n.useEffect(()=>{const d=l.registerWatchLang(r=>{t(r)});return()=>{d.unsubscribe()}},[]),{lang:e,t:o}}const K={t:e=>l.buildLocalesHandler(f.get())(e)},X=l;exports.BUBBLE_TEXT_LIST=O;exports.COLORS_LIST=R;exports.DEFAULT_FONT_FAMILY_LIST=U;exports.DEFAULT_FONT_SIZE_LIST=M;exports.DEFAULT_FONT_SIZE_VALUE=P;exports.DEFAULT_LANGUAGE_CODE_BLOCK=W;exports.DEFAULT_LINE_HEIGHT=H;exports.DEFAULT_LINE_HEIGHT_LIST=j;exports.EDITOR_UPDATE_WATCH_THROTTLE_WAIT_TIME=L;exports.IMAGE_MAX_SIZE=y;exports.IMAGE_MIN_SIZE=D;exports.IMAGE_SIZE=h;exports.IMAGE_THROTTLE_WAIT_TIME=S;exports.MAP_LANGUAGE_CODE_LABELS=N;exports.TABLE_DEFAULT_SELECTED_GRID_SIZE=w;exports.TABLE_INIT_GRID_SIZE=I;exports.TABLE_MAX_GRID_SIZE=B;exports.VIDEO_SIZE=b;exports.en=s;exports.hu_HU=c;exports.locale=X;exports.localeActions=K;exports.pt_BR=m;exports.useLocale=q;exports.vi=g;exports.zh_CN=u;
|
package/lib/tiptap-BWShr3Ps.cjs
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
"use strict";var je=Object.defineProperty;var Fe=(e,t,n)=>t in e?je(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var et=(e,t,n)=>Fe(e,typeof t!="symbol"?t+"":t,n);const me=require("tippy.js"),m=require("./vendor-DhcRzB9P.cjs"),A=require("react"),ge=require("react-dom");function ut(e){const{state:t,transaction:n}=e;let{selection:r}=n,{doc:s}=n,{storedMarks:o}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return o},get selection(){return r},get doc(){return s},get tr(){return r=n.selection,s=n.doc,o=n.storedMarks,n}}}class pt{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:n,state:r}=this,{view:s}=n,{tr:o}=r,i=this.buildProps(o);return Object.fromEntries(Object.entries(t).map(([a,c])=>[a,(...u)=>{const d=c(...u)(i);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(o),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,n=!0){const{rawCommands:r,editor:s,state:o}=this,{view:i}=s,a=[],c=!!t,l=t||o.tr,u=()=>(!c&&n&&!l.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(l),a.every(p=>p===!0)),d={...Object.fromEntries(Object.entries(r).map(([p,h])=>[p,(...g)=>{const y=this.buildProps(l,n),v=h(...g)(y);return a.push(v),d}])),run:u};return d}createCan(t){const{rawCommands:n,state:r}=this,s=!1,o=t||r.tr,i=this.buildProps(o,s);return{...Object.fromEntries(Object.entries(n).map(([c,l])=>[c,(...u)=>l(...u)({...i,dispatch:void 0})])),chain:()=>this.createChain(o,s)}}buildProps(t,n=!0){const{rawCommands:r,editor:s,state:o}=this,{view:i}=s,a={tr:t,editor:s,view:i,state:ut({state:o,transaction:t}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(t,n),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(r).map(([c,l])=>[c,(...u)=>l(...u)(a)]))}};return a}}class ze{constructor(){this.callbacks={}}on(t,n){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(n),this}emit(t,...n){const r=this.callbacks[t];return r&&r.forEach(s=>s.apply(this,n)),this}off(t,n){const r=this.callbacks[t];return r&&(n?this.callbacks[t]=r.filter(s=>s!==n):delete this.callbacks[t]),this}once(t,n){const r=(...s)=>{this.off(t,r),n.apply(this,s)};return this.on(t,r)}removeAllListeners(){this.callbacks={}}}function w(e,t,n){return e.config[t]===void 0&&e.parent?w(e.parent,t,n):typeof e.config[t]=="function"?e.config[t].bind({...n,parent:e.parent?w(e.parent,t,n):null}):e.config[t]}function ht(e){const t=e.filter(s=>s.type==="extension"),n=e.filter(s=>s.type==="node"),r=e.filter(s=>s.type==="mark");return{baseExtensions:t,nodeExtensions:n,markExtensions:r}}function ye(e){const t=[],{nodeExtensions:n,markExtensions:r}=ht(e),s=[...n,...r],o={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return e.forEach(i=>{const a={name:i.name,options:i.options,storage:i.storage,extensions:s},c=w(i,"addGlobalAttributes",a);if(!c)return;c().forEach(u=>{u.types.forEach(d=>{Object.entries(u.attributes).forEach(([p,h])=>{t.push({type:d,name:p,attribute:{...o,...h}})})})})}),s.forEach(i=>{const a={name:i.name,options:i.options,storage:i.storage},c=w(i,"addAttributes",a);if(!c)return;const l=c();Object.entries(l).forEach(([u,d])=>{const p={...o,...d};typeof(p==null?void 0:p.default)=="function"&&(p.default=p.default()),p!=null&&p.isRequired&&(p==null?void 0:p.default)===void 0&&delete p.default,t.push({type:i.name,name:u,attribute:p})})}),t}function _(e,t){if(typeof e=="string"){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}function O(...e){return e.filter(t=>!!t).reduce((t,n)=>{const r={...t};return Object.entries(n).forEach(([s,o])=>{if(!r[s]){r[s]=o;return}if(s==="class"){const a=o?o.split(" "):[],c=r[s]?r[s].split(" "):[],l=a.filter(u=>!c.includes(u));r[s]=[...c,...l].join(" ")}else if(s==="style"){const a=o?o.split(";").map(u=>u.trim()).filter(Boolean):[],c=r[s]?r[s].split(";").map(u=>u.trim()).filter(Boolean):[],l=new Map;c.forEach(u=>{const[d,p]=u.split(":").map(h=>h.trim());l.set(d,p)}),a.forEach(u=>{const[d,p]=u.split(":").map(h=>h.trim());l.set(d,p)}),r[s]=Array.from(l.entries()).map(([u,d])=>`${u}: ${d}`).join("; ")}else r[s]=o}),r},{})}function lt(e,t){return t.filter(n=>n.type===e.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(e.attrs)||{}:{[n.name]:e.attrs[n.name]}).reduce((n,r)=>O(n,r),{})}function ve(e){return typeof e=="function"}function C(e,t=void 0,...n){return ve(e)?t?e.bind(t)(...n):e(...n):e}function Ve(e={}){return Object.keys(e).length===0&&e.constructor===Object}function We(e){return typeof e!="string"?e:e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):e==="true"?!0:e==="false"?!1:e}function Gt(e,t){return"style"in e?e:{...e,getAttrs:n=>{const r=e.getAttrs?e.getAttrs(n):e.attrs;if(r===!1)return!1;const s=t.reduce((o,i)=>{const a=i.attribute.parseHTML?i.attribute.parseHTML(n):We(n.getAttribute(i.name));return a==null?o:{...o,[i.name]:a}},{});return{...r,...s}}}}function Jt(e){return Object.fromEntries(Object.entries(e).filter(([t,n])=>t==="attrs"&&Ve(n)?!1:n!=null))}function Ke(e,t){var n;const r=ye(e),{nodeExtensions:s,markExtensions:o}=ht(e),i=(n=s.find(l=>w(l,"topNode")))===null||n===void 0?void 0:n.name,a=Object.fromEntries(s.map(l=>{const u=r.filter(v=>v.type===l.name),d={name:l.name,options:l.options,storage:l.storage,editor:t},p=e.reduce((v,S)=>{const b=w(S,"extendNodeSchema",d);return{...v,...b?b(l):{}}},{}),h=Jt({...p,content:C(w(l,"content",d)),marks:C(w(l,"marks",d)),group:C(w(l,"group",d)),inline:C(w(l,"inline",d)),atom:C(w(l,"atom",d)),selectable:C(w(l,"selectable",d)),draggable:C(w(l,"draggable",d)),code:C(w(l,"code",d)),whitespace:C(w(l,"whitespace",d)),linebreakReplacement:C(w(l,"linebreakReplacement",d)),defining:C(w(l,"defining",d)),isolating:C(w(l,"isolating",d)),attrs:Object.fromEntries(u.map(v=>{var S;return[v.name,{default:(S=v==null?void 0:v.attribute)===null||S===void 0?void 0:S.default}]}))}),f=C(w(l,"parseHTML",d));f&&(h.parseDOM=f.map(v=>Gt(v,u)));const g=w(l,"renderHTML",d);g&&(h.toDOM=v=>g({node:v,HTMLAttributes:lt(v,u)}));const y=w(l,"renderText",d);return y&&(h.toText=y),[l.name,h]})),c=Object.fromEntries(o.map(l=>{const u=r.filter(y=>y.type===l.name),d={name:l.name,options:l.options,storage:l.storage,editor:t},p=e.reduce((y,v)=>{const S=w(v,"extendMarkSchema",d);return{...y,...S?S(l):{}}},{}),h=Jt({...p,inclusive:C(w(l,"inclusive",d)),excludes:C(w(l,"excludes",d)),group:C(w(l,"group",d)),spanning:C(w(l,"spanning",d)),code:C(w(l,"code",d)),attrs:Object.fromEntries(u.map(y=>{var v;return[y.name,{default:(v=y==null?void 0:y.attribute)===null||v===void 0?void 0:v.default}]}))}),f=C(w(l,"parseHTML",d));f&&(h.parseDOM=f.map(y=>Gt(y,u)));const g=w(l,"renderHTML",d);return g&&(h.toDOM=y=>g({mark:y,HTMLAttributes:lt(y,u)})),[l.name,h]}));return new m.Schema({topNode:i,nodes:a,marks:c})}function wt(e,t){return t.nodes[e]||t.marks[e]||null}function Yt(e,t){return Array.isArray(t)?t.some(n=>(typeof n=="string"?n:n.name)===e.name):t}function Bt(e,t){const n=m.DOMSerializer.fromSchema(t).serializeFragment(e),s=document.implementation.createHTMLDocument().createElement("div");return s.appendChild(n),s.innerHTML}const Ue=(e,t=500)=>{let n="";const r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(s,o,i,a)=>{var c,l;const u=((l=(c=s.type.spec).toText)===null||l===void 0?void 0:l.call(c,{node:s,pos:o,parent:i,index:a}))||s.textContent||"%leaf%";n+=s.isAtom&&!s.isText?u:u.slice(0,Math.max(0,r-o))}),n};function jt(e){return Object.prototype.toString.call(e)==="[object RegExp]"}class ft{constructor(t){this.find=t.find,this.handler=t.handler}}const qe=(e,t)=>{if(jt(t))return t.exec(e);const n=t(e);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function nt(e){var t;const{editor:n,from:r,to:s,text:o,rules:i,plugin:a}=e,{view:c}=n;if(c.composing)return!1;const l=c.state.doc.resolve(r);if(l.parent.type.spec.code||!((t=l.nodeBefore||l.nodeAfter)===null||t===void 0)&&t.marks.find(p=>p.type.spec.code))return!1;let u=!1;const d=Ue(l)+o;return i.forEach(p=>{if(u)return;const h=qe(d,p.find);if(!h)return;const f=c.state.tr,g=ut({state:c.state,transaction:f}),y={from:r-(h[0].length-o.length),to:s},{commands:v,chain:S,can:b}=new pt({editor:n,state:g});p.handler({state:g,range:y,match:h,commands:v,chain:S,can:b})===null||!f.steps.length||(f.setMeta(a,{transform:f,from:r,to:s,text:o}),c.dispatch(f),u=!0)}),u}function Ge(e){const{editor:t,rules:n}=e,r=new m.Plugin({state:{init(){return null},apply(s,o,i){const a=s.getMeta(r);if(a)return a;const c=s.getMeta("applyInputRules");return!!c&&setTimeout(()=>{let{text:u}=c;typeof u=="string"?u=u:u=Bt(m.Fragment.from(u),i.schema);const{from:d}=c,p=d+u.length;nt({editor:t,from:d,to:p,text:u,rules:n,plugin:r})}),s.selectionSet||s.docChanged?null:o}},props:{handleTextInput(s,o,i,a){return nt({editor:t,from:o,to:i,text:a,rules:n,plugin:r})},handleDOMEvents:{compositionend:s=>(setTimeout(()=>{const{$cursor:o}=s.state.selection;o&&nt({editor:t,from:o.pos,to:o.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(s,o){if(o.key!=="Enter")return!1;const{$cursor:i}=s.state.selection;return i?nt({editor:t,from:i.pos,to:i.pos,text:`
|
|
2
|
-
`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function Je(e){return Object.prototype.toString.call(e).slice(8,-1)}function rt(e){return Je(e)!=="Object"?!1:e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function mt(e,t){const n={...e};return rt(e)&&rt(t)&&Object.keys(t).forEach(r=>{rt(t[r])&&rt(e[r])?n[r]=mt(e[r],t[r]):n[r]=t[r]}),n}class D{constructor(t={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=C(w(this,"addOptions",{name:this.name}))),this.storage=C(w(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new D(t)}configure(t={}){const n=this.extend({...this.config,addOptions:()=>mt(this.options,t)});return n.name=this.name,n.parent=this.parent,n}extend(t={}){const n=new D(t);return n.parent=this,this.child=n,n.name=t.name?t.name:n.parent.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=C(w(n,"addOptions",{name:n.name})),n.storage=C(w(n,"addStorage",{name:n.name,options:n.options})),n}static handleExit({editor:t,mark:n}){const{tr:r}=t.state,s=t.state.selection.$from;if(s.pos===s.end()){const i=s.marks();if(!!!i.find(l=>(l==null?void 0:l.type.name)===n.name))return!1;const c=i.find(l=>(l==null?void 0:l.type.name)===n.name);return c&&r.removeStoredMark(c),r.insertText(" ",s.pos),t.view.dispatch(r),!0}return!1}}function be(e){return typeof e=="number"}class Me{constructor(t){this.find=t.find,this.handler=t.handler}}const Ye=(e,t,n)=>{if(jt(t))return[...e.matchAll(t)];const r=t(e,n);return r?r.map(s=>{const o=[s.text];return o.index=s.index,o.input=e,o.data=s.data,s.replaceWith&&(s.text.includes(s.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),o.push(s.replaceWith)),o}):[]};function Xe(e){const{editor:t,state:n,from:r,to:s,rule:o,pasteEvent:i,dropEvent:a}=e,{commands:c,chain:l,can:u}=new pt({editor:t,state:n}),d=[];return n.doc.nodesBetween(r,s,(h,f)=>{if(!h.isTextblock||h.type.spec.code)return;const g=Math.max(r,f),y=Math.min(s,f+h.content.size),v=h.textBetween(g-f,y-f,void 0,"");Ye(v,o.find,i).forEach(b=>{if(b.index===void 0)return;const M=g+b.index+1,T=M+b[0].length,k={from:n.tr.mapping.map(M),to:n.tr.mapping.map(T)},x=o.handler({state:n,range:k,match:b,commands:c,chain:l,can:u,pasteEvent:i,dropEvent:a});d.push(x)})}),d.every(h=>h!==null)}const Qe=e=>{var t;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(t=n.clipboardData)===null||t===void 0||t.setData("text/html",e),n};function Ze(e){const{editor:t,rules:n}=e;let r=null,s=!1,o=!1,i=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const c=({state:u,from:d,to:p,rule:h,pasteEvt:f})=>{const g=u.tr,y=ut({state:u,transaction:g});if(!(!Xe({editor:t,state:y,from:Math.max(d-1,0),to:p.b-1,rule:h,pasteEvent:f,dropEvent:a})||!g.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return i=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,g}};return n.map(u=>new m.Plugin({view(d){const p=h=>{var f;r=!((f=d.dom.parentElement)===null||f===void 0)&&f.contains(h.target)?d.dom.parentElement:null};return window.addEventListener("dragstart",p),{destroy(){window.removeEventListener("dragstart",p)}}},props:{handleDOMEvents:{drop:(d,p)=>(o=r===d.dom.parentElement,a=p,!1),paste:(d,p)=>{var h;const f=(h=p.clipboardData)===null||h===void 0?void 0:h.getData("text/html");return i=p,s=!!(f!=null&&f.includes("data-pm-slice")),!1}}},appendTransaction:(d,p,h)=>{const f=d[0],g=f.getMeta("uiEvent")==="paste"&&!s,y=f.getMeta("uiEvent")==="drop"&&!o,v=f.getMeta("applyPasteRules"),S=!!v;if(!g&&!y&&!S)return;if(S){let{text:T}=v;typeof T=="string"?T=T:T=Bt(m.Fragment.from(T),h.schema);const{from:k}=v,x=k+T.length,L=Qe(T);return c({rule:u,state:h,from:k,to:{b:x},pasteEvt:L})}const b=p.doc.content.findDiffStart(h.doc.content),M=p.doc.content.findDiffEnd(h.doc.content);if(!(!be(b)||!M||b===M.b))return c({rule:u,state:h,from:b,to:M,pasteEvt:i})}}))}function tn(e){const t=e.filter((n,r)=>e.indexOf(n)!==r);return Array.from(new Set(t))}class Y{constructor(t,n){this.splittableMarks=[],this.editor=n,this.extensions=Y.resolve(t),this.schema=Ke(this.extensions,n),this.setupExtensions()}static resolve(t){const n=Y.sort(Y.flatten(t)),r=tn(n.map(s=>s.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(s=>`'${s}'`).join(", ")}]. This can lead to issues.`),n}static flatten(t){return t.map(n=>{const r={name:n.name,options:n.options,storage:n.storage},s=w(n,"addExtensions",r);return s?[n,...this.flatten(s())]:n}).flat(10)}static sort(t){return t.sort((r,s)=>{const o=w(r,"priority")||100,i=w(s,"priority")||100;return o>i?-1:o<i?1:0})}get commands(){return this.extensions.reduce((t,n)=>{const r={name:n.name,options:n.options,storage:n.storage,editor:this.editor,type:wt(n.name,this.schema)},s=w(n,"addCommands",r);return s?{...t,...s()}:t},{})}get plugins(){const{editor:t}=this,n=Y.sort([...this.extensions].reverse()),r=[],s=[],o=n.map(i=>{const a={name:i.name,options:i.options,storage:i.storage,editor:t,type:wt(i.name,this.schema)},c=[],l=w(i,"addKeyboardShortcuts",a);let u={};if(i.type==="mark"&&w(i,"exitable",a)&&(u.ArrowRight=()=>D.handleExit({editor:t,mark:i})),l){const g=Object.fromEntries(Object.entries(l()).map(([y,v])=>[y,()=>v({editor:t})]));u={...u,...g}}const d=m.keymap(u);c.push(d);const p=w(i,"addInputRules",a);Yt(i,t.options.enableInputRules)&&p&&r.push(...p());const h=w(i,"addPasteRules",a);Yt(i,t.options.enablePasteRules)&&h&&s.push(...h());const f=w(i,"addProseMirrorPlugins",a);if(f){const g=f();c.push(...g)}return c}).flat();return[Ge({editor:t,rules:r}),...Ze({editor:t,rules:s}),...o]}get attributes(){return ye(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:n}=ht(this.extensions);return Object.fromEntries(n.filter(r=>!!w(r,"addNodeView")).map(r=>{const s=this.attributes.filter(c=>c.type===r.name),o={name:r.name,options:r.options,storage:r.storage,editor:t,type:_(r.name,this.schema)},i=w(r,"addNodeView",o);if(!i)return[];const a=(c,l,u,d,p)=>{const h=lt(c,s);return i()({node:c,view:l,getPos:u,decorations:d,innerDecorations:p,editor:t,extension:r,HTMLAttributes:h})};return[r.name,a]}))}setupExtensions(){this.extensions.forEach(t=>{var n;this.editor.extensionStorage[t.name]=t.storage;const r={name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:wt(t.name,this.schema)};t.type==="mark"&&(!((n=C(w(t,"keepOnSplit",r)))!==null&&n!==void 0)||n)&&this.splittableMarks.push(t.name);const s=w(t,"onBeforeCreate",r),o=w(t,"onCreate",r),i=w(t,"onUpdate",r),a=w(t,"onSelectionUpdate",r),c=w(t,"onTransaction",r),l=w(t,"onFocus",r),u=w(t,"onBlur",r),d=w(t,"onDestroy",r);s&&this.editor.on("beforeCreate",s),o&&this.editor.on("create",o),i&&this.editor.on("update",i),a&&this.editor.on("selectionUpdate",a),c&&this.editor.on("transaction",c),l&&this.editor.on("focus",l),u&&this.editor.on("blur",u),d&&this.editor.on("destroy",d)})}}class H{constructor(t={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=C(w(this,"addOptions",{name:this.name}))),this.storage=C(w(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new H(t)}configure(t={}){const n=this.extend({...this.config,addOptions:()=>mt(this.options,t)});return n.name=this.name,n.parent=this.parent,n}extend(t={}){const n=new H({...this.config,...t});return n.parent=this,this.child=n,n.name=t.name?t.name:n.parent.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=C(w(n,"addOptions",{name:n.name})),n.storage=C(w(n,"addStorage",{name:n.name,options:n.options})),n}}function Se(e,t,n){const{from:r,to:s}=t,{blockSeparator:o=`
|
|
3
|
-
|
|
4
|
-
`,textSerializers:i={}}=n||{};let a="";return e.nodesBetween(r,s,(c,l,u,d)=>{var p;c.isBlock&&l>r&&(a+=o);const h=i==null?void 0:i[c.type.name];if(h)return u&&(a+=h({node:c,pos:l,parent:u,index:d,range:t})),!1;c.isText&&(a+=(p=c==null?void 0:c.text)===null||p===void 0?void 0:p.slice(Math.max(r,l)-l,s-l))}),a}function ke(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,t])=>t.spec.toText).map(([t,n])=>[t,n.spec.toText]))}const en=H.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new m.Plugin({key:new m.PluginKey("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:s}=t,{ranges:o}=s,i=Math.min(...o.map(u=>u.$from.pos)),a=Math.max(...o.map(u=>u.$to.pos)),c=ke(n);return Se(r,{from:i,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:c})}}})]}}),nn=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),(n=window==null?void 0:window.getSelection())===null||n===void 0||n.removeAllRanges())}),!0),rn=(e=!1)=>({commands:t})=>t.setContent("",e),sn=()=>({state:e,tr:t,dispatch:n})=>{const{selection:r}=t,{ranges:s}=r;return n&&s.forEach(({$from:o,$to:i})=>{e.doc.nodesBetween(o.pos,i.pos,(a,c)=>{if(a.type.isText)return;const{doc:l,mapping:u}=t,d=l.resolve(u.map(c)),p=l.resolve(u.map(c+a.nodeSize)),h=d.blockRange(p);if(!h)return;const f=m.liftTarget(h);if(a.type.isTextblock){const{defaultType:g}=d.parent.contentMatchAt(d.index());t.setNodeMarkup(h.start,g)}(f||f===0)&&t.lift(h,f)})}),!0},on=e=>t=>e(t),an=()=>({state:e,dispatch:t})=>m.createParagraphNear(e,t),ln=(e,t)=>({editor:n,tr:r})=>{const{state:s}=n,o=s.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);const i=r.mapping.map(t);return r.insert(i,o.content),r.setSelection(new m.TextSelection(r.doc.resolve(i-1))),!0},cn=()=>({tr:e,dispatch:t})=>{const{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;const s=e.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===r.type){if(t){const a=s.before(o),c=s.after(o);e.delete(a,c).scrollIntoView()}return!0}return!1},dn=e=>({tr:t,state:n,dispatch:r})=>{const s=_(e,n.schema),o=t.selection.$anchor;for(let i=o.depth;i>0;i-=1)if(o.node(i).type===s){if(r){const c=o.before(i),l=o.after(i);t.delete(c,l).scrollIntoView()}return!0}return!1},un=e=>({tr:t,dispatch:n})=>{const{from:r,to:s}=e;return n&&t.delete(r,s),!0},pn=()=>({state:e,dispatch:t})=>m.deleteSelection(e,t),hn=()=>({commands:e})=>e.keyboardShortcut("Enter"),fn=()=>({state:e,dispatch:t})=>m.exitCode(e,t);function ct(e,t,n={strict:!0}){const r=Object.keys(t);return r.length?r.every(s=>n.strict?t[s]===e[s]:jt(t[s])?t[s].test(e[s]):t[s]===e[s]):!0}function we(e,t,n={}){return e.find(r=>r.type===t&&ct(Object.fromEntries(Object.keys(n).map(s=>[s,r.attrs[s]])),n))}function Xt(e,t,n={}){return!!we(e,t,n)}function gt(e,t,n){var r;if(!e||!t)return;let s=e.parent.childAfter(e.parentOffset);if((!s.node||!s.node.marks.some(u=>u.type===t))&&(s=e.parent.childBefore(e.parentOffset)),!s.node||!s.node.marks.some(u=>u.type===t)||(n=n||((r=s.node.marks[0])===null||r===void 0?void 0:r.attrs),!we([...s.node.marks],t,n)))return;let i=s.index,a=e.start()+s.offset,c=i+1,l=a+s.node.nodeSize;for(;i>0&&Xt([...e.parent.child(i-1).marks],t,n);)i-=1,a-=e.parent.child(i).nodeSize;for(;c<e.parent.childCount&&Xt([...e.parent.child(c).marks],t,n);)l+=e.parent.child(c).nodeSize,c+=1;return{from:a,to:l}}function z(e,t){if(typeof e=="string"){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}const mn=(e,t={})=>({tr:n,state:r,dispatch:s})=>{const o=z(e,r.schema),{doc:i,selection:a}=n,{$from:c,from:l,to:u}=a;if(s){const d=gt(c,o,t);if(d&&d.from<=l&&d.to>=u){const p=m.TextSelection.create(i,d.from,d.to);n.setSelection(p)}}return!0},gn=e=>t=>{const n=typeof e=="function"?e(t):e;for(let r=0;r<n.length;r+=1)if(n[r](t))return!0;return!1};function Ft(e){return e instanceof m.TextSelection}function $(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function Te(e,t=null){if(!t)return null;const n=m.Selection.atStart(e),r=m.Selection.atEnd(e);if(t==="start"||t===!0)return n;if(t==="end")return r;const s=n.from,o=r.to;return t==="all"?m.TextSelection.create(e,$(0,s,o),$(e.content.size,s,o)):m.TextSelection.create(e,$(t,s,o),$(t,s,o))}function yt(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}const yn=(e=null,t={})=>({editor:n,view:r,tr:s,dispatch:o})=>{t={scrollIntoView:!0,...t};const i=()=>{yt()&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),t!=null&&t.scrollIntoView&&n.commands.scrollIntoView())})};if(r.hasFocus()&&e===null||e===!1)return!0;if(o&&e===null&&!Ft(n.state.selection))return i(),!0;const a=Te(s.doc,e)||n.state.selection,c=n.state.selection.eq(a);return o&&(c||s.setSelection(a),c&&s.storedMarks&&s.setStoredMarks(s.storedMarks),i()),!0},vn=(e,t)=>n=>e.every((r,s)=>t(r,{...n,index:s})),bn=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),Ee=e=>{const t=e.childNodes;for(let n=t.length-1;n>=0;n-=1){const r=t[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):r.nodeType===1&&Ee(r)}return e};function st(e){const t=`<body>${e}</body>`,n=new window.DOMParser().parseFromString(t,"text/html").body;return Ee(n)}function dt(e,t,n){if(e instanceof m.Node||e instanceof m.Fragment)return e;n={slice:!0,parseOptions:{},...n};const r=typeof e=="object"&&e!==null,s=typeof e=="string";if(r)try{if(Array.isArray(e)&&e.length>0)return m.Fragment.fromArray(e.map(a=>t.nodeFromJSON(a)));const i=t.nodeFromJSON(e);return n.errorOnInvalidContent&&i.check(),i}catch(o){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:o});return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",o),dt("",t,n)}if(s){if(n.errorOnInvalidContent){let i=!1,a="";const c=new m.Schema({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:l=>(i=!0,a=typeof l=="string"?l:l.outerHTML,null)}]}})});if(n.slice?m.DOMParser.fromSchema(c).parseSlice(st(e),n.parseOptions):m.DOMParser.fromSchema(c).parse(st(e),n.parseOptions),n.errorOnInvalidContent&&i)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const o=m.DOMParser.fromSchema(t);return n.slice?o.parseSlice(st(e),n.parseOptions).content:o.parse(st(e),n.parseOptions)}return dt("",t,n)}function Mn(e,t,n){const r=e.steps.length-1;if(r<t)return;const s=e.steps[r];if(!(s instanceof m.ReplaceStep||s instanceof m.ReplaceAroundStep))return;const o=e.mapping.maps[r];let i=0;o.forEach((a,c,l,u)=>{i===0&&(i=u)}),e.setSelection(m.Selection.near(e.doc.resolve(i),n))}const Sn=e=>!("type"in e),kn=(e,t,n)=>({tr:r,dispatch:s,editor:o})=>{var i;if(s){n={parseOptions:o.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let a;try{a=dt(t,o.schema,{parseOptions:{preserveWhitespace:"full",...n.parseOptions},errorOnInvalidContent:(i=n.errorOnInvalidContent)!==null&&i!==void 0?i:o.options.enableContentCheck})}catch(f){return o.emit("contentError",{editor:o,error:f,disableCollaboration:()=>{o.storage.collaboration&&(o.storage.collaboration.isDisabled=!0)}}),!1}let{from:c,to:l}=typeof e=="number"?{from:e,to:e}:{from:e.from,to:e.to},u=!0,d=!0;if((Sn(a)?a:[a]).forEach(f=>{f.check(),u=u?f.isText&&f.marks.length===0:!1,d=d?f.isBlock:!1}),c===l&&d){const{parent:f}=r.doc.resolve(c);f.isTextblock&&!f.type.spec.code&&!f.childCount&&(c-=1,l+=1)}let h;if(u){if(Array.isArray(t))h=t.map(f=>f.text||"").join("");else if(t instanceof m.Fragment){let f="";t.forEach(g=>{g.text&&(f+=g.text)}),h=f}else typeof t=="object"&&t&&t.text?h=t.text:h=t;r.insertText(h,c,l)}else h=a,r.replaceWith(c,l,h);n.updateSelection&&Mn(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:c,text:h}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:c,text:h})}return!0},wn=()=>({state:e,dispatch:t})=>m.joinUp(e,t),Tn=()=>({state:e,dispatch:t})=>m.joinDown(e,t),En=()=>({state:e,dispatch:t})=>m.joinBackward(e,t),Cn=()=>({state:e,dispatch:t})=>m.joinForward(e,t),xn=()=>({state:e,dispatch:t,tr:n})=>{try{const r=m.joinPoint(e.doc,e.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},An=()=>({state:e,dispatch:t,tr:n})=>{try{const r=m.joinPoint(e.doc,e.selection.$from.pos,1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},On=()=>({state:e,dispatch:t})=>m.joinTextblockBackward(e,t),Ln=()=>({state:e,dispatch:t})=>m.joinTextblockForward(e,t);function Ce(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function Pn(e){const t=e.split(/-(?!$)/);let n=t[t.length-1];n==="Space"&&(n=" ");let r,s,o,i;for(let a=0;a<t.length-1;a+=1){const c=t[a];if(/^(cmd|meta|m)$/i.test(c))i=!0;else if(/^a(lt)?$/i.test(c))r=!0;else if(/^(c|ctrl|control)$/i.test(c))s=!0;else if(/^s(hift)?$/i.test(c))o=!0;else if(/^mod$/i.test(c))yt()||Ce()?i=!0:s=!0;else throw new Error(`Unrecognized modifier name: ${c}`)}return r&&(n=`Alt-${n}`),s&&(n=`Ctrl-${n}`),i&&(n=`Meta-${n}`),o&&(n=`Shift-${n}`),n}const Rn=e=>({editor:t,view:n,tr:r,dispatch:s})=>{const o=Pn(e).split(/-(?!$)/),i=o.find(l=>!["Alt","Ctrl","Meta","Shift"].includes(l)),a=new KeyboardEvent("keydown",{key:i==="Space"?" ":i,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),c=t.captureTransaction(()=>{n.someProp("handleKeyDown",l=>l(n,a))});return c==null||c.steps.forEach(l=>{const u=l.map(r.mapping);u&&s&&r.maybeStep(u)}),!0};function tt(e,t,n={}){const{from:r,to:s,empty:o}=e.selection,i=t?_(t,e.schema):null,a=[];e.doc.nodesBetween(r,s,(d,p)=>{if(d.isText)return;const h=Math.max(r,p),f=Math.min(s,p+d.nodeSize);a.push({node:d,from:h,to:f})});const c=s-r,l=a.filter(d=>i?i.name===d.node.type.name:!0).filter(d=>ct(d.node.attrs,n,{strict:!1}));return o?!!l.length:l.reduce((d,p)=>d+p.to-p.from,0)>=c}const Hn=(e,t={})=>({state:n,dispatch:r})=>{const s=_(e,n.schema);return tt(n,s,t)?m.lift(n,r):!1},_n=()=>({state:e,dispatch:t})=>m.liftEmptyBlock(e,t),Dn=e=>({state:t,dispatch:n})=>{const r=_(e,t.schema);return m.liftListItem(r)(t,n)},In=()=>({state:e,dispatch:t})=>m.newlineInCode(e,t);function vt(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function Qt(e,t){const n=typeof t=="string"?[t]:t;return Object.keys(e).reduce((r,s)=>(n.includes(s)||(r[s]=e[s]),r),{})}const Nn=(e,t)=>({tr:n,state:r,dispatch:s})=>{let o=null,i=null;const a=vt(typeof e=="string"?e:e.name,r.schema);return a?(a==="node"&&(o=_(e,r.schema)),a==="mark"&&(i=z(e,r.schema)),s&&n.selection.ranges.forEach(c=>{r.doc.nodesBetween(c.$from.pos,c.$to.pos,(l,u)=>{o&&o===l.type&&n.setNodeMarkup(u,void 0,Qt(l.attrs,t)),i&&l.marks.length&&l.marks.forEach(d=>{i===d.type&&n.addMark(u,u+l.nodeSize,i.create(Qt(d.attrs,t)))})})}),!0):!1},$n=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),Bn=()=>({tr:e,commands:t})=>t.setTextSelection({from:0,to:e.doc.content.size}),jn=()=>({state:e,dispatch:t})=>m.selectNodeBackward(e,t),Fn=()=>({state:e,dispatch:t})=>m.selectNodeForward(e,t),zn=()=>({state:e,dispatch:t})=>m.selectParentNode(e,t),Vn=()=>({state:e,dispatch:t})=>m.selectTextblockEnd(e,t),Wn=()=>({state:e,dispatch:t})=>m.selectTextblockStart(e,t);function Pt(e,t,n={},r={}){return dt(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}const Kn=(e,t=!1,n={},r={})=>({editor:s,tr:o,dispatch:i,commands:a})=>{var c,l;const{doc:u}=o;if(n.preserveWhitespace!=="full"){const d=Pt(e,s.schema,n,{errorOnInvalidContent:(c=r.errorOnInvalidContent)!==null&&c!==void 0?c:s.options.enableContentCheck});return i&&o.replaceWith(0,u.content.size,d).setMeta("preventUpdate",!t),!0}return i&&o.setMeta("preventUpdate",!t),a.insertContentAt({from:0,to:u.content.size},e,{parseOptions:n,errorOnInvalidContent:(l=r.errorOnInvalidContent)!==null&&l!==void 0?l:s.options.enableContentCheck})};function zt(e,t){const n=z(t,e.schema),{from:r,to:s,empty:o}=e.selection,i=[];o?(e.storedMarks&&i.push(...e.storedMarks),i.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,s,c=>{i.push(...c.marks)});const a=i.find(c=>c.type.name===n.name);return a?{...a.attrs}:{}}function Un(e,t){const n=new m.Transform(e);return t.forEach(r=>{r.steps.forEach(s=>{n.step(s)})}),n}function qn(e){for(let t=0;t<e.edgeCount;t+=1){const{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function Gn(e,t){const n=[];return e.descendants((r,s)=>{t(r)&&n.push({node:r,pos:s})}),n}function Jn(e,t,n){const r=[];return e.nodesBetween(t.from,t.to,(s,o)=>{n(s)&&r.push({node:s,pos:o})}),r}function xe(e,t){for(let n=e.depth;n>0;n-=1){const r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}function bt(e){return t=>xe(t.$from,e)}function Yn(e,t){const n={from:0,to:e.content.size};return Se(e,n,t)}function Xn(e,t){const n=_(t,e.schema),{from:r,to:s}=e.selection,o=[];e.doc.nodesBetween(r,s,a=>{o.push(a)});const i=o.reverse().find(a=>a.type.name===n.name);return i?{...i.attrs}:{}}function Ae(e,t){const n=vt(typeof t=="string"?t:t.name,e.schema);return n==="node"?Xn(e,t):n==="mark"?zt(e,t):{}}function Qn(e,t=JSON.stringify){const n={};return e.filter(r=>{const s=t(r);return Object.prototype.hasOwnProperty.call(n,s)?!1:n[s]=!0})}function Zn(e){const t=Qn(e);return t.length===1?t:t.filter((n,r)=>!t.filter((o,i)=>i!==r).some(o=>n.oldRange.from>=o.oldRange.from&&n.oldRange.to<=o.oldRange.to&&n.newRange.from>=o.newRange.from&&n.newRange.to<=o.newRange.to))}function tr(e){const{mapping:t,steps:n}=e,r=[];return t.maps.forEach((s,o)=>{const i=[];if(s.ranges.length)s.forEach((a,c)=>{i.push({from:a,to:c})});else{const{from:a,to:c}=n[o];if(a===void 0||c===void 0)return;i.push({from:a,to:c})}i.forEach(({from:a,to:c})=>{const l=t.slice(o).map(a,-1),u=t.slice(o).map(c),d=t.invert().map(l,-1),p=t.invert().map(u);r.push({oldRange:{from:d,to:p},newRange:{from:l,to:u}})})}),Zn(r)}function Vt(e,t,n){const r=[];return e===t?n.resolve(e).marks().forEach(s=>{const o=n.resolve(e),i=gt(o,s.type);i&&r.push({mark:s,...i})}):n.nodesBetween(e,t,(s,o)=>{!s||(s==null?void 0:s.nodeSize)===void 0||r.push(...s.marks.map(i=>({from:o,to:o+s.nodeSize,mark:i})))}),r}function at(e,t,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const s=e.find(o=>o.type===t&&o.name===r);return s?s.attribute.keepOnSplit:!1}))}function Rt(e,t,n={}){const{empty:r,ranges:s}=e.selection,o=t?z(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(d=>o?o.name===d.type.name:!0).find(d=>ct(d.attrs,n,{strict:!1}));let i=0;const a=[];if(s.forEach(({$from:d,$to:p})=>{const h=d.pos,f=p.pos;e.doc.nodesBetween(h,f,(g,y)=>{if(!g.isText&&!g.marks.length)return;const v=Math.max(h,y),S=Math.min(f,y+g.nodeSize),b=S-v;i+=b,a.push(...g.marks.map(M=>({mark:M,from:v,to:S})))})}),i===0)return!1;const c=a.filter(d=>o?o.name===d.mark.type.name:!0).filter(d=>ct(d.mark.attrs,n,{strict:!1})).reduce((d,p)=>d+p.to-p.from,0),l=a.filter(d=>o?d.mark.type!==o&&d.mark.type.excludes(o):!0).reduce((d,p)=>d+p.to-p.from,0);return(c>0?c+l:c)>=i}function Oe(e,t,n={}){if(!t)return tt(e,null,n)||Rt(e,null,n);const r=vt(t,e.schema);return r==="node"?tt(e,t,n):r==="mark"?Rt(e,t,n):!1}function Ht(e,t){const{nodeExtensions:n}=ht(t),r=n.find(i=>i.name===e);if(!r)return!1;const s={name:r.name,options:r.options,storage:r.storage},o=C(w(r,"group",s));return typeof o!="string"?!1:o.split(" ").includes("list")}function Mt(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(e.type.name==="hardBreak")return!0;if(e.isText)return/^\s*$/m.test((r=e.text)!==null&&r!==void 0?r:"")}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(e.content.childCount===0)return!0;if(t){let s=!0;return e.content.forEach(o=>{s!==!1&&(Mt(o,{ignoreWhitespace:n,checkChildren:t})||(s=!1))}),s}return!1}function Le(e){return e instanceof m.NodeSelection}function er(e,t,n){const s=e.state.doc.content.size,o=$(t,0,s),i=$(n,0,s),a=e.coordsAtPos(o),c=e.coordsAtPos(i,-1),l=Math.min(a.top,c.top),u=Math.max(a.bottom,c.bottom),d=Math.min(a.left,c.left),p=Math.max(a.right,c.right),h=p-d,f=u-l,v={top:l,bottom:u,left:d,right:p,width:h,height:f,x:d,y:l};return{...v,toJSON:()=>v}}function nr(e,t,n){var r;const{selection:s}=t;let o=null;if(Ft(s)&&(o=s.$cursor),o){const a=(r=e.storedMarks)!==null&&r!==void 0?r:o.marks();return!!n.isInSet(a)||!a.some(c=>c.type.excludes(n))}const{ranges:i}=s;return i.some(({$from:a,$to:c})=>{let l=a.depth===0?e.doc.inlineContent&&e.doc.type.allowsMarkType(n):!1;return e.doc.nodesBetween(a.pos,c.pos,(u,d,p)=>{if(l)return!1;if(u.isInline){const h=!p||p.type.allowsMarkType(n),f=!!n.isInSet(u.marks)||!u.marks.some(g=>g.type.excludes(n));l=h&&f}return!l}),l})}const rr=(e,t={})=>({tr:n,state:r,dispatch:s})=>{const{selection:o}=n,{empty:i,ranges:a}=o,c=z(e,r.schema);if(s)if(i){const l=zt(r,c);n.addStoredMark(c.create({...l,...t}))}else a.forEach(l=>{const u=l.$from.pos,d=l.$to.pos;r.doc.nodesBetween(u,d,(p,h)=>{const f=Math.max(h,u),g=Math.min(h+p.nodeSize,d);p.marks.find(v=>v.type===c)?p.marks.forEach(v=>{c===v.type&&n.addMark(f,g,c.create({...v.attrs,...t}))}):n.addMark(f,g,c.create(t))})});return nr(r,n,c)},sr=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),or=(e,t={})=>({state:n,dispatch:r,chain:s})=>{const o=_(e,n.schema);let i;return n.selection.$anchor.sameParent(n.selection.$head)&&(i=n.selection.$anchor.parent.attrs),o.isTextblock?s().command(({commands:a})=>m.setBlockType(o,{...i,...t})(n)?!0:a.clearNodes()).command(({state:a})=>m.setBlockType(o,{...i,...t})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},ir=e=>({tr:t,dispatch:n})=>{if(n){const{doc:r}=t,s=$(e,0,r.content.size),o=m.NodeSelection.create(r,s);t.setSelection(o)}return!0},ar=e=>({tr:t,dispatch:n})=>{if(n){const{doc:r}=t,{from:s,to:o}=typeof e=="number"?{from:e,to:e}:e,i=m.TextSelection.atStart(r).from,a=m.TextSelection.atEnd(r).to,c=$(s,i,a),l=$(o,i,a),u=m.TextSelection.create(r,c,l);t.setSelection(u)}return!0},lr=e=>({state:t,dispatch:n})=>{const r=_(e,t.schema);return m.sinkListItem(r)(t,n)};function Zt(e,t){const n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){const r=n.filter(s=>t==null?void 0:t.includes(s.type.name));e.tr.ensureMarks(r)}}const cr=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:s})=>{const{selection:o,doc:i}=t,{$from:a,$to:c}=o,l=s.extensionManager.attributes,u=at(l,a.node().type.name,a.node().attrs);if(o instanceof m.NodeSelection&&o.node.isBlock)return!a.parentOffset||!m.canSplit(i,a.pos)?!1:(r&&(e&&Zt(n,s.extensionManager.splittableMarks),t.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const d=c.parentOffset===c.parent.content.size,p=a.depth===0?void 0:qn(a.node(-1).contentMatchAt(a.indexAfter(-1)));let h=d&&p?[{type:p,attrs:u}]:void 0,f=m.canSplit(t.doc,t.mapping.map(a.pos),1,h);if(!h&&!f&&m.canSplit(t.doc,t.mapping.map(a.pos),1,p?[{type:p}]:void 0)&&(f=!0,h=p?[{type:p,attrs:u}]:void 0),r){if(f&&(o instanceof m.TextSelection&&t.deleteSelection(),t.split(t.mapping.map(a.pos),1,h),p&&!d&&!a.parentOffset&&a.parent.type!==p)){const g=t.mapping.map(a.before()),y=t.doc.resolve(g);a.node(-1).canReplaceWith(y.index(),y.index()+1,p)&&t.setNodeMarkup(t.mapping.map(a.before()),p)}e&&Zt(n,s.extensionManager.splittableMarks),t.scrollIntoView()}return f},dr=(e,t={})=>({tr:n,state:r,dispatch:s,editor:o})=>{var i;const a=_(e,r.schema),{$from:c,$to:l}=r.selection,u=r.selection.node;if(u&&u.isBlock||c.depth<2||!c.sameParent(l))return!1;const d=c.node(-1);if(d.type!==a)return!1;const p=o.extensionManager.attributes;if(c.parent.content.size===0&&c.node(-1).childCount===c.indexAfter(-1)){if(c.depth===2||c.node(-3).type!==a||c.index(-2)!==c.node(-2).childCount-1)return!1;if(s){let v=m.Fragment.empty;const S=c.index(-1)?1:c.index(-2)?2:3;for(let L=c.depth-S;L>=c.depth-3;L-=1)v=m.Fragment.from(c.node(L).copy(v));const b=c.indexAfter(-1)<c.node(-2).childCount?1:c.indexAfter(-2)<c.node(-3).childCount?2:3,M={...at(p,c.node().type.name,c.node().attrs),...t},T=((i=a.contentMatch.defaultType)===null||i===void 0?void 0:i.createAndFill(M))||void 0;v=v.append(m.Fragment.from(a.createAndFill(null,T)||void 0));const k=c.before(c.depth-(S-1));n.replace(k,c.after(-b),new m.Slice(v,4-S,0));let x=-1;n.doc.nodesBetween(k,n.doc.content.size,(L,E)=>{if(x>-1)return!1;L.isTextblock&&L.content.size===0&&(x=E+1)}),x>-1&&n.setSelection(m.TextSelection.near(n.doc.resolve(x))),n.scrollIntoView()}return!0}const h=l.pos===c.end()?d.contentMatchAt(0).defaultType:null,f={...at(p,d.type.name,d.attrs),...t},g={...at(p,c.node().type.name,c.node().attrs),...t};n.delete(c.pos,l.pos);const y=h?[{type:a,attrs:f},{type:h,attrs:g}]:[{type:a,attrs:f}];if(!m.canSplit(n.doc,c.pos,2))return!1;if(s){const{selection:v,storedMarks:S}=r,{splittableMarks:b}=o.extensionManager,M=S||v.$to.parentOffset&&v.$from.marks();if(n.split(c.pos,2,y).scrollIntoView(),!M||!s)return!0;const T=M.filter(k=>b.includes(k.type.name));n.ensureMarks(T)}return!0},Tt=(e,t)=>{const n=bt(i=>i.type===t)(e.selection);if(!n)return!0;const r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const s=e.doc.nodeAt(r);return n.node.type===(s==null?void 0:s.type)&&m.canJoin(e.doc,n.pos)&&e.join(n.pos),!0},Et=(e,t)=>{const n=bt(i=>i.type===t)(e.selection);if(!n)return!0;const r=e.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const s=e.doc.nodeAt(r);return n.node.type===(s==null?void 0:s.type)&&m.canJoin(e.doc,r)&&e.join(r),!0},ur=(e,t,n,r={})=>({editor:s,tr:o,state:i,dispatch:a,chain:c,commands:l,can:u})=>{const{extensions:d,splittableMarks:p}=s.extensionManager,h=_(e,i.schema),f=_(t,i.schema),{selection:g,storedMarks:y}=i,{$from:v,$to:S}=g,b=v.blockRange(S),M=y||g.$to.parentOffset&&g.$from.marks();if(!b)return!1;const T=bt(k=>Ht(k.type.name,d))(g);if(b.depth>=1&&T&&b.depth-T.depth<=1){if(T.node.type===h)return l.liftListItem(f);if(Ht(T.node.type.name,d)&&h.validContent(T.node.content)&&a)return c().command(()=>(o.setNodeMarkup(T.pos,h),!0)).command(()=>Tt(o,h)).command(()=>Et(o,h)).run()}return!n||!M||!a?c().command(()=>u().wrapInList(h,r)?!0:l.clearNodes()).wrapInList(h,r).command(()=>Tt(o,h)).command(()=>Et(o,h)).run():c().command(()=>{const k=u().wrapInList(h,r),x=M.filter(L=>p.includes(L.type.name));return o.ensureMarks(x),k?!0:l.clearNodes()}).wrapInList(h,r).command(()=>Tt(o,h)).command(()=>Et(o,h)).run()},pr=(e,t={},n={})=>({state:r,commands:s})=>{const{extendEmptyMarkRange:o=!1}=n,i=z(e,r.schema);return Rt(r,i,t)?s.unsetMark(i,{extendEmptyMarkRange:o}):s.setMark(i,t)},hr=(e,t,n={})=>({state:r,commands:s})=>{const o=_(e,r.schema),i=_(t,r.schema),a=tt(r,o,n);let c;return r.selection.$anchor.sameParent(r.selection.$head)&&(c=r.selection.$anchor.parent.attrs),a?s.setNode(i,c):s.setNode(o,{...c,...n})},fr=(e,t={})=>({state:n,commands:r})=>{const s=_(e,n.schema);return tt(n,s,t)?r.lift(s):r.wrapIn(s,t)},mr=()=>({state:e,dispatch:t})=>{const n=e.plugins;for(let r=0;r<n.length;r+=1){const s=n[r];let o;if(s.spec.isInputRules&&(o=s.getState(e))){if(t){const i=e.tr,a=o.transform;for(let c=a.steps.length-1;c>=0;c-=1)i.step(a.steps[c].invert(a.docs[c]));if(o.text){const c=i.doc.resolve(o.from).marks();i.replaceWith(o.from,o.to,e.schema.text(o.text,c))}else i.delete(o.from,o.to)}return!0}}return!1},gr=()=>({tr:e,dispatch:t})=>{const{selection:n}=e,{empty:r,ranges:s}=n;return r||t&&s.forEach(o=>{e.removeMark(o.$from.pos,o.$to.pos)}),!0},yr=(e,t={})=>({tr:n,state:r,dispatch:s})=>{var o;const{extendEmptyMarkRange:i=!1}=t,{selection:a}=n,c=z(e,r.schema),{$from:l,empty:u,ranges:d}=a;if(!s)return!0;if(u&&i){let{from:p,to:h}=a;const f=(o=l.marks().find(y=>y.type===c))===null||o===void 0?void 0:o.attrs,g=gt(l,c,f);g&&(p=g.from,h=g.to),n.removeMark(p,h,c)}else d.forEach(p=>{n.removeMark(p.$from.pos,p.$to.pos,c)});return n.removeStoredMark(c),!0},vr=(e,t={})=>({tr:n,state:r,dispatch:s})=>{let o=null,i=null;const a=vt(typeof e=="string"?e:e.name,r.schema);return a?(a==="node"&&(o=_(e,r.schema)),a==="mark"&&(i=z(e,r.schema)),s&&n.selection.ranges.forEach(c=>{const l=c.$from.pos,u=c.$to.pos;let d,p,h,f;n.selection.empty?r.doc.nodesBetween(l,u,(g,y)=>{o&&o===g.type&&(h=Math.max(y,l),f=Math.min(y+g.nodeSize,u),d=y,p=g)}):r.doc.nodesBetween(l,u,(g,y)=>{y<l&&o&&o===g.type&&(h=Math.max(y,l),f=Math.min(y+g.nodeSize,u),d=y,p=g),y>=l&&y<=u&&(o&&o===g.type&&n.setNodeMarkup(y,void 0,{...g.attrs,...t}),i&&g.marks.length&&g.marks.forEach(v=>{if(i===v.type){const S=Math.max(y,l),b=Math.min(y+g.nodeSize,u);n.addMark(S,b,i.create({...v.attrs,...t}))}}))}),p&&(d!==void 0&&n.setNodeMarkup(d,void 0,{...p.attrs,...t}),i&&p.marks.length&&p.marks.forEach(g=>{i===g.type&&n.addMark(h,f,i.create({...g.attrs,...t}))}))}),!0):!1},br=(e,t={})=>({state:n,dispatch:r})=>{const s=_(e,n.schema);return m.wrapIn(s,t)(n,r)},Mr=(e,t={})=>({state:n,dispatch:r})=>{const s=_(e,n.schema);return m.wrapInList(s,t)(n,r)};var Sr=Object.freeze({__proto__:null,blur:nn,clearContent:rn,clearNodes:sn,command:on,createParagraphNear:an,cut:ln,deleteCurrentNode:cn,deleteNode:dn,deleteRange:un,deleteSelection:pn,enter:hn,exitCode:fn,extendMarkRange:mn,first:gn,focus:yn,forEach:vn,insertContent:bn,insertContentAt:kn,joinBackward:En,joinDown:Tn,joinForward:Cn,joinItemBackward:xn,joinItemForward:An,joinTextblockBackward:On,joinTextblockForward:Ln,joinUp:wn,keyboardShortcut:Rn,lift:Hn,liftEmptyBlock:_n,liftListItem:Dn,newlineInCode:In,resetAttributes:Nn,scrollIntoView:$n,selectAll:Bn,selectNodeBackward:jn,selectNodeForward:Fn,selectParentNode:zn,selectTextblockEnd:Vn,selectTextblockStart:Wn,setContent:Kn,setMark:rr,setMeta:sr,setNode:or,setNodeSelection:ir,setTextSelection:ar,sinkListItem:lr,splitBlock:cr,splitListItem:dr,toggleList:ur,toggleMark:pr,toggleNode:hr,toggleWrap:fr,undoInputRule:mr,unsetAllMarks:gr,unsetMark:yr,updateAttributes:vr,wrapIn:br,wrapInList:Mr});const kr=H.create({name:"commands",addCommands(){return{...Sr}}}),wr=H.create({name:"drop",addProseMirrorPlugins(){return[new m.Plugin({key:new m.PluginKey("tiptapDrop"),props:{handleDrop:(e,t,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),Tr=H.create({name:"editable",addProseMirrorPlugins(){return[new m.Plugin({key:new m.PluginKey("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Er=H.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:e}=this;return[new m.Plugin({key:new m.PluginKey("focusEvents"),props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;const r=e.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;const r=e.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1}}}})]}}),Cr=H.create({name:"keymap",addKeyboardShortcuts(){const e=()=>this.editor.commands.first(({commands:i})=>[()=>i.undoInputRule(),()=>i.command(({tr:a})=>{const{selection:c,doc:l}=a,{empty:u,$anchor:d}=c,{pos:p,parent:h}=d,f=d.parent.isTextblock&&p>0?a.doc.resolve(p-1):d,g=f.parent.type.spec.isolating,y=d.pos-d.parentOffset,v=g&&f.parent.childCount===1?y===d.pos:m.Selection.atStart(l).from===p;return!u||!h.type.isTextblock||h.textContent.length||!v||v&&d.parent.type.name==="paragraph"?!1:i.clearNodes()}),()=>i.deleteSelection(),()=>i.joinBackward(),()=>i.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:i})=>[()=>i.deleteSelection(),()=>i.deleteCurrentNode(),()=>i.joinForward(),()=>i.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:i})=>[()=>i.newlineInCode(),()=>i.createParagraphNear(),()=>i.liftEmptyBlock(),()=>i.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},s={...r},o={...r,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return yt()||Ce()?o:s},addProseMirrorPlugins(){return[new m.Plugin({key:new m.PluginKey("clearDocument"),appendTransaction:(e,t,n)=>{const r=e.some(g=>g.docChanged)&&!t.doc.eq(n.doc),s=e.some(g=>g.getMeta("preventClearDocument"));if(!r||s)return;const{empty:o,from:i,to:a}=t.selection,c=m.Selection.atStart(t.doc).from,l=m.Selection.atEnd(t.doc).to;if(o||!(i===c&&a===l)||!Mt(n.doc))return;const p=n.tr,h=ut({state:n,transaction:p}),{commands:f}=new pt({editor:this.editor,state:h});if(f.clearNodes(),!!p.steps.length)return p}})]}}),xr=H.create({name:"paste",addProseMirrorPlugins(){return[new m.Plugin({key:new m.PluginKey("tiptapPaste"),props:{handlePaste:(e,t,n)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:n})}}})]}}),Ar=H.create({name:"tabindex",addProseMirrorPlugins(){return[new m.Plugin({key:new m.PluginKey("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class U{get name(){return this.node.type.name}constructor(t,n,r=!1,s=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=t,this.editor=n,this.currentNode=s}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var t;return(t=this.actualDepth)!==null&&t!==void 0?t:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(t){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},t)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const t=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(t);return new U(n,this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new U(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new U(t,this.editor)}get children(){const t=[];return this.node.content.forEach((n,r)=>{const s=n.isBlock&&!n.isTextblock,o=n.isAtom&&!n.isText,i=this.pos+r+(o?0:1),a=this.resolvedPos.doc.resolve(i);if(!s&&a.depth<=this.depth)return;const c=new U(a,this.editor,s,s?n:null);s&&(c.actualDepth=this.depth+1),t.push(new U(a,this.editor,s,s?n:null))}),t}get firstChild(){return this.children[0]||null}get lastChild(){const t=this.children;return t[t.length-1]||null}closest(t,n={}){let r=null,s=this.parent;for(;s&&!r;){if(s.node.type.name===t)if(Object.keys(n).length>0){const o=s.node.attrs,i=Object.keys(n);for(let a=0;a<i.length;a+=1){const c=i[a];if(o[c]!==n[c])break}}else r=s;s=s.parent}return r}querySelector(t,n={}){return this.querySelectorAll(t,n,!0)[0]||null}querySelectorAll(t,n={},r=!1){let s=[];if(!this.children||this.children.length===0)return s;const o=Object.keys(n);return this.children.forEach(i=>{r&&s.length>0||(i.node.type.name===t&&o.every(c=>n[c]===i.node.attrs[c])&&s.push(i),!(r&&s.length>0)&&(s=s.concat(i.querySelectorAll(t,n,r))))}),s}setAttribute(t){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...t}),this.editor.view.dispatch(n)}}const Or=`.ProseMirror {
|
|
5
|
-
position: relative;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.ProseMirror {
|
|
9
|
-
word-wrap: break-word;
|
|
10
|
-
white-space: pre-wrap;
|
|
11
|
-
white-space: break-spaces;
|
|
12
|
-
-webkit-font-variant-ligatures: none;
|
|
13
|
-
font-variant-ligatures: none;
|
|
14
|
-
font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.ProseMirror [contenteditable="false"] {
|
|
18
|
-
white-space: normal;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.ProseMirror [contenteditable="false"] [contenteditable="true"] {
|
|
22
|
-
white-space: pre-wrap;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.ProseMirror pre {
|
|
26
|
-
white-space: pre-wrap;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
img.ProseMirror-separator {
|
|
30
|
-
display: inline !important;
|
|
31
|
-
border: none !important;
|
|
32
|
-
margin: 0 !important;
|
|
33
|
-
width: 0 !important;
|
|
34
|
-
height: 0 !important;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.ProseMirror-gapcursor {
|
|
38
|
-
display: none;
|
|
39
|
-
pointer-events: none;
|
|
40
|
-
position: absolute;
|
|
41
|
-
margin: 0;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.ProseMirror-gapcursor:after {
|
|
45
|
-
content: "";
|
|
46
|
-
display: block;
|
|
47
|
-
position: absolute;
|
|
48
|
-
top: -2px;
|
|
49
|
-
width: 20px;
|
|
50
|
-
border-top: 1px solid black;
|
|
51
|
-
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
@keyframes ProseMirror-cursor-blink {
|
|
55
|
-
to {
|
|
56
|
-
visibility: hidden;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.ProseMirror-hideselection *::selection {
|
|
61
|
-
background: transparent;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
.ProseMirror-hideselection *::-moz-selection {
|
|
65
|
-
background: transparent;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.ProseMirror-hideselection * {
|
|
69
|
-
caret-color: transparent;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
.ProseMirror-focused .ProseMirror-gapcursor {
|
|
73
|
-
display: block;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
.tippy-box[data-animation=fade][data-state=hidden] {
|
|
77
|
-
opacity: 0
|
|
78
|
-
}`;function Lr(e,t,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const s=document.createElement("style");return t&&s.setAttribute("nonce",t),s.setAttribute("data-tiptap-style",""),s.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(s),s}class Pr extends ze{constructor(t={}){super(),this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:n})=>{throw n},onPaste:()=>null,onDrop:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),this.createView(),this.injectCSS(),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:n,slice:r,moved:s})=>this.options.onDrop(n,r,s)),this.on("paste",({event:n,slice:r})=>this.options.onPaste(n,r)),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&document&&(this.css=Lr(Or,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.view||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,n=!0){this.setOptions({editable:t}),n&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(t,n){const r=ve(n)?n(t,[...this.state.plugins]):[...this.state.plugins,t],s=this.state.reconfigure({plugins:r});return this.view.updateState(s),s}unregisterPlugin(t){if(this.isDestroyed)return;const n=this.state.plugins;let r=n;if([].concat(t).forEach(o=>{const i=typeof o=="string"?`${o}$`:o.key;r=n.filter(a=>!a.key.startsWith(i))}),n.length===r.length)return;const s=this.state.reconfigure({plugins:r});return this.view.updateState(s),s}createExtensionManager(){var t,n;const s=[...this.options.enableCoreExtensions?[Tr,en.configure({blockSeparator:(n=(t=this.options.coreExtensionOptions)===null||t===void 0?void 0:t.clipboardTextSerializer)===null||n===void 0?void 0:n.blockSeparator}),kr,Er,Cr,Ar,wr,xr].filter(o=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[o.name]!==!1:!0):[],...this.options.extensions].filter(o=>["extension","node","mark"].includes(o==null?void 0:o.type));this.extensionManager=new Y(s,this)}createCommandManager(){this.commandManager=new pt({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var t;let n;try{n=Pt(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(i){if(!(i instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(i.message))throw i;this.emit("contentError",{editor:this,error:i,disableCollaboration:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(a=>a.name!=="collaboration"),this.createExtensionManager()}}),n=Pt(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const r=Te(n,this.options.autofocus);this.view=new m.EditorView(this.options.element,{...this.options.editorProps,attributes:{role:"textbox",...(t=this.options.editorProps)===null||t===void 0?void 0:t.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:m.EditorState.create({doc:n,selection:r||void 0})});const s=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(s),this.createNodeViews(),this.prependClass();const o=this.view.dom;o.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const n=this.capturedTransaction;return this.capturedTransaction=null,n}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(i=>{var a;return(a=this.capturedTransaction)===null||a===void 0?void 0:a.step(i)});return}const n=this.state.apply(t),r=!this.state.selection.eq(n.selection);this.emit("beforeTransaction",{editor:this,transaction:t,nextState:n}),this.view.updateState(n),this.emit("transaction",{editor:this,transaction:t}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});const s=t.getMeta("focus"),o=t.getMeta("blur");s&&this.emit("focus",{editor:this,event:s.event,transaction:t}),o&&this.emit("blur",{editor:this,event:o.event,transaction:t}),!(!t.docChanged||t.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:t})}getAttributes(t){return Ae(this.state,t)}isActive(t,n){const r=typeof t=="string"?t:null,s=typeof t=="string"?n:t;return Oe(this.state,r,s)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Bt(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:n=`
|
|
79
|
-
|
|
80
|
-
`,textSerializers:r={}}=t||{};return Yn(this.state.doc,{blockSeparator:n,textSerializers:{...ke(this.schema),...r}})}get isEmpty(){return Mt(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){if(this.emit("destroy"),this.view){const t=this.view.dom;t&&t.editor&&delete t.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){var t;return!(!((t=this.view)===null||t===void 0)&&t.docView)}$node(t,n){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelector(t,n))||null}$nodes(t,n){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelectorAll(t,n))||null}$pos(t){const n=this.state.doc.resolve(t);return new U(n,this)}get $doc(){return this.$pos(0)}}function q(e){return new ft({find:e.find,handler:({state:t,range:n,match:r})=>{const s=C(e.getAttributes,void 0,r);if(s===!1||s===null)return null;const{tr:o}=t,i=r[r.length-1],a=r[0];if(i){const c=a.search(/\S/),l=n.from+a.indexOf(i),u=l+i.length;if(Vt(n.from,n.to,t.doc).filter(h=>h.mark.type.excluded.find(g=>g===e.type&&g!==h.mark.type)).filter(h=>h.to>l).length)return null;u<n.to&&o.delete(u,n.to),l>n.from&&o.delete(n.from+c,l);const p=n.from+c+i.length;o.addMark(n.from+c,p,e.type.create(s||{})),o.removeStoredMark(e.type)}}})}function Wt(e){return new ft({find:e.find,handler:({state:t,range:n,match:r})=>{const s=C(e.getAttributes,void 0,r)||{},{tr:o}=t,i=n.from;let a=n.to;const c=e.type.create(s);if(r[1]){const l=r[0].lastIndexOf(r[1]);let u=i+l;u>a?u=a:a=u+r[1].length;const d=r[0][r[0].length-1];o.insertText(d,i+r[0].length-1),o.replaceWith(u,a,c)}else if(r[0]){const l=e.type.isInline?i:i-1;o.insert(l,e.type.create(s)).delete(o.mapping.map(i),o.mapping.map(a))}o.scrollIntoView()}})}function _t(e){return new ft({find:e.find,handler:({state:t,range:n,match:r})=>{const s=t.doc.resolve(n.from),o=C(e.getAttributes,void 0,r)||{};if(!s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,o)}})}function X(e){return new ft({find:e.find,handler:({state:t,range:n,match:r,chain:s})=>{const o=C(e.getAttributes,void 0,r)||{},i=t.tr.delete(n.from,n.to),c=i.doc.resolve(n.from).blockRange(),l=c&&m.findWrapping(c,e.type,o);if(!l)return null;if(i.wrap(c,l),e.keepMarks&&e.editor){const{selection:d,storedMarks:p}=t,{splittableMarks:h}=e.editor.extensionManager,f=p||d.$to.parentOffset&&d.$from.marks();if(f){const g=f.filter(y=>h.includes(y.type.name));i.ensureMarks(g)}}if(e.keepAttributes){const d=e.type.name==="bulletList"||e.type.name==="orderedList"?"listItem":"taskList";s().updateAttributes(d,o).run()}const u=i.doc.resolve(n.from-1).nodeBefore;u&&u.type===e.type&&m.canJoin(i.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,u))&&i.join(n.from-1)}})}class R{constructor(t={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=C(w(this,"addOptions",{name:this.name}))),this.storage=C(w(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new R(t)}configure(t={}){const n=this.extend({...this.config,addOptions:()=>mt(this.options,t)});return n.name=this.name,n.parent=this.parent,n}extend(t={}){const n=new R(t);return n.parent=this,this.child=n,n.name=t.name?t.name:n.parent.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=C(w(n,"addOptions",{name:n.name})),n.storage=C(w(n,"addStorage",{name:n.name,options:n.options})),n}}function Rr(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}class Hr{constructor(t,n,r){this.isDragging=!1,this.component=t,this.editor=n.editor,this.options={stopEvent:null,ignoreMutation:null,...r},this.extension=n.extension,this.node=n.node,this.decorations=n.decorations,this.innerDecorations=n.innerDecorations,this.view=n.view,this.HTMLAttributes=n.HTMLAttributes,this.getPos=n.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(t){var n,r,s,o,i,a,c;const{view:l}=this.editor,u=t.target,d=u.nodeType===3?(n=u.parentElement)===null||n===void 0?void 0:n.closest("[data-drag-handle]"):u.closest("[data-drag-handle]");if(!this.dom||!((r=this.contentDOM)===null||r===void 0)&&r.contains(u)||!d)return;let p=0,h=0;if(this.dom!==d){const v=this.dom.getBoundingClientRect(),S=d.getBoundingClientRect(),b=(s=t.offsetX)!==null&&s!==void 0?s:(o=t.nativeEvent)===null||o===void 0?void 0:o.offsetX,M=(i=t.offsetY)!==null&&i!==void 0?i:(a=t.nativeEvent)===null||a===void 0?void 0:a.offsetY;p=S.x-v.x+b,h=S.y-v.y+M}(c=t.dataTransfer)===null||c===void 0||c.setDragImage(this.dom,p,h);const f=this.getPos();if(typeof f!="number")return;const g=m.NodeSelection.create(l.state.doc,f),y=l.state.tr.setSelection(g);l.dispatch(y)}stopEvent(t){var n;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:t});const r=t.target;if(!(this.dom.contains(r)&&!(!((n=this.contentDOM)===null||n===void 0)&&n.contains(r))))return!1;const o=t.type.startsWith("drag"),i=t.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(r.tagName)||r.isContentEditable)&&!i&&!o)return!0;const{isEditable:c}=this.editor,{isDragging:l}=this,u=!!this.node.type.spec.draggable,d=m.NodeSelection.isSelectable(this.node),p=t.type==="copy",h=t.type==="paste",f=t.type==="cut",g=t.type==="mousedown";if(!u&&d&&o&&t.preventDefault(),u&&o&&!l)return t.preventDefault(),!1;if(u&&c&&!l&&g){const y=r.closest("[data-drag-handle]");y&&(this.dom===y||this.dom.contains(y))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!(l||i||p||h||f||g&&d)}ignoreMutation(t){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:t}):this.node.isLeaf||this.node.isAtom?!0:t.type==="selection"||this.dom.contains(t.target)&&t.type==="childList"&&(yt()||Rr())&&this.editor.isFocused&&[...Array.from(t.addedNodes),...Array.from(t.removedNodes)].every(r=>r.isContentEditable)?!1:this.contentDOM===t.target&&t.type==="attributes"?!0:!this.contentDOM.contains(t.target)}updateAttributes(t){this.editor.commands.command(({tr:n})=>{const r=this.getPos();return typeof r!="number"?!1:(n.setNodeMarkup(r,void 0,{...this.node.attrs,...t}),!0)})}deleteNode(){const t=this.getPos();if(typeof t!="number")return;const n=t+this.node.nodeSize;this.editor.commands.deleteRange({from:t,to:n})}}function F(e){return new Me({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:s})=>{const o=C(e.getAttributes,void 0,r,s);if(o===!1||o===null)return null;const{tr:i}=t,a=r[r.length-1],c=r[0];let l=n.to;if(a){const u=c.search(/\S/),d=n.from+c.indexOf(a),p=d+a.length;if(Vt(n.from,n.to,t.doc).filter(f=>f.mark.type.excluded.find(y=>y===e.type&&y!==f.mark.type)).filter(f=>f.to>d).length)return null;p<n.to&&i.delete(p,n.to),d>n.from&&i.delete(n.from+u,d),l=n.from+u+a.length,i.addMark(n.from+u,l,e.type.create(o||{})),i.removeStoredMark(e.type)}}})}function _r(e){return e.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}function Dr(e){return new Me({find:e.find,handler({match:t,chain:n,range:r,pasteEvent:s}){const o=C(e.getAttributes,void 0,t,s),i=C(e.getContent,void 0,o);if(o===!1||o===null)return null;const a={type:e.type.name,attrs:o};i&&(a.content=i),t.input&&n().deleteRange(r).insertContentAt(r.from,a)}})}const Ir=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,Nr=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,$r=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,Br=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,jr=D.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:e=>e.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:e=>e.type.name===this.name},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return["strong",O(this.options.HTMLAttributes,e),0]},addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[q({find:Ir,type:this.type}),q({find:$r,type:this.type})]},addPasteRules(){return[F({find:Nr,type:this.type}),F({find:Br,type:this.type})]}});class Fr{constructor({editor:t,element:n,view:r,tippyOptions:s={},updateDelay:o=250,shouldShow:i}){this.preventHide=!1,this.shouldShow=({view:a,state:c,from:l,to:u})=>{const{doc:d,selection:p}=c,{empty:h}=p,f=!d.textBetween(l,u).length&&Ft(c.selection),g=this.element.contains(document.activeElement);return!(!(a.hasFocus()||g)||h||f||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:a})=>{var c;if(this.preventHide){this.preventHide=!1;return}a!=null&&a.relatedTarget&&(!((c=this.element.parentNode)===null||c===void 0)&&c.contains(a.relatedTarget))||(a==null?void 0:a.relatedTarget)!==this.editor.view.dom&&this.hide()},this.tippyBlurHandler=a=>{this.blurHandler({event:a})},this.handleDebouncedUpdate=(a,c)=>{const l=!(c!=null&&c.selection.eq(a.state.selection)),u=!(c!=null&&c.doc.eq(a.state.doc));!l&&!u||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(a,l,u,c)},this.updateDelay))},this.updateHandler=(a,c,l,u)=>{var d,p,h;const{state:f,composing:g}=a,{selection:y}=f;if(g||!c&&!l)return;this.createTooltip();const{ranges:S}=y,b=Math.min(...S.map(k=>k.$from.pos)),M=Math.max(...S.map(k=>k.$to.pos));if(!((d=this.shouldShow)===null||d===void 0?void 0:d.call(this,{editor:this.editor,element:this.element,view:a,state:f,oldState:u,from:b,to:M}))){this.hide();return}(p=this.tippy)===null||p===void 0||p.setProps({getReferenceClientRect:((h=this.tippyOptions)===null||h===void 0?void 0:h.getReferenceClientRect)||(()=>{if(Le(f.selection)){let k=a.nodeDOM(b);if(k){const x=k.dataset.nodeViewWrapper?k:k.querySelector("[data-node-view-wrapper]");if(x&&(k=x.firstChild),k)return k.getBoundingClientRect()}}return er(a,b,M)})}),this.show()},this.editor=t,this.element=n,this.view=r,this.updateDelay=o,i&&(this.shouldShow=i),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.tippyOptions=s,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:t}=this.editor.options,n=!!t.parentElement;this.tippy||!n||(this.tippy=me(t,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"top",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(t,n){const{state:r}=t,s=r.selection.from!==r.selection.to;if(this.updateDelay>0&&s){this.handleDebouncedUpdate(t,n);return}const o=!(n!=null&&n.selection.eq(t.state.selection)),i=!(n!=null&&n.doc.eq(t.state.doc));this.updateHandler(t,o,i,n)}show(){var t;(t=this.tippy)===null||t===void 0||t.show()}hide(){var t;(t=this.tippy)===null||t===void 0||t.hide()}destroy(){var t,n;!((t=this.tippy)===null||t===void 0)&&t.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(n=this.tippy)===null||n===void 0||n.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}const Pe=e=>new m.Plugin({key:typeof e.pluginKey=="string"?new m.PluginKey(e.pluginKey):e.pluginKey,view:t=>new Fr({view:t,...e})});H.create({name:"bubbleMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"bubbleMenu",updateDelay:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[Pe({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,updateDelay:this.options.updateDelay,shouldShow:this.options.shouldShow})]:[]}});function zr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Dt={exports:{}},Ct={};/**
|
|
81
|
-
* @license React
|
|
82
|
-
* use-sync-external-store-shim.production.min.js
|
|
83
|
-
*
|
|
84
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
85
|
-
*
|
|
86
|
-
* This source code is licensed under the MIT license found in the
|
|
87
|
-
* LICENSE file in the root directory of this source tree.
|
|
88
|
-
*/var te;function Vr(){if(te)return Ct;te=1;var e=A;function t(d,p){return d===p&&(d!==0||1/d===1/p)||d!==d&&p!==p}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,s=e.useEffect,o=e.useLayoutEffect,i=e.useDebugValue;function a(d,p){var h=p(),f=r({inst:{value:h,getSnapshot:p}}),g=f[0].inst,y=f[1];return o(function(){g.value=h,g.getSnapshot=p,c(g)&&y({inst:g})},[d,h,p]),s(function(){return c(g)&&y({inst:g}),d(function(){c(g)&&y({inst:g})})},[d]),i(h),h}function c(d){var p=d.getSnapshot;d=d.value;try{var h=p();return!n(d,h)}catch{return!0}}function l(d,p){return p()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?l:a;return Ct.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,Ct}var xt={};/**
|
|
89
|
-
* @license React
|
|
90
|
-
* use-sync-external-store-shim.development.js
|
|
91
|
-
*
|
|
92
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
93
|
-
*
|
|
94
|
-
* This source code is licensed under the MIT license found in the
|
|
95
|
-
* LICENSE file in the root directory of this source tree.
|
|
96
|
-
*/var ee;function Wr(){return ee||(ee=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var e=A,t=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function n(b){{for(var M=arguments.length,T=new Array(M>1?M-1:0),k=1;k<M;k++)T[k-1]=arguments[k];r("error",b,T)}}function r(b,M,T){{var k=t.ReactDebugCurrentFrame,x=k.getStackAddendum();x!==""&&(M+="%s",T=T.concat([x]));var L=T.map(function(E){return String(E)});L.unshift("Warning: "+M),Function.prototype.apply.call(console[b],console,L)}}function s(b,M){return b===M&&(b!==0||1/b===1/M)||b!==b&&M!==M}var o=typeof Object.is=="function"?Object.is:s,i=e.useState,a=e.useEffect,c=e.useLayoutEffect,l=e.useDebugValue,u=!1,d=!1;function p(b,M,T){u||e.startTransition!==void 0&&(u=!0,n("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var k=M();if(!d){var x=M();o(k,x)||(n("The result of getSnapshot should be cached to avoid an infinite loop"),d=!0)}var L=i({inst:{value:k,getSnapshot:M}}),E=L[0].inst,P=L[1];return c(function(){E.value=k,E.getSnapshot=M,h(E)&&P({inst:E})},[b,k,M]),a(function(){h(E)&&P({inst:E});var N=function(){h(E)&&P({inst:E})};return b(N)},[b]),l(k),k}function h(b){var M=b.getSnapshot,T=b.value;try{var k=M();return!o(T,k)}catch{return!0}}function f(b,M,T){return M()}var g=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",y=!g,v=y?f:p,S=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:v;xt.useSyncExternalStore=S,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),xt}process.env.NODE_ENV==="production"?Dt.exports=Vr():Dt.exports=Wr();var St=Dt.exports;const Kr=(...e)=>t=>{e.forEach(n=>{typeof n=="function"?n(t):n&&(n.current=t)})},Ur=({contentComponent:e})=>{const t=St.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getServerSnapshot);return A.createElement(A.Fragment,null,Object.values(t))};function qr(){const e=new Set;let t={};return{subscribe(n){return e.add(n),()=>{e.delete(n)}},getSnapshot(){return t},getServerSnapshot(){return t},setRenderer(n,r){t={...t,[n]:ge.createPortal(r.reactElement,r.element,n)},e.forEach(s=>s())},removeRenderer(n){const r={...t};delete r[n],t=r,e.forEach(s=>s())}}}class Gr extends A.Component{constructor(t){var n;super(t),this.editorContentRef=A.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!(!((n=t.editor)===null||n===void 0)&&n.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){const t=this.props.editor;if(t&&!t.isDestroyed&&t.options.element){if(t.contentComponent)return;const n=this.editorContentRef.current;n.append(...t.options.element.childNodes),t.setOptions({element:n}),t.contentComponent=qr(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=t.contentComponent.subscribe(()=>{this.setState(r=>r.hasContentComponentInitialized?r:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),t.createNodeViews(),this.initialized=!0}}componentWillUnmount(){const t=this.props.editor;if(!t||(this.initialized=!1,t.isDestroyed||t.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),t.contentComponent=null,!t.options.element.firstChild))return;const n=document.createElement("div");n.append(...t.options.element.childNodes),t.setOptions({element:n})}render(){const{editor:t,innerRef:n,...r}=this.props;return A.createElement(A.Fragment,null,A.createElement("div",{ref:Kr(n,this.editorContentRef),...r}),(t==null?void 0:t.contentComponent)&&A.createElement(Ur,{contentComponent:t.contentComponent}))}}const Jr=A.forwardRef((e,t)=>{const n=A.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[e.editor]);return A.createElement(Gr,{key:n,innerRef:t,...e})}),Yr=A.memo(Jr);var Xr=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var r,s,o;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(s=r;s--!==0;)if(!e(t[s],n[s]))return!1;return!0}if(t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(s of t.entries())if(!n.has(s[0]))return!1;for(s of t.entries())if(!e(s[1],n.get(s[0])))return!1;return!0}if(t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(s of t.entries())if(!n.has(s[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(n)){if(r=t.length,r!=n.length)return!1;for(s=r;s--!==0;)if(t[s]!==n[s])return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(o=Object.keys(t),r=o.length,r!==Object.keys(n).length)return!1;for(s=r;s--!==0;)if(!Object.prototype.hasOwnProperty.call(n,o[s]))return!1;for(s=r;s--!==0;){var i=o[s];if(!(i==="_owner"&&t.$$typeof)&&!e(t[i],n[i]))return!1}return!0}return t!==t&&n!==n},Qr=zr(Xr),It={exports:{}},At={};/**
|
|
97
|
-
* @license React
|
|
98
|
-
* use-sync-external-store-shim/with-selector.production.min.js
|
|
99
|
-
*
|
|
100
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
101
|
-
*
|
|
102
|
-
* This source code is licensed under the MIT license found in the
|
|
103
|
-
* LICENSE file in the root directory of this source tree.
|
|
104
|
-
*/var ne;function Zr(){if(ne)return At;ne=1;var e=A,t=St;function n(l,u){return l===u&&(l!==0||1/l===1/u)||l!==l&&u!==u}var r=typeof Object.is=="function"?Object.is:n,s=t.useSyncExternalStore,o=e.useRef,i=e.useEffect,a=e.useMemo,c=e.useDebugValue;return At.useSyncExternalStoreWithSelector=function(l,u,d,p,h){var f=o(null);if(f.current===null){var g={hasValue:!1,value:null};f.current=g}else g=f.current;f=a(function(){function v(k){if(!S){if(S=!0,b=k,k=p(k),h!==void 0&&g.hasValue){var x=g.value;if(h(x,k))return M=x}return M=k}if(x=M,r(b,k))return x;var L=p(k);return h!==void 0&&h(x,L)?x:(b=k,M=L)}var S=!1,b,M,T=d===void 0?null:d;return[function(){return v(u())},T===null?void 0:function(){return v(T())}]},[u,d,p,h]);var y=s(l,f[0],f[1]);return i(function(){g.hasValue=!0,g.value=y},[y]),c(y),y},At}var Ot={};/**
|
|
105
|
-
* @license React
|
|
106
|
-
* use-sync-external-store-shim/with-selector.development.js
|
|
107
|
-
*
|
|
108
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
109
|
-
*
|
|
110
|
-
* This source code is licensed under the MIT license found in the
|
|
111
|
-
* LICENSE file in the root directory of this source tree.
|
|
112
|
-
*/var re;function ts(){return re||(re=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var e=A,t=St;function n(u,d){return u===d&&(u!==0||1/u===1/d)||u!==u&&d!==d}var r=typeof Object.is=="function"?Object.is:n,s=t.useSyncExternalStore,o=e.useRef,i=e.useEffect,a=e.useMemo,c=e.useDebugValue;function l(u,d,p,h,f){var g=o(null),y;g.current===null?(y={hasValue:!1,value:null},g.current=y):y=g.current;var v=a(function(){var T=!1,k,x,L=function(B){if(!T){T=!0,k=B;var G=h(B);if(f!==void 0&&y.hasValue){var V=y.value;if(f(V,G))return x=V,V}return x=G,G}var W=k,j=x;if(r(W,B))return j;var K=h(B);return f!==void 0&&f(j,K)?j:(k=B,x=K,K)},E=p===void 0?null:p,P=function(){return L(d())},N=E===null?void 0:function(){return L(E())};return[P,N]},[d,p,h,f]),S=v[0],b=v[1],M=s(u,S,b);return i(function(){y.hasValue=!0,y.value=M},[M]),c(M),M}Ot.useSyncExternalStoreWithSelector=l,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),Ot}process.env.NODE_ENV==="production"?It.exports=Zr():It.exports=ts();var es=It.exports;const ns=typeof window<"u"?A.useLayoutEffect:A.useEffect;class rs{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){const n=()=>{this.transactionNumber+=1,this.subscribers.forEach(s=>s())},r=this.editor;return r.on("transaction",n),()=>{r.off("transaction",n)}}}}function ss(e){var t;const[n]=A.useState(()=>new rs(e.editor)),r=es.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,e.selector,(t=e.equalityFn)!==null&&t!==void 0?t:Qr);return ns(()=>n.watch(e.editor),[e.editor,n]),A.useDebugValue(r),r}const se=process.env.NODE_ENV!=="production",Nt=typeof window>"u",os=Nt||!!(typeof window<"u"&&window.next);class is{constructor(t){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=t,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(t){this.editor=t,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){if(this.options.current.immediatelyRender===void 0)return Nt||os?(se&&console.warn("Tiptap Error: SSR has been detected, please set `immediatelyRender` explicitly to `false` to avoid hydration mismatches."),null):this.createEditor();if(this.options.current.immediatelyRender&&Nt&&se)throw new Error("Tiptap Error: SSR has been detected, and `immediatelyRender` has been set to `true` this is an unsupported configuration that may result in errors, explicitly set `immediatelyRender` to `false` to avoid hydration mismatches.");return this.options.current.immediatelyRender?this.createEditor():null}createEditor(){const t={...this.options.current,onBeforeCreate:(...r)=>{var s,o;return(o=(s=this.options.current).onBeforeCreate)===null||o===void 0?void 0:o.call(s,...r)},onBlur:(...r)=>{var s,o;return(o=(s=this.options.current).onBlur)===null||o===void 0?void 0:o.call(s,...r)},onCreate:(...r)=>{var s,o;return(o=(s=this.options.current).onCreate)===null||o===void 0?void 0:o.call(s,...r)},onDestroy:(...r)=>{var s,o;return(o=(s=this.options.current).onDestroy)===null||o===void 0?void 0:o.call(s,...r)},onFocus:(...r)=>{var s,o;return(o=(s=this.options.current).onFocus)===null||o===void 0?void 0:o.call(s,...r)},onSelectionUpdate:(...r)=>{var s,o;return(o=(s=this.options.current).onSelectionUpdate)===null||o===void 0?void 0:o.call(s,...r)},onTransaction:(...r)=>{var s,o;return(o=(s=this.options.current).onTransaction)===null||o===void 0?void 0:o.call(s,...r)},onUpdate:(...r)=>{var s,o;return(o=(s=this.options.current).onUpdate)===null||o===void 0?void 0:o.call(s,...r)},onContentError:(...r)=>{var s,o;return(o=(s=this.options.current).onContentError)===null||o===void 0?void 0:o.call(s,...r)},onDrop:(...r)=>{var s,o;return(o=(s=this.options.current).onDrop)===null||o===void 0?void 0:o.call(s,...r)},onPaste:(...r)=>{var s,o;return(o=(s=this.options.current).onPaste)===null||o===void 0?void 0:o.call(s,...r)}};return new Pr(t)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(t){return this.subscriptions.add(t),()=>{this.subscriptions.delete(t)}}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&t.length===0?this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(t),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(t){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=t;return}if(this.previousDeps.length===t.length&&this.previousDeps.every((r,s)=>r===t[s]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=t}scheduleDestroy(){const t=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===t){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===t&&this.setEditor(null))},1)}}function as(e={},t=[]){const n=A.useRef(e);n.current=e;const[r]=A.useState(()=>new is(n)),s=St.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return A.useDebugValue(s),A.useEffect(r.onRender(t)),ss({editor:s,selector:({transactionNumber:o})=>e.shouldRerenderOnTransaction===!1?null:e.immediatelyRender&&o===0?0:o+1}),s}const Re=A.createContext({editor:null});Re.Consumer;const ls=()=>A.useContext(Re),cs=e=>{const[t,n]=A.useState(null),{editor:r}=ls();return A.useEffect(()=>{var s;if(!t||!((s=e.editor)===null||s===void 0)&&s.isDestroyed||r!=null&&r.isDestroyed)return;const{pluginKey:o="bubbleMenu",editor:i,tippyOptions:a={},updateDelay:c,shouldShow:l=null}=e,u=i||r;if(!u){console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");return}const d=Pe({updateDelay:c,editor:u,element:t,pluginKey:o,shouldShow:l,tippyOptions:a});return u.registerPlugin(d),()=>{u.unregisterPlugin(o)}},[e.editor,r,t]),A.createElement("div",{ref:n,className:e.className,style:{visibility:"hidden"}},e.children)},He=A.createContext({onDragStart:void 0}),_e=()=>A.useContext(He),ds=e=>{const t=e.as||"div",{nodeViewContentRef:n}=_e();return A.createElement(t,{...e,ref:n,"data-node-view-content":"",style:{whiteSpace:"pre-wrap",...e.style}})},us=A.forwardRef((e,t)=>{const{onDragStart:n}=_e(),r=e.as||"div";return A.createElement(r,{...e,ref:t,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...e.style}})});function ps(e){return!!(typeof e=="function"&&e.prototype&&e.prototype.isReactComponent)}function hs(e){var t;return typeof e=="object"&&((t=e.$$typeof)===null||t===void 0?void 0:t.toString())==="Symbol(react.forward_ref)"}class De{constructor(t,{editor:n,props:r={},as:s="div",className:o=""}){this.ref=null,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=t,this.editor=n,this.props=r,this.element=document.createElement(s),this.element.classList.add("react-renderer"),o&&this.element.classList.add(...o.split(" ")),this.editor.isInitialized?ge.flushSync(()=>{this.render()}):this.render()}render(){var t;const n=this.component,r=this.props,s=this.editor;(ps(n)||hs(n))&&(r.ref=o=>{this.ref=o}),this.reactElement=A.createElement(n,{...r}),(t=s==null?void 0:s.contentComponent)===null||t===void 0||t.setRenderer(this.id,this)}updateProps(t={}){this.props={...this.props,...t},this.render()}destroy(){var t;const n=this.editor;(t=n==null?void 0:n.contentComponent)===null||t===void 0||t.removeRenderer(this.id)}updateAttributes(t){Object.keys(t).forEach(n=>{this.element.setAttribute(n,t[n])})}}class fs extends Hr{mount(){const t={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extension,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(l={})=>this.updateAttributes(l),deleteNode:()=>this.deleteNode()};if(!this.component.displayName){const l=u=>u.charAt(0).toUpperCase()+u.substring(1);this.component.displayName=l(this.extension.name)}const s={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:l=>{l&&this.contentDOMElement&&l.firstChild!==this.contentDOMElement&&l.appendChild(this.contentDOMElement)}},o=this.component,i=A.memo(l=>A.createElement(He.Provider,{value:s},A.createElement(o,l)));i.displayName="ReactNodeView",this.node.isLeaf?this.contentDOMElement=null:this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement&&(this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.style.whiteSpace="inherit");let a=this.node.isInline?"span":"div";this.options.as&&(a=this.options.as);const{className:c=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.renderer=new De(i,{editor:this.editor,props:t,as:a,className:`node-${this.node.type.name} ${c}`.trim()}),this.updateElementAttributes()}get dom(){var t;if(this.renderer.element.firstElementChild&&!(!((t=this.renderer.element.firstElementChild)===null||t===void 0)&&t.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){const{from:t,to:n}=this.editor.state.selection,r=this.getPos();if(typeof r=="number")if(t<=r&&n>=r+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}}update(t,n,r){const s=o=>{this.renderer.updateProps(o),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(t.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const o=this.node,i=this.decorations,a=this.innerDecorations;return this.node=t,this.decorations=n,this.innerDecorations=r,this.options.update({oldNode:o,oldDecorations:i,newNode:t,newDecorations:n,oldInnerDecorations:a,innerDecorations:r,updateProps:()=>s({node:t,decorations:n,innerDecorations:r})})}return t===this.node&&this.decorations===n&&this.innerDecorations===r||(this.node=t,this.decorations=n,this.innerDecorations=r,s({node:t,decorations:n,innerDecorations:r})),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.contentDOMElement=null}updateElementAttributes(){if(this.options.attrs){let t={};if(typeof this.options.attrs=="function"){const n=this.editor.extensionManager.attributes,r=lt(this.node,n);t=this.options.attrs({node:this.node,HTMLAttributes:r})}else t=this.options.attrs;this.renderer.updateAttributes(t)}}}function ms(e,t){return n=>n.editor.contentComponent?new fs(e,n,t):{}}function Kt(e,t,n){const r=[],s=e.node(0);n=typeof n=="number"&&n>=0?n:e.sameParent(t)?Math.max(0,e.sharedDepth(t.pos)-1):e.sharedDepth(t.pos);const o=new m.NodeRange(e,t,n),i=o.depth===0?0:s.resolve(o.start).posAtIndex(0);return o.parent.forEach((a,c)=>{const l=i+c,u=l+a.nodeSize;if(l<o.start||l>=o.end)return;const d=new m.SelectionRange(s.resolve(l),s.resolve(u));r.push(d)}),r}class Ut{constructor(t,n){et(this,"anchor");et(this,"head");this.anchor=t,this.head=n}map(t){return new Ut(t.map(this.anchor),t.map(this.head))}resolve(t){const n=t.resolve(this.anchor),r=t.resolve(this.head);return new I(n,r)}}class I extends m.Selection{constructor(n,r,s,o=1){const{doc:i}=n,a=n===r,c=n.pos===i.content.size&&r.pos===i.content.size,l=a&&!c?i.resolve(r.pos+(o>0?1:-1)):r,u=a&&c?i.resolve(n.pos-(o>0?1:-1)):n,d=Kt(u.min(l),u.max(l),s);super(l.pos>=n.pos?d[0].$from:d[d.length-1].$to,l.pos>=n.pos?d[d.length-1].$to:d[0].$from,d);et(this,"depth");this.depth=s}get $to(){return this.ranges[this.ranges.length-1].$to}eq(n){return n instanceof I&&n.$from.pos===this.$from.pos&&n.$to.pos===this.$to.pos}map(n,r){const s=n.resolve(r.map(this.anchor)),o=n.resolve(r.map(this.head));return new I(s,o)}toJSON(){return{type:"nodeRange",anchor:this.anchor,head:this.head}}get isForwards(){return this.head>=this.anchor}get isBackwards(){return!this.isForwards}extendBackwards(){const{doc:n}=this.$from;if(this.isForwards&&this.ranges.length>1){const o=this.ranges.slice(0,-1),i=o[0].$from,a=o[o.length-1].$to;return new I(i,a,this.depth)}const r=this.ranges[0],s=n.resolve(Math.max(0,r.$from.pos-1));return new I(this.$anchor,s,this.depth)}extendForwards(){const{doc:n}=this.$from;if(this.isBackwards&&this.ranges.length>1){const o=this.ranges.slice(1),i=o[0].$from,a=o[o.length-1].$to;return new I(a,i,this.depth)}const r=this.ranges[this.ranges.length-1],s=n.resolve(Math.min(n.content.size,r.$to.pos+1));return new I(this.$anchor,s,this.depth)}static fromJSON(n,r){return new I(n.resolve(r.anchor),n.resolve(r.head))}static create(n,r,s,o,i=1){return new this(n.resolve(r),n.resolve(s),o,i)}getBookmark(){return new Ut(this.anchor,this.head)}}function gs(e){const t=e.cloneNode(!0),n=[e,...Array.from(e.getElementsByTagName("*"))],r=[t,...Array.from(t.getElementsByTagName("*"))];return n.forEach((s,o)=>{r[o].style.cssText=function(i){let a="";const c=getComputedStyle(i);for(let l=0;l<c.length;l+=1)a+=`${c[l]}:${c.getPropertyValue(c[l])};`;return a}(s)}),t}function ot(e,t){return window.getComputedStyle(e)[t]}function ys(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function oe(e){e.parentNode!==null&&e.parentNode!==void 0&&e.parentNode.removeChild(e)}const Ie=e=>{const{x:t,y:n,direction:r,editor:s}=e;let o=null,i=null,a=null,c=t;for(;i===null&&c<window.innerWidth&&c>0;){const l=document.elementsFromPoint(c,n),u=l.findIndex(p=>p.classList.contains("ProseMirror")),d=l.slice(0,u);if(d.length>0){const p=d[0];if(o=p,a=s.view.posAtDOM(p,0),a>=0){i=s.state.doc.nodeAt(Math.max(a-1,0)),(i===null||i.isText)&&(i=s.state.doc.nodeAt(Math.max(a-1,0))),i||(i=s.state.doc.nodeAt(Math.max(a,0)));break}}r==="left"?c-=1:c+=1}return{resultElement:o,resultNode:i,pos:a!==null?a:null}};function vs(e,t){const{doc:n}=t.view.state,r=Ie({editor:t,x:e.clientX,y:e.clientY,direction:"right"});if(!r.resultNode||r.pos===null)return[];const s=e.clientX,o=function(u,d,p){const h=parseInt(ot(u.dom,"paddingLeft"),10),f=parseInt(ot(u.dom,"paddingRight"),10),g=parseInt(ot(u.dom,"borderLeftWidth"),10),y=parseInt(ot(u.dom,"borderLeftWidth"),10),v=u.dom.getBoundingClientRect();return{left:ys(d,v.left+h+g,v.right-f-y),top:p}}(t.view,s,e.clientY),i=t.view.posAtCoords(o);if(!i)return[];const{pos:a}=i;if(!n.resolve(a).parent)return[];const c=n.resolve(r.pos),l=n.resolve(r.pos+1);return Kt(c,l,0)}const ie=(e,t)=>{const n=e.resolve(t),{depth:r}=n;return r===0?t:n.pos-n.parentOffset-1},ae=(e,t)=>{const n=e.nodeAt(t),r=e.resolve(t);let{depth:s}=r,o=n;for(;s>0;){const i=r.node(s);s-=1,s===0&&(o=i)}return o},Lt=(e,t)=>{const n=m.ySyncPluginKey.getState(e);return n?m.absolutePositionToRelativePosition(t,n.type,n.binding.mapping):null},le=(e,t)=>{let n=t;for(;n&&n.parentNode&&n.parentNode!==e.dom;)n=n.parentNode;return n},Ne=new m.PluginKey("dragHandle"),bs=({pluginKey:e=Ne,element:t,editor:n,tippyOptions:r,onNodeChange:s})=>{const o=document.createElement("div");let i=null,a=!1,c=null,l=-1;return t.addEventListener("dragstart",u=>{const{view:d}=n;if(!u.dataTransfer)return;const{empty:p,$from:h,$to:f}=d.state.selection,g=vs(u,n),y=Kt(h,f,0),v=y.some(E=>g.find(P=>P.$from===E.$from&&P.$to===E.$to)),S=p||!v?g:y;if(!S.length)return;const{tr:b}=d.state,M=document.createElement("div"),T=S[0].$from.pos,k=S[S.length-1].$to.pos,x=I.create(d.state.doc,T,k),L=x.content();S.forEach(E=>{const P=gs(d.nodeDOM(E.$from.pos));M.append(P)}),M.style.position="absolute",M.style.top="-10000px",document.body.append(M),u.dataTransfer.clearData(),u.dataTransfer.setDragImage(M,0,0),d.dragging={slice:L,move:!0},b.setSelection(x),d.dispatch(b),document.addEventListener("drop",()=>oe(M),{once:!0}),setTimeout(()=>{t&&(t.style.pointerEvents="none")},0)}),t.addEventListener("dragend",()=>{t&&(t.style.pointerEvents="auto")}),new m.Plugin({key:typeof e=="string"?new m.PluginKey(e):e,state:{init:()=>({locked:!1}),apply(u,d,p,h){const f=u.getMeta("lockDragHandle"),g=u.getMeta("hideDragHandle");if(f!==void 0&&(a=f),g&&i)return i.hide(),a=!1,c=null,l=-1,s==null||s({editor:n,node:null,pos:-1}),d;if(u.docChanged&&l!==-1&&t&&i){const y=u.mapping.map(l);y!==l&&(l=y,Lt(h,l))}return d}},view:u=>{var d;return t.draggable=!0,t.style.pointerEvents="auto",(d=n.view.dom.parentElement)===null||d===void 0||d.appendChild(o),o.appendChild(t),o.style.pointerEvents="none",o.style.position="absolute",o.style.top="0",o.style.left="0",i=me(u.dom,{getReferenceClientRect:null,interactive:!0,trigger:"manual",placement:"left-start",hideOnClick:!1,duration:100,zIndex:10,popperOptions:{modifiers:[{name:"flip",enabled:!1},{name:"preventOverflow",options:{rootBoundary:"document",mainAxis:!1}}]},...r,appendTo:o,content:t}),{update(p,h){if(!t||!i||(t.draggable=!a,u.state.doc.eq(h.doc)||l===-1))return;let f=u.nodeDOM(l);if(f=le(u,f),f===u.dom||(f==null?void 0:f.nodeType)!==1)return;const g=u.posAtDOM(f,0),y=ae(n.state.doc,g);if(y!==c){const v=ie(n.state.doc,g);c=y,l=v,Lt(u.state,l),s==null||s({editor:n,node:c,pos:l}),i.setProps({getReferenceClientRect:()=>f.getBoundingClientRect()}),i.show()}},destroy(){i==null||i.destroy(),t&&oe(o)}}},props:{handleDOMEvents:{mouseleave:(u,d)=>(a||d.target&&!o.contains(d.relatedTarget)&&(i==null||i.hide(),c=null,l=-1,s==null||s({editor:n,node:null,pos:-1})),!1),mousemove(u,d){if(!t||!i||a)return!1;const p=Ie({x:d.clientX,y:d.clientY,direction:"right",editor:n});if(!p.resultElement)return!1;let h=p.resultElement;if(h=le(u,h),h===u.dom||(h==null?void 0:h.nodeType)!==1)return!1;const f=u.posAtDOM(h,0),g=ae(n.state.doc,f);if(g!==c){const y=ie(n.state.doc,f);c=g,l=y,Lt(u.state,l),s==null||s({editor:n,node:c,pos:l}),i.setProps({getReferenceClientRect:()=>h.getBoundingClientRect()}),i.show()}return!1}}}})},Ms=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Ss=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,ks=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,ws=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Ts=D.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:e=>e.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:e=>e.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:e}){return["em",O(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[q({find:Ms,type:this.type}),q({find:ks,type:this.type})]},addPasteRules(){return[F({find:Ss,type:this.type}),F({find:ws,type:this.type})]}}),Es=D.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>e.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:e}){return["u",O(this.options.HTMLAttributes,e),0]},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),Cs=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,xs=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,As=D.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:e=>e.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:e}){return["s",O(this.options.HTMLAttributes,e),0]},addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[q({find:Cs,type:this.type})]},addPasteRules(){return[F({find:xs,type:this.type})]}}),Os=new RegExp("(?<!`)`([^`]+)`(?!`)"),Ls=new RegExp("(?<!`)`([^`]+)`(?!`)","g"),Ps=D.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:e}){return["code",O(this.options.HTMLAttributes,e),0]},addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[q({find:Os,type:this.type})]},addPasteRules(){return[F({find:Ls,type:this.type})]}}),Rs=/^```([a-z]+)?[\s\n]$/,Hs=/^~~~([a-z]+)?[\s\n]$/,_s=R.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{var t;const{languageClassPrefix:n}=this.options,o=[...((t=e.firstElementChild)===null||t===void 0?void 0:t.classList)||[]].filter(i=>i.startsWith(n)).map(i=>i.replace(n,""))[0];return o||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:e,HTMLAttributes:t}){return["pre",O(this.options.HTMLAttributes,t),["code",{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:e,$anchor:t}=this.editor.state.selection,n=t.pos===1;return!e||t.parent.type.name!==this.name?!1:n||!t.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:t}=e,{selection:n}=t,{$from:r,empty:s}=n;if(!s||r.parent.type!==this.type)return!1;const o=r.parentOffset===r.parent.nodeSize-2,i=r.parent.textContent.endsWith(`
|
|
113
|
-
|
|
114
|
-
`);return!o||!i?!1:e.chain().command(({tr:a})=>(a.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;const{state:t}=e,{selection:n,doc:r}=t,{$from:s,empty:o}=n;if(!o||s.parent.type!==this.type||!(s.parentOffset===s.parent.nodeSize-2))return!1;const a=s.after();return a===void 0?!1:r.nodeAt(a)?e.commands.command(({tr:l})=>(l.setSelection(m.Selection.near(r.resolve(a))),!0)):e.commands.exitCode()}}},addInputRules(){return[_t({find:Rs,type:this.type,getAttributes:e=>({language:e[1]})}),_t({find:Hs,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new m.Plugin({key:new m.PluginKey("codeBlockVSCodeHandler"),props:{handlePaste:(e,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;const n=t.clipboardData.getData("text/plain"),r=t.clipboardData.getData("vscode-editor-data"),s=r?JSON.parse(r):void 0,o=s==null?void 0:s.mode;if(!n||!o)return!1;const{tr:i,schema:a}=e.state,c=a.text(n.replace(/\r\n?/g,`
|
|
115
|
-
`));return i.replaceSelectionWith(this.type.create({language:o},c)),i.selection.$from.parent.type!==this.type&&i.setSelection(m.TextSelection.near(i.doc.resolve(Math.max(0,i.selection.from-2)))),i.setMeta("paste",!0),e.dispatch(i),!0}}})]}}),Ds=D.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:e=>e.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:e}){return["span",O(this.options.HTMLAttributes,e),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:e,commands:t})=>{const n=zt(e,this.type);return Object.entries(n).some(([,s])=>!!s)?!0:t.unsetMark(this.name)}}}}),Is=H.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:e=>e.style.fontFamily,renderHTML:e=>e.fontFamily?{style:`font-family: ${e.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:e=>({chain:t})=>t().setMark("textStyle",{fontFamily:e}).run(),unsetFontFamily:()=>({chain:e})=>e().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),Ns=R.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,O(this.options.HTMLAttributes,t),0]},addCommands(){return{setHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.setNode(this.name,e):!1,toggleHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.toggleNode(this.name,"paragraph",e):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>_t({find:new RegExp(`^(#{1,${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}}),$s=H.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:"left"}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:e=>{const t=e.style.textAlign||this.options.defaultAlignment;return this.options.alignments.includes(t)?t:this.options.defaultAlignment},renderHTML:e=>e.textAlign===this.options.defaultAlignment?{}:{style:`text-align: ${e.textAlign}`}}}}]},addCommands(){return{setTextAlign:e=>({commands:t})=>this.options.alignments.includes(e)?this.options.types.map(n=>t.updateAttributes(n,{textAlign:e})).every(n=>n):!1,unsetTextAlign:()=>({commands:e})=>this.options.types.map(t=>e.resetAttributes(t,"textAlign")).every(t=>t)}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),Bs=H.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:e=>{var t;return(t=e.style.color)===null||t===void 0?void 0:t.replace(/['"]+/g,"")},renderHTML:e=>e.color?{style:`color: ${e.color}`}:{}}}}]},addCommands(){return{setColor:e=>({chain:t})=>t().setMark("textStyle",{color:e}).run(),unsetColor:()=>({chain:e})=>e().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),js=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,Fs=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,zs=D.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:e=>e.getAttribute("data-color")||e.style.backgroundColor,renderHTML:e=>e.color?{"data-color":e.color,style:`background-color: ${e.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:e}){return["mark",O(this.options.HTMLAttributes,e),0]},addCommands(){return{setHighlight:e=>({commands:t})=>t.setMark(this.name,e),toggleHighlight:e=>({commands:t})=>t.toggleMark(this.name,e),unsetHighlight:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[q({find:js,type:this.type})]},addPasteRules(){return[F({find:Fs,type:this.type})]}}),Vs="listItem",ce="textStyle",de=/^\s*([-+*])\s$/,Ws=R.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:e}){return["ul",O(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Vs,this.editor.getAttributes(ce)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=X({find:de,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=X({find:de,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(ce),editor:this.editor})),[e]}}),Ks="listItem",ue="textStyle",pe=/^(\d+)\.\s$/,Us=R.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:e=>e.hasAttribute("start")?parseInt(e.getAttribute("start")||"",10):1},type:{default:void 0,parseHTML:e=>e.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:e}){const{start:t,...n}=e;return t===1?["ol",O(this.options.HTMLAttributes,n),0]:["ol",O(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Ks,this.editor.getAttributes(ue)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=X({find:pe,type:this.type,getAttributes:t=>({start:+t[1]}),joinPredicate:(t,n)=>n.childCount+n.attrs.start===+t[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=X({find:pe,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:t=>({start:+t[1],...this.editor.getAttributes(ue)}),joinPredicate:(t,n)=>n.childCount+n.attrs.start===+t[1],editor:this.editor})),[e]}}),qs=/^\s*(\[([( |x])?\])\s$/,Gs=R.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList"}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{const t=e.getAttribute("data-checked");return t===""||t==="true"},renderHTML:e=>({"data-checked":e.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:e,HTMLAttributes:t}){return["li",O(this.options.HTMLAttributes,t,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:e.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{const s=document.createElement("li"),o=document.createElement("label"),i=document.createElement("span"),a=document.createElement("input"),c=document.createElement("div");return o.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",l=>l.preventDefault()),a.addEventListener("change",l=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:u}=l.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:d})=>{const p=n();if(typeof p!="number")return!1;const h=d.doc.nodeAt(p);return d.setNodeMarkup(p,void 0,{...h==null?void 0:h.attrs,checked:u}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,u)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([l,u])=>{s.setAttribute(l,u)}),s.dataset.checked=e.attrs.checked,e.attrs.checked&&a.setAttribute("checked","checked"),o.append(a,i),s.append(o,c),Object.entries(t).forEach(([l,u])=>{s.setAttribute(l,u)}),{dom:s,contentDOM:c,update:l=>l.type!==this.type?!1:(s.dataset.checked=l.attrs.checked,l.attrs.checked?a.setAttribute("checked","checked"):a.removeAttribute("checked"),!0)}}},addInputRules(){return[X({find:qs,type:this.type,getAttributes:e=>({checked:e[e.length-1]==="x"})})]}}),Js=R.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:e}){return["ul",O(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),Ys=/^\s*>\s$/,Xs=R.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:e}){return["blockquote",O(this.options.HTMLAttributes,e),0]},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[X({find:Ys,type:this.type})]}});function Qs(e){return e.length===1?e[0].isLink:e.length===3&&e[1].isLink?["()","[]"].includes(e[0].value+e[2].value):!1}function Zs(e){return new m.Plugin({key:new m.PluginKey("autolink"),appendTransaction:(t,n,r)=>{const s=t.some(l=>l.docChanged)&&!n.doc.eq(r.doc),o=t.some(l=>l.getMeta("preventAutolink"));if(!s||o)return;const{tr:i}=r,a=Un(n.doc,[...t]);if(tr(a).forEach(({newRange:l})=>{const u=Jn(r.doc,l,h=>h.isTextblock);let d,p;if(u.length>1?(d=u[0],p=r.doc.textBetween(d.pos,d.pos+d.node.nodeSize,void 0," ")):u.length&&r.doc.textBetween(l.from,l.to," "," ").endsWith(" ")&&(d=u[0],p=r.doc.textBetween(d.pos,l.to,void 0," ")),d&&p){const h=p.split(" ").filter(v=>v!=="");if(h.length<=0)return!1;const f=h[h.length-1],g=d.pos+p.lastIndexOf(f);if(!f)return!1;const y=m.tokenize(f).map(v=>v.toObject(e.defaultProtocol));if(!Qs(y))return!1;y.filter(v=>v.isLink).map(v=>({...v,from:g+v.start+1,to:g+v.end+1})).filter(v=>r.schema.marks.code?!r.doc.rangeHasMark(v.from,v.to,r.schema.marks.code):!0).filter(v=>e.validate(v.value)).filter(v=>e.shouldAutoLink(v.value)).forEach(v=>{Vt(v.from,v.to,r.doc).some(S=>S.mark.type===e.type)||i.addMark(v.from,v.to,e.type.create({href:v.href}))})}}),!!i.steps.length)return i}})}function to(e){return new m.Plugin({key:new m.PluginKey("handleClickLink"),props:{handleClick:(t,n,r)=>{var s,o;if(r.button!==0||!t.editable)return!1;let i=r.target;const a=[];for(;i.nodeName!=="DIV";)a.push(i),i=i.parentNode;if(!a.find(p=>p.nodeName==="A"))return!1;const c=Ae(t.state,e.type.name),l=r.target,u=(s=l==null?void 0:l.href)!==null&&s!==void 0?s:c.href,d=(o=l==null?void 0:l.target)!==null&&o!==void 0?o:c.target;return l&&u?(window.open(u,d),!0):!1}}})}function eo(e){return new m.Plugin({key:new m.PluginKey("handlePasteLink"),props:{handlePaste:(t,n,r)=>{const{state:s}=t,{selection:o}=s,{empty:i}=o;if(i)return!1;let a="";r.content.forEach(l=>{a+=l.textContent});const c=m.find(a,{defaultProtocol:e.defaultProtocol}).find(l=>l.isLink&&l.value===a);return!a||!c?!1:(e.editor.commands.setMark(e.type,{href:c.href}),!0)}}})}const no=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;function Z(e,t){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return t&&t.forEach(r=>{const s=typeof r=="string"?r:r.scheme;s&&n.push(s)}),!e||e.replace(no,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z+.-]+(?:[^a-z+.-:]|$))`,"i"))}const ro=D.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(e=>{if(typeof e=="string"){m.registerCustomProtocol(e);return}m.registerCustomProtocol(e.scheme,e.optionalSlashes)})},onDestroy(){m.reset()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(e,t)=>!!Z(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>!!e}},addAttributes(){return{href:{default:null,parseHTML(e){return e.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:e=>{const t=e.getAttribute("href");return!t||!this.options.isAllowedUri(t,{defaultValidate:n=>!!Z(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:t=>!!Z(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",O(this.options.HTMLAttributes,e),0]:["a",O(this.options.HTMLAttributes,{...e,href:""}),0]},addCommands(){return{setLink:e=>({chain:t})=>t().setMark(this.name,e).setMeta("preventAutolink",!0).run(),toggleLink:e=>({chain:t})=>t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run(),unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[F({find:e=>{const t=[];if(e){const{protocols:n,defaultProtocol:r}=this.options,s=m.find(e).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:i=>!!Z(i,n),protocols:n,defaultProtocol:r}));s.length&&s.forEach(o=>t.push({text:o.value,data:{href:o.href},index:o.start}))}return t},type:this.type,getAttributes:e=>{var t;return{href:(t=e.data)===null||t===void 0?void 0:t.href}}})]},addProseMirrorPlugins(){const e=[],{protocols:t,defaultProtocol:n}=this.options;return this.options.autolink&&e.push(Zs({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:s=>!!Z(s,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&e.push(to({type:this.type})),this.options.linkOnPaste&&e.push(eo({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),e}}),so=R.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:e}){return["hr",O(this.options.HTMLAttributes,e)]},addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{const{selection:n}=t,{$from:r,$to:s}=n,o=e();return r.parentOffset===0?o.insertContentAt({from:Math.max(r.pos-1,0),to:s.pos},{type:this.name}):Le(n)?o.insertContentAt(s.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({tr:i,dispatch:a})=>{var c;if(a){const{$to:l}=i.selection,u=l.end();if(l.nodeAfter)l.nodeAfter.isTextblock?i.setSelection(m.TextSelection.create(i.doc,l.pos+1)):l.nodeAfter.isBlock?i.setSelection(m.NodeSelection.create(i.doc,l.pos)):i.setSelection(m.TextSelection.create(i.doc,l.pos));else{const d=(c=l.parent.type.contentMatch.defaultType)===null||c===void 0?void 0:c.create();d&&(i.insert(u,d),i.setSelection(m.TextSelection.create(i.doc,u+1)))}i.scrollIntoView()}return!0}).run()}}},addInputRules(){return[Wt({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),oo=H.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>m.undo(e,t),redo:()=>({state:e,dispatch:t})=>m.redo(e,t)}},addProseMirrorPlugins(){return[m.history(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),io=H.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:e=>e.length,wordCounter:e=>e.split(" ").filter(t=>t!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=e=>{const t=(e==null?void 0:e.node)||this.editor.state.doc;if(((e==null?void 0:e.mode)||this.options.mode)==="textSize"){const r=t.textBetween(0,t.content.size,void 0," ");return this.options.textCounter(r)}return t.nodeSize},this.storage.words=e=>{const t=(e==null?void 0:e.node)||this.editor.state.doc,n=t.textBetween(0,t.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new m.Plugin({key:new m.PluginKey("characterCount"),appendTransaction:(t,n,r)=>{if(e)return;const s=this.options.limit;if(s==null||s===0){e=!0;return}const o=this.storage.characters({node:r.doc});if(o>s){const i=o-s,a=0,c=i;console.warn(`[CharacterCount] Initial content exceeded limit of ${s} characters. Content was automatically trimmed.`);const l=r.tr.deleteRange(a,c);return e=!0,l}e=!0},filterTransaction:(t,n)=>{const r=this.options.limit;if(!t.docChanged||r===0||r===null||r===void 0)return!0;const s=this.storage.characters({node:n.doc}),o=this.storage.characters({node:t.doc});if(o<=r||s>r&&o>r&&o<=s)return!0;if(s>r&&o>r&&o>s||!t.getMeta("paste"))return!1;const a=t.selection.$head.pos,c=o-r,l=a-c,u=a;return t.deleteRange(l,u),!(this.storage.characters({node:t.doc})>r)}})]}}),ao=H.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[m.dropCursor(this.options)]}}),lo=H.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new m.Plugin({key:new m.PluginKey("focus"),props:{decorations:({doc:e,selection:t})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:s}=t,o=[];if(!n||!r)return m.DecorationSet.create(e,[]);let i=0;this.options.mode==="deepest"&&e.descendants((c,l)=>{if(c.isText)return;if(!(s>=l&&s<=l+c.nodeSize-1))return!1;i+=1});let a=0;return e.descendants((c,l)=>{if(c.isText||!(s>=l&&s<=l+c.nodeSize-1))return!1;if(a+=1,this.options.mode==="deepest"&&i-a>0||this.options.mode==="shallowest"&&a>1)return this.options.mode==="deepest";o.push(m.Decoration.node(l,l+c.nodeSize,{class:this.options.className}))}),m.DecorationSet.create(e,o)}}})]}}),co=H.create({name:"gapCursor",addProseMirrorPlugins(){return[m.gapCursor()]},extendNodeSchema(e){var t;const n={name:e.name,options:e.options,storage:e.storage};return{allowGapCursor:(t=C(w(e,"allowGapCursor",n)))!==null&&t!==void 0?t:null}}}),uo=R.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:e}){return["br",O(this.options.HTMLAttributes,e)]},renderText(){return`
|
|
116
|
-
`},addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command(()=>{const{selection:s,storedMarks:o}=n;if(s.$from.parent.type.spec.isolating)return!1;const{keepMarks:i}=this.options,{splittableMarks:a}=r.extensionManager,c=o||s.$to.parentOffset&&s.$from.marks();return t().insertContent({type:this.name}).command(({tr:l,dispatch:u})=>{if(u&&c&&i){const d=c.filter(p=>a.includes(p.type.name));l.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),po=R.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:e}){return["li",O(this.options.HTMLAttributes,e),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),ho=R.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:e}){return["p",O(this.options.HTMLAttributes,e),0]},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),fo=H.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new m.Plugin({key:new m.PluginKey("placeholder"),props:{decorations:({doc:e,selection:t})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=t,s=[];if(!n)return null;const o=this.editor.isEmpty;return e.descendants((i,a)=>{const c=r>=a&&r<=a+i.nodeSize,l=!i.isLeaf&&Mt(i);if((c||!this.options.showOnlyCurrent)&&l){const u=[this.options.emptyNodeClass];o&&u.push(this.options.emptyEditorClass);const d=m.Decoration.node(a,a+i.nodeSize,{class:u.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:i,pos:a,hasAnchor:c}):this.options.placeholder});s.push(d)}return this.options.includeChildren}),m.DecorationSet.create(e,s)}}})]}}),mo=R.create({name:"text",group:"inline"}),go=R.create({name:"doc",topNode:!0,content:"block+"}),yo=D.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(e){return e!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:e}){return["sub",O(this.options.HTMLAttributes,e),0]},addCommands(){return{setSubscript:()=>({commands:e})=>e.setMark(this.name),toggleSubscript:()=>({commands:e})=>e.toggleMark(this.name),unsetSubscript:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),vo=D.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(e){return e!=="super"?!1:null}}]},renderHTML({HTMLAttributes:e}){return["sup",O(this.options.HTMLAttributes,e),0]},addCommands(){return{setSuperscript:()=>({commands:e})=>e.setMark(this.name),toggleSuperscript:()=>({commands:e})=>e.toggleMark(this.name),unsetSuperscript:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}});function bo(e){var t;const{char:n,allowSpaces:r,allowedPrefixes:s,startOfLine:o,$position:i}=e,a=_r(n),c=new RegExp(`\\s${a}$`),l=o?"^":"",u=r?new RegExp(`${l}${a}.*?(?=\\s${a}|$)`,"gm"):new RegExp(`${l}(?:^)?${a}[^\\s${a}]*`,"gm"),d=((t=i.nodeBefore)===null||t===void 0?void 0:t.isText)&&i.nodeBefore.text;if(!d)return null;const p=i.pos-d.length,h=Array.from(d.matchAll(u)).pop();if(!h||h.input===void 0||h.index===void 0)return null;const f=h.input.slice(Math.max(0,h.index-1),h.index),g=new RegExp(`^[${s==null?void 0:s.join("")}\0]?$`).test(f);if(s!==null&&!g)return null;const y=p+h.index;let v=y+h[0].length;return r&&c.test(d.slice(v-1,v+1))&&(h[0]+=" ",v+=1),y<i.pos&&v>=i.pos?{range:{from:y,to:v},query:h[0].slice(n.length),text:h[0]}:null}const Mo=new m.PluginKey("suggestion");function $e({pluginKey:e=Mo,editor:t,char:n="@",allowSpaces:r=!1,allowedPrefixes:s=[" "],startOfLine:o=!1,decorationTag:i="span",decorationClass:a="suggestion",command:c=()=>null,items:l=()=>[],render:u=()=>({}),allow:d=()=>!0,findSuggestionMatch:p=bo}){let h;const f=u==null?void 0:u(),g=new m.Plugin({key:e,view(){return{update:async(y,v)=>{var S,b,M,T,k,x,L;const E=(S=this.key)===null||S===void 0?void 0:S.getState(v),P=(b=this.key)===null||b===void 0?void 0:b.getState(y.state),N=E.active&&P.active&&E.range.from!==P.range.from,B=!E.active&&P.active,G=E.active&&!P.active,V=!B&&!G&&E.query!==P.query,W=B||N&&V,j=V||N,K=G||N&&V;if(!W&&!j&&!K)return;const J=K&&!W?E:P,qt=y.dom.querySelector(`[data-decoration-id="${J.decorationId}"]`);h={editor:t,range:J.range,query:J.query,text:J.text,items:[],command:Q=>c({editor:t,range:J.range,props:Q}),decorationNode:qt,clientRect:qt?()=>{var Q;const{decorationId:Be}=(Q=this.key)===null||Q===void 0?void 0:Q.getState(t.state),kt=y.dom.querySelector(`[data-decoration-id="${Be}"]`);return(kt==null?void 0:kt.getBoundingClientRect())||null}:null},W&&((M=f==null?void 0:f.onBeforeStart)===null||M===void 0||M.call(f,h)),j&&((T=f==null?void 0:f.onBeforeUpdate)===null||T===void 0||T.call(f,h)),(j||W)&&(h.items=await l({editor:t,query:J.query})),K&&((k=f==null?void 0:f.onExit)===null||k===void 0||k.call(f,h)),j&&((x=f==null?void 0:f.onUpdate)===null||x===void 0||x.call(f,h)),W&&((L=f==null?void 0:f.onStart)===null||L===void 0||L.call(f,h))},destroy:()=>{var y;h&&((y=f==null?void 0:f.onExit)===null||y===void 0||y.call(f,h))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(y,v,S,b){const{isEditable:M}=t,{composing:T}=t.view,{selection:k}=y,{empty:x,from:L}=k,E={...v};if(E.composing=T,M&&(x||t.view.composing)){(L<v.range.from||L>v.range.to)&&!T&&!v.composing&&(E.active=!1);const P=p({char:n,allowSpaces:r,allowedPrefixes:s,startOfLine:o,$position:k.$from}),N=`id_${Math.floor(Math.random()*4294967295)}`;P&&d({editor:t,state:b,range:P.range,isActive:v.active})?(E.active=!0,E.decorationId=v.decorationId?v.decorationId:N,E.range=P.range,E.query=P.query,E.text=P.text):E.active=!1}else E.active=!1;return E.active||(E.decorationId=null,E.range={from:0,to:0},E.query=null,E.text=null),E}},props:{handleKeyDown(y,v){var S;const{active:b,range:M}=g.getState(y.state);return b&&((S=f==null?void 0:f.onKeyDown)===null||S===void 0?void 0:S.call(f,{view:y,event:v,range:M}))||!1},decorations(y){const{active:v,range:S,decorationId:b}=g.getState(y);return v?m.DecorationSet.create(y.doc,[m.Decoration.inline(S.from,S.to,{nodeName:i,class:a,"data-decoration-id":b})]):null}}});return g}const So=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,ko=R.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:e}){return["img",O(this.options.HTMLAttributes,e)]},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[Wt({find:So,type:this.type,getAttributes:e=>{const[,,t,n,r]=e;return{src:n,alt:t,title:r}}})]}}),wo=R.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:e}){return["tr",O(this.options.HTMLAttributes,e),0]}});function $t(e,t){return t?["width",`${Math.max(t,e)}px`]:["min-width",`${e}px`]}function he(e,t,n,r,s,o){var i;let a=0,c=!0,l=t.firstChild;const u=e.firstChild;if(u!==null)for(let d=0,p=0;d<u.childCount;d+=1){const{colspan:h,colwidth:f}=u.child(d).attrs;for(let g=0;g<h;g+=1,p+=1){const y=s===p?o:f&&f[g],v=y?`${y}px`:"";if(a+=y||r,y||(c=!1),l){if(l.style.width!==v){const[S,b]=$t(r,y);l.style.setProperty(S,b)}l=l.nextSibling}else{const S=document.createElement("col"),[b,M]=$t(r,y);S.style.setProperty(b,M),t.appendChild(S)}}}for(;l;){const d=l.nextSibling;(i=l.parentNode)===null||i===void 0||i.removeChild(l),l=d}c?(n.style.width=`${a}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${a}px`)}class To{constructor(t,n){this.node=t,this.cellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),he(t,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type!==this.node.type?!1:(this.node=t,he(t,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(t){return t.type==="attributes"&&(t.target===this.table||this.colgroup.contains(t.target))}}function Eo(e,t,n,r){let s=0,o=!0;const i=[],a=e.firstChild;if(!a)return{};for(let d=0,p=0;d<a.childCount;d+=1){const{colspan:h,colwidth:f}=a.child(d).attrs;for(let g=0;g<h;g+=1,p+=1){const y=n===p?r:f&&f[g];s+=y||t,y||(o=!1);const[v,S]=$t(t,y);i.push(["col",{style:`${v}: ${S}`}])}}const c=o?`${s}px`:"",l=o?"":`${s}px`;return{colgroup:["colgroup",{},...i],tableWidth:c,tableMinWidth:l}}function fe(e,t){return e.createAndFill()}function Co(e){if(e.cached.tableNodeTypes)return e.cached.tableNodeTypes;const t={};return Object.keys(e.nodes).forEach(n=>{const r=e.nodes[n];r.spec.tableRole&&(t[r.spec.tableRole]=r)}),e.cached.tableNodeTypes=t,t}function xo(e,t,n,r,s){const o=Co(e),i=[],a=[];for(let l=0;l<n;l+=1){const u=fe(o.cell);if(u&&a.push(u),r){const d=fe(o.header_cell);d&&i.push(d)}}const c=[];for(let l=0;l<t;l+=1)c.push(o.row.createChecked(null,r&&l===0?i:a));return o.table.createChecked(null,c)}function Ao(e){return e instanceof m.CellSelection}const it=({editor:e})=>{const{selection:t}=e.state;if(!Ao(t))return!1;let n=0;const r=xe(t.ranges[0].$from,o=>o.type.name==="table");return r==null||r.node.descendants(o=>{if(o.type.name==="table")return!1;["tableCell","tableHeader"].includes(o.type.name)&&(n+=1)}),n===t.ranges.length?(e.commands.deleteTable(),!0):!1},Oo=R.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:To,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:e,HTMLAttributes:t}){const{colgroup:n,tableWidth:r,tableMinWidth:s}=Eo(e,this.options.cellMinWidth);return["table",O(this.options.HTMLAttributes,t,{style:r?`width: ${r}`:`min-width: ${s}`}),n,["tbody",0]]},addCommands(){return{insertTable:({rows:e=3,cols:t=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:s,editor:o})=>{const i=xo(o.schema,e,t,n);if(s){const a=r.selection.from+1;r.replaceSelectionWith(i).scrollIntoView().setSelection(m.TextSelection.near(r.doc.resolve(a)))}return!0},addColumnBefore:()=>({state:e,dispatch:t})=>m.addColumnBefore(e,t),addColumnAfter:()=>({state:e,dispatch:t})=>m.addColumnAfter(e,t),deleteColumn:()=>({state:e,dispatch:t})=>m.deleteColumn(e,t),addRowBefore:()=>({state:e,dispatch:t})=>m.addRowBefore(e,t),addRowAfter:()=>({state:e,dispatch:t})=>m.addRowAfter(e,t),deleteRow:()=>({state:e,dispatch:t})=>m.deleteRow(e,t),deleteTable:()=>({state:e,dispatch:t})=>m.deleteTable(e,t),mergeCells:()=>({state:e,dispatch:t})=>m.mergeCells(e,t),splitCell:()=>({state:e,dispatch:t})=>m.splitCell(e,t),toggleHeaderColumn:()=>({state:e,dispatch:t})=>m.toggleHeader("column")(e,t),toggleHeaderRow:()=>({state:e,dispatch:t})=>m.toggleHeader("row")(e,t),toggleHeaderCell:()=>({state:e,dispatch:t})=>m.toggleHeaderCell(e,t),mergeOrSplit:()=>({state:e,dispatch:t})=>m.mergeCells(e,t)?!0:m.splitCell(e,t),setCellAttribute:(e,t)=>({state:n,dispatch:r})=>m.setCellAttr(e,t)(n,r),goToNextCell:()=>({state:e,dispatch:t})=>m.goToNextCell(1)(e,t),goToPreviousCell:()=>({state:e,dispatch:t})=>m.goToNextCell(-1)(e,t),fixTables:()=>({state:e,dispatch:t})=>(t&&m.fixTables(e),!0),setCellSelection:e=>({tr:t,dispatch:n})=>{if(n){const r=m.CellSelection.create(t.doc,e.anchorCell,e.headCell);t.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:it,"Mod-Backspace":it,Delete:it,"Mod-Delete":it}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[m.columnResizing({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],m.tableEditing({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(e){const t={name:e.name,options:e.options,storage:e.storage};return{tableRole:C(w(e,"tableRole",t))}}}),Lo=R.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{const t=e.getAttribute("colwidth");return t?t.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:e}){return["td",O(this.options.HTMLAttributes,e),0]}}),Po=R.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{const t=e.getAttribute("colwidth");return t?t.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:e}){return["th",O(this.options.HTMLAttributes,e),0]}}),Ro=new m.PluginKey("mention"),Ho=R.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({options:e,node:t}){var n;return`${e.suggestion.char}${(n=t.attrs.label)!==null&&n!==void 0?n:t.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:e,node:t}){var n;return["span",O(this.HTMLAttributes,e.HTMLAttributes),`${e.suggestion.char}${(n=t.attrs.label)!==null&&n!==void 0?n:t.attrs.id}`]},suggestion:{char:"@",pluginKey:Ro,command:({editor:e,range:t,props:n})=>{var r,s,o;const i=e.view.state.selection.$to.nodeAfter;((r=i==null?void 0:i.text)===null||r===void 0?void 0:r.startsWith(" "))&&(t.to+=1),e.chain().focus().insertContentAt(t,[{type:this.name,attrs:n},{type:"text",text:" "}]).run(),(o=(s=e.view.dom.ownerDocument.defaultView)===null||s===void 0?void 0:s.getSelection())===null||o===void 0||o.collapseToEnd()},allow:({state:e,range:t})=>{const n=e.doc.resolve(t.from),r=e.schema.nodes[this.name];return!!n.parent.type.contentMatch.matchType(r)}}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:e=>e.getAttribute("data-id"),renderHTML:e=>e.id?{"data-id":e.id}:{}},label:{default:null,parseHTML:e=>e.getAttribute("data-label"),renderHTML:e=>e.label?{"data-label":e.label}:{}}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:e,HTMLAttributes:t}){if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",O({"data-type":this.name},this.options.HTMLAttributes,t),this.options.renderLabel({options:this.options,node:e})];const n={...this.options};n.HTMLAttributes=O({"data-type":this.name},this.options.HTMLAttributes,t);const r=this.options.renderHTML({options:n,node:e});return typeof r=="string"?["span",O({"data-type":this.name},this.options.HTMLAttributes,t),r]:r},renderText({node:e}){return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel({options:this.options,node:e})):this.options.renderText({options:this.options,node:e})},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:e,state:t})=>{let n=!1;const{selection:r}=t,{empty:s,anchor:o}=r;return s?(t.doc.nodesBetween(o-1,o,(i,a)=>{if(i.type.name===this.name)return n=!0,e.insertText(this.options.deleteTriggerWithBackspace?"":this.options.suggestion.char||"",a,a+i.nodeSize),!1}),n):!1})}},addProseMirrorPlugins(){return[$e({editor:this.editor,...this.options.suggestion})]}});exports.Blockquote=Xs;exports.Bold=jr;exports.BubbleMenu=cs;exports.BulletList=Ws;exports.CharacterCount=io;exports.Code=Ps;exports.CodeBlock=_s;exports.Color=Bs;exports.Document=go;exports.DragHandlePlugin=bs;exports.Dropcursor=ao;exports.EditorContent=Yr;exports.Extension=H;exports.FocusClasses=lo;exports.FontFamily=Is;exports.Gapcursor=co;exports.HardBreak=uo;exports.Heading=Ns;exports.Highlight=zs;exports.History=oo;exports.HorizontalRule=so;exports.Image=ko;exports.Italic=Ts;exports.Link=ro;exports.ListItem=po;exports.Mention=Ho;exports.Node=R;exports.NodeViewContent=ds;exports.NodeViewWrapper=us;exports.OrderedList=Us;exports.Paragraph=ho;exports.Placeholder=fo;exports.ReactNodeViewRenderer=ms;exports.ReactRenderer=De;exports.Strike=As;exports.Subscript=yo;exports.Suggestion=$e;exports.Superscript=vo;exports.Table=Oo;exports.TableCell=Lo;exports.TableHeader=Po;exports.TableRow=wo;exports.TaskItem=Gs;exports.TaskList=Js;exports.Text=mo;exports.TextAlign=$s;exports.TextStyle=Ds;exports.Underline=Es;exports.dragHandlePluginDefaultKey=Ne;exports.findChildren=Gn;exports.findParentNode=bt;exports.getMarkRange=gt;exports.isActive=Oe;exports.isList=Ht;exports.isNumber=be;exports.mergeAttributes=O;exports.nodeInputRule=Wt;exports.nodePasteRule=Dr;exports.useEditor=as;
|