@ones-editor/editor 2.8.25-beta.1 → 2.8.25-beta.11

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.
@@ -46,6 +46,7 @@ import CommentIcon from './comment.svg?raw';
46
46
  import RefreshIcon from './refresh.svg?raw';
47
47
  import HelpIcon from './help.svg?raw';
48
48
  import CheckMarkIcon from './check-mark.svg?raw';
49
+ import CircleCheckMarkIcon from './circle-check-mark.svg?raw';
49
50
  import TextIcon from './text.svg?raw';
50
51
  import RightArrowIcon from './right-arrow.svg?raw';
51
52
  import BilibiliIcon from './bilibili-icon.svg?raw';
@@ -126,4 +127,4 @@ import ShiftTabIcon from './shift-tab.svg?raw';
126
127
  import TableEditIcon from './table-edit.svg?raw';
127
128
  import AdjustWidthIcon from './adjust-width.svg?raw';
128
129
  import TocIcon from './toc.svg?raw';
129
- export { TableEditIcon, TabIcon, ShiftTabIcon, DownloadIcon, AddEmojiIcon, BallIcon, CardIcon, FoodIcon, LightIcon, SmileIcon, SymbolIcon, TreeIcon, TimeIcon, ClearIcon, CloseIcon, PrevIcon, NextIcon, MoreIcon, TextColorIcon, AddIcon, ArrowDownIcon, ArrowUpIcon, ArrowLeftIcon, ArrowRightIcon, DeleteRowIcon, DeleteColIcon, MergeCellIcon, SplitCellIcon, DeleteTableIcon, Heading1Icon, Heading2Icon, Heading3Icon, Heading4Icon, Heading5Icon, Heading6Icon, Heading7Icon, Heading8Icon, HeadingNIcon, OrderedListIcon, UnorderedListIcon, CheckListIcon, BlockquoteIcon, AlignCenterIcon, AlignLeftIcon, AlignRightIcon, ImageIcon, ImageMenuIcon, ImageErrorIcon, ImageEmptyIcon, LinkIcon, LinkOffIcon, WarningIcon, PasteSpecialIcon, LaunchIcon, CodeIcon, LayoutIcon, AudioIcon, GraphIcon, VideoIcon, FileIcon, MathIcon, MathMenuIcon, TableIcon, TableMenuIcon, BilibiliIcon, YoukuIcon, ModaoIcon, FigmaIcon, EditIcon, CommentIcon, RefreshIcon, HelpIcon, CheckMarkIcon, TextIcon, RightArrowIcon, TencentVideoIcon, WebPageIcon, UmlIcon, DividingLineIcon, HeadingH1Icon, HeadingH2Icon, HeadingH3Icon, HeadingH4Icon, HeadingH5Icon, HeadingH6Icon, HeadingH7Icon, HeadingH8Icon, CheckboxIcon, QuoteIcon, LinkHrefIcon, OrderedIcon, UnorderedIcon, CopyIcon, CutIcon, DeleteIcon, LockBlockIcon, UnLockBlockIcon, InsertBeforeIcon, InsertAfterIcon, MentionIcon, CircleAddIcon, LoadingIcon, DragIcon, UmlBrandIcon, OnesLoadingIcon, BoldIcon, ItalicIcon, UnderlineIcon, LineThroughIcon, SubscriptIcon, SuperscriptIcon, InlineCodeIcon, ToMindMapIcon, FitIcon, FullScreenIcon, ExitFullScreenIcon, CaretDownIcon, StatusIcon, AlertEmojiIcon, ForbiddenIcon, WarningFilledIcon, InformationFilledIcon, SearchIcon, CalloutIcon, LoadingCircleIcon, TextGroupIcon, AdjustWidthIcon, TocIcon, };
130
+ export { TableEditIcon, TabIcon, ShiftTabIcon, DownloadIcon, AddEmojiIcon, BallIcon, CardIcon, FoodIcon, LightIcon, SmileIcon, SymbolIcon, TreeIcon, TimeIcon, ClearIcon, CloseIcon, PrevIcon, NextIcon, MoreIcon, TextColorIcon, AddIcon, ArrowDownIcon, ArrowUpIcon, ArrowLeftIcon, ArrowRightIcon, DeleteRowIcon, DeleteColIcon, MergeCellIcon, SplitCellIcon, DeleteTableIcon, Heading1Icon, Heading2Icon, Heading3Icon, Heading4Icon, Heading5Icon, Heading6Icon, Heading7Icon, Heading8Icon, HeadingNIcon, OrderedListIcon, UnorderedListIcon, CheckListIcon, BlockquoteIcon, AlignCenterIcon, AlignLeftIcon, AlignRightIcon, ImageIcon, ImageMenuIcon, ImageErrorIcon, ImageEmptyIcon, LinkIcon, LinkOffIcon, WarningIcon, PasteSpecialIcon, LaunchIcon, CodeIcon, LayoutIcon, AudioIcon, GraphIcon, VideoIcon, FileIcon, MathIcon, MathMenuIcon, TableIcon, TableMenuIcon, BilibiliIcon, YoukuIcon, ModaoIcon, FigmaIcon, EditIcon, CommentIcon, RefreshIcon, HelpIcon, CheckMarkIcon, CircleCheckMarkIcon, TextIcon, RightArrowIcon, TencentVideoIcon, WebPageIcon, UmlIcon, DividingLineIcon, HeadingH1Icon, HeadingH2Icon, HeadingH3Icon, HeadingH4Icon, HeadingH5Icon, HeadingH6Icon, HeadingH7Icon, HeadingH8Icon, CheckboxIcon, QuoteIcon, LinkHrefIcon, OrderedIcon, UnorderedIcon, CopyIcon, CutIcon, DeleteIcon, LockBlockIcon, UnLockBlockIcon, InsertBeforeIcon, InsertAfterIcon, MentionIcon, CircleAddIcon, LoadingIcon, DragIcon, UmlBrandIcon, OnesLoadingIcon, BoldIcon, ItalicIcon, UnderlineIcon, LineThroughIcon, SubscriptIcon, SuperscriptIcon, InlineCodeIcon, ToMindMapIcon, FitIcon, FullScreenIcon, ExitFullScreenIcon, CaretDownIcon, StatusIcon, AlertEmojiIcon, ForbiddenIcon, WarningFilledIcon, InformationFilledIcon, SearchIcon, CalloutIcon, LoadingCircleIcon, TextGroupIcon, AdjustWidthIcon, TocIcon, };
package/dist/index.d.ts CHANGED
@@ -45,6 +45,7 @@ export * from 'tiny-typed-emitter';
45
45
  export { ShareDBDocVersionsProvider, OnesEditorIcons, isLayoutBlock, LayoutQuickMenuItemFilter, CalloutQuickMenuItemFilter, MobileCommandHandler, PasteSpecialHandler };
46
46
  export type { FileBoxData, FileEmbedData } from '../@ones-editor/file';
47
47
  export * from './helper';
48
+ export { OnesEditorComments, OnesEditorCommentsRender } from '../@ones-editor/comments';
48
49
  export { type DocListBlock } from '../@ones-editor/list-block';
49
50
  export declare function getDefaultOnesEditorOptions(options: CreateOnesEditorOptions): {
50
51
  id: string | undefined;
package/dist/index.js CHANGED
@@ -4326,6 +4326,15 @@ div.editor-root.readonly div.editor-content div[data-type=editor-container] div[
4326
4326
  padding-left: 8px;
4327
4327
  padding-top: 60px;
4328
4328
  }
4329
+ .editor-web-comment-root[list-type=resolved] .comment-groups-container .comment-no-resolved-tip {
4330
+ font-size: 12px;
4331
+ width: 100%;
4332
+ color: #BEBFC2;
4333
+ display: flex;
4334
+ justify-content: center;
4335
+ align-items: center;
4336
+ margin-top: 100px;
4337
+ }
4329
4338
  .editor-web-comment-root[list-type=resolved] .comment-groups-container .comment-group-item-root {
4330
4339
  position: inherit;
4331
4340
  transform: none;
@@ -4347,7 +4356,7 @@ div.editor-root.readonly div.editor-content div[data-type=editor-container] div[
4347
4356
  box-shadow: var(--editor-box-shadow);
4348
4357
  padding-bottom: 10px;
4349
4358
  }
4350
- .editor-web-comment-root .comment-groups-container .comment-group-item-root.resolved .item-head-switch .editor-text-button.resolved {
4359
+ .editor-web-comment-root .comment-groups-container .comment-group-item-root.resolved .comment-item-head .item-head-switch {
4351
4360
  display: none;
4352
4361
  }
4353
4362
  .editor-web-comment-root .comment-groups-container .comment-group-item-root.resolved .item-head-tools {
@@ -4404,22 +4413,23 @@ div.editor-root.readonly div.editor-content div[data-type=editor-container] div[
4404
4413
  display: flex;
4405
4414
  align-items: center;
4406
4415
  height: 22px;
4407
- visibility: hidden;
4408
4416
  }
4409
4417
  .editor-web-comment-root .comment-groups-container .comment-group-item-root .comment-item-head .item-head-switch .editor-text-button {
4410
4418
  padding: 0;
4411
4419
  width: var(--editor-comment-switch-button-width);
4412
- margin: 3px 0;
4420
+ margin-right: 5px;
4413
4421
  color: #606060;
4422
+ width: 16px;
4423
+ height: 16px;
4414
4424
  }
4415
4425
  .editor-web-comment-root .comment-groups-container .comment-group-item-root .comment-item-head .item-head-switch .editor-text-button[data-button-id=switch-up] {
4416
- margin-right: 16px;
4426
+ visibility: hidden;
4417
4427
  }
4418
4428
  .editor-web-comment-root .comment-groups-container .comment-group-item-root .comment-item-head .item-head-switch .editor-text-button[data-button-id=switch-down] {
4419
- margin-right: 16px;
4429
+ visibility: hidden;
4420
4430
  }
4421
- .editor-web-comment-root .comment-groups-container .comment-group-item-root .comment-item-head .item-head-switch .editor-text-button[data-button-id=resolve].resolved {
4422
- color: green;
4431
+ .editor-web-comment-root .comment-groups-container .comment-group-item-root .comment-item-head .item-head-switch .editor-text-button[data-button-id=resolve] {
4432
+ margin-right: 0;
4423
4433
  }
4424
4434
  .editor-web-comment-root .comment-groups-container .comment-group-item-root .comment-item-head .item-head-switch .editor-text-button:not(.disabled):hover {
4425
4435
  color: var(--text-button-color-hover);
@@ -4440,9 +4450,14 @@ div.editor-root.readonly div.editor-content div[data-type=editor-container] div[
4440
4450
  }
4441
4451
  .editor-web-comment-root .comment-groups-container .comment-group-item-root .comment-item-footer .comment-actions .comment-date {
4442
4452
  flex: 1;
4453
+ white-space: nowrap;
4443
4454
  }
4444
4455
  .editor-web-comment-root .comment-groups-container .comment-group-item-root .comment-item-footer .comment-actions .removed-tips {
4445
4456
  color: #87888A;
4457
+ white-space: nowrap;
4458
+ text-overflow: ellipsis;
4459
+ overflow: hidden;
4460
+ margin-left: 10px;
4446
4461
  }
4447
4462
  .editor-web-comment-root .comment-groups-container .comment-group-item-root .comment-item-footer .comment-actions .comment-reopen {
4448
4463
  background: none;
@@ -4457,7 +4472,10 @@ div.editor-root.readonly div.editor-content div[data-type=editor-container] div[
4457
4472
  .editor-web-comment-root .comment-groups-container .comment-group-item-root.active::before {
4458
4473
  background-color: #f59300;
4459
4474
  }
4460
- .editor-web-comment-root .comment-groups-container .comment-group-item-root.active .item-head-switch {
4475
+ .editor-web-comment-root .comment-groups-container .comment-group-item-root.active .item-head-switch .editor-text-button[data-button-id=switch-up] {
4476
+ visibility: visible;
4477
+ }
4478
+ .editor-web-comment-root .comment-groups-container .comment-group-item-root.active .item-head-switch .editor-text-button[data-button-id=switch-down] {
4461
4479
  visibility: visible;
4462
4480
  }
4463
4481
  .editor-web-comment-root .comment-groups-container .comment-group-item-root.readonly .comment-quick-reply .quick-reply-button.invisible {
@@ -32284,6 +32302,9 @@ ${codeText}
32284
32302
  toJSON() {
32285
32303
  return cloneDeep__default.default(this.doc);
32286
32304
  }
32305
+ rawData() {
32306
+ return this.doc;
32307
+ }
32287
32308
  getContainerBlocks(containerId) {
32288
32309
  const blocks = this.doc.blocks[containerId];
32289
32310
  return blocks;
@@ -40755,6 +40776,7 @@ ${codeText}
40755
40776
  const RefreshIcon = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M15.3498 7.51663L12.9692 9.49971L10.5902 7.51663" stroke="currentColor"/>\n<path d="M12.811 9.5C12.9344 9.02057 13 8.51795 13 8C13 4.68629 10.3137 2 7 2C3.68629 2 1 4.68629 1 8C1 11.3137 3.68629 14 7 14C8.39546 14 9.67966 13.5236 10.6988 12.7246" stroke="currentColor"/>\n</svg>';
40756
40777
  const HelpIcon = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M15 8C15 11.8659 11.8659 15 8 15C4.13408 15 1 11.8659 1 8C1 4.13408 4.13408 1 8 1C11.8659 1 15 4.13408 15 8Z" stroke="currentColor"/>\n<path d="M6 6.41815C6 5.81984 6.55057 4.52136 7.98652 4.52136C9.24198 4.52136 10 5.42027 10 6.41815C10 7.24315 9.34611 7.76435 8.89738 8.21308C7.99992 9.11055 7.99992 10.0001 7.99992 10.0001" stroke="currentColor"/>\n<path d="M8 11V13" stroke="currentColor"/>\n</svg>\n';
40757
40778
  const CheckMarkIcon = '<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" stroke-width="2">\n <path d="m1 7.4 1.497-1.498 3.861 3.86L12.85 2.45l1.498 1.497-6.491 7.312.005.007-.096.095-1.318 1.486L1 7.399Z" fill="currentColor" fill-rule="nonzero"></path>\n</svg>';
40779
+ const CircleCheckMarkIcon = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M10.9825 5.99158L7.19788 10.0128L5.30554 8.12045" stroke="currentColor" stroke-linejoin="round"/>\n<circle cx="8.03119" cy="7.99481" r="4.98883" stroke="currentColor"/>\n</svg>\n';
40758
40780
  const TextIcon = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M2.5 4L2.5 1.5L13.5 1.5V4" stroke="currentColor" stroke-linejoin="round"/>\n<path d="M8 14.5V2" stroke="currentColor"/>\n<path d="M5 14.5H11" stroke="currentColor" stroke-linejoin="round"/>\n</svg>\n';
40759
40781
  const rightArrow = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M5.76573 4.17763L9.58809 7.99999L5.76573 11.8209" stroke="currentColor" stroke-width="2"/>\n</svg>\n';
40760
40782
  const BilibiliIcon = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M11.3909 3.71427H11.8891C12.7699 3.74577 13.5043 4.05144 14.09 4.63244C14.6757 5.21285 14.979 5.94435 15 6.82577V11.1191C14.979 11.9999 14.6757 12.7344 14.09 13.32C13.5043 13.9057 12.7705 14.209 11.8891 14.23H4.11092C3.23008 14.209 2.49567 13.9057 1.91 13.32C1.32433 12.7344 1.021 12.0005 1 11.1191V6.82577C1.021 5.94435 1.32433 5.21285 1.91 4.63244C2.49567 4.05144 3.2295 3.74577 4.11092 3.71427H4.56242L3.87758 3.06094C3.80715 2.99237 3.75151 2.9101 3.71409 2.81921C3.67667 2.72831 3.65826 2.63072 3.66 2.53244C3.66 2.32477 3.73233 2.1486 3.87758 2.00335L3.89333 1.9876C4.04908 1.84235 4.22758 1.77002 4.43 1.77002C4.63242 1.77002 4.81092 1.84235 4.96667 1.9876L6.63092 3.59002C6.67233 3.63144 6.70908 3.67285 6.74 3.71427H9.22908C9.25335 3.66813 9.28486 3.62618 9.32242 3.59002L10.9867 1.9876C11.1424 1.84235 11.3209 1.77002 11.5233 1.77002C11.7258 1.77002 11.9095 1.8581 12.0652 2.00335C12.221 2.1486 12.2933 2.32477 12.2933 2.53244C12.2933 2.73952 12.221 2.91569 12.0757 3.06094L11.3909 3.71427ZM4.11092 5.22335C3.67575 5.23385 3.31 5.38435 3.01425 5.67427C2.71908 5.96477 2.56567 6.33344 2.55575 6.7791V11.1658C2.56567 11.6114 2.71908 11.9795 3.01425 12.27C3.31 12.5605 3.67575 12.711 4.11092 12.7209H11.8891C12.3242 12.711 12.69 12.5605 12.9858 12.27C13.2809 11.9795 13.4343 11.6114 13.4442 11.1658V6.7791C13.4343 6.33285 13.2809 5.96477 12.9858 5.67427C12.69 5.38435 12.3242 5.23385 11.8891 5.22335H4.11092ZM5.66667 7.4791C5.88425 7.4791 6.06567 7.55144 6.21092 7.69669C6.35675 7.84194 6.43433 8.0286 6.44425 8.25669V8.94094C6.43433 9.16902 6.35675 9.35569 6.21092 9.50094C6.06567 9.64677 5.88425 9.7191 5.66667 9.7191C5.44908 9.7191 5.26767 9.64619 5.12242 9.50094C4.97658 9.35569 4.899 9.16902 4.88908 8.94094V8.25669C4.88908 8.0391 4.96433 7.85477 5.11425 7.70427C5.26475 7.55435 5.44908 7.4791 5.66667 7.4791ZM10.3333 7.4791C10.5509 7.4791 10.7323 7.55144 10.8776 7.69669C11.0234 7.84194 11.101 8.0286 11.1109 8.25669V8.94094C11.101 9.16902 11.0234 9.35569 10.8776 9.50094C10.7323 9.64677 10.5509 9.7191 10.3333 9.7191C10.1157 9.7191 9.93433 9.64619 9.78908 9.50094C9.64325 9.35569 9.56567 9.16902 9.55575 8.94094V8.25669C9.56567 8.0286 9.64325 7.84194 9.78908 7.69669C9.93433 7.55144 10.1157 7.4791 10.3333 7.4791Z" fill="#07A3D7"/>\n</svg>\n';
@@ -40910,6 +40932,7 @@ ${codeText}
40910
40932
  RefreshIcon,
40911
40933
  HelpIcon,
40912
40934
  CheckMarkIcon,
40935
+ CircleCheckMarkIcon,
40913
40936
  TextIcon,
40914
40937
  RightArrowIcon: rightArrow,
40915
40938
  TencentVideoIcon,
@@ -63425,7 +63448,7 @@ $$${mathData.mathjaxText}$$
63425
63448
  function removeResolvedComments(commentProvider, commentIds) {
63426
63449
  return commentIds.filter((commentId) => {
63427
63450
  const comment = commentProvider.getComment(commentId);
63428
- return !comment.resolver;
63451
+ return !(comment == null ? void 0 : comment.resolver);
63429
63452
  });
63430
63453
  }
63431
63454
  const logger$1F = getLogger("active-comments");
@@ -69282,8 +69305,8 @@ ${codeText}
69282
69305
  });
69283
69306
  }
69284
69307
  }
69285
- const switchUpIcon = '<svg width="17" height="16" viewBox="0 0 17 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M2.00218 11.0005L8.00341 4.99923L14.0046 11.0005" stroke="currentColor" fill="transparent" stroke-width="1.5" stroke-linejoin="bevel"/>\n</svg>';
69286
- const switchDownIcon = '<svg width="17" height="16" viewBox="0 0 17 16" xmlns="http://www.w3.org/2000/svg">\n<path d="M14.0029 4.99933L8.00172 11.0006L2.00049 4.99933" stroke="currentColor" fill="transparent" stroke-width="1.5" stroke-linejoin="bevel"/>\n</svg>';
69308
+ const switchUpIcon = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M4.17757 10.2343L7.99993 6.41191L11.8208 10.2343" stroke="currentColor"/>\n</svg>\n';
69309
+ const switchDownIcon = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M4.17757 5.76573L7.99993 9.58809L11.8208 5.76573" stroke="currentColor"/>\n</svg>\n';
69287
69310
  const index$8 = "";
69288
69311
  const REPLY_EDITOR_EDITING_CLS = "reply-editor-editing";
69289
69312
  const { t: t$3 } = i18n$1;
@@ -69512,10 +69535,11 @@ ${codeText}
69512
69535
  const switchContainer = createElement("span", ["item-head-switch"], head);
69513
69536
  const switchUp = createTextButton(switchContainer, GroupItemActions.SwitchUp, "up", switchUpIcon);
69514
69537
  const switchDown = createTextButton(switchContainer, GroupItemActions.SwitchDown, "down", switchDownIcon);
69515
- const resolve = createTextButton(switchContainer, GroupItemActions.Resolve, "resolve", CheckMarkIcon);
69538
+ const resolve = createTextButton(switchContainer, GroupItemActions.Resolve, "resolve", CircleCheckMarkIcon);
69516
69539
  addGroupActionToElement(switchUp, GroupItemActions.SwitchUp);
69517
69540
  addGroupActionToElement(switchDown, GroupItemActions.SwitchDown);
69518
69541
  addGroupActionToElement(resolve, GroupItemActions.Resolve);
69542
+ addClass(resolve, "disable-active");
69519
69543
  if (comment.resolver) {
69520
69544
  addClass(resolve, "resolved");
69521
69545
  }
@@ -69558,6 +69582,7 @@ ${codeText}
69558
69582
  handleUpdateMainComment(comment) {
69559
69583
  assert(logger$1h, comment.id === this.mainItem.comment.id, "invalid comment");
69560
69584
  this.mainItem.reloadDoc();
69585
+ this.setCreatingComment(false);
69561
69586
  }
69562
69587
  deleteMainComment(commentId) {
69563
69588
  assert(logger$1h, commentId === this.mainItem.comment.id, "invalid comment");
@@ -69566,6 +69591,18 @@ ${codeText}
69566
69591
  edit() {
69567
69592
  this.mainItem.edit();
69568
69593
  }
69594
+ setCreatingComment(creating) {
69595
+ const resolveButton = this.header.querySelector('.editor-text-button[group-item-action="resolve"]');
69596
+ if (!resolveButton) {
69597
+ return;
69598
+ }
69599
+ resolveButton.disabled = creating;
69600
+ if (creating) {
69601
+ resolveButton.classList.add("disabled");
69602
+ } else {
69603
+ resolveButton.classList.remove("disabled");
69604
+ }
69605
+ }
69569
69606
  destroy() {
69570
69607
  this.quickReply.destroy();
69571
69608
  this.mainItem.destroy();
@@ -69761,7 +69798,7 @@ ${codeText}
69761
69798
  date: Date.now()
69762
69799
  });
69763
69800
  });
69764
- __publicField(this, "execute", (element, groupItem, commentId, itemIndex) => {
69801
+ __publicField(this, "execute", (element, groupItem, commentId, itemIndex, event) => {
69765
69802
  const actionElement = getClosestGroupItemActionElement(element);
69766
69803
  if (!actionElement)
69767
69804
  return;
@@ -69801,6 +69838,8 @@ ${codeText}
69801
69838
  this.handleQuickReplyCancel(groupItem);
69802
69839
  break;
69803
69840
  case GroupItemActions.Resolve:
69841
+ event.preventDefault();
69842
+ event.stopPropagation();
69804
69843
  this.handleResolve(groupItem);
69805
69844
  break;
69806
69845
  default:
@@ -69855,7 +69894,9 @@ ${codeText}
69855
69894
  const commentId = getClosestCommentItemId(event.target);
69856
69895
  const index2 = this.items.findIndex((item) => item.root === itemRoot);
69857
69896
  if (index2 !== -1) {
69858
- if (this.activeIndex !== index2) {
69897
+ const disableActive = !!event.target.closest(".disable-active");
69898
+ const enableActive = !disableActive;
69899
+ if (this.activeIndex !== index2 && enableActive) {
69859
69900
  this.setActiveItem(index2);
69860
69901
  }
69861
69902
  const { groupItemHandlers } = this;
@@ -69863,7 +69904,8 @@ ${codeText}
69863
69904
  event.target,
69864
69905
  this.items[index2],
69865
69906
  commentId,
69866
- index2
69907
+ index2,
69908
+ event
69867
69909
  );
69868
69910
  }
69869
69911
  });
@@ -70127,6 +70169,7 @@ ${codeText}
70127
70169
  newItem.quickReply.hide();
70128
70170
  setTimeout(() => {
70129
70171
  newItem.edit();
70172
+ newItem.setCreatingComment(true);
70130
70173
  }, 300);
70131
70174
  }
70132
70175
  }
@@ -70151,6 +70194,12 @@ ${codeText}
70151
70194
  }
70152
70195
  }
70153
70196
  }
70197
+ handleResolveComment(commentId) {
70198
+ const item = this.findItem(commentId);
70199
+ if (item) {
70200
+ this.deleteItem(item.comment.id);
70201
+ }
70202
+ }
70154
70203
  handleUpdateComment(comment) {
70155
70204
  const group = this.findItemAsGroupId(comment.groupId);
70156
70205
  if (group && group.comment.id !== comment.id) {
@@ -70224,10 +70273,20 @@ ${codeText}
70224
70273
  });
70225
70274
  return resultMap;
70226
70275
  }
70276
+ function getBlocksByCommentId(doc2, commentId) {
70277
+ const result = [];
70278
+ const resultMap = getBlockCommentsFromDoc(doc2);
70279
+ resultMap.forEach((commentIds, blockId) => {
70280
+ if (commentIds.has(commentId)) {
70281
+ result.push(blockId);
70282
+ }
70283
+ });
70284
+ return result;
70285
+ }
70227
70286
  class OnesEditorCommentsRender {
70228
70287
  constructor(type = "current") {
70229
70288
  __publicField(this, "updateUnknownCommentsDelayed", debounce__default.default((editor) => {
70230
- const comments = editor.doc.toJSON().comments;
70289
+ const comments = this.getComments(editor);
70231
70290
  const invisibleComments = Object.values(comments).filter((comment) => {
70232
70291
  if (comment.id !== comment.groupId) {
70233
70292
  return false;
@@ -70343,6 +70402,14 @@ ${codeText}
70343
70402
  this.updateUnknownCommentsDelayed(editor);
70344
70403
  }
70345
70404
  }
70405
+ getComments(editor) {
70406
+ const editorComments = editor.findCustom("editor-comments");
70407
+ if (!editorComments) {
70408
+ return [];
70409
+ }
70410
+ const commentProvider = editorComments.commentProvider;
70411
+ return commentProvider.getComments();
70412
+ }
70346
70413
  changeType(editor, type) {
70347
70414
  this.type = type;
70348
70415
  const elements = editor.rootContainer.querySelectorAll(".comment");
@@ -70354,8 +70421,8 @@ ${codeText}
70354
70421
  }
70355
70422
  });
70356
70423
  });
70357
- const doc2 = editor.doc.toJSON();
70358
- const visibleComments = Object.values(doc2.comments).filter((comment) => {
70424
+ const comments = this.getComments(editor);
70425
+ const visibleComments = Object.values(comments).filter((comment) => {
70359
70426
  if (comment.id !== comment.groupId) {
70360
70427
  return false;
70361
70428
  }
@@ -70363,7 +70430,7 @@ ${codeText}
70363
70430
  return ret;
70364
70431
  });
70365
70432
  const visibleCommentsId = new Set(visibleComments.map((c) => c.id));
70366
- const commentsFromDoc = getBlockCommentsFromDoc(doc2);
70433
+ const commentsFromDoc = getBlockCommentsFromDoc(editor.doc.toJSON());
70367
70434
  commentsFromDoc.forEach((commentIds, blockId) => {
70368
70435
  if (Array.from(commentIds).some((c) => visibleCommentsId.has(c))) {
70369
70436
  const block = editor.findBlockById(blockId);
@@ -70399,6 +70466,7 @@ ${codeText}
70399
70466
  }]
70400
70467
  });
70401
70468
  __publicField(this, "switcherBar");
70469
+ __publicField(this, "noResolvedCommentTip", null);
70402
70470
  __publicField(this, "handleSwitchType", (bar2, item) => {
70403
70471
  if (item.id === "current-comment") {
70404
70472
  this.listType = "current";
@@ -70416,6 +70484,7 @@ ${codeText}
70416
70484
  if (renderer) {
70417
70485
  renderer.changeType(this.editor, this.listType);
70418
70486
  }
70487
+ this.updateNoResolvedCommentTip();
70419
70488
  });
70420
70489
  __publicField(this, "handleSelectionOnComment", () => {
70421
70490
  this.emit("onSelectComment");
@@ -70424,8 +70493,12 @@ ${codeText}
70424
70493
  var _a, _b;
70425
70494
  const count = getCommentsCountInDoc(this.editor, this.commentsProvider);
70426
70495
  (_b = (_a = this.commentOptions) == null ? void 0 : _a.onCommentCountChange) == null ? void 0 : _b.call(_a, count);
70496
+ this.updateNoResolvedCommentTip();
70427
70497
  });
70428
70498
  __publicField(this, "handleActiveItemChanged", (index2, direction) => {
70499
+ if (this.listType === "resolved") {
70500
+ return;
70501
+ }
70429
70502
  setTimeout(() => {
70430
70503
  var _a, _b;
70431
70504
  const item = this.list.activeItem;
@@ -70458,11 +70531,13 @@ ${codeText}
70458
70531
  return commentOptions;
70459
70532
  }
70460
70533
  destroy() {
70534
+ var _a;
70461
70535
  this.list.removeAllListeners();
70462
70536
  this.commentsProvider.removeListener(this);
70463
70537
  this.list.destroy();
70464
70538
  this.root.remove();
70465
70539
  this.switcherBar.destroy();
70540
+ (_a = this.noResolvedCommentTip) == null ? void 0 : _a.remove();
70466
70541
  }
70467
70542
  onCreateComment(commentId, local) {
70468
70543
  const comment = this.commentsProvider.getComment(commentId);
@@ -70479,40 +70554,56 @@ ${codeText}
70479
70554
  }
70480
70555
  onUpdateCommentResolver(commentId, local) {
70481
70556
  const comment = this.commentsProvider.getComment(commentId);
70482
- const groupItem = this.list.findGroupItem(comment.groupId);
70483
- if (!groupItem) {
70557
+ if (!comment) {
70484
70558
  return;
70485
70559
  }
70486
- setTimeout(() => {
70487
- if (this.listType === "current") {
70488
- if (comment.resolver) {
70489
- this.list.handleDeleteComment(commentId);
70490
- } else {
70491
- this.list.handleCreateComment(comment, local);
70492
- }
70493
- } else {
70494
- if (comment.resolver) {
70495
- this.list.handleCreateComment(comment, local);
70496
- } else {
70497
- this.list.handleDeleteComment(commentId);
70498
- }
70560
+ let type = "add";
70561
+ if (this.listType === "current") {
70562
+ if (comment.resolver) {
70563
+ type = "remove";
70499
70564
  }
70500
- }, 300);
70501
- this.updateCommentCount();
70565
+ } else {
70566
+ if (!comment.resolver) {
70567
+ type = "remove";
70568
+ }
70569
+ }
70502
70570
  const blocks = /* @__PURE__ */ new Set();
70503
- getElementsByCommentId(this.editor, groupItem.comment.id).forEach((element) => {
70504
- if (isBlock$1(element)) {
70505
- blocks.add(element);
70506
- } else {
70507
- const block = getParentBlock(element);
70571
+ if (type === "remove") {
70572
+ getElementsByCommentId(this.editor, commentId).forEach((element) => {
70573
+ if (isBlock$1(element)) {
70574
+ blocks.add(element);
70575
+ } else {
70576
+ const block = getParentBlock(element);
70577
+ if (block) {
70578
+ blocks.add(block);
70579
+ }
70580
+ }
70581
+ });
70582
+ } else {
70583
+ const blockIds = getBlocksByCommentId(this.editor.doc.toJSON(), commentId);
70584
+ blockIds.forEach((blockId) => {
70585
+ const block = this.editor.findBlockById(blockId);
70508
70586
  if (block) {
70509
70587
  blocks.add(block);
70510
70588
  }
70511
- }
70512
- });
70589
+ });
70590
+ }
70513
70591
  blocks.forEach((block) => {
70514
70592
  this.editor.reloadBlock(block);
70515
70593
  });
70594
+ const commentGroup = getCommentsGroup(this.commentsProvider.getComments());
70595
+ const commentWithChildren = commentGroup.find((group) => group.groupId === comment.groupId);
70596
+ if (!commentWithChildren) {
70597
+ return;
70598
+ }
70599
+ setTimeout(() => {
70600
+ if (type === "add") {
70601
+ this.list.handleCreateComment(commentWithChildren, local);
70602
+ } else {
70603
+ this.list.handleResolveComment(commentId);
70604
+ }
70605
+ this.updateCommentCount();
70606
+ }, 300);
70516
70607
  }
70517
70608
  createList() {
70518
70609
  return new CommentGroupList(this.editor, this.commentsProvider, this.groupsContainer, this.listType);
@@ -70525,12 +70616,28 @@ ${codeText}
70525
70616
  commandBar2.addListener("click", this.handleSwitchType);
70526
70617
  return commandBar2;
70527
70618
  }
70619
+ setSwitcherParent(parent) {
70620
+ this.switcherBar.content.remove();
70621
+ parent.append(this.switcherBar.content);
70622
+ }
70528
70623
  isEditing(includeEmpty) {
70529
70624
  return this.list.isEditing(includeEmpty);
70530
70625
  }
70531
70626
  setFirstEditingCommentActive() {
70532
70627
  this.list.setFirstEditingCommentActive();
70533
70628
  }
70629
+ updateNoResolvedCommentTip() {
70630
+ var _a;
70631
+ if (this.listType === "resolved" && this.list.items.length === 0) {
70632
+ if (!this.noResolvedCommentTip) {
70633
+ this.noResolvedCommentTip = createElement("div", ["comment-no-resolved-tip"], this.groupsContainer);
70634
+ this.noResolvedCommentTip.innerText = i18n$1.t("comment.noResolvedComment");
70635
+ }
70636
+ return;
70637
+ }
70638
+ (_a = this.noResolvedCommentTip) == null ? void 0 : _a.remove();
70639
+ this.noResolvedCommentTip = null;
70640
+ }
70534
70641
  show(groupId) {
70535
70642
  var _a;
70536
70643
  removeClass(this.root, "hidden");
@@ -71329,6 +71436,15 @@ ${codeText}
71329
71436
  get isMobile() {
71330
71437
  return clientType.isMobile;
71331
71438
  }
71439
+ getCommentList() {
71440
+ return this.commentList;
71441
+ }
71442
+ getMobileCommentList() {
71443
+ return this.mobileCommentList;
71444
+ }
71445
+ getMiniCommentList() {
71446
+ return this.miniCommentList;
71447
+ }
71332
71448
  destroy() {
71333
71449
  var _a, _b;
71334
71450
  (_a = this.commentList) == null ? void 0 : _a.destroy();
@@ -71354,6 +71470,9 @@ ${codeText}
71354
71470
  if (containers.mobileContainer && this.mobileCommentList) {
71355
71471
  containers.mobileContainer.append(this.mobileCommentList.root);
71356
71472
  }
71473
+ if (containers.switchBarContainer && this.commentList) {
71474
+ this.commentList.setSwitcherParent(containers.switchBarContainer);
71475
+ }
71357
71476
  }
71358
71477
  }
71359
71478
  const style$7 = "";
@@ -71382,7 +71501,8 @@ ${codeText}
71382
71501
  reopen: "\u91CD\u65B0\u6253\u5F00",
71383
71502
  currentComment: "\u5F53\u524D\u6279\u6CE8",
71384
71503
  resolvedComment: "\u5DF2\u89E3\u51B3\u6279\u6CE8",
71385
- removedFromDoc: "\u5F15\u7528\u5185\u5BB9\u5DF2\u5220\u9664"
71504
+ removedFromDoc: "\u5F15\u7528\u5185\u5BB9\u5DF2\u5220\u9664",
71505
+ noResolvedComment: "\u65E0\u5DF2\u89E3\u51B3\u6279\u6CE8"
71386
71506
  }
71387
71507
  };
71388
71508
  const enUS$k = {
@@ -71410,7 +71530,8 @@ ${codeText}
71410
71530
  reopen: "Reopen",
71411
71531
  currentComment: "Current Annotations",
71412
71532
  resolvedComment: "Resolved Annotations",
71413
- removedFromDoc: "This annotation has been removed from the document"
71533
+ removedFromDoc: "This annotation has been removed from the document",
71534
+ noResolvedComment: "No resolved annotations"
71414
71535
  }
71415
71536
  };
71416
71537
  const jaJP$k = {
@@ -71438,7 +71559,8 @@ ${codeText}
71438
71559
  reopen: "\u518D\u958B",
71439
71560
  currentComment: "\u73FE\u5728\u306E\u6CE8\u91C8",
71440
71561
  resolvedComment: "\u89E3\u6C7A\u6E08\u307F\u306E\u6CE8\u91C8",
71441
- removedFromDoc: "\u3053\u306E\u6CE8\u91C8\u306F\u6587\u66F8\u304B\u3089\u524A\u9664\u3055\u308C\u307E\u3057\u305F"
71562
+ removedFromDoc: "\u3053\u306E\u6CE8\u91C8\u306F\u6587\u66F8\u304B\u3089\u524A\u9664\u3055\u308C\u307E\u3057\u305F",
71563
+ noResolvedComment: "\u89E3\u6C7A\u6E08\u307F\u306E\u6CE8\u91C8\u306F\u3042\u308A\u307E\u305B\u3093"
71442
71564
  }
71443
71565
  };
71444
71566
  i18n$1.mergeLang({
@@ -71597,6 +71719,19 @@ ${codeText}
71597
71719
  method: "delete"
71598
71720
  });
71599
71721
  }
71722
+ function updateCommentResolverToOldDoc(editor, version, commentId, resolver) {
71723
+ var _a, _b;
71724
+ const doc2 = editor.doc;
71725
+ const server = (_b = (_a = doc2.getServerMeta) == null ? void 0 : _a.call(doc2)) == null ? void 0 : _b.apiServer;
71726
+ assert(logger$16, server, "apiServer is not set");
71727
+ const api = `${server}/${version}/comments/${commentId}/resolver`;
71728
+ return doc2.request(api, {
71729
+ method: "put",
71730
+ data: {
71731
+ resolver
71732
+ }
71733
+ });
71734
+ }
71600
71735
  getLogger("resolved-comment-item");
71601
71736
  const styles = "";
71602
71737
  const isAllContainersSelected = (editor) => {
@@ -71674,6 +71809,14 @@ ${codeText}
71674
71809
  }
71675
71810
  }
71676
71811
  onUpdateCommentResolver(commentId, local) {
71812
+ const comments = this.editor.getCustom("editor-comments");
71813
+ const provider = comments.commentProvider;
71814
+ const comment = provider.getComment(commentId);
71815
+ if (!comment) {
71816
+ return;
71817
+ }
71818
+ const resolver = comment.resolver;
71819
+ updateCommentResolverToOldDoc(this.editor, this.version, commentId, resolver);
71677
71820
  }
71678
71821
  hideToolbar(editor) {
71679
71822
  const toolbar2 = editor.findCustom("toolbar-handler");
@@ -90813,9 +90956,10 @@ ${data2.plantumlText}
90813
90956
  constructor(editor, localDoc) {
90814
90957
  __publicField(this, "_listeners", /* @__PURE__ */ new Set());
90815
90958
  __publicField(this, "_doc");
90959
+ var _a, _b;
90816
90960
  this.editor = editor;
90817
90961
  this.localDoc = localDoc;
90818
- this._doc = this.localDoc.toJSON();
90962
+ this._doc = ((_b = (_a = this.localDoc).rawData) == null ? void 0 : _b.call(_a)) || this.localDoc.toJSON();
90819
90963
  }
90820
90964
  get doc() {
90821
90965
  return this._doc;
@@ -90873,8 +91017,12 @@ ${data2.plantumlText}
90873
91017
  localUpdateCommentResolver(commentId, resolver) {
90874
91018
  const comment = this.getComment(commentId);
90875
91019
  if (comment) {
90876
- comment.resolver = resolver;
90877
- this.localUpdateComment(comment, this.getCommentDoc(commentId));
91020
+ if (resolver) {
91021
+ comment.resolver = resolver;
91022
+ } else {
91023
+ delete comment.resolver;
91024
+ }
91025
+ Array.from(this._listeners.values()).forEach((listener) => listener.onUpdateCommentResolver(commentId, true));
90878
91026
  }
90879
91027
  }
90880
91028
  createCommentEditor(parent, childDoc) {
@@ -93668,7 +93816,7 @@ ${data2.plantumlText}
93668
93816
  }
93669
93817
  }
93670
93818
  });
93671
- editor.version = "2.8.25-beta.1";
93819
+ editor.version = "2.8.25-beta.11";
93672
93820
  return editor;
93673
93821
  }
93674
93822
  function isDoc(doc2) {
@@ -93781,7 +93929,7 @@ ${data2.plantumlText}
93781
93929
  }
93782
93930
  });
93783
93931
  OnesEditorToolbar.register(editor);
93784
- editor.version = "2.8.25-beta.1";
93932
+ editor.version = "2.8.25-beta.11";
93785
93933
  return editor;
93786
93934
  }
93787
93935
  async function showDocVersions(editor, options, serverUrl) {
@@ -139601,6 +139749,7 @@ ${data2.plantumlText}
139601
139749
  exports2.CheckMarkIcon = CheckMarkIcon;
139602
139750
  exports2.CheckboxIcon = CheckboxIcon;
139603
139751
  exports2.CircleAddIcon = CircleAddIcon;
139752
+ exports2.CircleCheckMarkIcon = CircleCheckMarkIcon;
139604
139753
  exports2.ClearIcon = ClearIcon;
139605
139754
  exports2.ClipboardProvider = ClipboardProvider;
139606
139755
  exports2.CloseIcon = CloseIcon;
@@ -139751,6 +139900,8 @@ ${data2.plantumlText}
139751
139900
  exports2.MoreItem = MoreItem;
139752
139901
  exports2.NextIcon = NextIcon;
139753
139902
  exports2.OnesEditorAutoSuggest = OnesEditorAutoSuggest;
139903
+ exports2.OnesEditorComments = OnesEditorComments;
139904
+ exports2.OnesEditorCommentsRender = OnesEditorCommentsRender;
139754
139905
  exports2.OnesEditorCustomDataWrapper = OnesEditorCustomDataWrapper;
139755
139906
  exports2.OnesEditorExclusiveBlock = OnesEditorExclusiveBlock;
139756
139907
  exports2.OnesEditorHoveringBlock = OnesEditorHoveringBlock;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ones-editor/editor",
3
- "version": "2.8.25-beta.1",
3
+ "version": "2.8.25-beta.11",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "dependencies": {