@ckeditor/ckeditor5-comments 44.1.0-alpha.5 → 44.2.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +1 -2
- package/README.md +1 -1
- package/build/comments.js +2 -2
- package/dist/index-content.css +2 -2
- package/dist/index-editor.css +2 -2
- package/dist/index.css +15 -15
- package/dist/index.js +10 -10
- package/dist/translations/af.d.ts +2 -2
- package/dist/translations/af.js +2 -2
- package/dist/translations/af.umd.js +2 -2
- package/dist/translations/ar.d.ts +2 -2
- package/dist/translations/ar.js +2 -2
- package/dist/translations/ar.umd.js +2 -2
- package/dist/translations/ast.d.ts +2 -2
- package/dist/translations/ast.js +2 -2
- package/dist/translations/ast.umd.js +2 -2
- package/dist/translations/az.d.ts +2 -2
- package/dist/translations/az.js +2 -2
- package/dist/translations/az.umd.js +2 -2
- package/dist/translations/bg.d.ts +2 -2
- package/dist/translations/bg.js +2 -2
- package/dist/translations/bg.umd.js +2 -2
- package/dist/translations/bn.d.ts +2 -2
- package/dist/translations/bn.js +2 -2
- package/dist/translations/bn.umd.js +2 -2
- package/dist/translations/bs.d.ts +2 -2
- package/dist/translations/bs.js +2 -2
- package/dist/translations/bs.umd.js +2 -2
- package/dist/translations/ca.d.ts +2 -2
- package/dist/translations/ca.js +2 -2
- package/dist/translations/ca.umd.js +2 -2
- package/dist/translations/cs.d.ts +2 -2
- package/dist/translations/cs.js +2 -2
- package/dist/translations/cs.umd.js +2 -2
- package/dist/translations/da.d.ts +2 -2
- package/dist/translations/da.js +2 -2
- package/dist/translations/da.umd.js +2 -2
- package/dist/translations/de-ch.d.ts +2 -2
- package/dist/translations/de-ch.js +2 -2
- package/dist/translations/de-ch.umd.js +2 -2
- package/dist/translations/de.d.ts +2 -2
- package/dist/translations/de.js +2 -2
- package/dist/translations/de.umd.js +2 -2
- package/dist/translations/el.d.ts +2 -2
- package/dist/translations/el.js +2 -2
- package/dist/translations/el.umd.js +2 -2
- package/dist/translations/en-au.d.ts +2 -2
- package/dist/translations/en-au.js +2 -2
- package/dist/translations/en-au.umd.js +2 -2
- package/dist/translations/en-gb.d.ts +2 -2
- package/dist/translations/en-gb.js +2 -2
- package/dist/translations/en-gb.umd.js +2 -2
- package/dist/translations/en.d.ts +2 -2
- package/dist/translations/en.js +2 -2
- package/dist/translations/en.umd.js +2 -2
- package/dist/translations/eo.d.ts +2 -2
- package/dist/translations/eo.js +2 -2
- package/dist/translations/eo.umd.js +2 -2
- package/dist/translations/es-co.d.ts +2 -2
- package/dist/translations/es-co.js +2 -2
- package/dist/translations/es-co.umd.js +2 -2
- package/dist/translations/es.d.ts +2 -2
- package/dist/translations/es.js +2 -2
- package/dist/translations/es.umd.js +2 -2
- package/dist/translations/et.d.ts +2 -2
- package/dist/translations/et.js +2 -2
- package/dist/translations/et.umd.js +2 -2
- package/dist/translations/eu.d.ts +2 -2
- package/dist/translations/eu.js +2 -2
- package/dist/translations/eu.umd.js +2 -2
- package/dist/translations/fa.d.ts +2 -2
- package/dist/translations/fa.js +2 -2
- package/dist/translations/fa.umd.js +2 -2
- package/dist/translations/fi.d.ts +2 -2
- package/dist/translations/fi.js +2 -2
- package/dist/translations/fi.umd.js +2 -2
- package/dist/translations/fr.d.ts +2 -2
- package/dist/translations/fr.js +2 -2
- package/dist/translations/fr.umd.js +2 -2
- package/dist/translations/gl.d.ts +2 -2
- package/dist/translations/gl.js +2 -2
- package/dist/translations/gl.umd.js +2 -2
- package/dist/translations/gu.d.ts +2 -2
- package/dist/translations/gu.js +2 -2
- package/dist/translations/gu.umd.js +2 -2
- package/dist/translations/he.d.ts +2 -2
- package/dist/translations/he.js +2 -2
- package/dist/translations/he.umd.js +2 -2
- package/dist/translations/hi.d.ts +2 -2
- package/dist/translations/hi.js +2 -2
- package/dist/translations/hi.umd.js +2 -2
- package/dist/translations/hr.d.ts +2 -2
- package/dist/translations/hr.js +2 -2
- package/dist/translations/hr.umd.js +2 -2
- package/dist/translations/hu.d.ts +2 -2
- package/dist/translations/hu.js +2 -2
- package/dist/translations/hu.umd.js +2 -2
- package/dist/translations/hy.d.ts +2 -2
- package/dist/translations/hy.js +2 -2
- package/dist/translations/hy.umd.js +2 -2
- package/dist/translations/id.d.ts +2 -2
- package/dist/translations/id.js +2 -2
- package/dist/translations/id.umd.js +2 -2
- package/dist/translations/it.d.ts +2 -2
- package/dist/translations/it.js +2 -2
- package/dist/translations/it.umd.js +2 -2
- package/dist/translations/ja.d.ts +2 -2
- package/dist/translations/ja.js +2 -2
- package/dist/translations/ja.umd.js +2 -2
- package/dist/translations/jv.d.ts +2 -2
- package/dist/translations/jv.js +2 -2
- package/dist/translations/jv.umd.js +2 -2
- package/dist/translations/kk.d.ts +2 -2
- package/dist/translations/kk.js +2 -2
- package/dist/translations/kk.umd.js +2 -2
- package/dist/translations/km.d.ts +2 -2
- package/dist/translations/km.js +2 -2
- package/dist/translations/km.umd.js +2 -2
- package/dist/translations/kn.d.ts +2 -2
- package/dist/translations/kn.js +2 -2
- package/dist/translations/kn.umd.js +2 -2
- package/dist/translations/ko.d.ts +2 -2
- package/dist/translations/ko.js +2 -2
- package/dist/translations/ko.umd.js +2 -2
- package/dist/translations/ku.d.ts +2 -2
- package/dist/translations/ku.js +2 -2
- package/dist/translations/ku.umd.js +2 -2
- package/dist/translations/lt.d.ts +2 -2
- package/dist/translations/lt.js +2 -2
- package/dist/translations/lt.umd.js +2 -2
- package/dist/translations/lv.d.ts +2 -2
- package/dist/translations/lv.js +2 -2
- package/dist/translations/lv.umd.js +2 -2
- package/dist/translations/ms.d.ts +2 -2
- package/dist/translations/ms.js +2 -2
- package/dist/translations/ms.umd.js +2 -2
- package/dist/translations/nb.d.ts +2 -2
- package/dist/translations/nb.js +2 -2
- package/dist/translations/nb.umd.js +2 -2
- package/dist/translations/ne.d.ts +2 -2
- package/dist/translations/ne.js +2 -2
- package/dist/translations/ne.umd.js +2 -2
- package/dist/translations/nl.d.ts +2 -2
- package/dist/translations/nl.js +2 -2
- package/dist/translations/nl.umd.js +2 -2
- package/dist/translations/no.d.ts +2 -2
- package/dist/translations/no.js +2 -2
- package/dist/translations/no.umd.js +2 -2
- package/dist/translations/oc.d.ts +2 -2
- package/dist/translations/oc.js +2 -2
- package/dist/translations/oc.umd.js +2 -2
- package/dist/translations/pl.d.ts +2 -2
- package/dist/translations/pl.js +2 -2
- package/dist/translations/pl.umd.js +2 -2
- package/dist/translations/pt-br.d.ts +2 -2
- package/dist/translations/pt-br.js +2 -2
- package/dist/translations/pt-br.umd.js +2 -2
- package/dist/translations/pt.d.ts +2 -2
- package/dist/translations/pt.js +2 -2
- package/dist/translations/pt.umd.js +2 -2
- package/dist/translations/ro.d.ts +2 -2
- package/dist/translations/ro.js +2 -2
- package/dist/translations/ro.umd.js +2 -2
- package/dist/translations/ru.d.ts +2 -2
- package/dist/translations/ru.js +2 -2
- package/dist/translations/ru.umd.js +2 -2
- package/dist/translations/si.d.ts +2 -2
- package/dist/translations/si.js +2 -2
- package/dist/translations/si.umd.js +2 -2
- package/dist/translations/sk.d.ts +2 -2
- package/dist/translations/sk.js +2 -2
- package/dist/translations/sk.umd.js +2 -2
- package/dist/translations/sl.d.ts +2 -2
- package/dist/translations/sl.js +2 -2
- package/dist/translations/sl.umd.js +2 -2
- package/dist/translations/sq.d.ts +2 -2
- package/dist/translations/sq.js +2 -2
- package/dist/translations/sq.umd.js +2 -2
- package/dist/translations/sr-latn.d.ts +2 -2
- package/dist/translations/sr-latn.js +2 -2
- package/dist/translations/sr-latn.umd.js +2 -2
- package/dist/translations/sr.d.ts +2 -2
- package/dist/translations/sr.js +2 -2
- package/dist/translations/sr.umd.js +2 -2
- package/dist/translations/sv.d.ts +2 -2
- package/dist/translations/sv.js +2 -2
- package/dist/translations/sv.umd.js +2 -2
- package/dist/translations/th.d.ts +2 -2
- package/dist/translations/th.js +2 -2
- package/dist/translations/th.umd.js +2 -2
- package/dist/translations/ti.d.ts +2 -2
- package/dist/translations/ti.js +2 -2
- package/dist/translations/ti.umd.js +2 -2
- package/dist/translations/tk.d.ts +2 -2
- package/dist/translations/tk.js +2 -2
- package/dist/translations/tk.umd.js +2 -2
- package/dist/translations/tr.d.ts +2 -2
- package/dist/translations/tr.js +2 -2
- package/dist/translations/tr.umd.js +2 -2
- package/dist/translations/tt.d.ts +2 -2
- package/dist/translations/tt.js +2 -2
- package/dist/translations/tt.umd.js +2 -2
- package/dist/translations/ug.d.ts +2 -2
- package/dist/translations/ug.js +2 -2
- package/dist/translations/ug.umd.js +2 -2
- package/dist/translations/uk.d.ts +2 -2
- package/dist/translations/uk.js +2 -2
- package/dist/translations/uk.umd.js +2 -2
- package/dist/translations/ur.d.ts +2 -2
- package/dist/translations/ur.js +2 -2
- package/dist/translations/ur.umd.js +2 -2
- package/dist/translations/uz.d.ts +2 -2
- package/dist/translations/uz.js +2 -2
- package/dist/translations/uz.umd.js +2 -2
- package/dist/translations/vi.d.ts +2 -2
- package/dist/translations/vi.js +2 -2
- package/dist/translations/vi.umd.js +2 -2
- package/dist/translations/zh-cn.d.ts +2 -2
- package/dist/translations/zh-cn.js +2 -2
- package/dist/translations/zh-cn.umd.js +2 -2
- package/dist/translations/zh.d.ts +2 -2
- package/dist/translations/zh.js +2 -2
- package/dist/translations/zh.umd.js +2 -2
- package/lang/translations/af.po +1 -1
- package/lang/translations/ar.po +1 -1
- package/lang/translations/ast.po +1 -1
- package/lang/translations/az.po +1 -1
- package/lang/translations/bg.po +1 -1
- package/lang/translations/bn.po +1 -1
- package/lang/translations/bs.po +1 -1
- package/lang/translations/ca.po +1 -1
- package/lang/translations/cs.po +1 -1
- package/lang/translations/da.po +1 -1
- package/lang/translations/de-ch.po +1 -1
- package/lang/translations/de.po +1 -1
- package/lang/translations/el.po +1 -1
- package/lang/translations/en-au.po +1 -1
- package/lang/translations/en-gb.po +1 -1
- package/lang/translations/en.po +1 -1
- package/lang/translations/eo.po +1 -1
- package/lang/translations/es-co.po +1 -1
- package/lang/translations/es.po +1 -1
- package/lang/translations/et.po +1 -1
- package/lang/translations/eu.po +1 -1
- package/lang/translations/fa.po +1 -1
- package/lang/translations/fi.po +1 -1
- package/lang/translations/fr.po +1 -1
- package/lang/translations/gl.po +1 -1
- package/lang/translations/gu.po +1 -1
- package/lang/translations/he.po +1 -1
- package/lang/translations/hi.po +1 -1
- package/lang/translations/hr.po +1 -1
- package/lang/translations/hu.po +1 -1
- package/lang/translations/hy.po +1 -1
- package/lang/translations/id.po +1 -1
- package/lang/translations/it.po +1 -1
- package/lang/translations/ja.po +1 -1
- package/lang/translations/jv.po +1 -1
- package/lang/translations/kk.po +1 -1
- package/lang/translations/km.po +1 -1
- package/lang/translations/kn.po +1 -1
- package/lang/translations/ko.po +1 -1
- package/lang/translations/ku.po +1 -1
- package/lang/translations/lt.po +1 -1
- package/lang/translations/lv.po +1 -1
- package/lang/translations/ms.po +1 -1
- package/lang/translations/nb.po +1 -1
- package/lang/translations/ne.po +1 -1
- package/lang/translations/nl.po +1 -1
- package/lang/translations/no.po +1 -1
- package/lang/translations/oc.po +1 -1
- package/lang/translations/pl.po +1 -1
- package/lang/translations/pt-br.po +1 -1
- package/lang/translations/pt.po +1 -1
- package/lang/translations/ro.po +1 -1
- package/lang/translations/ru.po +1 -1
- package/lang/translations/si.po +1 -1
- package/lang/translations/sk.po +1 -1
- package/lang/translations/sl.po +1 -1
- package/lang/translations/sq.po +1 -1
- package/lang/translations/sr-latn.po +1 -1
- package/lang/translations/sr.po +1 -1
- package/lang/translations/sv.po +1 -1
- package/lang/translations/th.po +1 -1
- package/lang/translations/ti.po +1 -1
- package/lang/translations/tk.po +1 -1
- package/lang/translations/tr.po +1 -1
- package/lang/translations/tt.po +1 -1
- package/lang/translations/ug.po +1 -1
- package/lang/translations/uk.po +1 -1
- package/lang/translations/ur.po +1 -1
- package/lang/translations/uz.po +1 -1
- package/lang/translations/vi.po +1 -1
- package/lang/translations/zh-cn.po +1 -1
- package/lang/translations/zh.po +1 -1
- package/package.json +39 -16
- package/src/annotations/annotation.d.ts +1 -1
- package/src/annotations/annotation.js +3 -3
- package/src/annotations/annotationcollection.d.ts +1 -1
- package/src/annotations/annotationcollection.js +2 -2
- package/src/annotations/annotations.d.ts +1 -1
- package/src/annotations/annotations.js +2 -2
- package/src/annotations/annotationsuis.d.ts +2 -2
- package/src/annotations/annotationsuis.js +2 -2
- package/src/annotations/editorannotations.d.ts +1 -1
- package/src/annotations/editorannotations.js +2 -2
- package/src/annotations/inlineannotations.d.ts +1 -1
- package/src/annotations/inlineannotations.js +2 -2
- package/src/annotations/narrowsidebar.d.ts +1 -1
- package/src/annotations/narrowsidebar.js +2 -2
- package/src/annotations/sidebar.d.ts +1 -1
- package/src/annotations/sidebar.js +2 -2
- package/src/annotations/view/annotationcounterbuttonview.d.ts +1 -1
- package/src/annotations/view/annotationcounterbuttonview.js +2 -2
- package/src/annotations/view/annotationview.d.ts +1 -1
- package/src/annotations/view/annotationview.js +2 -2
- package/src/annotations/view/sidebaritemview.d.ts +1 -1
- package/src/annotations/view/sidebaritemview.js +2 -2
- package/src/annotations/view/sidebarview.d.ts +1 -1
- package/src/annotations/view/sidebarview.js +2 -2
- package/src/annotations/widesidebar.d.ts +1 -1
- package/src/annotations/widesidebar.js +2 -2
- package/src/augmentation.d.ts +1 -1
- package/src/augmentation.js +1 -1
- package/src/comments/addcommentthreadcommand.d.ts +1 -1
- package/src/comments/addcommentthreadcommand.js +2 -2
- package/src/comments/commentsarchive.d.ts +1 -1
- package/src/comments/commentsarchive.js +2 -2
- package/src/comments/commentsarchiveui.d.ts +1 -1
- package/src/comments/commentsarchiveui.js +2 -2
- package/src/comments/commentsediting.d.ts +1 -1
- package/src/comments/commentsediting.js +2 -2
- package/src/comments/commentsrepository.d.ts +1 -1
- package/src/comments/commentsrepository.js +4 -4
- package/src/comments/commentsui.d.ts +1 -1
- package/src/comments/commentsui.js +2 -2
- package/src/comments/integrations/clipboard.d.ts +1 -1
- package/src/comments/integrations/clipboard.js +2 -2
- package/src/comments/integrations/commentsrestrictededitingmode.d.ts +1 -1
- package/src/comments/integrations/commentsrestrictededitingmode.js +2 -2
- package/src/comments/integrations/importword.d.ts +1 -1
- package/src/comments/integrations/importword.js +2 -2
- package/src/comments/integrations/showcommenthighlights.d.ts +1 -1
- package/src/comments/integrations/showcommenthighlights.js +2 -2
- package/src/comments/ui/commenteditor/commenteditor.d.ts +1 -1
- package/src/comments/ui/commenteditor/commenteditor.js +3 -3
- package/src/comments/ui/commenteditor/commenteditorui.d.ts +1 -1
- package/src/comments/ui/commenteditor/commenteditorui.js +2 -2
- package/src/comments/ui/commenteditor/commenteditoruiview.d.ts +1 -1
- package/src/comments/ui/commenteditor/commenteditoruiview.js +2 -2
- package/src/comments/ui/commentthreadcontroller.d.ts +1 -1
- package/src/comments/ui/commentthreadcontroller.js +3 -3
- package/src/comments/ui/view/basecommentthreadview.d.ts +1 -1
- package/src/comments/ui/view/basecommentthreadview.js +2 -2
- package/src/comments/ui/view/basecommentview.d.ts +1 -1
- package/src/comments/ui/view/basecommentview.js +2 -2
- package/src/comments/ui/view/collapsedcommentsview.d.ts +1 -1
- package/src/comments/ui/view/collapsedcommentsview.js +2 -2
- package/src/comments/ui/view/commentcontentview.d.ts +1 -1
- package/src/comments/ui/view/commentcontentview.js +2 -2
- package/src/comments/ui/view/commentinputview.d.ts +1 -1
- package/src/comments/ui/view/commentinputview.js +2 -2
- package/src/comments/ui/view/commentsarchiveview.d.ts +1 -1
- package/src/comments/ui/view/commentsarchiveview.js +2 -2
- package/src/comments/ui/view/commentslistview.d.ts +1 -1
- package/src/comments/ui/view/commentslistview.js +2 -2
- package/src/comments/ui/view/commentthreadheadercontextview.d.ts +1 -1
- package/src/comments/ui/view/commentthreadheadercontextview.js +2 -2
- package/src/comments/ui/view/commentthreadheaderview.d.ts +1 -1
- package/src/comments/ui/view/commentthreadheaderview.js +2 -2
- package/src/comments/ui/view/commentthreadinputview.d.ts +1 -1
- package/src/comments/ui/view/commentthreadinputview.js +2 -2
- package/src/comments/ui/view/commentthreadview.d.ts +1 -1
- package/src/comments/ui/view/commentthreadview.js +3 -3
- package/src/comments/ui/view/commentview.d.ts +1 -1
- package/src/comments/ui/view/commentview.js +3 -3
- package/src/comments.d.ts +1 -1
- package/src/comments.js +2 -2
- package/src/commentsonly.d.ts +1 -1
- package/src/commentsonly.js +2 -2
- package/src/config.d.ts +1 -1
- package/src/config.js +1 -1
- package/src/index.d.ts +2 -2
- package/src/index.js +2 -2
- package/src/utils/common-translations.d.ts +1 -1
- package/src/utils/common-translations.js +2 -2
- package/src/utils/createmutationobserver.d.ts +1 -1
- package/src/utils/createmutationobserver.js +2 -2
- package/theme/annotation-inline.css +1 -1
- package/theme/annotation.css +1 -1
- package/theme/comment.css +1 -1
- package/theme/commentinput.css +1 -1
- package/theme/commentmarker.css +1 -1
- package/theme/commentsarchive.css +1 -1
- package/theme/commentthread.css +1 -1
- package/theme/icons/add-comment.svg +1 -1
- package/theme/icons/comments-archive.svg +1 -1
- package/theme/icons/edit-comment.svg +1 -1
- package/theme/icons/remove-comment.svg +1 -1
- package/theme/sidebar-narrow.css +1 -1
- package/theme/sidebar.css +1 -1
- package/dist/annotations/annotation.d.ts +0 -101
- package/dist/annotations/annotationcollection.d.ts +0 -102
- package/dist/annotations/annotations.d.ts +0 -166
- package/dist/annotations/annotationsuis.d.ts +0 -244
- package/dist/annotations/editorannotations.d.ts +0 -79
- package/dist/annotations/inlineannotations.d.ts +0 -102
- package/dist/annotations/narrowsidebar.d.ts +0 -97
- package/dist/annotations/sidebar.d.ts +0 -112
- package/dist/annotations/view/annotationcounterbuttonview.d.ts +0 -33
- package/dist/annotations/view/annotationview.d.ts +0 -94
- package/dist/annotations/view/sidebaritemview.d.ts +0 -63
- package/dist/annotations/view/sidebarview.d.ts +0 -57
- package/dist/annotations/widesidebar.d.ts +0 -89
- package/dist/augmentation.d.ts +0 -63
- package/dist/comments/addcommentthreadcommand.d.ts +0 -39
- package/dist/comments/commentsarchive.d.ts +0 -43
- package/dist/comments/commentsarchiveui.d.ts +0 -57
- package/dist/comments/commentsediting.d.ts +0 -106
- package/dist/comments/commentsrepository.d.ts +0 -1137
- package/dist/comments/commentsui.d.ts +0 -49
- package/dist/comments/integrations/clipboard.d.ts +0 -30
- package/dist/comments/integrations/commentsrestrictededitingmode.d.ts +0 -21
- package/dist/comments/integrations/importword.d.ts +0 -25
- package/dist/comments/integrations/showcommenthighlights.d.ts +0 -23
- package/dist/comments/ui/commenteditor/commenteditor.d.ts +0 -40
- package/dist/comments/ui/commenteditor/commenteditorui.d.ts +0 -35
- package/dist/comments/ui/commenteditor/commenteditoruiview.d.ts +0 -40
- package/dist/comments/ui/commentthreadcontroller.d.ts +0 -68
- package/dist/comments/ui/view/basecommentthreadview.d.ts +0 -152
- package/dist/comments/ui/view/basecommentview.d.ts +0 -154
- package/dist/comments/ui/view/collapsedcommentsview.d.ts +0 -17
- package/dist/comments/ui/view/commentcontentview.d.ts +0 -18
- package/dist/comments/ui/view/commentinputview.d.ts +0 -105
- package/dist/comments/ui/view/commentsarchiveview.d.ts +0 -50
- package/dist/comments/ui/view/commentslistview.d.ts +0 -116
- package/dist/comments/ui/view/commentthreadheadercontextview.d.ts +0 -25
- package/dist/comments/ui/view/commentthreadheaderview.d.ts +0 -80
- package/dist/comments/ui/view/commentthreadinputview.d.ts +0 -60
- package/dist/comments/ui/view/commentthreadview.d.ts +0 -127
- package/dist/comments/ui/view/commentview.d.ts +0 -244
- package/dist/comments.d.ts +0 -47
- package/dist/commentsonly.d.ts +0 -45
- package/dist/config.d.ts +0 -199
- package/dist/index.d.ts +0 -33
- package/dist/utils/common-translations.d.ts +0 -13
- package/dist/utils/createmutationobserver.d.ts +0 -18
|
@@ -1,1137 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
7
|
-
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* @module comments/comments/commentsrepository
|
|
11
|
-
* @publicApi
|
|
12
|
-
*/
|
|
13
|
-
import { PendingActions, ContextPlugin, Editor, type Context } from 'ckeditor5/src/core.js';
|
|
14
|
-
import { Collection } from 'ckeditor5/src/utils.js';
|
|
15
|
-
import { Users, type User } from 'ckeditor5-collaboration/src/collaboration-core.js';
|
|
16
|
-
import CommentThreadController from './ui/commentthreadcontroller.js';
|
|
17
|
-
import '../../theme/comment.css';
|
|
18
|
-
import '../../theme/commentthread.css';
|
|
19
|
-
import '../../theme/commentinput.css';
|
|
20
|
-
import Annotation, { type AnnotationTarget } from '../annotations/annotation.js';
|
|
21
|
-
import Annotations from '../annotations/annotations.js';
|
|
22
|
-
import type { default as BaseCommentThreadView } from './ui/view/basecommentthreadview.js';
|
|
23
|
-
/**
|
|
24
|
-
* Stores the list of {@link module:comments/comments/commentsrepository~CommentThread}
|
|
25
|
-
* and provides event-driven API for managing them. It is also responsible for using the comments adapter
|
|
26
|
-
* to communicate with the data source.
|
|
27
|
-
*
|
|
28
|
-
* {@link module:comments/comments/commentsrepository~CommentsRepository} is a context plugin.
|
|
29
|
-
* It can be added to a context or to an editor. Add it to the context configuration if you use
|
|
30
|
-
* {@link module:core/context~Context} in your integration.
|
|
31
|
-
*
|
|
32
|
-
* The event-driven API makes it possible to attach a listener to each action that changes comment data.
|
|
33
|
-
* Using different event priorities allows to attach an action before the main action ('low' priority)
|
|
34
|
-
* or after the main action ('high' priority). It works very similar to
|
|
35
|
-
* {@link module:utils/observablemixin~Observable#decorate}.
|
|
36
|
-
*
|
|
37
|
-
* Sample usage:
|
|
38
|
-
*
|
|
39
|
-
* ```ts
|
|
40
|
-
* // Get the comments repository:
|
|
41
|
-
* const commentsRepository = editor.plugins.get( 'CommentsRepository' );
|
|
42
|
-
*
|
|
43
|
-
* // Create a new, empty comment thread on a DOM form field element:
|
|
44
|
-
* commentsRepository.openNewCommentThread( { channelId, target: formFieldElement } );
|
|
45
|
-
*
|
|
46
|
-
* // Get all comment threads:
|
|
47
|
-
* commentsRepository.getCommentThreads();
|
|
48
|
-
*
|
|
49
|
-
* // Set the adapter:
|
|
50
|
-
* commentsRepository.adapter = {
|
|
51
|
-
* // ...
|
|
52
|
-
* };
|
|
53
|
-
* ```
|
|
54
|
-
*
|
|
55
|
-
* For more information about the comments adapter see {@link module:comments/comments/commentsrepository~CommentsAdapter}.
|
|
56
|
-
*/
|
|
57
|
-
export default class CommentsRepository extends ContextPlugin {
|
|
58
|
-
/**
|
|
59
|
-
* The currently active comment thread.
|
|
60
|
-
* An annotation with this thread will be marked as active.
|
|
61
|
-
*
|
|
62
|
-
* @observable
|
|
63
|
-
*/
|
|
64
|
-
activeCommentThread: CommentThread | null;
|
|
65
|
-
/**
|
|
66
|
-
* @inheritDoc
|
|
67
|
-
*/
|
|
68
|
-
static get requires(): readonly [typeof Annotations, typeof PendingActions, typeof Users];
|
|
69
|
-
/**
|
|
70
|
-
* @inheritDoc
|
|
71
|
-
*/
|
|
72
|
-
static get pluginName(): "CommentsRepository";
|
|
73
|
-
/**
|
|
74
|
-
* @inheritDoc
|
|
75
|
-
*/
|
|
76
|
-
static get isOfficialPlugin(): true;
|
|
77
|
-
/**
|
|
78
|
-
* @inheritDoc
|
|
79
|
-
*/
|
|
80
|
-
static get isPremiumPlugin(): true;
|
|
81
|
-
/**
|
|
82
|
-
* @inheritDoc
|
|
83
|
-
*/
|
|
84
|
-
constructor(context: Context | Editor);
|
|
85
|
-
/**
|
|
86
|
-
* @inheritDoc
|
|
87
|
-
*/
|
|
88
|
-
init(): void;
|
|
89
|
-
/**
|
|
90
|
-
* An adapter object that should communicate with the data source to fetch or save the comments data.
|
|
91
|
-
*/
|
|
92
|
-
set adapter(adapter: CommentsAdapter);
|
|
93
|
-
get adapter(): CommentsAdapter;
|
|
94
|
-
/**
|
|
95
|
-
* Adds a new comment thread.
|
|
96
|
-
*
|
|
97
|
-
* When a target is provided, the comment annotation will be attached to this target.
|
|
98
|
-
*
|
|
99
|
-
* Use this method to load the comments data during the editor initialization
|
|
100
|
-
* if you do not use the adapter integration.
|
|
101
|
-
*
|
|
102
|
-
* **Note:** This method fires the {@link #event:addCommentThread} event and the default behavior
|
|
103
|
-
* is added as a `'normal'` priority listener. It makes it possible to cancel the method
|
|
104
|
-
* or call some custom code before or after the default behavior is executed.
|
|
105
|
-
*
|
|
106
|
-
* **Note:** The comments adapter will send the data only if `commentThreadData.comments`
|
|
107
|
-
* is not empty and `commentThreadData.isFromAdapter` is set to `false`.
|
|
108
|
-
*
|
|
109
|
-
* See also `CommentsRepository#openNewCommentThread()`.
|
|
110
|
-
*
|
|
111
|
-
* An example of loading a comment thread on editor initialization:
|
|
112
|
-
*
|
|
113
|
-
* ```ts
|
|
114
|
-
* commentsRepository.addCommentThread( {
|
|
115
|
-
* threadId: 'thread-id',
|
|
116
|
-
* channelId: 'channel-id',
|
|
117
|
-
* comments: [
|
|
118
|
-
* {
|
|
119
|
-
* commentId: 'comment-1', // String
|
|
120
|
-
* authorId: 'author-id', // String
|
|
121
|
-
* content: 'First comment', // String
|
|
122
|
-
* createdAt: new Date( ... ) // Date instance
|
|
123
|
-
* },
|
|
124
|
-
* // ...
|
|
125
|
-
* ],
|
|
126
|
-
* target: () => ...,
|
|
127
|
-
* // Added during initialization, so do not call the adapter:
|
|
128
|
-
* isFromAdapter: true
|
|
129
|
-
* } );
|
|
130
|
-
* ```
|
|
131
|
-
*
|
|
132
|
-
* @fires addCommentThread
|
|
133
|
-
* @param commentThreadData The data of the comment thread to add.
|
|
134
|
-
* @param data.channelId The ID of a document or context to which the comment thread is added.
|
|
135
|
-
* @param data.threadId The ID of the added comment thread.
|
|
136
|
-
* @param data.comments Comments in the comment thread. See the example above.
|
|
137
|
-
* @param data.unlinkedAt The date when the content related to the comment thread was lost (usually, the commented content was
|
|
138
|
-
* removed from the document).
|
|
139
|
-
* @param data.resolvedAt The date when the comment thread has been resolved.
|
|
140
|
-
* @param data.resolvedBy The ID of user who resolved the comment thread.
|
|
141
|
-
* @param data.target The target that the comment
|
|
142
|
-
* balloon should be attached to. If a function is passed, it should return a DOM element or `Rect`.
|
|
143
|
-
* @param data.context The text on which the comment thread was created on or similar contextual information for the comment thread.
|
|
144
|
-
* To be displayed as an additional hint for archived comment threads.
|
|
145
|
-
* @param data.attributes Custom comment attributes. See also
|
|
146
|
-
* {@link module:comments/comments/commentsrepository~CommentThread#setAttribute} and
|
|
147
|
-
* {@link module:comments/comments/commentsrepository~CommentThread#removeAttribute}.
|
|
148
|
-
* @param data.isResolvable Indicates whether the comment thread can become resolved.
|
|
149
|
-
* Set this flag to `false` to disable the possibility of resolving given comment thread.
|
|
150
|
-
* @param data.isSubmitted Indicates whether the comment thread has been submitted.
|
|
151
|
-
* Comment thread is submitted after adding the first comment, however, in some cases,
|
|
152
|
-
* it could be necessary to manage it in a custom way (e.g. track changes).
|
|
153
|
-
* @param data.isFromAdapter A flag describing whether the added data
|
|
154
|
-
* comes from an adapter (`true`) or is a new data (`false`). If set to `true`, the
|
|
155
|
-
* comment data will be added only in the editor and will not be sent to the adapter.
|
|
156
|
-
* @returns The added comment thread.
|
|
157
|
-
*/
|
|
158
|
-
addCommentThread({ channelId, threadId, comments, unlinkedAt, resolvedAt, resolvedBy, target, context, attributes, isResolvable, isSubmitted, isFromAdapter }?: Partial<AddCommentThreadEventData>): CommentThread | undefined;
|
|
159
|
-
/**
|
|
160
|
-
* Creates a new, empty comment thread.
|
|
161
|
-
*
|
|
162
|
-
* Displays a new comment annotation attached to the target and focuses the comment editor.
|
|
163
|
-
* When the comment data is submitted, the comment thread is added to the editor
|
|
164
|
-
* and sent to the adapter.
|
|
165
|
-
*
|
|
166
|
-
* Use this method to start a new comment thread after a user performed an action
|
|
167
|
-
* (clicked a button, etc.).
|
|
168
|
-
*
|
|
169
|
-
* @fires addCommentThread
|
|
170
|
-
* @param commentThreadData.channelId The ID of a document or context to which the comment is added.
|
|
171
|
-
* @param commentThreadData.threadId The ID of the comment thread.
|
|
172
|
-
* Random id will be generated if it is not set. All thread IDs should be unique.
|
|
173
|
-
* @param commentThreadData.target The target that the comment
|
|
174
|
-
* balloon should be attached to. If a function is passed, it should return a DOM element or `Rect`.
|
|
175
|
-
* @param commentThreadData.context The text on which the comment thread was created on.
|
|
176
|
-
* @param commentThreadData.isResolvable Indicates whether the comment thread can become resolved.
|
|
177
|
-
* Set this flag to `false` to disable the possibility of resolving given comment thread.
|
|
178
|
-
* @returns The created comment thread or `null` if there was a problem
|
|
179
|
-
* creating the thread (for example, if the comments repository was in the read-only mode).
|
|
180
|
-
*/
|
|
181
|
-
openNewCommentThread({ channelId, threadId, target, context, isResolvable }: AddCommentThreadEventData): CommentThread | null;
|
|
182
|
-
/**
|
|
183
|
-
* Checks if a comment thread with a given ID is added to the repository.
|
|
184
|
-
*/
|
|
185
|
-
hasCommentThread(threadId: string): boolean;
|
|
186
|
-
/**
|
|
187
|
-
* Updates existing comment thread.
|
|
188
|
-
*
|
|
189
|
-
* @fires updateCommentThread
|
|
190
|
-
* @param data The data of the comment thread to add.
|
|
191
|
-
* @param data.channelId The ID of a document or context to which the comment thread is added.
|
|
192
|
-
* @param data.threadId The ID of the updated comment thread.
|
|
193
|
-
* @param data.unlinkedAt The date when the content related to the comment thread was lost (usually, the commented content was
|
|
194
|
-
* removed from the document).
|
|
195
|
-
* @param data.context The text on which the comment thread was created on or similar contextual information for the comment thread.
|
|
196
|
-
* To be displayed as an additional hint for archived comment threads.
|
|
197
|
-
* @param data.attributes Custom comment attributes. See also
|
|
198
|
-
* {@link module:comments/comments/commentsrepository~CommentThread#setAttribute} and
|
|
199
|
-
* {@link module:comments/comments/commentsrepository~CommentThread#removeAttribute}.
|
|
200
|
-
* @param data.isFromAdapter A flag describing whether the added data
|
|
201
|
-
* comes from an adapter (`true`) or is a new data (`false`). If set to `true`, the
|
|
202
|
-
* comment data will be added only in the editor and will not be sent to the adapter.
|
|
203
|
-
* @returns The updated comment thread.
|
|
204
|
-
*/
|
|
205
|
-
updateCommentThread({ channelId, threadId, context, unlinkedAt, attributes, isFromAdapter }: UpdateCommentThreadEventData): CommentThread;
|
|
206
|
-
/**
|
|
207
|
-
* Returns comment thread of given id.
|
|
208
|
-
*/
|
|
209
|
-
getCommentThread(threadId: string): CommentThread | undefined;
|
|
210
|
-
/**
|
|
211
|
-
* Gets the comment thread data using the adapter and adds the thread to the editor.
|
|
212
|
-
*
|
|
213
|
-
* When the comment thread is already present in the repository,
|
|
214
|
-
* then the adapter will not be used but the result will be asynchronous as well.
|
|
215
|
-
*/
|
|
216
|
-
fetchCommentThread({ channelId, threadId }?: BaseCommentThread): Promise<CommentThread | undefined>;
|
|
217
|
-
getCommentThreads(data?: {
|
|
218
|
-
channelId?: string | symbol;
|
|
219
|
-
skipNotAttached?: boolean;
|
|
220
|
-
skipEmpty?: boolean;
|
|
221
|
-
toJSON?: false;
|
|
222
|
-
}): Array<CommentThread>;
|
|
223
|
-
getCommentThreads(data: {
|
|
224
|
-
channelId?: string | symbol;
|
|
225
|
-
skipNotAttached?: boolean;
|
|
226
|
-
skipEmpty?: boolean;
|
|
227
|
-
toJSON: true;
|
|
228
|
-
}): Array<CommentThreadDataJSON>;
|
|
229
|
-
/**
|
|
230
|
-
* Marks a comment thread with the given ID as active.
|
|
231
|
-
* When `threadId` is `null`, the currently active comment thread will be deactivated.
|
|
232
|
-
*/
|
|
233
|
-
setActiveCommentThread(threadId: string | null): void;
|
|
234
|
-
/**
|
|
235
|
-
* Changes the read-only state for comment threads.
|
|
236
|
-
*
|
|
237
|
-
* When the value is `true` then all comment threads will be switched to read-only,
|
|
238
|
-
* when the value is `false` then all comment threads will be switched to editing mode.
|
|
239
|
-
*
|
|
240
|
-
* Optionally new state can be applied to a comment threads limited to a given channel.
|
|
241
|
-
* This function has precedence over any permission settings.
|
|
242
|
-
*/
|
|
243
|
-
switchReadOnly(value: boolean, channelId?: string | symbol): void;
|
|
244
|
-
/**
|
|
245
|
-
* Returns `true` if a given channel is set to read-only mode, returns `false` otherwise.
|
|
246
|
-
*/
|
|
247
|
-
isReadOnly(channelId: string | symbol): boolean;
|
|
248
|
-
/**
|
|
249
|
-
* Create an instance of the {@link module:comments/comments/ui/commentthreadcontroller~CommentThreadController} class.
|
|
250
|
-
*
|
|
251
|
-
* @param commentThreadModel Comment thread model.
|
|
252
|
-
* @param commentThreadView Comment thread view.
|
|
253
|
-
*/
|
|
254
|
-
createCommentThreadController(commentThreadModel: CommentThread, commentThreadView: BaseCommentThreadView): CommentThreadController;
|
|
255
|
-
/**
|
|
256
|
-
* Gets permissions set for repository (or default if permissions was not set).
|
|
257
|
-
*/
|
|
258
|
-
getPermissions(channelId?: string | symbol): CommentPermissionsConfig;
|
|
259
|
-
}
|
|
260
|
-
interface CommentPermissionsConfig {
|
|
261
|
-
/**
|
|
262
|
-
* Allows for removing other users' threads.
|
|
263
|
-
*/
|
|
264
|
-
admin: boolean;
|
|
265
|
-
/**
|
|
266
|
-
* Allows for editing and removing any comments created by other users.
|
|
267
|
-
*/
|
|
268
|
-
modifyAll: boolean;
|
|
269
|
-
/**
|
|
270
|
-
* Allows for adding new comments as well as editing and removing comments created by this user.
|
|
271
|
-
*/
|
|
272
|
-
write: boolean;
|
|
273
|
-
/**
|
|
274
|
-
* Allows for resolving and reopening comment threads.
|
|
275
|
-
*/
|
|
276
|
-
resolve: boolean;
|
|
277
|
-
}
|
|
278
|
-
declare const CommentThread_base: {
|
|
279
|
-
new (): import("ckeditor5/src/utils.js").Observable;
|
|
280
|
-
prototype: import("ckeditor5/src/utils.js").Observable;
|
|
281
|
-
};
|
|
282
|
-
/**
|
|
283
|
-
* Comment thread representation.
|
|
284
|
-
* Stores a list of {@link module:comments/comments/commentsrepository~Comment `Comments`}.
|
|
285
|
-
*/
|
|
286
|
-
export declare class CommentThread extends /* #__PURE__ -- @preserve */ CommentThread_base {
|
|
287
|
-
/**
|
|
288
|
-
* Informs if the comment thread is in read-only state (`true`) or not (`false`).
|
|
289
|
-
*
|
|
290
|
-
* @observable
|
|
291
|
-
*/
|
|
292
|
-
isReadOnly: boolean;
|
|
293
|
-
/**
|
|
294
|
-
* Informs if the comment thread can be removed by the local user.
|
|
295
|
-
*
|
|
296
|
-
* @observable
|
|
297
|
-
*/
|
|
298
|
-
isRemovable: boolean;
|
|
299
|
-
/**
|
|
300
|
-
* Informs if a user has permission to add a new comment to the comment thread.
|
|
301
|
-
*
|
|
302
|
-
* @observable
|
|
303
|
-
*/
|
|
304
|
-
canComment: boolean;
|
|
305
|
-
/**
|
|
306
|
-
* Date when the comment thread has been archived.
|
|
307
|
-
*
|
|
308
|
-
* Comment threads become archived after they are {@link #resolvedAt resolved} or {@link #unlinkedAt unlinked}.
|
|
309
|
-
* If the comment thread is resolved and/or unlinked, this value is set to the earliest of the dates. Otherwise, it is `null`.
|
|
310
|
-
*
|
|
311
|
-
* @observable
|
|
312
|
-
*/
|
|
313
|
-
archivedAt: Date | null;
|
|
314
|
-
/**
|
|
315
|
-
* The date when the content related to the comment thread was lost (usually, the commented content was removed from the document).
|
|
316
|
-
*
|
|
317
|
-
* @observable
|
|
318
|
-
*/
|
|
319
|
-
unlinkedAt: Date | null;
|
|
320
|
-
/**
|
|
321
|
-
* User id which resolved the comment thread.
|
|
322
|
-
*
|
|
323
|
-
* @observable
|
|
324
|
-
*/
|
|
325
|
-
resolvedBy: User | null;
|
|
326
|
-
/**
|
|
327
|
-
* Date when the comment thread has been resolved.
|
|
328
|
-
*
|
|
329
|
-
* @observable
|
|
330
|
-
*/
|
|
331
|
-
resolvedAt: Date | null;
|
|
332
|
-
/**
|
|
333
|
-
* Informs if the comment thread is resolved.
|
|
334
|
-
*
|
|
335
|
-
* @observable
|
|
336
|
-
*/
|
|
337
|
-
readonly isResolved: boolean;
|
|
338
|
-
/**
|
|
339
|
-
* Custom comment thread attributes. See also {@link #setAttribute} and {@link #removeAttribute}.
|
|
340
|
-
*
|
|
341
|
-
* @observable
|
|
342
|
-
*/
|
|
343
|
-
attributes: Record<string, unknown>;
|
|
344
|
-
/**
|
|
345
|
-
* The channel where the comment thread was created.
|
|
346
|
-
*/
|
|
347
|
-
channelId: string | symbol;
|
|
348
|
-
/**
|
|
349
|
-
* The comment thread ID.
|
|
350
|
-
*/
|
|
351
|
-
id: string;
|
|
352
|
-
/**
|
|
353
|
-
* A collection of {@link module:comments/comments/commentsrepository~Comment}s belonging to this thread.
|
|
354
|
-
*
|
|
355
|
-
* @readonly
|
|
356
|
-
*/
|
|
357
|
-
readonly comments: Collection<Comment>;
|
|
358
|
-
constructor(commentsRepository: CommentsRepository, data: {
|
|
359
|
-
channelId: string | symbol;
|
|
360
|
-
id: string;
|
|
361
|
-
context: CommentThreadContext;
|
|
362
|
-
attributes: Record<string, unknown>;
|
|
363
|
-
unlinkedAt: Date | null;
|
|
364
|
-
resolvedAt: Date | null;
|
|
365
|
-
resolvedBy: User | null;
|
|
366
|
-
isResolvable: boolean;
|
|
367
|
-
isSubmitted: boolean;
|
|
368
|
-
});
|
|
369
|
-
/**
|
|
370
|
-
* Sum of {@link module:comments/comments/commentsrepository~Comment#weight weights of all comments} in this thread.
|
|
371
|
-
*/
|
|
372
|
-
get weight(): number;
|
|
373
|
-
/**
|
|
374
|
-
* The number of {@link module:comments/comments/commentsrepository~Comment comments} in the comment thread.
|
|
375
|
-
*/
|
|
376
|
-
get length(): number;
|
|
377
|
-
/**
|
|
378
|
-
* Informs if the comment thread is attached to any target at the moment.
|
|
379
|
-
*/
|
|
380
|
-
get isAttached(): boolean;
|
|
381
|
-
/**
|
|
382
|
-
* Informs if the comment thread has been submitted.
|
|
383
|
-
*/
|
|
384
|
-
get isSubmitted(): boolean;
|
|
385
|
-
/**
|
|
386
|
-
* Submits the locally created comment thread draft.
|
|
387
|
-
*/
|
|
388
|
-
submit(): void;
|
|
389
|
-
/**
|
|
390
|
-
* Updates the unlinked date.
|
|
391
|
-
*/
|
|
392
|
-
setUnlinkedAt(unlinkedAt: Date | null): void;
|
|
393
|
-
/**
|
|
394
|
-
* Resolves the comment thread.
|
|
395
|
-
*/
|
|
396
|
-
resolve({ resolvedAt, resolvedBy, isFromAdapter }?: {
|
|
397
|
-
resolvedAt?: Date | undefined;
|
|
398
|
-
resolvedBy?: null | undefined;
|
|
399
|
-
isFromAdapter?: boolean | undefined;
|
|
400
|
-
}): void;
|
|
401
|
-
/**
|
|
402
|
-
* Reopens the resolved comment thread.
|
|
403
|
-
*/
|
|
404
|
-
reopen({ isFromAdapter }?: {
|
|
405
|
-
isFromAdapter?: boolean | undefined;
|
|
406
|
-
}): void;
|
|
407
|
-
/**
|
|
408
|
-
* Set the context on the comment thread.
|
|
409
|
-
* This method should be called only when the context has been not set during initialization.
|
|
410
|
-
*
|
|
411
|
-
* @param context Text context of comment thread.
|
|
412
|
-
*/
|
|
413
|
-
setContext(context: CommentThreadContext): void;
|
|
414
|
-
/**
|
|
415
|
-
* Adds attribute to the comment thread.
|
|
416
|
-
*
|
|
417
|
-
* Comment thread attributes are custom data that can be set and used by features
|
|
418
|
-
* built around comments. Use it to store your feature data with other comment thread data.
|
|
419
|
-
* You can also group multiple values in an object, using dot notation:
|
|
420
|
-
*
|
|
421
|
-
* ```ts
|
|
422
|
-
* commentThread.setAttribute( 'customData.isImportant', true );
|
|
423
|
-
* ```
|
|
424
|
-
*
|
|
425
|
-
* Attributes set on the comment can be accessed through the `attribute` property:
|
|
426
|
-
*
|
|
427
|
-
* ```ts
|
|
428
|
-
* const isImportant = commentThread.attributes.customData.isImportant;
|
|
429
|
-
* ```
|
|
430
|
-
*
|
|
431
|
-
* You can also observe the `attributes` property or bind other properties to it:
|
|
432
|
-
*
|
|
433
|
-
* ```ts
|
|
434
|
-
* myObj.bind( 'customData' ).to( commentThread, 'attributes', attributes => attributes.customData );
|
|
435
|
-
* ```
|
|
436
|
-
*
|
|
437
|
-
* Whenever `setAttribute()` or `removeAttribute()` is called, the `attributes` property
|
|
438
|
-
* is re-set and observables are refreshed.
|
|
439
|
-
*
|
|
440
|
-
* @fires module:comments/comments/commentsrepository~CommentsRepository#event:updateCommentThread
|
|
441
|
-
* @param name Attribute name.
|
|
442
|
-
* @param value Attribute value.
|
|
443
|
-
*/
|
|
444
|
-
setAttribute(name: string, value: unknown): void;
|
|
445
|
-
/**
|
|
446
|
-
* Removes a comment attribute.
|
|
447
|
-
*
|
|
448
|
-
* See also {@link module:comments/comments/commentsrepository~CommentThread#setAttribute}.
|
|
449
|
-
*
|
|
450
|
-
* @fires module:comments/comments/commentsrepository~CommentsRepository#event:updateCommentThread
|
|
451
|
-
* @param name The attribute name.
|
|
452
|
-
*/
|
|
453
|
-
removeAttribute(name: string): void;
|
|
454
|
-
/**
|
|
455
|
-
* Removes comment thread.
|
|
456
|
-
*
|
|
457
|
-
* **Note** This method is event-driven. It means it fires an event then a normal priority listener catches
|
|
458
|
-
* it and executes an action. It makes it possible to add some actions before and after method will be executed.
|
|
459
|
-
*
|
|
460
|
-
* @fires module:comments/comments/commentsrepository~RemoveCommentThreadEvent
|
|
461
|
-
*/
|
|
462
|
-
remove({ isFromAdapter }?: {
|
|
463
|
-
isFromAdapter?: boolean | undefined;
|
|
464
|
-
}): void;
|
|
465
|
-
/**
|
|
466
|
-
* Creates comment annotations and displays it attached to the given target.
|
|
467
|
-
*
|
|
468
|
-
* @returns Created annotation.
|
|
469
|
-
*/
|
|
470
|
-
attachTo(target: AnnotationTarget): Annotation;
|
|
471
|
-
/**
|
|
472
|
-
* Creates a new comment inside the comment thread.
|
|
473
|
-
*
|
|
474
|
-
* **Note** This method is event-driven. It means it fires an event then a normal priority listener catches
|
|
475
|
-
* it and executes an action. It makes it possible to add some actions before and after method will be executed.
|
|
476
|
-
*
|
|
477
|
-
* @fires module:comments/comments/commentsrepository~CommentsRepository#event:addComment
|
|
478
|
-
* @param data Data object.
|
|
479
|
-
* @param data.commentId Comment id.
|
|
480
|
-
* @param data.content Comment content.
|
|
481
|
-
* @param data.authorId Author id.
|
|
482
|
-
* @param data.createdAt Creation date. If not set, current date (`new Date()`) will be used.
|
|
483
|
-
* @param data.attributes Custom comment attributes. See also
|
|
484
|
-
* {@link module:comments/comments/commentsrepository~Comment#setAttribute} and
|
|
485
|
-
* {@link module:comments/comments/commentsrepository~Comment#removeAttribute}.
|
|
486
|
-
*/
|
|
487
|
-
addComment(data: CommentData): void;
|
|
488
|
-
/**
|
|
489
|
-
* Returns comment of given id.
|
|
490
|
-
*/
|
|
491
|
-
getComment(commentId: string): Comment | null;
|
|
492
|
-
toJSON(): CommentThreadDataJSON;
|
|
493
|
-
}
|
|
494
|
-
declare const Comment_base: {
|
|
495
|
-
new (): import("ckeditor5/src/utils.js").Observable;
|
|
496
|
-
prototype: import("ckeditor5/src/utils.js").Observable;
|
|
497
|
-
};
|
|
498
|
-
/**
|
|
499
|
-
* Single comment representation. A part of a {@link module:comments/comments/commentsrepository~CommentThread commentThread}.
|
|
500
|
-
*/
|
|
501
|
-
export declare class Comment extends /* #__PURE__ -- @preserve */ Comment_base {
|
|
502
|
-
/**
|
|
503
|
-
* When is set to `true`, editing the comment is blocked.
|
|
504
|
-
*
|
|
505
|
-
* @observable
|
|
506
|
-
*/
|
|
507
|
-
readonly isEditable: boolean;
|
|
508
|
-
/**
|
|
509
|
-
* When is set to `false`, removing the comment is blocked.
|
|
510
|
-
*
|
|
511
|
-
* @observable
|
|
512
|
-
*/
|
|
513
|
-
readonly isRemovable: boolean;
|
|
514
|
-
/**
|
|
515
|
-
* The read-only state inherited from the parent {@link module:comments/comments/commentsrepository~CommentThread}.
|
|
516
|
-
* When is set to `true`, then removing and editing the comment thread is blocked.
|
|
517
|
-
*
|
|
518
|
-
* In contrast to {@link #isEditable} and {@link #isRemovable}, this state can be used to
|
|
519
|
-
* hide some UI parts instead of temporarily disabling them.
|
|
520
|
-
*
|
|
521
|
-
* @observable
|
|
522
|
-
*/
|
|
523
|
-
readonly isReadOnly: boolean;
|
|
524
|
-
/**
|
|
525
|
-
* The comment content.
|
|
526
|
-
*/
|
|
527
|
-
content: string;
|
|
528
|
-
/**
|
|
529
|
-
* Date when the comment was made.
|
|
530
|
-
*
|
|
531
|
-
* Usually the same as {@link #createdAt `createdAt`} but may be different in some cases
|
|
532
|
-
* (e.g. when comment was added from an external source).
|
|
533
|
-
*
|
|
534
|
-
* @observable
|
|
535
|
-
*/
|
|
536
|
-
authoredAt: Date;
|
|
537
|
-
/**
|
|
538
|
-
* The date when the comment thread was resolved or `null` if it is not resolved.
|
|
539
|
-
*
|
|
540
|
-
* @observable
|
|
541
|
-
*/
|
|
542
|
-
resolvedAt: Date | null;
|
|
543
|
-
/**
|
|
544
|
-
* Custom comment attributes. See also {@link #setAttribute} and {@link #removeAttribute}.
|
|
545
|
-
*
|
|
546
|
-
* @observable
|
|
547
|
-
*/
|
|
548
|
-
attributes: Record<string, any>;
|
|
549
|
-
/**
|
|
550
|
-
* The comment ID.
|
|
551
|
-
*/
|
|
552
|
-
readonly id: string;
|
|
553
|
-
/**
|
|
554
|
-
* The ID of the comment thread that contains this comment.
|
|
555
|
-
*/
|
|
556
|
-
readonly threadId: string;
|
|
557
|
-
/**
|
|
558
|
-
* The comment author.
|
|
559
|
-
*/
|
|
560
|
-
readonly author: User;
|
|
561
|
-
/**
|
|
562
|
-
* The user which saved the comment data in the database.
|
|
563
|
-
*
|
|
564
|
-
* Usually the same as author but may be different in some cases (e.g. when comment was added from an external source).
|
|
565
|
-
*/
|
|
566
|
-
readonly creator: User;
|
|
567
|
-
/**
|
|
568
|
-
* The flag indicating whether the comment comes from an external source.
|
|
569
|
-
*/
|
|
570
|
-
readonly isExternal: boolean;
|
|
571
|
-
/**
|
|
572
|
-
* Date when the comment was saved in the database.
|
|
573
|
-
*/
|
|
574
|
-
createdAt: Date;
|
|
575
|
-
/**
|
|
576
|
-
* @param commentsRepository
|
|
577
|
-
* @param data Configuration object.
|
|
578
|
-
* @param data.id Comment id.
|
|
579
|
-
* @param data.threadId Comment thread id.
|
|
580
|
-
* @param data.content Comment content.
|
|
581
|
-
* @param data.author Comment author.
|
|
582
|
-
* @param data.creator The user which saved the comment data.
|
|
583
|
-
* Usually the same as author but may be different in some cases (e.g. when comment was added from an external source).
|
|
584
|
-
* @param data.createdAt Date when the comment was saved in the database.
|
|
585
|
-
* @param data.authoredAt Date when the comment was made.
|
|
586
|
-
* @param data.attributes Custom comment attributes. See also
|
|
587
|
-
* {@link module:comments/comments/commentsrepository~Comment#setAttribute} and
|
|
588
|
-
* {@link module:comments/comments/commentsrepository~Comment#removeAttribute}.
|
|
589
|
-
*/
|
|
590
|
-
constructor(commentsRepository: CommentsRepository, data: {
|
|
591
|
-
id: string;
|
|
592
|
-
threadId: string;
|
|
593
|
-
content: string;
|
|
594
|
-
author: User;
|
|
595
|
-
creator: User;
|
|
596
|
-
createdAt: Date;
|
|
597
|
-
authoredAt: Date;
|
|
598
|
-
attributes: Record<string, unknown>;
|
|
599
|
-
});
|
|
600
|
-
/**
|
|
601
|
-
* The comment weight.
|
|
602
|
-
*
|
|
603
|
-
* It is equal to the length of the comment content, however it is never smaller than `200`.
|
|
604
|
-
* This limit is set to avoid a long list of very short not collapsed comments.
|
|
605
|
-
*/
|
|
606
|
-
get weight(): number;
|
|
607
|
-
/**
|
|
608
|
-
* Updates the comment with provided data.
|
|
609
|
-
*
|
|
610
|
-
* **Note:** This method fires the {@link module:comments/comments/commentsrepository~CommentsRepository#event:updateComment}
|
|
611
|
-
* event and the default behavior is added as a normal priority listener. It makes it
|
|
612
|
-
* possible to cancel the method or call some custom code before or after the default
|
|
613
|
-
* behavior is executed.
|
|
614
|
-
*
|
|
615
|
-
* @fires module:comments/comments/commentsrepository~CommentsRepository#event:updateComment
|
|
616
|
-
* @param data Data object.
|
|
617
|
-
* @param data.content Comment content.
|
|
618
|
-
* @param data.createdAt Creation date.
|
|
619
|
-
* @param data.attributes Custom comment attributes. See also
|
|
620
|
-
* {@link module:comments/comments/commentsrepository~Comment#setAttribute} and
|
|
621
|
-
* {@link module:comments/comments/commentsrepository~Comment#removeAttribute}.
|
|
622
|
-
* @param data.isFromAdapter
|
|
623
|
-
*/
|
|
624
|
-
update(data: UpdateCommentData): void;
|
|
625
|
-
/**
|
|
626
|
-
* Adds attribute to the comment.
|
|
627
|
-
*
|
|
628
|
-
* Comment attributes are custom data that can be set and used by features
|
|
629
|
-
* built around comments. Use it to store your feature data with other comment data.
|
|
630
|
-
*
|
|
631
|
-
* comment.setAttribute( 'isImportant', true );
|
|
632
|
-
*
|
|
633
|
-
* You can group multiple values in an object, using dot notation:
|
|
634
|
-
*
|
|
635
|
-
* comment.setAttribute( 'customData.type', 'image' );
|
|
636
|
-
* comment.setAttribute( 'customData.src', 'foo.jpg' );
|
|
637
|
-
*
|
|
638
|
-
* Attributes set on the comment can be accessed through the `attribute` property:
|
|
639
|
-
*
|
|
640
|
-
* const isImportant = comment.attributes.isImportant;
|
|
641
|
-
* const type = comment.attributes.customData.type;
|
|
642
|
-
*
|
|
643
|
-
* You can also observe the `attributes` property or bind other properties to it:
|
|
644
|
-
*
|
|
645
|
-
* myObj.bind( 'customData' ).to( comment, 'attributes', attributes => attributes.customData );
|
|
646
|
-
*
|
|
647
|
-
* Whenever `setAttribute()` or `removeAttribute()` is called, the `attributes` property
|
|
648
|
-
* is re-set and observables are refreshed.
|
|
649
|
-
*
|
|
650
|
-
* @fires module:comments/comments/commentsrepository~CommentsRepository#event:updateComment
|
|
651
|
-
* @param name Attribute name.
|
|
652
|
-
* @param value Attribute value.
|
|
653
|
-
*/
|
|
654
|
-
setAttribute(name: string, value: unknown): void;
|
|
655
|
-
/**
|
|
656
|
-
* Removes a comment attribute.
|
|
657
|
-
*
|
|
658
|
-
* See also {@link module:comments/comments/commentsrepository~Comment#setAttribute}.
|
|
659
|
-
*
|
|
660
|
-
* @fires module:comments/comments/commentsrepository~CommentsRepository#event:updateComment
|
|
661
|
-
* @param name The attribute name.
|
|
662
|
-
*/
|
|
663
|
-
removeAttribute(name: string): void;
|
|
664
|
-
/**
|
|
665
|
-
* Removes the comment.
|
|
666
|
-
*
|
|
667
|
-
* **Note:** This method fires the {@link module:comments/comments/commentsrepository~CommentsRepository#event:updateComment}
|
|
668
|
-
* event and the default behavior is added as a normal priority listener. It makes it
|
|
669
|
-
* possible to cancel the method or call some custom code before or after the default
|
|
670
|
-
* behavior is executed.
|
|
671
|
-
*
|
|
672
|
-
* @fires module:comments/comments/commentsrepository~CommentsRepository#event:removeComment
|
|
673
|
-
* @param data.isFromAdapter A flag describing whether the comment was
|
|
674
|
-
* updated from an adapter (`true`) or from the UI (`false`). If set to `true`, the adapter will not be called.
|
|
675
|
-
*/
|
|
676
|
-
remove(data?: {
|
|
677
|
-
isFromAdapter?: boolean;
|
|
678
|
-
}): void;
|
|
679
|
-
toJSON(): CommentDataJSON;
|
|
680
|
-
/**
|
|
681
|
-
* Destroys the comment instance.
|
|
682
|
-
*/
|
|
683
|
-
destroy(): void;
|
|
684
|
-
}
|
|
685
|
-
export type CommentThreadContext = null | {
|
|
686
|
-
type: string;
|
|
687
|
-
value: unknown;
|
|
688
|
-
};
|
|
689
|
-
/**
|
|
690
|
-
* @param channelId The ID of a document or context that the comment thread is handled.
|
|
691
|
-
* @param threadId The ID of the comment thread.
|
|
692
|
-
* @param isFromAdapter A flag describing whether the operation was done on a remote client (`true`) or a local one (`false`).
|
|
693
|
-
*/
|
|
694
|
-
export interface BaseCommentThread {
|
|
695
|
-
channelId: string | symbol;
|
|
696
|
-
threadId: string;
|
|
697
|
-
isFromAdapter?: boolean;
|
|
698
|
-
}
|
|
699
|
-
/**
|
|
700
|
-
* @param commentId The comment ID.
|
|
701
|
-
*/
|
|
702
|
-
export interface BaseComment extends BaseCommentThread {
|
|
703
|
-
commentId: string;
|
|
704
|
-
}
|
|
705
|
-
/**
|
|
706
|
-
* @param content The comment content.
|
|
707
|
-
* @param attributes Comment custom attributes.
|
|
708
|
-
*/
|
|
709
|
-
export interface BaseCommentData {
|
|
710
|
-
content: string;
|
|
711
|
-
attributes: Record<string, any>;
|
|
712
|
-
}
|
|
713
|
-
/**
|
|
714
|
-
* Fired whenever a comment thread is added to the comments repository.
|
|
715
|
-
*
|
|
716
|
-
* The event name includes `channelId` so it is possible to listen only
|
|
717
|
-
* on changes happening in the specified channel.
|
|
718
|
-
*
|
|
719
|
-
* ```ts
|
|
720
|
-
* const channelId = 'foo';
|
|
721
|
-
*
|
|
722
|
-
* commentsRepository.on( `addCommentThread:${ channelId }`, ( evt, data ) => {
|
|
723
|
-
* console.log( evt, data );
|
|
724
|
-
* } );
|
|
725
|
-
* ```
|
|
726
|
-
*
|
|
727
|
-
* @eventName ~CommentsRepository#addCommentThread
|
|
728
|
-
*/
|
|
729
|
-
export type AddCommentThreadEvent = {
|
|
730
|
-
name: string;
|
|
731
|
-
args: [Required<AddCommentThreadEventData>];
|
|
732
|
-
};
|
|
733
|
-
/**
|
|
734
|
-
* @param context The comment ID.
|
|
735
|
-
* @param attributes Comment thread custom attributes.
|
|
736
|
-
* @param resolvedAt ID of the comment author.
|
|
737
|
-
* @param resolvedBy The comment creation date.
|
|
738
|
-
*/
|
|
739
|
-
export type CommentThreadData = BaseCommentThread & Partial<{
|
|
740
|
-
context: CommentThreadContext;
|
|
741
|
-
attributes: Record<string, any>;
|
|
742
|
-
unlinkedAt: Date | null;
|
|
743
|
-
resolvedAt: Date | null;
|
|
744
|
-
resolvedBy: string | null;
|
|
745
|
-
}>;
|
|
746
|
-
/**
|
|
747
|
-
* @param comments Comments in the comment thread.
|
|
748
|
-
* @param target The target that the comment balloon should be attached to.
|
|
749
|
-
*/
|
|
750
|
-
export type AddCommentThreadEventData = CommentThreadData & {
|
|
751
|
-
comments?: Array<CommentData>;
|
|
752
|
-
target?: AnnotationTarget;
|
|
753
|
-
isResolvable?: boolean;
|
|
754
|
-
isSubmitted?: boolean;
|
|
755
|
-
};
|
|
756
|
-
/**
|
|
757
|
-
* Fired whenever a new comment thread is submitted and occurs after creating the first comment.
|
|
758
|
-
*
|
|
759
|
-
* The event name includes `channelId` so it is possible to listen only
|
|
760
|
-
* on changes happening in the specified channel.
|
|
761
|
-
*
|
|
762
|
-
* ```ts
|
|
763
|
-
* const channelId = 'foo';
|
|
764
|
-
*
|
|
765
|
-
* commentsRepository.on( `submitCommentThread:${ channelId }`, ( evt, data ) => {
|
|
766
|
-
* console.log( evt, data );
|
|
767
|
-
* } );
|
|
768
|
-
* ```
|
|
769
|
-
*
|
|
770
|
-
* @eventName ~CommentsRepository#submitCommentThread
|
|
771
|
-
*/
|
|
772
|
-
export type SubmitCommentThreadEvent = {
|
|
773
|
-
name: string;
|
|
774
|
-
args: [BaseCommentThread];
|
|
775
|
-
};
|
|
776
|
-
/**
|
|
777
|
-
* Fired whenever a comment thread is updated in comments repository.
|
|
778
|
-
*
|
|
779
|
-
* The event name includes `channelId` so it is possible to listen only
|
|
780
|
-
* on changes happening in the specified channel.
|
|
781
|
-
*
|
|
782
|
-
* @eventName ~CommentsRepository#updateCommentThread
|
|
783
|
-
*/
|
|
784
|
-
export type UpdateCommentThreadEvent = {
|
|
785
|
-
name: string;
|
|
786
|
-
args: [UpdateCommentThreadEventData];
|
|
787
|
-
};
|
|
788
|
-
export type UpdateCommentThreadEventData = Omit<CommentThreadData, 'resolvedAt' | 'resolvedBy'>;
|
|
789
|
-
/**
|
|
790
|
-
* Fired whenever a comment thread is resolved.
|
|
791
|
-
*
|
|
792
|
-
* The event name includes `channelId` so it is possible to listen only
|
|
793
|
-
* on changes happening in the specified channel.
|
|
794
|
-
*
|
|
795
|
-
* ```ts
|
|
796
|
-
* const channelId = 'foo';
|
|
797
|
-
*
|
|
798
|
-
* commentsRepository.on( `resolveCommentThread:${ channelId }`, ( evt, data ) => {
|
|
799
|
-
* console.log( evt, data );
|
|
800
|
-
* } );
|
|
801
|
-
* ```
|
|
802
|
-
*
|
|
803
|
-
* @eventName ~CommentsRepository#resolveCommentThread
|
|
804
|
-
*/
|
|
805
|
-
export type ResolveCommentThreadEvent = {
|
|
806
|
-
name: string;
|
|
807
|
-
args: [ResolveCommentThreadEventData];
|
|
808
|
-
};
|
|
809
|
-
export type ResolveCommentThreadEventData = BaseCommentThread & {
|
|
810
|
-
resolvedAt: Date | null;
|
|
811
|
-
resolvedBy: string | null;
|
|
812
|
-
};
|
|
813
|
-
/**
|
|
814
|
-
* Fired whenever a comment thread is reopened.
|
|
815
|
-
*
|
|
816
|
-
* The event name includes `channelId` so it is possible to listen only
|
|
817
|
-
* on changes happening in the specified channel.
|
|
818
|
-
*
|
|
819
|
-
* ```ts
|
|
820
|
-
* const channelId = 'foo';
|
|
821
|
-
*
|
|
822
|
-
* commentsRepository.on( `reopenCommentThread:${ channelId }`, ( evt, data ) => {
|
|
823
|
-
* console.log( evt, data );
|
|
824
|
-
* } );
|
|
825
|
-
* ```
|
|
826
|
-
*
|
|
827
|
-
* @eventName ~CommentsRepository#reopenCommentThread
|
|
828
|
-
*/
|
|
829
|
-
export type ReopenCommentThreadEvent = {
|
|
830
|
-
name: string;
|
|
831
|
-
args: [BaseCommentThread];
|
|
832
|
-
};
|
|
833
|
-
/**
|
|
834
|
-
* Fired whenever a comment thread is removed from the comments repository.
|
|
835
|
-
*
|
|
836
|
-
* The event name includes `channelId` so it is possible to listen only
|
|
837
|
-
* on changes happening in the specified channel.
|
|
838
|
-
*
|
|
839
|
-
* ```ts
|
|
840
|
-
* const channelId = 'foo';
|
|
841
|
-
*
|
|
842
|
-
* commentsRepository.on( `removeCommentThread:${ channelId }`, ( evt, data ) => {
|
|
843
|
-
* console.log( evt, data );
|
|
844
|
-
* } );
|
|
845
|
-
* ```
|
|
846
|
-
*
|
|
847
|
-
* @eventName ~CommentsRepository#removeCommentThread
|
|
848
|
-
*/
|
|
849
|
-
export type RemoveCommentThreadEvent = {
|
|
850
|
-
name: string;
|
|
851
|
-
args: [BaseCommentThread];
|
|
852
|
-
};
|
|
853
|
-
/**
|
|
854
|
-
* Fired whenever a comment is added.
|
|
855
|
-
*
|
|
856
|
-
* The event name includes `channelId` so it is possible to listen only
|
|
857
|
-
* on changes happening in the specified channel.
|
|
858
|
-
*
|
|
859
|
-
* It is also possible to listen to events from the given thread ID by appending `:[threadId]` part to the event name
|
|
860
|
-
*
|
|
861
|
-
* ```ts
|
|
862
|
-
* const channelId = 'foo';
|
|
863
|
-
* const threadId = '1234';
|
|
864
|
-
*
|
|
865
|
-
* commentsRepository.on( `addComment:${ channelId }:${ threadId }`, ( evt, data ) => {
|
|
866
|
-
* console.log( evt, data );
|
|
867
|
-
* } );
|
|
868
|
-
* ```
|
|
869
|
-
*
|
|
870
|
-
* @eventName ~CommentsRepository#addComment
|
|
871
|
-
*/
|
|
872
|
-
export type AddCommentEvent = {
|
|
873
|
-
name: string;
|
|
874
|
-
args: [CommentEventData];
|
|
875
|
-
};
|
|
876
|
-
/**
|
|
877
|
-
* @param commentId The comment ID.
|
|
878
|
-
* @param authorId ID of the comment author.
|
|
879
|
-
* @param createdAt The comment creation date.
|
|
880
|
-
* @param isFromAdapter A flag describing whether the comment was updated on a remote client (`true`) or a local one (`false`).
|
|
881
|
-
*/
|
|
882
|
-
export type CommentData = BaseCommentData & {
|
|
883
|
-
commentId?: string;
|
|
884
|
-
authorId: string;
|
|
885
|
-
createdAt: Date;
|
|
886
|
-
isFromAdapter?: boolean;
|
|
887
|
-
};
|
|
888
|
-
export type CommentEventData = BaseCommentThread & CommentData;
|
|
889
|
-
/**
|
|
890
|
-
* Fired whenever a comment is updated.
|
|
891
|
-
*
|
|
892
|
-
* The event name includes `channelId` so it is possible to listen only
|
|
893
|
-
* to changes happening in the specified channel.
|
|
894
|
-
*
|
|
895
|
-
* It is also possible to listen to events from the given thread ID by appending `:[threadId]` part to the event name
|
|
896
|
-
*
|
|
897
|
-
* ```ts
|
|
898
|
-
* const channelId = 'foo';
|
|
899
|
-
* const threadId = '1234';
|
|
900
|
-
*
|
|
901
|
-
* commentsRepository.on( `updateComment:${ channelId }:${ threadId }`, ( evt, data ) => {
|
|
902
|
-
* console.log( evt, data );
|
|
903
|
-
* } );
|
|
904
|
-
* ```
|
|
905
|
-
*
|
|
906
|
-
* @eventName ~CommentsRepository#updateComment
|
|
907
|
-
*/
|
|
908
|
-
export type UpdateCommentEvent = {
|
|
909
|
-
name: string;
|
|
910
|
-
args: [UpdateCommentEventData];
|
|
911
|
-
};
|
|
912
|
-
export type UpdateCommentData = Partial<CommentEventData>;
|
|
913
|
-
export type UpdateCommentEventData = UpdateCommentData & BaseComment;
|
|
914
|
-
/**
|
|
915
|
-
* Fired whenever a comment is removed.
|
|
916
|
-
*
|
|
917
|
-
* The event name includes `channelId` so it is possible to listen only
|
|
918
|
-
* to changes happening in the specified channel.
|
|
919
|
-
*
|
|
920
|
-
* It is also possible to listen to events from the given thread ID by appending `:[threadId]` part to the event name
|
|
921
|
-
*
|
|
922
|
-
* ```ts
|
|
923
|
-
* const channelId = 'foo';
|
|
924
|
-
* const threadId = '1234';
|
|
925
|
-
*
|
|
926
|
-
* commentsRepository.on( `removeComment:${ channelId }:${ threadId }`, ( evt, data ) => {
|
|
927
|
-
* console.log( evt, data );
|
|
928
|
-
* } );
|
|
929
|
-
* ```
|
|
930
|
-
*
|
|
931
|
-
* @eventName ~CommentsRepository#removeComment
|
|
932
|
-
*/
|
|
933
|
-
export type RemoveCommentEvent = {
|
|
934
|
-
name: string;
|
|
935
|
-
args: [BaseComment];
|
|
936
|
-
};
|
|
937
|
-
export type CommentDataJSON = Omit<CommentData, 'isFromAdapter'>;
|
|
938
|
-
export type CommentThreadDataJSON = {
|
|
939
|
-
threadId: string;
|
|
940
|
-
context: CommentThreadContext;
|
|
941
|
-
unlinkedAt: Date | null;
|
|
942
|
-
resolvedAt: Date | null;
|
|
943
|
-
resolvedBy: string | null;
|
|
944
|
-
archivedAt: Date | null;
|
|
945
|
-
comments: Array<CommentDataJSON>;
|
|
946
|
-
attributes: Record<string, unknown>;
|
|
947
|
-
};
|
|
948
|
-
/**
|
|
949
|
-
* Comments adapter.
|
|
950
|
-
*
|
|
951
|
-
* The comments adapter is an object that communicates asynchronously with the data source to fetch or save
|
|
952
|
-
* the comment data. It is used internally by the comments feature whenever a comment is loaded, created or deleted.
|
|
953
|
-
* The adapter is optional. You might need to provide it if you are {@glink features/collaboration/comments/comments-integration
|
|
954
|
-
* using the comments feature without real-time collaboration}.
|
|
955
|
-
* To set the adapter, overwrite the `CommentsRepository#adapter` property.
|
|
956
|
-
*/
|
|
957
|
-
export interface CommentsAdapter {
|
|
958
|
-
/**
|
|
959
|
-
* Called whenever a new comment thread is created.
|
|
960
|
-
*
|
|
961
|
-
* The object which is passed as a parameter can contain the following properties:
|
|
962
|
-
* * channelId: string | symbol;
|
|
963
|
-
* * threadId: string;
|
|
964
|
-
* * context?: {@link module:comments/comments/commentsrepository~CommentThreadContext CommentThreadContext};
|
|
965
|
-
* * comments?: Array<{@link module:comments/comments/commentsrepository~CommentDataJSON CommentDataJSON}>;
|
|
966
|
-
* * resolvedAt?: Date | null;
|
|
967
|
-
* * resolvedBy?: string | null;
|
|
968
|
-
* * attributes?: Record<string, any> | null;
|
|
969
|
-
*
|
|
970
|
-
* It should return a promise that resolves with the new comment thread data.
|
|
971
|
-
* The resolved data object should contain the following properties:
|
|
972
|
-
* * threadId: string;
|
|
973
|
-
* * comments: Array<\{ commentId: string; createdAt: Date; \}>;
|
|
974
|
-
*/
|
|
975
|
-
addCommentThread: (data: Omit<CommentThreadData, 'isFromAdapter'> & {
|
|
976
|
-
comments: Array<CommentDataJSON>;
|
|
977
|
-
}) => Promise<{
|
|
978
|
-
threadId: string;
|
|
979
|
-
comments: Array<{
|
|
980
|
-
commentId: string;
|
|
981
|
-
createdAt: Date;
|
|
982
|
-
}>;
|
|
983
|
-
}>;
|
|
984
|
-
/**
|
|
985
|
-
* Called when the editor needs the data for a comment thread.
|
|
986
|
-
*
|
|
987
|
-
* It should return a promise that resolves with the comment thread data.
|
|
988
|
-
* The resolved data object should contain the following properties:
|
|
989
|
-
* * threadId: string;
|
|
990
|
-
* * comments: Array<\{ commentId?: string; authorId: string; createdAt: Date; content: string; attributes: Record<string, any>; \}>;
|
|
991
|
-
* * resolvedAt?: Date | null;
|
|
992
|
-
* * resolvedBy?: string | null;
|
|
993
|
-
* * attributes: Record<string, unknown>;
|
|
994
|
-
*
|
|
995
|
-
* @param data.channelId The ID of the document or context to which the comment is added.
|
|
996
|
-
* @param data.threadId The ID of the comment thread that the comment is added to.
|
|
997
|
-
*/
|
|
998
|
-
getCommentThread: (data: Omit<BaseCommentThread, 'isFromAdapter'>) => Promise<{
|
|
999
|
-
threadId: string;
|
|
1000
|
-
comments: Array<CommentData>;
|
|
1001
|
-
resolvedAt?: Date | null;
|
|
1002
|
-
resolvedBy?: string | null;
|
|
1003
|
-
attributes: Record<string, unknown>;
|
|
1004
|
-
} | null>;
|
|
1005
|
-
/**
|
|
1006
|
-
* Called each time the user changes the existing comment thread.
|
|
1007
|
-
*
|
|
1008
|
-
* Keep in mind that for security reasons, the `authorId`, `createdAt`, `resolvedBy` and `resolvedAt` properties
|
|
1009
|
-
* are not passed in the `updateCommentThread()` call and you should not set them as a result of this call.
|
|
1010
|
-
*
|
|
1011
|
-
* It updates the comment data in the database and returns a promise
|
|
1012
|
-
* that will be resolved when the update is completed.
|
|
1013
|
-
*
|
|
1014
|
-
* The object which is passed as a parameter can contain the following properties:
|
|
1015
|
-
* * channelId: string | symbol;
|
|
1016
|
-
* * threadId: string;
|
|
1017
|
-
* * context?: {@link module:comments/comments/commentsrepository~CommentThreadContext};
|
|
1018
|
-
* * attributes?: Record<string, any> | null;
|
|
1019
|
-
*/
|
|
1020
|
-
updateCommentThread: (data: Omit<UpdateCommentThreadEventData, 'isFromAdapter'>) => Promise<void>;
|
|
1021
|
-
/**
|
|
1022
|
-
* Called each time the user resolves a comment thread.
|
|
1023
|
-
*
|
|
1024
|
-
* Should set `resolvedAt` and `resolvedBy` properties in your database and should resolve with an object
|
|
1025
|
-
* containing these two properties and returns a promise that will be resolved when the operation is completed.
|
|
1026
|
-
*
|
|
1027
|
-
* The resolved data object should contain the following properties:
|
|
1028
|
-
* * threadId: string;
|
|
1029
|
-
* * resolvedAt: Date;
|
|
1030
|
-
* * resolvedBy: string;
|
|
1031
|
-
*
|
|
1032
|
-
* @param data.channelId The ID of the document or context that the comment thread is removed from.
|
|
1033
|
-
* @param data.threadId The ID of the thread to remove.
|
|
1034
|
-
*/
|
|
1035
|
-
resolveCommentThread: (data: Omit<BaseCommentThread, 'isFromAdapter'>) => Promise<{
|
|
1036
|
-
threadId: string;
|
|
1037
|
-
resolvedAt: Date;
|
|
1038
|
-
resolvedBy: string;
|
|
1039
|
-
}>;
|
|
1040
|
-
/**
|
|
1041
|
-
* Called when the user reopens a resolved comment thread.
|
|
1042
|
-
*
|
|
1043
|
-
* Should set `resolvedAt` and `resolvedBy` properties to `null` in your database and returns a promise
|
|
1044
|
-
* that will be resolved when the operation is completed.
|
|
1045
|
-
*
|
|
1046
|
-
* @param data.channelId The ID of the document or context that the comment thread is removed from.
|
|
1047
|
-
* @param data.threadId The ID of the thread to remove.
|
|
1048
|
-
*/
|
|
1049
|
-
reopenCommentThread: (data: Omit<BaseCommentThread, 'isFromAdapter'>) => Promise<void>;
|
|
1050
|
-
/**
|
|
1051
|
-
* Called each time the user removes a comment thread.
|
|
1052
|
-
*
|
|
1053
|
-
* It should return a promise that resolves when the thread is removed.
|
|
1054
|
-
*
|
|
1055
|
-
* @param data.channelId The ID of the document or context that the comment thread is removed from.
|
|
1056
|
-
* @param data.threadId The ID of the thread to remove.
|
|
1057
|
-
*/
|
|
1058
|
-
removeCommentThread: (data: Omit<BaseCommentThread, 'isFromAdapter'>) => Promise<void>;
|
|
1059
|
-
/**
|
|
1060
|
-
* Called each time the user adds a new comment to a thread.
|
|
1061
|
-
*
|
|
1062
|
-
* It saves the comment data in the database and returns a promise
|
|
1063
|
-
* that should get resolved when the save is completed.
|
|
1064
|
-
*
|
|
1065
|
-
* If the promise resolves with an object with the `createdAt` property, the
|
|
1066
|
-
* comment property will be updated in the comment in the editor.
|
|
1067
|
-
* This is to update the comment data with the server-side information.
|
|
1068
|
-
*
|
|
1069
|
-
* The `data` object does not expect the `authorId` property.
|
|
1070
|
-
* For security reasons, the author of the comment should be set
|
|
1071
|
-
* on the server side.
|
|
1072
|
-
*
|
|
1073
|
-
* The `data` object does not expect the `createdAt` property either.
|
|
1074
|
-
* You should use the server-side time generator to ensure that all users
|
|
1075
|
-
* see the same date.
|
|
1076
|
-
*
|
|
1077
|
-
* It is recommended to stringify the `data.attributes` value to JSON
|
|
1078
|
-
* and to save it as a string in your database and then to parse the
|
|
1079
|
-
* value from JSON when loading comments.
|
|
1080
|
-
*
|
|
1081
|
-
* The object which is passed as a parameter can contain the following properties:
|
|
1082
|
-
* * channelId: string | symbol;
|
|
1083
|
-
* * threadId: string;
|
|
1084
|
-
* * commentId: string;
|
|
1085
|
-
* * content: string;
|
|
1086
|
-
* * attributes: Record<string, any>;
|
|
1087
|
-
*
|
|
1088
|
-
* The resolved data object should contain the following properties:
|
|
1089
|
-
* * commentId: string;
|
|
1090
|
-
* * createdAt: Date;
|
|
1091
|
-
*
|
|
1092
|
-
* @param data.channelId The ID of the document or context to which the comment is added.
|
|
1093
|
-
* @param data.threadId The ID of the comment thread that the comment is added to.
|
|
1094
|
-
* @param data.commentId The comment ID.
|
|
1095
|
-
* @param data.content The comment content.
|
|
1096
|
-
* @param data.attributes Comment custom attributes.
|
|
1097
|
-
*/
|
|
1098
|
-
addComment: (data: Omit<BaseComment, 'isFromAdapter'> & BaseCommentData) => Promise<{
|
|
1099
|
-
commentId: string;
|
|
1100
|
-
createdAt: Date;
|
|
1101
|
-
}>;
|
|
1102
|
-
/**
|
|
1103
|
-
* Called each time the user changes the existing comment.
|
|
1104
|
-
*
|
|
1105
|
-
* It updates the comment data in the database and returns a promise
|
|
1106
|
-
* that will be resolved when the update is completed.
|
|
1107
|
-
*
|
|
1108
|
-
* Keep in mind that the `data` parameter only contains the
|
|
1109
|
-
* properties of a comment that have changed.
|
|
1110
|
-
*
|
|
1111
|
-
* The object which is passed as a parameter can contain the following properties:
|
|
1112
|
-
* * channelId: string | symbol;
|
|
1113
|
-
* * threadId: string;
|
|
1114
|
-
* * commentId: string;
|
|
1115
|
-
* * content?: string;
|
|
1116
|
-
* * attributes?: Record<string, any>;
|
|
1117
|
-
*
|
|
1118
|
-
* @param data.channelId The ID of the document or context where the comment is updated.
|
|
1119
|
-
* @param data.threadId The ID of the comment thread where the comment is updated.
|
|
1120
|
-
* @param data.commentId The ID of the comment to update.
|
|
1121
|
-
* @param data.content The new content of the comment.
|
|
1122
|
-
* @param data.attributes Custom comment attributes.
|
|
1123
|
-
*/
|
|
1124
|
-
updateComment: (data: Omit<BaseComment, 'isFromAdapter'> & Partial<BaseCommentData>) => Promise<void>;
|
|
1125
|
-
/**
|
|
1126
|
-
* Called each time the user removes a comment from the thread.
|
|
1127
|
-
*
|
|
1128
|
-
* It removes the comment from the database and returns a promise
|
|
1129
|
-
* that will be resolved when the removal is completed.
|
|
1130
|
-
*
|
|
1131
|
-
* @param data.channelId The ID of the document or context that the comment is removed from.
|
|
1132
|
-
* @param data.threadId The ID of the comment thread that the comment is removed from.
|
|
1133
|
-
* @param data.commentId The ID of the comment to remove.
|
|
1134
|
-
*/
|
|
1135
|
-
removeComment: (data: Omit<BaseComment, 'isFromAdapter'>) => Promise<void>;
|
|
1136
|
-
}
|
|
1137
|
-
export {};
|