@ones-editor/editor 2.8.34 → 2.8.36

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.
Files changed (42) hide show
  1. package/@ones-editor/comments/src/comments/comments.d.ts +5 -1
  2. package/@ones-editor/comments/src/comments-helper/active-comment.d.ts +3 -1
  3. package/@ones-editor/comments/src/comments-helper/get-comment-from-selection.d.ts +3 -0
  4. package/@ones-editor/comments/src/comments-helper/get-comments-from-doc.d.ts +5 -1
  5. package/@ones-editor/comments/src/comments-helper/old-version-comment.d.ts +2 -1
  6. package/@ones-editor/comments/src/comments-list/comments-list.d.ts +14 -2
  7. package/@ones-editor/comments/src/comments-list/group-item.d.ts +2 -0
  8. package/@ones-editor/comments/src/comments-list/group-list.d.ts +8 -2
  9. package/@ones-editor/comments/src/comments-list/handler.d.ts +2 -1
  10. package/@ones-editor/comments/src/comments-list/mini-comment/group-list.d.ts +1 -1
  11. package/@ones-editor/comments/src/comments-list/mini-comment/mini-comments-list.d.ts +1 -0
  12. package/@ones-editor/comments/src/comments-list/mobile-comments-list/mobile-comments-list.d.ts +1 -0
  13. package/@ones-editor/comments/src/comments-render/get-block-comments.d.ts +5 -0
  14. package/@ones-editor/comments/src/comments-render/index.d.ts +10 -1
  15. package/@ones-editor/comments/src/constant/index.d.ts +2 -1
  16. package/@ones-editor/comments/src/index.d.ts +1 -0
  17. package/@ones-editor/comments/src/locale/en-us.d.ts +9 -0
  18. package/@ones-editor/comments/src/locale/ja-jp.d.ts +9 -0
  19. package/@ones-editor/comments/src/locale/zh-cn.d.ts +9 -0
  20. package/@ones-editor/comments/src/resolved-comments/index.d.ts +4 -0
  21. package/@ones-editor/comments/src/resolved-comments/resolved-comment-editor.d.ts +14 -0
  22. package/@ones-editor/comments/src/resolved-comments/resolved-comment-list.d.ts +4 -0
  23. package/@ones-editor/comments/src/types.d.ts +7 -1
  24. package/@ones-editor/core/src/core/block-renderers/block-renderers.d.ts +1 -0
  25. package/@ones-editor/core/src/core/composition/editor-input.d.ts +2 -0
  26. package/@ones-editor/core/src/core/doc/doc.d.ts +9 -0
  27. package/@ones-editor/core/src/core/types.d.ts +3 -0
  28. package/@ones-editor/core/src/local-doc/index.d.ts +1 -0
  29. package/@ones-editor/sharedb-doc/src/doc/comments.d.ts +2 -1
  30. package/@ones-editor/sharedb-doc/src/doc/op-parser/parse-handler.d.ts +2 -1
  31. package/@ones-editor/sharedb-doc/src/doc/sharedb-doc.d.ts +3 -1
  32. package/@ones-editor/sharedb-doc/src/types.d.ts +1 -0
  33. package/@ones-editor/tsconfig.tsbuildinfo +1 -1
  34. package/@ones-editor/ui/src/readonly-toolbar/add-comment-to-old-doc.d.ts +1 -0
  35. package/@ones-editor/ui-base/src/icons/index.d.ts +2 -1
  36. package/@ones-editor/versions/src/version-dialog/history-handler.d.ts +1 -0
  37. package/dist/comments/local-doc-comments-provider.d.ts +2 -1
  38. package/dist/comments/sharedb-doc-comments-provider.d.ts +3 -1
  39. package/dist/index.d.ts +2 -0
  40. package/dist/index.js +1000 -155
  41. package/dist/types.d.ts +2 -0
  42. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -4116,6 +4116,7 @@ div.editor-root.readonly div.editor-content div[data-type=editor-container] div[
4116
4116
  .comment-item-root .item-head-tools {
4117
4117
  display: flex;
4118
4118
  align-items: center;
4119
+ justify-content: center;
4119
4120
  visibility: hidden;
4120
4121
  }
4121
4122
  .comment-item-root .item-head-tools .editor-text-button {
@@ -4125,8 +4126,8 @@ div.editor-root.readonly div.editor-content div[data-type=editor-container] div[
4125
4126
  color: #0064ff;
4126
4127
  }
4127
4128
  .comment-item-root .item-head-tools .editor-text-button svg {
4128
- width: 20px;
4129
- height: 20px;
4129
+ width: 16px;
4130
+ height: 16px;
4130
4131
  }
4131
4132
  .comment-item-root .item-head-tools.active {
4132
4133
  visibility: visible;
@@ -4319,6 +4320,36 @@ div.editor-root.readonly div.editor-content div[data-type=editor-container] div[
4319
4320
  will-change: width;
4320
4321
  font-family: var(--editor-font-family);
4321
4322
  }
4323
+ .editor-web-comment-root.disable-resolve .comment-groups-container .item-head-switch .editor-text-button[data-button-id=resolve] {
4324
+ display: none;
4325
+ }
4326
+ .editor-web-comment-root.disable-resolve .comment-groups-container .comment-actions button.comment-reopen {
4327
+ display: none;
4328
+ }
4329
+ .editor-web-comment-root .comment-groups-container .no-comment-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
+ }
4338
+ .editor-web-comment-root[list-type=resolved] .comment-groups-container {
4339
+ display: flex;
4340
+ flex-direction: column;
4341
+ padding-left: 8px;
4342
+ padding-top: 60px;
4343
+ }
4344
+ .editor-web-comment-root[list-type=resolved] .comment-groups-container .comment-group-item-root {
4345
+ margin-bottom: 20px;
4346
+ position: inherit;
4347
+ transform: none;
4348
+ }
4349
+ .editor-web-comment-root[list-type=resolved] .comment-groups-container .comment-group-item-root::before {
4350
+ left: 8px;
4351
+ right: 8px;
4352
+ }
4322
4353
  .editor-web-comment-root .comment-groups-container .comment-group-item-root {
4323
4354
  position: absolute;
4324
4355
  left: 50%;
@@ -4332,8 +4363,17 @@ div.editor-root.readonly div.editor-content div[data-type=editor-container] div[
4332
4363
  box-shadow: var(--editor-box-shadow);
4333
4364
  padding-bottom: 10px;
4334
4365
  }
4366
+ .editor-web-comment-root .comment-groups-container .comment-group-item-root.resolved .comment-item-head .item-head-switch {
4367
+ display: none;
4368
+ }
4369
+ .editor-web-comment-root .comment-groups-container .comment-group-item-root.resolved .item-head-tools {
4370
+ display: none;
4371
+ }
4372
+ .editor-web-comment-root .comment-groups-container .comment-group-item-root.resolved .comment-quick-reply {
4373
+ display: none;
4374
+ }
4335
4375
  .editor-web-comment-root .comment-groups-container .comment-group-item-root:not(.no-animation) {
4336
- transition: top 0.2s ease-in, opacity 0.35s ease-in;
4376
+ transition: top 0.2s ease-in, opacity 0.2s ease-in;
4337
4377
  }
4338
4378
  .editor-web-comment-root .comment-groups-container .comment-group-item-root::before {
4339
4379
  content: "";
@@ -4380,16 +4420,23 @@ div.editor-root.readonly div.editor-content div[data-type=editor-container] div[
4380
4420
  display: flex;
4381
4421
  align-items: center;
4382
4422
  height: 22px;
4383
- visibility: hidden;
4384
4423
  }
4385
4424
  .editor-web-comment-root .comment-groups-container .comment-group-item-root .comment-item-head .item-head-switch .editor-text-button {
4386
4425
  padding: 0;
4387
4426
  width: var(--editor-comment-switch-button-width);
4388
- margin: 3px 0;
4427
+ margin-right: 5px;
4389
4428
  color: #606060;
4429
+ width: 16px;
4430
+ height: 16px;
4390
4431
  }
4391
4432
  .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] {
4392
- margin-right: 16px;
4433
+ visibility: hidden;
4434
+ }
4435
+ .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] {
4436
+ visibility: hidden;
4437
+ }
4438
+ .editor-web-comment-root .comment-groups-container .comment-group-item-root .comment-item-head .item-head-switch .editor-text-button[data-button-id=resolve] {
4439
+ margin-right: 0;
4393
4440
  }
4394
4441
  .editor-web-comment-root .comment-groups-container .comment-group-item-root .comment-item-head .item-head-switch .editor-text-button:not(.disabled):hover {
4395
4442
  color: var(--text-button-color-hover);
@@ -4398,15 +4445,70 @@ div.editor-root.readonly div.editor-content div[data-type=editor-container] div[
4398
4445
  color: rgba(96, 96, 96, 0.5019607843);
4399
4446
  cursor: not-allowed;
4400
4447
  }
4448
+ .editor-web-comment-root .comment-groups-container .comment-group-item-root .comment-item-footer {
4449
+ font-size: 12px;
4450
+ line-height: 20px;
4451
+ color: #87888A;
4452
+ margin-top: 10px;
4453
+ }
4454
+ .editor-web-comment-root .comment-groups-container .comment-group-item-root .comment-item-footer .comment-resolved {
4455
+ font-size: 12px;
4456
+ color: #87888a;
4457
+ flex-grow: 1;
4458
+ display: flex;
4459
+ white-space: nowrap;
4460
+ }
4461
+ .editor-web-comment-root .comment-groups-container .comment-group-item-root .comment-item-footer .comment-resolved .resolver-name {
4462
+ flex-shrink: 1;
4463
+ white-space: nowrap;
4464
+ overflow: hidden;
4465
+ text-overflow: ellipsis;
4466
+ }
4467
+ .editor-web-comment-root .comment-groups-container .comment-group-item-root .comment-item-footer .comment-actions {
4468
+ display: flex;
4469
+ align-items: center;
4470
+ }
4471
+ .editor-web-comment-root .comment-groups-container .comment-group-item-root .comment-item-footer .comment-actions .comment-date {
4472
+ flex: 1;
4473
+ white-space: nowrap;
4474
+ }
4475
+ .editor-web-comment-root .comment-groups-container .comment-group-item-root .comment-item-footer .comment-actions .removed-tips {
4476
+ color: #87888A;
4477
+ white-space: nowrap;
4478
+ text-overflow: ellipsis;
4479
+ overflow: hidden;
4480
+ margin-left: 10px;
4481
+ }
4482
+ .editor-web-comment-root .comment-groups-container .comment-group-item-root .comment-item-footer .comment-actions .comment-reopen {
4483
+ background: none;
4484
+ border: none;
4485
+ cursor: pointer;
4486
+ color: #575859;
4487
+ font-size: 12px;
4488
+ }
4489
+ .editor-web-comment-root .comment-groups-container .comment-group-item-root .comment-item-footer .comment-actions .comment-reopen:hover {
4490
+ color: #0064FF;
4491
+ }
4401
4492
  .editor-web-comment-root .comment-groups-container .comment-group-item-root.active::before {
4402
4493
  background-color: #f59300;
4403
4494
  }
4404
- .editor-web-comment-root .comment-groups-container .comment-group-item-root.active .item-head-switch {
4495
+ .editor-web-comment-root .comment-groups-container .comment-group-item-root.active .item-head-switch .editor-text-button[data-button-id=switch-up] {
4496
+ visibility: visible;
4497
+ }
4498
+ .editor-web-comment-root .comment-groups-container .comment-group-item-root.active .item-head-switch .editor-text-button[data-button-id=switch-down] {
4405
4499
  visibility: visible;
4406
4500
  }
4407
4501
  .editor-web-comment-root .comment-groups-container .comment-group-item-root.readonly .comment-quick-reply .quick-reply-button.invisible {
4408
4502
  display: none;
4409
4503
  }
4504
+ .editor-web-comment-root .comment-switcher-container {
4505
+ position: absolute;
4506
+ z-index: 1;
4507
+ top: 0;
4508
+ left: 0;
4509
+ right: 0;
4510
+ font-size: 14px;
4511
+ }
4410
4512
  .editor-mobile-comments-root {
4411
4513
  position: fixed;
4412
4514
  left: 0;
@@ -4508,6 +4610,108 @@ div.editor-root.readonly div.editor-content div[data-type=editor-container] div[
4508
4610
  }
4509
4611
  :is(.editor-web-comment-root, .editor-mobile-comments-root, .editor-mini-comment-root).hidden {
4510
4612
  display: none;
4613
+ }
4614
+ .editor-root .editor-content [data-type=editor-container][comment-list-type=resolved] div[data-type=editor-block].text-block.comment > div[data-type=block-content] > span {
4615
+ border-bottom-color: transparent;
4616
+ }
4617
+ .editor-root .editor-content [data-type=editor-container][comment-list-type=resolved] div[data-type=editor-block] span.text.comment,
4618
+ .editor-root .editor-content [data-type=editor-container][comment-list-type=resolved] div[data-type=editor-block] span[data-type=editor-box].comment {
4619
+ border-bottom-color: transparent;
4620
+ }
4621
+ .editor-root .editor-content [data-type=editor-container][comment-list-type=resolved] div[data-type=editor-block] span.text.comment.active,
4622
+ .editor-root .editor-content [data-type=editor-container][comment-list-type=resolved] div[data-type=editor-block] span[data-type=editor-box].comment.active {
4623
+ background-color: transparent;
4624
+ }
4625
+ .editor-root .editor-content [data-type=editor-container][comment-list-type=resolved] div[data-type=editor-block].comment::after {
4626
+ background-color: transparent;
4627
+ }
4628
+ .editor-root .editor-content [data-type=editor-container][comment-list-type=resolved] div[data-type=editor-block].comment.active {
4629
+ outline: none;
4630
+ }.resolved-comment-list .resolved-comment-group-item-root {
4631
+ padding: 10px 20px;
4632
+ border-bottom: 1px solid #f0f0f0;
4633
+ margin-right: 10px;
4634
+ }
4635
+ .resolved-comment-list .resolved-comment-group-item-root .comment-group-head {
4636
+ margin-bottom: 5px;
4637
+ }
4638
+ .resolved-comment-list .resolved-comment-group-item-root .comment-group-head span {
4639
+ padding: 0 5px;
4640
+ display: inline-block;
4641
+ line-height: 2;
4642
+ background-color: #FFF0D9;
4643
+ }
4644
+ .resolved-comment-list .resolved-comment-group-item-root .comment-children-container,
4645
+ .resolved-comment-list .resolved-comment-group-item-root .comment-container {
4646
+ padding-left: 10px;
4647
+ }
4648
+ .resolved-comment-list .resolved-comment-group-item-root .comment-children-container .resolved-comment-item-root,
4649
+ .resolved-comment-list .resolved-comment-group-item-root .comment-container .resolved-comment-item-root {
4650
+ position: relative;
4651
+ }
4652
+ .resolved-comment-list .resolved-comment-group-item-root .comment-children-container .resolved-comment-item-root:not(.no-children)::before,
4653
+ .resolved-comment-list .resolved-comment-group-item-root .comment-container .resolved-comment-item-root:not(.no-children)::before {
4654
+ content: " ";
4655
+ display: block;
4656
+ position: absolute;
4657
+ left: 10px;
4658
+ width: 1px;
4659
+ background-color: #DFE1E5;
4660
+ overflow: hidden;
4661
+ opacity: 0.8;
4662
+ top: 21px;
4663
+ bottom: -12px;
4664
+ transform: scaleX(0.5);
4665
+ }
4666
+ .resolved-comment-list .resolved-comment-group-item-root .comment-children-container .resolved-comment-item-root .comment-head,
4667
+ .resolved-comment-list .resolved-comment-group-item-root .comment-container .resolved-comment-item-root .comment-head {
4668
+ padding: 0;
4669
+ position: relative;
4670
+ display: flex;
4671
+ align-items: center;
4672
+ }
4673
+ .resolved-comment-list .resolved-comment-group-item-root .comment-children-container .resolved-comment-item-root .comment-head .comment-avatar,
4674
+ .resolved-comment-list .resolved-comment-group-item-root .comment-container .resolved-comment-item-root .comment-head .comment-avatar {
4675
+ margin-right: 5px;
4676
+ width: var(--editor-comment-avatar-width, 22px);
4677
+ height: var(--editor-comment-avatar-width, 22px);
4678
+ border-radius: 100%;
4679
+ }
4680
+ .resolved-comment-list .resolved-comment-group-item-root .comment-children-container .resolved-comment-item-root .comment-head .comment-username,
4681
+ .resolved-comment-list .resolved-comment-group-item-root .comment-container .resolved-comment-item-root .comment-head .comment-username {
4682
+ font-size: var(--editor-comment-username-font-size, 12px);
4683
+ color: #2d2d2e;
4684
+ overflow: hidden;
4685
+ text-overflow: ellipsis;
4686
+ white-space: nowrap;
4687
+ }
4688
+ .resolved-comment-list .resolved-comment-group-item-root .comment-children-container .resolved-comment-item-root .comment-head .comment-modified,
4689
+ .resolved-comment-list .resolved-comment-group-item-root .comment-container .resolved-comment-item-root .comment-head .comment-modified {
4690
+ margin-left: 10px;
4691
+ font-size: 12px;
4692
+ color: #87888a;
4693
+ flex-grow: 1;
4694
+ white-space: nowrap;
4695
+ }
4696
+ .resolved-comment-list .resolved-comment-group-item-root .comment-children-container .resolved-comment-item-root .comment-editor,
4697
+ .resolved-comment-list .resolved-comment-group-item-root .comment-container .resolved-comment-item-root .comment-editor {
4698
+ border: none;
4699
+ padding-top: 0;
4700
+ margin-top: 0;
4701
+ padding-left: 10px;
4702
+ margin-left: 0;
4703
+ }
4704
+ .resolved-comment-list .resolved-comment-group-item-root .comment-children-container .resolved-comment-item-root:last-child::before {
4705
+ display: none;
4706
+ }
4707
+ .resolved-comment-list .resolved-comment-group-item-root .comment-item-footer .comment-resolved {
4708
+ margin-left: 10px;
4709
+ font-size: 12px;
4710
+ color: #87888a;
4711
+ flex-grow: 1;
4712
+ white-space: nowrap;
4713
+ overflow: hidden;
4714
+ text-overflow: ellipsis;
4511
4715
  }div[data-type=editor-block].table-block {
4512
4716
  --table-bar-width: 6px;
4513
4717
  --table-bar-left: -6px;
@@ -9228,22 +9432,22 @@ var __publicField = (obj, key, value) => {
9228
9432
  function toFloat(value) {
9229
9433
  return parseFloat(value) || 0;
9230
9434
  }
9231
- function getBordersSize(styles) {
9435
+ function getBordersSize(styles2) {
9232
9436
  var positions = [];
9233
9437
  for (var _i = 1; _i < arguments.length; _i++) {
9234
9438
  positions[_i - 1] = arguments[_i];
9235
9439
  }
9236
9440
  return positions.reduce(function(size, position) {
9237
- var value = styles["border-" + position + "-width"];
9441
+ var value = styles2["border-" + position + "-width"];
9238
9442
  return size + toFloat(value);
9239
9443
  }, 0);
9240
9444
  }
9241
- function getPaddings(styles) {
9445
+ function getPaddings(styles2) {
9242
9446
  var positions = ["top", "right", "bottom", "left"];
9243
9447
  var paddings = {};
9244
9448
  for (var _i = 0, positions_1 = positions; _i < positions_1.length; _i++) {
9245
9449
  var position = positions_1[_i];
9246
- var value = styles["padding-" + position];
9450
+ var value = styles2["padding-" + position];
9247
9451
  paddings[position] = toFloat(value);
9248
9452
  }
9249
9453
  return paddings;
@@ -9257,17 +9461,17 @@ var __publicField = (obj, key, value) => {
9257
9461
  if (!clientWidth && !clientHeight) {
9258
9462
  return emptyRect;
9259
9463
  }
9260
- var styles = getWindowOf(target).getComputedStyle(target);
9261
- var paddings = getPaddings(styles);
9464
+ var styles2 = getWindowOf(target).getComputedStyle(target);
9465
+ var paddings = getPaddings(styles2);
9262
9466
  var horizPad = paddings.left + paddings.right;
9263
9467
  var vertPad = paddings.top + paddings.bottom;
9264
- var width = toFloat(styles.width), height = toFloat(styles.height);
9265
- if (styles.boxSizing === "border-box") {
9468
+ var width = toFloat(styles2.width), height = toFloat(styles2.height);
9469
+ if (styles2.boxSizing === "border-box") {
9266
9470
  if (Math.round(width + horizPad) !== clientWidth) {
9267
- width -= getBordersSize(styles, "left", "right") + horizPad;
9471
+ width -= getBordersSize(styles2, "left", "right") + horizPad;
9268
9472
  }
9269
9473
  if (Math.round(height + vertPad) !== clientHeight) {
9270
- height -= getBordersSize(styles, "top", "bottom") + vertPad;
9474
+ height -= getBordersSize(styles2, "top", "bottom") + vertPad;
9271
9475
  }
9272
9476
  }
9273
9477
  if (!isDocumentElement(target)) {
@@ -9922,8 +10126,8 @@ var __publicField = (obj, key, value) => {
9922
10126
  el.setAttribute(key, value);
9923
10127
  });
9924
10128
  }
9925
- function setStyles(el, styles) {
9926
- Object.entries(styles).forEach(([key, value]) => {
10129
+ function setStyles(el, styles2) {
10130
+ Object.entries(styles2).forEach(([key, value]) => {
9927
10131
  el.style.setProperty(key, value);
9928
10132
  });
9929
10133
  }
@@ -12343,12 +12547,12 @@ var __publicField = (obj, key, value) => {
12343
12547
  return blockClass.getBlockStyles(editor, block);
12344
12548
  }
12345
12549
  const data2 = editor.getBlockData(block);
12346
- const styles = Object.fromEntries(Object.entries(data2).filter(([key]) => key.startsWith("style-")));
12347
- Object.entries(styles).forEach(([, value]) => {
12550
+ const styles2 = Object.fromEntries(Object.entries(data2).filter(([key]) => key.startsWith("style-")));
12551
+ Object.entries(styles2).forEach(([, value]) => {
12348
12552
  const type = typeof value;
12349
12553
  assert(logger$4C, type === "string" || type === "number" || type === "boolean", "invalid style value");
12350
12554
  });
12351
- return styles;
12555
+ return styles2;
12352
12556
  }
12353
12557
  function getContainerWidth(container, options) {
12354
12558
  const ret = container.getBoundingClientRect().width;
@@ -24937,7 +25141,7 @@ var __publicField = (obj, key, value) => {
24937
25141
  if (attributes) {
24938
25142
  let string = op.insert;
24939
25143
  const tags = [];
24940
- let styles = "";
25144
+ let styles2 = "";
24941
25145
  if (attributes["style-bold"]) {
24942
25146
  tags.push("strong");
24943
25147
  }
@@ -24955,25 +25159,25 @@ var __publicField = (obj, key, value) => {
24955
25159
  }
24956
25160
  const fontBgColor = Object.keys(attributes).find((k) => k.startsWith("style-bg-color-"));
24957
25161
  if (fontBgColor) {
24958
- styles += `background-color: ${styleBackgroundColorToHighlight$1(fontBgColor)};`;
25162
+ styles2 += `background-color: ${styleBackgroundColorToHighlight$1(fontBgColor)};`;
24959
25163
  }
24960
25164
  const fontColor = Object.keys(attributes).find((k) => k.startsWith("style-color-"));
24961
25165
  if (fontColor) {
24962
- styles += `color: ${styleColorToColor$1(fontColor)};`;
25166
+ styles2 += `color: ${styleColorToColor$1(fontColor)};`;
24963
25167
  }
24964
25168
  if (attributes.link) {
24965
25169
  string = `<a href="${attributes.link}">${string}</a>`;
24966
25170
  }
24967
25171
  let prefix = tags.map((s) => `<${s}>`).join("");
24968
25172
  let suffix = tags.reverse().map((s) => `</${s}>`).join("");
24969
- if (styles) {
25173
+ if (styles2) {
24970
25174
  if (attributes.link) {
24971
- string = `<a href="${attributes.link}" style="${styles}">${op.insert}</a>`;
25175
+ string = `<a href="${attributes.link}" style="${styles2}">${op.insert}</a>`;
24972
25176
  } else {
24973
25177
  if (prefix) {
24974
- prefix = prefix.replace(">", ` style="${styles}">`);
25178
+ prefix = prefix.replace(">", ` style="${styles2}">`);
24975
25179
  } else {
24976
- prefix = `<span style="${styles}">`;
25180
+ prefix = `<span style="${styles2}">`;
24977
25181
  suffix = "</span>";
24978
25182
  }
24979
25183
  }
@@ -25416,6 +25620,9 @@ var __publicField = (obj, key, value) => {
25416
25620
  __publicField(this, "renders", []);
25417
25621
  this.editor = editor;
25418
25622
  }
25623
+ getRenderers() {
25624
+ return this.renders;
25625
+ }
25419
25626
  registerRender(render) {
25420
25627
  this.renders.push(render);
25421
25628
  }
@@ -25653,8 +25860,8 @@ var __publicField = (obj, key, value) => {
25653
25860
  renderBlock(editor, path, blockData) {
25654
25861
  var _a, _b;
25655
25862
  const attributes = {};
25656
- const styles = Object.entries(blockData).filter((k) => k[0].startsWith("style-"));
25657
- styles.forEach(([key, value]) => {
25863
+ const styles2 = Object.entries(blockData).filter((k) => k[0].startsWith("style-"));
25864
+ styles2.forEach(([key, value]) => {
25658
25865
  attributes[`data-${key}`] = `${value}`;
25659
25866
  });
25660
25867
  const classes = [];
@@ -25861,6 +26068,7 @@ var __publicField = (obj, key, value) => {
25861
26068
  constructor(editor, callbacks) {
25862
26069
  __publicField(this, "editor");
25863
26070
  __publicField(this, "composing", false);
26071
+ __publicField(this, "composingTimer");
25864
26072
  __publicField(this, "callbacks");
25865
26073
  __publicField(this, "inputElement");
25866
26074
  __publicField(this, "handleBlur", () => {
@@ -25920,12 +26128,13 @@ var __publicField = (obj, key, value) => {
25920
26128
  if (!this.editor.isWritable()) {
25921
26129
  return;
25922
26130
  }
26131
+ clearTimeout(this.composingTimer);
25923
26132
  this.composing = true;
25924
26133
  this.callbacks.onCompositionStart(event);
25925
26134
  });
25926
26135
  __publicField(this, "handleCompositionend", (event) => {
25927
26136
  if (isSafari()) {
25928
- setTimeout(() => {
26137
+ this.composingTimer = setTimeout(() => {
25929
26138
  this.composing = false;
25930
26139
  }, 100);
25931
26140
  } else {
@@ -31625,7 +31834,7 @@ ${codeText}
31625
31834
  const logger$38 = getLogger("editor");
31626
31835
  class Editor extends tinyTypedEmitter.TypedEmitter {
31627
31836
  constructor(parent, doc2, optionalOptions) {
31628
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
31837
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
31629
31838
  super();
31630
31839
  __publicField(this, "parent");
31631
31840
  __publicField(this, "rootElement");
@@ -31671,12 +31880,13 @@ ${codeText}
31671
31880
  componentsOptions: (_c = (_b = optionalOptions == null ? void 0 : optionalOptions.components) == null ? void 0 : _b.options) != null ? _c : {},
31672
31881
  scrollContainer: optionalOptions == null ? void 0 : optionalOptions.scrollContainer,
31673
31882
  enableComments: (_d = optionalOptions == null ? void 0 : optionalOptions.enableComments) != null ? _d : true,
31674
- enableContextMenu: (_e = optionalOptions == null ? void 0 : optionalOptions.enableContextMenu) != null ? _e : true
31883
+ enableResolveComments: (_e = optionalOptions == null ? void 0 : optionalOptions.enableResolveComments) != null ? _e : true,
31884
+ enableContextMenu: (_f = optionalOptions == null ? void 0 : optionalOptions.enableContextMenu) != null ? _f : true
31675
31885
  };
31676
- this.settingsProvider = (_f = optionalOptions == null ? void 0 : optionalOptions.settingsProvider) != null ? _f : new DefaultSettingsProvider(this);
31886
+ this.settingsProvider = (_g = optionalOptions == null ? void 0 : optionalOptions.settingsProvider) != null ? _g : new DefaultSettingsProvider(this);
31677
31887
  registerComponents(this, optionalOptions == null ? void 0 : optionalOptions.components);
31678
- this.blockHooks.push(...(_h = (_g = optionalOptions == null ? void 0 : optionalOptions.components) == null ? void 0 : _g.blockHooks) != null ? _h : []);
31679
- this.id = (_i = optionalOptions == null ? void 0 : optionalOptions.id) != null ? _i : genId();
31888
+ this.blockHooks.push(...(_i = (_h = optionalOptions == null ? void 0 : optionalOptions.components) == null ? void 0 : _h.blockHooks) != null ? _i : []);
31889
+ this.id = (_j = optionalOptions == null ? void 0 : optionalOptions.id) != null ? _j : genId();
31680
31890
  this.clientId = genId();
31681
31891
  this.undoManager = new UndoManager(this);
31682
31892
  this.doc = new EditorDoc(this, doc2, this.undoManager);
@@ -32162,6 +32372,9 @@ ${codeText}
32162
32372
  toJSON() {
32163
32373
  return cloneDeep__default.default(this.doc);
32164
32374
  }
32375
+ rawData() {
32376
+ return this.doc;
32377
+ }
32165
32378
  getContainerBlocks(containerId) {
32166
32379
  const blocks = this.doc.blocks[containerId];
32167
32380
  return blocks;
@@ -38682,6 +38895,12 @@ ${codeText}
38682
38895
  commentId
38683
38896
  });
38684
38897
  }
38898
+ onUpdateCommentResolver(commentId) {
38899
+ this.pushActions({
38900
+ type: "updateCommentResolved",
38901
+ commentId
38902
+ });
38903
+ }
38685
38904
  end() {
38686
38905
  const actions2 = this.actions;
38687
38906
  const deletedBlocks = /* @__PURE__ */ new Set();
@@ -38756,6 +38975,9 @@ ${codeText}
38756
38975
  } else if (action.type === "updateComment") {
38757
38976
  const a = action;
38758
38977
  this.outerHandler.onUpdateComment(a.commentId, this.local);
38978
+ } else if (action.type === "updateCommentResolved") {
38979
+ const a = action;
38980
+ this.outerHandler.onUpdateCommentResolver(a.commentId, this.local);
38759
38981
  }
38760
38982
  });
38761
38983
  Array.from(updatingBlockDataDeltaMap.entries()).forEach(([blockId, objectData]) => {
@@ -38933,7 +39155,14 @@ ${codeText}
38933
39155
  assert(logger$2W, commentId, `invalid comment op, no commentId: ${JSON.stringify(ops)}`);
38934
39156
  assert(logger$2W, actions2, `invalid comment op, no actions: ${JSON.stringify(ops)}`);
38935
39157
  if (typeof actions2 === "string") {
38936
- logger$2W.error(`unknown comment op, ${JSON.stringify(ops)}`);
39158
+ const data2 = ops[3];
39159
+ if (actions2 === "resolver" && typeof data2 === "object") {
39160
+ if (parseType === "upsert") {
39161
+ handler.onUpdateCommentResolver(commentId);
39162
+ }
39163
+ } else {
39164
+ logger$2W.error(`unknown comment op, ${JSON.stringify(ops)}`);
39165
+ }
38937
39166
  } else {
38938
39167
  if (actions2.i && actions2.r) {
38939
39168
  if (parseType === "upsert") {
@@ -39043,7 +39272,8 @@ ${codeText}
39043
39272
  avatarUrl,
39044
39273
  abstract,
39045
39274
  created,
39046
- modified
39275
+ modified,
39276
+ resolver: resolved
39047
39277
  } = shareDBComment;
39048
39278
  return {
39049
39279
  id,
@@ -39053,7 +39283,8 @@ ${codeText}
39053
39283
  avatarUrl,
39054
39284
  abstract,
39055
39285
  created,
39056
- modified
39286
+ modified,
39287
+ resolver: resolved
39057
39288
  };
39058
39289
  }
39059
39290
  function commentToShareDbComment(comment, doc2) {
@@ -39525,6 +39756,21 @@ ${codeText}
39525
39756
  const op = ["comments", comment.id, { r: true, i: shareDBComment }];
39526
39757
  return this.submitOp(op);
39527
39758
  }
39759
+ localUpdateCommentResolver(commentId, resolver) {
39760
+ const oldComment = this.getComment(commentId);
39761
+ const oldResolved = oldComment.resolver;
39762
+ const op = ["comments", commentId, "resolver", {}];
39763
+ if (!oldResolved && !resolver) {
39764
+ return Promise.resolve(true);
39765
+ }
39766
+ if (oldResolved !== void 0) {
39767
+ op[3] = { r: true };
39768
+ }
39769
+ if (resolver) {
39770
+ op[3].i = resolver;
39771
+ }
39772
+ return this.submitOp(op);
39773
+ }
39528
39774
  destroy() {
39529
39775
  var _a;
39530
39776
  this.destroyed = true;
@@ -39601,6 +39847,13 @@ ${codeText}
39601
39847
  return (_a = cb.onUpdateComment) == null ? void 0 : _a.call(cb, commentId, local);
39602
39848
  });
39603
39849
  }
39850
+ onUpdateCommentResolver(commentId, local) {
39851
+ assert(logger$2T, this.callbacks.length > 0, "no callbacks");
39852
+ this.callbacks.forEach((cb) => {
39853
+ var _a;
39854
+ return (_a = cb.onUpdateCommentResolver) == null ? void 0 : _a.call(cb, commentId, local);
39855
+ });
39856
+ }
39604
39857
  onCustomMessage(msg) {
39605
39858
  const message = msg;
39606
39859
  if ((message == null ? void 0 : message.type) === "custom" && (message == null ? void 0 : message.clientId) !== this.client.clientId) {
@@ -40669,6 +40922,7 @@ ${codeText}
40669
40922
  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>';
40670
40923
  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';
40671
40924
  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>';
40925
+ 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';
40672
40926
  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';
40673
40927
  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';
40674
40928
  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';
@@ -40824,6 +41078,7 @@ ${codeText}
40824
41078
  RefreshIcon,
40825
41079
  HelpIcon,
40826
41080
  CheckMarkIcon,
41081
+ CircleCheckMarkIcon,
40827
41082
  TextIcon,
40828
41083
  RightArrowIcon: rightArrow,
40829
41084
  TencentVideoIcon,
@@ -50633,7 +50888,7 @@ ${codeText}
50633
50888
  });
50634
50889
  return !!ret;
50635
50890
  }
50636
- function addBlockClasses(from, to, styles) {
50891
+ function addBlockClasses(from, to, styles2) {
50637
50892
  const container = getParentContainer(from);
50638
50893
  if (to) {
50639
50894
  const container2 = getParentContainer(to);
@@ -50644,18 +50899,18 @@ ${codeText}
50644
50899
  const toIndex = getBlockIndex(to);
50645
50900
  assert(logger$24, fromIndex <= toIndex, "invalid block index");
50646
50901
  }
50647
- addClass(from, ...styles);
50902
+ addClass(from, ...styles2);
50648
50903
  if (!to || to === from) {
50649
50904
  return;
50650
50905
  }
50651
50906
  let next2 = getNextBlock(from);
50652
50907
  while (next2 !== to) {
50653
50908
  assert(logger$24, next2, "no next button");
50654
- addClass(next2, ...styles);
50909
+ addClass(next2, ...styles2);
50655
50910
  next2 = getNextBlock(next2);
50656
50911
  }
50657
50912
  if (next2) {
50658
- addClass(next2, ...styles);
50913
+ addClass(next2, ...styles2);
50659
50914
  }
50660
50915
  }
50661
50916
  async function requestMindmapFullscreen(editor, block, mindmapTools) {
@@ -51643,7 +51898,7 @@ ${codeText}
51643
51898
  html = `<input type="checkbox" disabled="disabled" /> ${html}`;
51644
51899
  }
51645
51900
  let listTag = "ul";
51646
- let styles = "";
51901
+ let styles2 = "";
51647
51902
  if (list2.ordered) {
51648
51903
  html = `<li value="${list2.start}">${html}</li>`;
51649
51904
  listTag = "ol";
@@ -51651,18 +51906,18 @@ ${codeText}
51651
51906
  case 2:
51652
51907
  case 5:
51653
51908
  case 8:
51654
- styles = "list-style-type: lower-alpha;";
51909
+ styles2 = "list-style-type: lower-alpha;";
51655
51910
  break;
51656
51911
  case 3:
51657
51912
  case 6:
51658
- styles = "list-style-type: lower-roman;";
51913
+ styles2 = "list-style-type: lower-roman;";
51659
51914
  break;
51660
51915
  }
51661
51916
  } else {
51662
51917
  html = `<li>${html}</li>`;
51663
51918
  }
51664
51919
  if (isFirstListItem(editor, blockData, doc2, path)) {
51665
- html = `<${listTag}${styles ? ` style="${styles}"` : ""}>${html}`;
51920
+ html = `<${listTag}${styles2 ? ` style="${styles2}"` : ""}>${html}`;
51666
51921
  }
51667
51922
  if (isLastListItem(editor, blockData, doc2, path)) {
51668
51923
  html = `${html}</${listTag}>`;
@@ -62591,13 +62846,13 @@ $$${mathData.mathjaxText}$$
62591
62846
  if (!op.attributes) {
62592
62847
  return /* @__PURE__ */ new Map();
62593
62848
  }
62594
- const styles = Object.entries(op.attributes).filter(([key]) => {
62849
+ const styles2 = Object.entries(op.attributes).filter(([key]) => {
62595
62850
  if (key.startsWith("style-")) {
62596
62851
  return true;
62597
62852
  }
62598
62853
  return false;
62599
62854
  });
62600
- return new Map(styles);
62855
+ return new Map(styles2);
62601
62856
  };
62602
62857
  if (text2.length === 0) {
62603
62858
  return /* @__PURE__ */ new Map();
@@ -62641,11 +62896,11 @@ $$${mathData.mathjaxText}$$
62641
62896
  if (getTextLength(text2) === 0) {
62642
62897
  return textStyles;
62643
62898
  }
62644
- let styles = getIntersectionStyles(text2);
62645
- styles = mergeActiveStyle(editor, styles);
62899
+ let styles2 = getIntersectionStyles(text2);
62900
+ styles2 = mergeActiveStyle(editor, styles2);
62646
62901
  function getTextStyle(item) {
62647
62902
  const { id, icon, desc, name } = item;
62648
- const value = styles.get(id);
62903
+ const value = styles2.get(id);
62649
62904
  if (value !== void 0) {
62650
62905
  return {
62651
62906
  id,
@@ -63241,6 +63496,7 @@ $$${mathData.mathjaxText}$$
63241
63496
  GroupItemActions2["QuickReply"] = "quick-reply";
63242
63497
  GroupItemActions2["QuickReplyOk"] = "quick-reply-ok";
63243
63498
  GroupItemActions2["QuickReplyCancel"] = "quick-reply-cancel";
63499
+ GroupItemActions2["Resolve"] = "resolve";
63244
63500
  return GroupItemActions2;
63245
63501
  })(GroupItemActions || {});
63246
63502
  const GROUP_ITEM_ACTION_MARK = "group-item-action";
@@ -63288,7 +63544,7 @@ $$${mathData.mathjaxText}$$
63288
63544
  return attributes.filter((attribute) => attribute.startsWith("comment-")).map((attribute) => attribute.replace("comment-", ""));
63289
63545
  }
63290
63546
  const logger$1G = getLogger("doc-comments");
63291
- function addBlockComments(doc2, block, result, resultSet) {
63547
+ function addBlockComments$1(doc2, block, result, resultSet) {
63292
63548
  if (block.comments) {
63293
63549
  const blockComments = block.comments;
63294
63550
  if (Array.isArray(blockComments)) {
@@ -63324,7 +63580,7 @@ $$${mathData.mathjaxText}$$
63324
63580
  children.forEach((childContainerId) => {
63325
63581
  const childBlocks = doc2.blocks[childContainerId];
63326
63582
  childBlocks.forEach((subBlock) => {
63327
- addBlockComments(doc2, subBlock, result, resultSet);
63583
+ addBlockComments$1(doc2, subBlock, result, resultSet);
63328
63584
  });
63329
63585
  });
63330
63586
  }
@@ -63332,7 +63588,7 @@ $$${mathData.mathjaxText}$$
63332
63588
  const result = [];
63333
63589
  const resultSet = /* @__PURE__ */ new Set();
63334
63590
  doc2.blocks.root.forEach((block) => {
63335
- addBlockComments(doc2, block, result, resultSet);
63591
+ addBlockComments$1(doc2, block, result, resultSet);
63336
63592
  });
63337
63593
  const resultMap = /* @__PURE__ */ new Map();
63338
63594
  result.forEach((commentId, index2) => resultMap.set(commentId, index2));
@@ -63388,6 +63644,26 @@ $$${mathData.mathjaxText}$$
63388
63644
  });
63389
63645
  return result;
63390
63646
  }
63647
+ function getUnresolvedCommentsGroupFromDoc(editor, commentsProvider) {
63648
+ return getCommentsGroupFromDoc(editor, commentsProvider).filter((group) => !group.resolver);
63649
+ }
63650
+ function getResolvedCommentsGroupFromDoc(editor, commentsProvider) {
63651
+ const doc2 = editor.doc.toJSON();
63652
+ const commentsMap = getCommentsFromDoc(doc2);
63653
+ const commentGroup = getCommentsGroup(commentsProvider.getComments());
63654
+ const result = commentGroup.filter((group) => group.resolver).sort((group1, group2) => {
63655
+ var _a, _b, _c, _d;
63656
+ const date1 = (_b = (_a = group1.resolver) == null ? void 0 : _a.date) != null ? _b : 0;
63657
+ const date2 = (_d = (_c = group2.resolver) == null ? void 0 : _c.date) != null ? _d : 0;
63658
+ return date2 - date1;
63659
+ });
63660
+ result.forEach((group) => {
63661
+ if (!commentsMap.has(group.groupId)) {
63662
+ group.removedFromDoc = true;
63663
+ }
63664
+ });
63665
+ return result;
63666
+ }
63391
63667
  function flattenCommentGroup(comment) {
63392
63668
  const { children, ...raw } = comment;
63393
63669
  const comments = [raw];
@@ -63397,9 +63673,12 @@ $$${mathData.mathjaxText}$$
63397
63673
  return comments;
63398
63674
  }
63399
63675
  function getCommentsCountInDoc(editor, commentsProvider) {
63400
- const commentGroups = getCommentsGroupFromDoc(editor, commentsProvider);
63401
- const count = commentGroups.length;
63402
- return count;
63676
+ const unresolved = getUnresolvedCommentsGroupFromDoc(editor, commentsProvider).length;
63677
+ const commentsGroup = getCommentsGroup(commentsProvider.getComments());
63678
+ const resolved = commentsGroup.filter((group) => group.resolver).length;
63679
+ const total = unresolved + resolved;
63680
+ logger$1G.debug(`total comments: ${total}, unresolved: ${unresolved}, resolved: ${resolved}`);
63681
+ return total;
63403
63682
  }
63404
63683
  function getCommentsFromPos(editor, pos) {
63405
63684
  const commentIds = [];
@@ -63444,6 +63723,24 @@ $$${mathData.mathjaxText}$$
63444
63723
  const commentIds = intersection__default.default(comments1, comments2);
63445
63724
  return commentIds;
63446
63725
  }
63726
+ function removeUnresolvedComments(commentProvider, commentIds) {
63727
+ return commentIds.filter((commentId) => {
63728
+ const comment = commentProvider.getComment(commentId);
63729
+ if (!comment) {
63730
+ return false;
63731
+ }
63732
+ return !!comment.resolver;
63733
+ });
63734
+ }
63735
+ function removeResolvedComments(commentProvider, commentIds) {
63736
+ return commentIds.filter((commentId) => {
63737
+ const comment = commentProvider.getComment(commentId);
63738
+ if (!comment) {
63739
+ return false;
63740
+ }
63741
+ return !(comment == null ? void 0 : comment.resolver);
63742
+ });
63743
+ }
63447
63744
  const logger$1F = getLogger("active-comments");
63448
63745
  function inactiveComment(editor, commentId) {
63449
63746
  const activeCommentElements = editor.rootContainer.querySelectorAll(`span.comment[comment-${commentId}],[data-type=editor-block].comment[comment-${commentId}]`);
@@ -63499,6 +63796,11 @@ $$${mathData.mathjaxText}$$
63499
63796
  }
63500
63797
  }
63501
63798
  }
63799
+ function getElementsByCommentId(editor, commentId) {
63800
+ const lowerCommentId = commentId.toLocaleLowerCase();
63801
+ const elements = editor.rootContainer.querySelectorAll(`span.comment[comment-${lowerCommentId}],[data-type=editor-block].comment[comment-${lowerCommentId}]`);
63802
+ return Array.from(elements);
63803
+ }
63502
63804
  function isImageBlock(block) {
63503
63805
  return getBlockType(block) === "embed" && getEmbedType(block) === "image";
63504
63806
  }
@@ -69303,8 +69605,9 @@ ${codeText}
69303
69605
  return items;
69304
69606
  }
69305
69607
  reloadList(data2) {
69608
+ this._items.forEach((item) => item.destroy());
69306
69609
  this.container.innerHTML = "";
69307
- this.createList(data2);
69610
+ this._items = this.createList(data2);
69308
69611
  }
69309
69612
  insertItem(data2) {
69310
69613
  const index2 = this.findInsertPos(data2);
@@ -69377,8 +69680,8 @@ ${codeText}
69377
69680
  });
69378
69681
  }
69379
69682
  }
69380
- 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>';
69381
- 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>';
69683
+ 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';
69684
+ 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';
69382
69685
  const index$8 = "";
69383
69686
  const REPLY_EDITOR_EDITING_CLS = "reply-editor-editing";
69384
69687
  const { t: t$3 } = i18n$1;
@@ -69501,6 +69804,9 @@ ${codeText}
69501
69804
  __publicField(this, "quickReply");
69502
69805
  __publicField(this, "createRoot", () => {
69503
69806
  const root2 = createElement("div", ["comment-group-item-root"], null);
69807
+ if (this.comment.resolver) {
69808
+ addClass(root2, "resolved");
69809
+ }
69504
69810
  return root2;
69505
69811
  });
69506
69812
  __publicField(this, "createChildrenList", () => {
@@ -69557,6 +69863,7 @@ ${codeText}
69557
69863
  this.mainItem = this.createItem();
69558
69864
  this.childrenList = this.createChildrenList();
69559
69865
  this.quickReply = this.createQuickReply();
69866
+ this.createFooter();
69560
69867
  this.editor.on("readonlyChanged", this.handleReadonlyChanged);
69561
69868
  this.resizeObserver = new index$g(this.handleResize);
69562
69869
  this.resizeObserver.observe(this.root);
@@ -69566,9 +69873,49 @@ ${codeText}
69566
69873
  const count = getCommentItemCountInGroupItem(this.root);
69567
69874
  return count;
69568
69875
  }
69876
+ createFooter() {
69877
+ if (!this.comment.resolver) {
69878
+ return null;
69879
+ }
69880
+ const footer = createElement("div", ["comment-item-footer"], this.root);
69881
+ const resolved = createElement("span", ["comment-resolved"], footer);
69882
+ const date = new Date(this.comment.modified);
69883
+ const resolver = this.comment.resolver;
69884
+ assert(logger$1h, resolver, "resolver should not be null");
69885
+ const html = i18n$1.t("comment.resolvedBy", { name: resolver.displayName, date: fromNowString(date) });
69886
+ resolved.innerHTML = html;
69887
+ const actions2 = createElement("div", ["comment-actions"], footer);
69888
+ createElement("span", ["comment-date"], actions2, fromNowString(new Date(resolver.date)));
69889
+ if (this.comment.removedFromDoc) {
69890
+ createElement("span", ["removed-tips"], actions2, i18n$1.t("comment.removedFromDoc"));
69891
+ } else {
69892
+ const reopen = createElement("button", ["comment-reopen"], actions2, i18n$1.t("comment.reopen"));
69893
+ reopen.onclick = () => {
69894
+ const editor = this.editor;
69895
+ const doc2 = editor.doc.toJSON();
69896
+ const commentsMap = getCommentsFromDoc(doc2);
69897
+ if (!commentsMap.has(this.comment.groupId)) {
69898
+ showToast(i18n$1.t("comment.commentHasAlreadyRemoved"), {
69899
+ position: {
69900
+ y: 30,
69901
+ x: window.innerWidth / 2
69902
+ },
69903
+ theme: "warn"
69904
+ });
69905
+ return;
69906
+ }
69907
+ this.commentsProvider.localUpdateCommentResolver(this.comment.id, void 0);
69908
+ };
69909
+ }
69910
+ return footer;
69911
+ }
69569
69912
  createQuickReply() {
69570
69913
  const { editor, commentsProvider, comment } = this;
69571
69914
  const commentQuickReply = new CommentQuickReply(editor, commentsProvider, comment, this);
69915
+ const commentOptions = this.editor.getComponentOptions("comment");
69916
+ if (commentOptions == null ? void 0 : commentOptions.disableReply) {
69917
+ commentQuickReply.root.classList.add("hidden");
69918
+ }
69572
69919
  this.root.append(commentQuickReply.root);
69573
69920
  return commentQuickReply;
69574
69921
  }
@@ -69580,8 +69927,15 @@ ${codeText}
69580
69927
  const switchContainer = createElement("span", ["item-head-switch"], head);
69581
69928
  const switchUp = createTextButton(switchContainer, GroupItemActions.SwitchUp, "up", switchUpIcon);
69582
69929
  const switchDown = createTextButton(switchContainer, GroupItemActions.SwitchDown, "down", switchDownIcon);
69930
+ const resolve = createTextButton(switchContainer, GroupItemActions.Resolve, "resolve", CircleCheckMarkIcon);
69583
69931
  addGroupActionToElement(switchUp, GroupItemActions.SwitchUp);
69584
69932
  addGroupActionToElement(switchDown, GroupItemActions.SwitchDown);
69933
+ addGroupActionToElement(resolve, GroupItemActions.Resolve);
69934
+ resolve.setAttribute(`data-editor-tooltip-${this.editor.clientId}`, i18n$1.t("comment.resolveComment"));
69935
+ addClass(resolve, "disable-active");
69936
+ if (comment.resolver) {
69937
+ addClass(resolve, "resolved");
69938
+ }
69585
69939
  return head;
69586
69940
  }
69587
69941
  createItem() {
@@ -69621,6 +69975,7 @@ ${codeText}
69621
69975
  handleUpdateMainComment(comment) {
69622
69976
  assert(logger$1h, comment.id === this.mainItem.comment.id, "invalid comment");
69623
69977
  this.mainItem.reloadDoc();
69978
+ this.setCreatingComment(false);
69624
69979
  }
69625
69980
  deleteMainComment(commentId) {
69626
69981
  assert(logger$1h, commentId === this.mainItem.comment.id, "invalid comment");
@@ -69629,6 +69984,18 @@ ${codeText}
69629
69984
  edit() {
69630
69985
  this.mainItem.edit();
69631
69986
  }
69987
+ setCreatingComment(creating) {
69988
+ const resolveButton = this.header.querySelector('.editor-text-button[group-item-action="resolve"]');
69989
+ if (!resolveButton) {
69990
+ return;
69991
+ }
69992
+ resolveButton.disabled = creating;
69993
+ if (creating) {
69994
+ resolveButton.classList.add("disabled");
69995
+ } else {
69996
+ resolveButton.classList.remove("disabled");
69997
+ }
69998
+ }
69632
69999
  destroy() {
69633
70000
  this.quickReply.destroy();
69634
70001
  this.mainItem.destroy();
@@ -69814,7 +70181,21 @@ ${codeText}
69814
70181
  this.commentsProvider.localDeleteComment(comment.id);
69815
70182
  quickReply.show();
69816
70183
  });
69817
- __publicField(this, "execute", (element, groupItem, commentId, itemIndex) => {
70184
+ __publicField(this, "handleResolve", (groupItem) => {
70185
+ var _a;
70186
+ const { commentsProvider } = this;
70187
+ let comment = commentsProvider.getComment(groupItem.comment.id);
70188
+ if (!comment) {
70189
+ comment = (_a = groupItem.childrenList.items[0]) == null ? void 0 : _a.comment;
70190
+ }
70191
+ const user = this.groupList.editor.doc.getUser();
70192
+ commentsProvider.localUpdateCommentResolver(comment.id, {
70193
+ userId: user.userId,
70194
+ displayName: user.displayName,
70195
+ date: Date.now()
70196
+ });
70197
+ });
70198
+ __publicField(this, "execute", (element, groupItem, commentId, itemIndex, event) => {
69818
70199
  const actionElement = getClosestGroupItemActionElement(element);
69819
70200
  if (!actionElement)
69820
70201
  return;
@@ -69853,6 +70234,11 @@ ${codeText}
69853
70234
  case GroupItemActions.QuickReplyCancel:
69854
70235
  this.handleQuickReplyCancel(groupItem);
69855
70236
  break;
70237
+ case GroupItemActions.Resolve:
70238
+ event.preventDefault();
70239
+ event.stopPropagation();
70240
+ this.handleResolve(groupItem);
70241
+ break;
69856
70242
  default:
69857
70243
  const exhaustiveCheck = actionId;
69858
70244
  logger$1f.debug(`not implement handler for ${exhaustiveCheck}`);
@@ -69866,8 +70252,8 @@ ${codeText}
69866
70252
  }
69867
70253
  const logger$1e = getLogger("comment-group-list");
69868
70254
  class CommentGroupList extends ListBase {
69869
- constructor(editor, commentsProvider, parent) {
69870
- super(editor, commentsProvider, parent, getCommentsGroupFromDoc(editor, commentsProvider), {});
70255
+ constructor(editor, commentsProvider, parent, type) {
70256
+ super(editor, commentsProvider, parent, getUnresolvedCommentsGroupFromDoc(editor, commentsProvider), {});
69871
70257
  __publicField(this, "groupItemHandlers");
69872
70258
  __publicField(this, "dispatchScroll", debounce__default.default(() => {
69873
70259
  this.editor.scrollContainer.dispatchEvent(new Event("scroll"));
@@ -69905,7 +70291,9 @@ ${codeText}
69905
70291
  const commentId = getClosestCommentItemId(event.target);
69906
70292
  const index2 = this.items.findIndex((item) => item.root === itemRoot);
69907
70293
  if (index2 !== -1) {
69908
- if (this.activeIndex !== index2) {
70294
+ const disableActive = !!event.target.closest(".disable-active");
70295
+ const enableActive = !disableActive;
70296
+ if (this.activeIndex !== index2 && enableActive) {
69909
70297
  this.setActiveItem(index2);
69910
70298
  }
69911
70299
  const { groupItemHandlers } = this;
@@ -69913,7 +70301,8 @@ ${codeText}
69913
70301
  event.target,
69914
70302
  this.items[index2],
69915
70303
  commentId,
69916
- index2
70304
+ index2,
70305
+ event
69917
70306
  );
69918
70307
  }
69919
70308
  });
@@ -69954,7 +70343,10 @@ ${codeText}
69954
70343
  __publicField(this, "handleSelectionChanged", () => {
69955
70344
  setTimeout(() => {
69956
70345
  var _a;
69957
- const commentIds = getCommentsFromSelection(this.editor);
70346
+ if (this.type !== "current") {
70347
+ return;
70348
+ }
70349
+ const commentIds = this.type === "current" ? removeResolvedComments(this.commentsProvider, getCommentsFromSelection(this.editor)) : removeUnresolvedComments(this.commentsProvider, getCommentsFromSelection(this.editor));
69958
70350
  if (commentIds.length > 0) {
69959
70351
  if (((_a = this.activeItem) == null ? void 0 : _a.comment.id) && commentIds.includes(this.activeItem.comment.id)) {
69960
70352
  return;
@@ -69995,7 +70387,9 @@ ${codeText}
69995
70387
  const top = Number.parseFloat(firstItem.style.top);
69996
70388
  const targetTop = Number.parseFloat(firstItem.getAttribute("data-target-top") || "0");
69997
70389
  if (!Number.isNaN(top) && !Number.isNaN(targetTop) && top < targetTop) {
69998
- arrangeItems(this.editor, this.items, null, Math.min(top + (0 - event.deltaY) * 3, targetTop));
70390
+ if (this.type === "current") {
70391
+ arrangeItems(this.editor, this.items, null, Math.min(top + (0 - event.deltaY) * 3, targetTop));
70392
+ }
69999
70393
  }
70000
70394
  });
70001
70395
  __publicField(this, "updateGroupItemSwitch", () => {
@@ -70004,7 +70398,7 @@ ${codeText}
70004
70398
  activeItem.updateSwitchButton();
70005
70399
  });
70006
70400
  __publicField(this, "updateComments", debounce__default.default(() => {
70007
- const commentsGroup = getCommentsGroupFromDoc(this.editor, this.commentsProvider);
70401
+ const commentsGroup = this.type === "current" ? getUnresolvedCommentsGroupFromDoc(this.editor, this.commentsProvider) : getResolvedCommentsGroupFromDoc(this.editor, this.commentsProvider);
70008
70402
  let hasBeenChanged = false;
70009
70403
  for (let i = 0; i < commentsGroup.length; i++) {
70010
70404
  const comment = commentsGroup[i];
@@ -70027,6 +70421,8 @@ ${codeText}
70027
70421
  this.emit("commentCountChanged");
70028
70422
  }
70029
70423
  }, 100));
70424
+ this.editor = editor;
70425
+ this.type = type;
70030
70426
  this.updateItemsLayout();
70031
70427
  this.bindEvents();
70032
70428
  this.editor.addListener("selectionChanged", this.handleSelectionChanged);
@@ -70047,7 +70443,9 @@ ${codeText}
70047
70443
  document.removeEventListener("click", this.handleDocumentClick);
70048
70444
  }
70049
70445
  updateItemsLayout(dispatchScroll = true) {
70050
- arrangeItems(this.editor, this.items, this.activeItem);
70446
+ if (this.type === "current") {
70447
+ arrangeItems(this.editor, this.items, this.activeItem);
70448
+ }
70051
70449
  if (dispatchScroll) {
70052
70450
  this.dispatchScroll();
70053
70451
  }
@@ -70071,7 +70469,7 @@ ${codeText}
70071
70469
  return item;
70072
70470
  }
70073
70471
  findInsertPos(data2) {
70074
- const commentsMap = getCommentsGroupFromDoc(this.editor, this.commentsProvider);
70472
+ const commentsMap = getUnresolvedCommentsGroupFromDoc(this.editor, this.commentsProvider);
70075
70473
  const index2 = commentsMap.findIndex((group) => group.id === data2.id);
70076
70474
  if (index2 === -1) {
70077
70475
  return -1;
@@ -70171,6 +70569,7 @@ ${codeText}
70171
70569
  newItem.quickReply.hide();
70172
70570
  setTimeout(() => {
70173
70571
  newItem.edit();
70572
+ newItem.setCreatingComment(true);
70174
70573
  }, 300);
70175
70574
  }
70176
70575
  }
@@ -70195,6 +70594,18 @@ ${codeText}
70195
70594
  }
70196
70595
  }
70197
70596
  }
70597
+ handleResolveComment(commentId) {
70598
+ const item = this.findItem(commentId);
70599
+ if (item) {
70600
+ this.deleteItem(item.comment.id);
70601
+ }
70602
+ }
70603
+ removeGroupItem(comment) {
70604
+ const item = this.findItem(comment.id) || this.findItem(comment.groupId);
70605
+ if (item) {
70606
+ this.deleteItem(item.comment.id);
70607
+ }
70608
+ }
70198
70609
  handleUpdateComment(comment) {
70199
70610
  const group = this.findItemAsGroupId(comment.groupId);
70200
70611
  if (group && group.comment.id !== comment.id) {
@@ -70206,6 +70617,236 @@ ${codeText}
70206
70617
  item.handleUpdateMainComment(comment);
70207
70618
  }
70208
70619
  }
70620
+ changeType(type) {
70621
+ this.type = type;
70622
+ const comments = this.type === "current" ? getUnresolvedCommentsGroupFromDoc(this.editor, this.commentsProvider) : getResolvedCommentsGroupFromDoc(this.editor, this.commentsProvider);
70623
+ this.reloadList(comments);
70624
+ if (this.type === "current") {
70625
+ setTimeout(() => {
70626
+ arrangeItems(this.editor, this.items, null);
70627
+ });
70628
+ }
70629
+ }
70630
+ reloadList(data2) {
70631
+ super.reloadList(data2);
70632
+ this._items.forEach((item) => item.addListener("resize", this.handleItemResize));
70633
+ }
70634
+ }
70635
+ function addBlockComments(doc2, block, resultMap) {
70636
+ if (block.comments) {
70637
+ const blockComments = block.comments;
70638
+ if (Array.isArray(blockComments)) {
70639
+ blockComments.forEach((commentId) => {
70640
+ const commentIds = resultMap.get(block.id);
70641
+ if (commentIds) {
70642
+ commentIds.add(commentId);
70643
+ } else {
70644
+ resultMap.set(block.id, /* @__PURE__ */ new Set([commentId]));
70645
+ }
70646
+ });
70647
+ }
70648
+ }
70649
+ if (block.text) {
70650
+ const text2 = block.text;
70651
+ text2.forEach((op) => {
70652
+ if (op.attributes) {
70653
+ const prefix = "comment-";
70654
+ Object.entries(op.attributes).forEach(([key, value]) => {
70655
+ if (key.startsWith(prefix)) {
70656
+ const commentId = value;
70657
+ const commentIds = resultMap.get(block.id);
70658
+ if (commentIds) {
70659
+ commentIds.add(commentId);
70660
+ } else {
70661
+ resultMap.set(block.id, /* @__PURE__ */ new Set([commentId]));
70662
+ }
70663
+ }
70664
+ });
70665
+ }
70666
+ });
70667
+ }
70668
+ const children = block.children;
70669
+ if (!children) {
70670
+ return;
70671
+ }
70672
+ children.forEach((childContainerId) => {
70673
+ const childBlocks = doc2.blocks[childContainerId];
70674
+ childBlocks.forEach((subBlock) => {
70675
+ addBlockComments(doc2, subBlock, resultMap);
70676
+ });
70677
+ });
70678
+ }
70679
+ function getBlockCommentsFromDoc(doc2) {
70680
+ const resultMap = /* @__PURE__ */ new Map();
70681
+ doc2.blocks.root.forEach((block) => {
70682
+ addBlockComments(doc2, block, resultMap);
70683
+ });
70684
+ return resultMap;
70685
+ }
70686
+ function getBlocksByCommentId(doc2, commentId) {
70687
+ const result = [];
70688
+ const resultMap = getBlockCommentsFromDoc(doc2);
70689
+ resultMap.forEach((commentIds, blockId) => {
70690
+ if (commentIds.has(commentId)) {
70691
+ result.push(blockId);
70692
+ }
70693
+ });
70694
+ return result;
70695
+ }
70696
+ class OnesEditorCommentsRender {
70697
+ constructor(type = "current") {
70698
+ __publicField(this, "updateUnknownCommentsDelayed", debounce__default.default((editor) => {
70699
+ const comments = this.getComments(editor);
70700
+ const invisibleComments = Object.values(comments).filter((comment) => {
70701
+ const ret = this.type === "current" ? !!comment.resolver : !comment.resolver;
70702
+ return ret;
70703
+ });
70704
+ const root2 = editor.rootContainer;
70705
+ const effectedElements = /* @__PURE__ */ new Set();
70706
+ invisibleComments.forEach((comment) => {
70707
+ const key = `comment-${comment.groupId.toLocaleLowerCase()}`;
70708
+ const elements = root2.querySelectorAll(`[${key}]`);
70709
+ elements.forEach((elem) => {
70710
+ elem.removeAttribute(key);
70711
+ effectedElements.add(elem);
70712
+ });
70713
+ });
70714
+ effectedElements.forEach((elem) => {
70715
+ const commentAttributes = Array.from(elem.attributes).filter((a) => a.name.startsWith("comment-"));
70716
+ if (commentAttributes.length === 0) {
70717
+ elem.classList.remove("comment");
70718
+ }
70719
+ });
70720
+ }));
70721
+ this.type = type;
70722
+ }
70723
+ renderText(editor, path, attributes) {
70724
+ const classes = [];
70725
+ const textAttributes = {};
70726
+ Object.entries(attributes).forEach(([key, value]) => {
70727
+ if (key.startsWith("comment-")) {
70728
+ this.renderCommentElement(editor, key, value, classes, textAttributes);
70729
+ }
70730
+ });
70731
+ return { classes, attributes: textAttributes };
70732
+ }
70733
+ renderBox(editor, path, attributes) {
70734
+ const classes = [];
70735
+ const textAttributes = {};
70736
+ Object.entries(attributes).forEach(([key, value]) => {
70737
+ if (key.startsWith("comment-")) {
70738
+ this.renderCommentElement(editor, key, value, classes, textAttributes);
70739
+ }
70740
+ });
70741
+ return { classes, attributes: textAttributes };
70742
+ }
70743
+ renderBlock(editor, path, blockData) {
70744
+ const comments = blockData.comments;
70745
+ if (!comments || comments.length === 0) {
70746
+ return {};
70747
+ }
70748
+ const classes = [];
70749
+ const attributes = {};
70750
+ comments.forEach((commentId) => {
70751
+ const key = `comment-${commentId.toLocaleLowerCase()}`;
70752
+ this.renderCommentElement(editor, key, commentId, classes, attributes);
70753
+ });
70754
+ return {
70755
+ classes,
70756
+ attributes
70757
+ };
70758
+ }
70759
+ updateBlock(editor, path, blockElement, blockData) {
70760
+ const comments = blockData.comments;
70761
+ removeClass(blockElement, "comment");
70762
+ Array.from(blockElement.attributes).forEach((a) => {
70763
+ if (a.name.startsWith("comment-")) {
70764
+ blockElement.removeAttribute(a.name);
70765
+ }
70766
+ });
70767
+ if (!comments || comments.length === 0) {
70768
+ return;
70769
+ }
70770
+ if (this.type === "resolved") {
70771
+ return;
70772
+ }
70773
+ addClass(blockElement, "comment");
70774
+ const classList = [];
70775
+ const attributes = {};
70776
+ comments.forEach((commentId) => {
70777
+ const key = `comment-${commentId.toLocaleLowerCase()}`;
70778
+ this.renderCommentElement(editor, key, commentId, classList, attributes);
70779
+ });
70780
+ Object.entries(attributes).forEach(([key, value]) => {
70781
+ blockElement.setAttribute(key, value);
70782
+ });
70783
+ if (classList.length > 0) {
70784
+ addClass(blockElement, ...classList);
70785
+ }
70786
+ }
70787
+ getCommentStatus(editor, commentId) {
70788
+ const comments = editor.findCustom("editor-comments");
70789
+ if (!comments) {
70790
+ return "unknown";
70791
+ }
70792
+ const commentsProvider = comments.commentProvider;
70793
+ const comment = commentsProvider.getComment(commentId);
70794
+ if (!comment) {
70795
+ return "unknown";
70796
+ }
70797
+ if (comment.resolver) {
70798
+ return "resolved";
70799
+ }
70800
+ return "unresolved";
70801
+ }
70802
+ renderCommentElement(editor, key, commentId, classes, textAttributes) {
70803
+ const status = this.getCommentStatus(editor, commentId);
70804
+ if (this.type === "current") {
70805
+ if (status === "resolved") {
70806
+ return;
70807
+ }
70808
+ } else {
70809
+ return;
70810
+ }
70811
+ classes.push("comment");
70812
+ textAttributes[key] = commentId;
70813
+ if (status === "unknown") {
70814
+ this.updateUnknownCommentsDelayed(editor);
70815
+ }
70816
+ }
70817
+ getComments(editor) {
70818
+ const editorComments = editor.findCustom("editor-comments");
70819
+ if (!editorComments) {
70820
+ return [];
70821
+ }
70822
+ const commentProvider = editorComments.commentProvider;
70823
+ return commentProvider.getComments();
70824
+ }
70825
+ changeType(editor, type) {
70826
+ this.type = type;
70827
+ const elements = editor.rootContainer.querySelectorAll(".comment");
70828
+ elements.forEach((elem) => {
70829
+ elem.classList.remove("comment");
70830
+ Array.from(elem.attributes).forEach((a) => {
70831
+ if (a.name.startsWith("comment-")) {
70832
+ elem.removeAttribute(a.name);
70833
+ }
70834
+ });
70835
+ });
70836
+ const comments = this.getComments(editor);
70837
+ const resolvedCommentsId = new Set(Object.values(comments).filter((comment) => !!comment.resolver).map((comment) => comment.groupId));
70838
+ const unresolvedCommentsId = new Set(Object.values(comments).filter((comment) => !resolvedCommentsId.has(comment.groupId)).map((comment) => comment.groupId));
70839
+ const visibleCommentsId = type === "current" ? unresolvedCommentsId : resolvedCommentsId;
70840
+ const commentsFromDoc = getBlockCommentsFromDoc(editor.doc.toJSON());
70841
+ commentsFromDoc.forEach((commentIds, blockId) => {
70842
+ if (Array.from(commentIds).some((c) => visibleCommentsId.has(c))) {
70843
+ const block = editor.findBlockById(blockId);
70844
+ if (block) {
70845
+ editor.reloadBlock(block);
70846
+ }
70847
+ }
70848
+ });
70849
+ }
70209
70850
  }
70210
70851
  const COMMENT_MINI_CLS = "comment-mini";
70211
70852
  getLogger("comment-list");
@@ -70215,6 +70856,46 @@ ${codeText}
70215
70856
  __publicField(this, "root");
70216
70857
  __publicField(this, "groupsContainer");
70217
70858
  __publicField(this, "list");
70859
+ __publicField(this, "listType", "current");
70860
+ __publicField(this, "switcherItem", {
70861
+ id: "switch-comment",
70862
+ name: i18n$1.t("comment.currentComment"),
70863
+ dropdown: true,
70864
+ manualShowChildren: true,
70865
+ childrenPlacement: "bottom-start",
70866
+ children: [{
70867
+ id: "current-comment",
70868
+ name: i18n$1.t("comment.currentComment"),
70869
+ states: ["checked"]
70870
+ }, {
70871
+ id: "resolved-comment",
70872
+ name: i18n$1.t("comment.resolvedComment")
70873
+ }]
70874
+ });
70875
+ __publicField(this, "switcherBar");
70876
+ __publicField(this, "noCommentTip", null);
70877
+ __publicField(this, "handleSwitchType", (bar2, item) => {
70878
+ var _a, _b;
70879
+ if (item.id === "current-comment") {
70880
+ this.listType = "current";
70881
+ } else {
70882
+ this.listType = "resolved";
70883
+ }
70884
+ this.editor.rootContainer.setAttribute("comment-list-type", this.listType);
70885
+ this.root.setAttribute("list-type", this.listType);
70886
+ this.switcherItem.name = this.listType === "current" ? i18n$1.t("comment.currentComment") : i18n$1.t("comment.resolvedComment");
70887
+ const children = this.switcherItem.children;
70888
+ children[0].states = this.listType === "current" ? ["checked"] : [];
70889
+ children[1].states = this.listType === "resolved" ? ["checked"] : [];
70890
+ this.switcherBar.updateItems([this.switcherItem]);
70891
+ this.list.changeType(this.listType);
70892
+ const renderer = this.editor.editorBlockRenders.getRenderers().find((r) => r instanceof OnesEditorCommentsRender);
70893
+ if (renderer) {
70894
+ renderer.changeType(this.editor, this.listType);
70895
+ }
70896
+ this.updateCommentCountTip();
70897
+ (_b = (_a = this.commentOptions) == null ? void 0 : _a.onCommentListTypeChange) == null ? void 0 : _b.call(_a, this.editor, this.listType);
70898
+ });
70218
70899
  __publicField(this, "handleSelectionOnComment", () => {
70219
70900
  this.emit("onSelectComment");
70220
70901
  });
@@ -70222,8 +70903,12 @@ ${codeText}
70222
70903
  var _a, _b;
70223
70904
  const count = getCommentsCountInDoc(this.editor, this.commentsProvider);
70224
70905
  (_b = (_a = this.commentOptions) == null ? void 0 : _a.onCommentCountChange) == null ? void 0 : _b.call(_a, count);
70906
+ this.updateCommentCountTip();
70225
70907
  });
70226
70908
  __publicField(this, "handleActiveItemChanged", (index2, direction) => {
70909
+ if (this.listType === "resolved") {
70910
+ return;
70911
+ }
70227
70912
  setTimeout(() => {
70228
70913
  var _a, _b;
70229
70914
  const item = this.list.activeItem;
@@ -70240,13 +70925,19 @@ ${codeText}
70240
70925
  this.editor = editor;
70241
70926
  this.commentsProvider = commentsProvider;
70242
70927
  this.root = createElement("div", ["editor-web-comment-root"], null);
70928
+ this.root.setAttribute("list-type", this.listType);
70243
70929
  this.groupsContainer = createElement("div", ["comment-groups-container"], this.root);
70244
70930
  this.list = this.createList();
70931
+ this.switcherBar = this.createSwitcher();
70245
70932
  this.commentsProvider.addListener(this);
70246
70933
  this.list.addListener("activeItemChanged", this.handleActiveItemChanged);
70247
70934
  this.list.addListener("itemLayoutUpdated", this.handleItemLayoutUpdated);
70248
70935
  this.list.addListener("selectionOnComment", this.handleSelectionOnComment);
70249
70936
  this.list.addListener("commentCountChanged", this.updateCommentCount);
70937
+ if (!this.editor.options.enableResolveComments) {
70938
+ this.root.classList.add("disable-resolve");
70939
+ }
70940
+ this.editor.rootContainer.setAttribute("comment-list-type", this.listType);
70250
70941
  this.updateCommentCount();
70251
70942
  }
70252
70943
  get commentOptions() {
@@ -70254,10 +70945,13 @@ ${codeText}
70254
70945
  return commentOptions;
70255
70946
  }
70256
70947
  destroy() {
70948
+ var _a;
70257
70949
  this.list.removeAllListeners();
70258
70950
  this.commentsProvider.removeListener(this);
70259
70951
  this.list.destroy();
70260
70952
  this.root.remove();
70953
+ this.switcherBar.destroy();
70954
+ (_a = this.noCommentTip) == null ? void 0 : _a.remove();
70261
70955
  }
70262
70956
  onCreateComment(commentId, local) {
70263
70957
  const comment = this.commentsProvider.getComment(commentId);
@@ -70272,8 +70966,73 @@ ${codeText}
70272
70966
  const comment = this.commentsProvider.getComment(commentId);
70273
70967
  this.list.handleUpdateComment(comment);
70274
70968
  }
70969
+ onUpdateCommentResolver(commentId, local) {
70970
+ const comment = this.commentsProvider.getComment(commentId);
70971
+ if (!comment) {
70972
+ return;
70973
+ }
70974
+ let type = "add";
70975
+ if (this.listType === "current") {
70976
+ if (comment.resolver) {
70977
+ type = "remove";
70978
+ }
70979
+ } else {
70980
+ if (!comment.resolver) {
70981
+ type = "remove";
70982
+ }
70983
+ }
70984
+ const blocks = /* @__PURE__ */ new Set();
70985
+ if (type === "remove") {
70986
+ getElementsByCommentId(this.editor, comment.groupId).forEach((element) => {
70987
+ if (isBlock$1(element)) {
70988
+ blocks.add(element);
70989
+ } else {
70990
+ const block = getParentBlock(element);
70991
+ if (block) {
70992
+ blocks.add(block);
70993
+ }
70994
+ }
70995
+ });
70996
+ } else {
70997
+ const blockIds = getBlocksByCommentId(this.editor.doc.toJSON(), comment.groupId);
70998
+ blockIds.forEach((blockId) => {
70999
+ const block = this.editor.findBlockById(blockId);
71000
+ if (block) {
71001
+ blocks.add(block);
71002
+ }
71003
+ });
71004
+ }
71005
+ blocks.forEach((block) => {
71006
+ this.editor.reloadBlock(block);
71007
+ });
71008
+ const commentGroup = getCommentsGroup(this.commentsProvider.getComments());
71009
+ const commentWithChildren = commentGroup.find((group) => group.groupId === comment.groupId);
71010
+ if (!commentWithChildren) {
71011
+ return;
71012
+ }
71013
+ setTimeout(() => {
71014
+ if (type === "add") {
71015
+ this.list.handleCreateComment(commentWithChildren, local);
71016
+ } else {
71017
+ this.list.removeGroupItem(comment);
71018
+ }
71019
+ this.updateCommentCount();
71020
+ }, 300);
71021
+ }
70275
71022
  createList() {
70276
- return new CommentGroupList(this.editor, this.commentsProvider, this.groupsContainer);
71023
+ return new CommentGroupList(this.editor, this.commentsProvider, this.groupsContainer, this.listType);
71024
+ }
71025
+ createSwitcher() {
71026
+ const container = createElement("div", ["comment-switcher-container"], this.root);
71027
+ const commandBar2 = new FixedToolbar(container, [this.switcherItem], {
71028
+ id: "comment-switcher"
71029
+ });
71030
+ commandBar2.addListener("click", this.handleSwitchType);
71031
+ return commandBar2;
71032
+ }
71033
+ setSwitcherParent(parent) {
71034
+ this.switcherBar.content.remove();
71035
+ parent.append(this.switcherBar.content);
70277
71036
  }
70278
71037
  isEditing(includeEmpty) {
70279
71038
  return this.list.isEditing(includeEmpty);
@@ -70281,14 +71040,49 @@ ${codeText}
70281
71040
  setFirstEditingCommentActive() {
70282
71041
  this.list.setFirstEditingCommentActive();
70283
71042
  }
70284
- show(groupId) {
71043
+ getListType() {
71044
+ return this.listType;
71045
+ }
71046
+ setListType(type) {
71047
+ var _a, _b;
71048
+ if (type === "resolved") {
71049
+ const item = (_a = this.switcherItem.children) == null ? void 0 : _a[1];
71050
+ this.handleSwitchType(this.switcherBar, item);
71051
+ } else {
71052
+ const item = (_b = this.switcherItem.children) == null ? void 0 : _b[0];
71053
+ this.handleSwitchType(this.switcherBar, item);
71054
+ }
71055
+ }
71056
+ updateCommentCountTip() {
70285
71057
  var _a;
71058
+ (_a = this.noCommentTip) == null ? void 0 : _a.remove();
71059
+ this.noCommentTip = null;
71060
+ if (this.listType === "resolved" && this.list.items.length === 0) {
71061
+ if (!this.noCommentTip) {
71062
+ this.noCommentTip = createElement("div", ["no-comment-tip"], this.groupsContainer);
71063
+ this.noCommentTip.innerText = i18n$1.t("comment.noResolvedComment");
71064
+ }
71065
+ return;
71066
+ }
71067
+ if (this.listType === "current" && this.list.items.length === 0) {
71068
+ if (!this.noCommentTip) {
71069
+ this.noCommentTip = createElement("div", ["no-comment-tip"], this.groupsContainer);
71070
+ this.noCommentTip.innerText = i18n$1.t("comment.noCurrentComment");
71071
+ }
71072
+ }
71073
+ }
71074
+ show(groupId) {
71075
+ var _a, _b;
70286
71076
  removeClass(this.root, "hidden");
70287
71077
  if (groupId) {
71078
+ if (this.listType !== "current") {
71079
+ const commandItem = (_a = this.switcherItem.children) == null ? void 0 : _a[0];
71080
+ this.handleSwitchType(this.switcherBar, commandItem);
71081
+ }
70288
71082
  const index2 = this.list.findItemIndex(groupId);
70289
71083
  this.list.setActiveItem(index2);
70290
71084
  }
70291
- (_a = this.commentOptions) == null ? void 0 : _a.controller.showCommentList();
71085
+ (_b = this.commentOptions) == null ? void 0 : _b.controller.showCommentList();
70292
71086
  }
70293
71087
  hide() {
70294
71088
  addClass(this.root, "hidden");
@@ -70416,7 +71210,7 @@ ${codeText}
70416
71210
  const logger$1c = getLogger("mobile-group-list");
70417
71211
  class MobileGroupList extends ListBase {
70418
71212
  constructor(editor, commentsProvider, parent, scrollElement) {
70419
- super(editor, commentsProvider, parent, getCommentsGroupFromDoc(editor, commentsProvider), {});
71213
+ super(editor, commentsProvider, parent, getUnresolvedCommentsGroupFromDoc(editor, commentsProvider), {});
70420
71214
  __publicField(this, "scroller");
70421
71215
  __publicField(this, "refreshScroller", () => {
70422
71216
  this.scroller.refresh();
@@ -70464,7 +71258,7 @@ ${codeText}
70464
71258
  this.updateComments();
70465
71259
  });
70466
71260
  __publicField(this, "updateComments", debounce__default.default(() => {
70467
- const commentsGroup = getCommentsGroupFromDoc(this.editor, this.commentsProvider);
71261
+ const commentsGroup = getUnresolvedCommentsGroupFromDoc(this.editor, this.commentsProvider);
70468
71262
  for (let i = 0; i < commentsGroup.length; i++) {
70469
71263
  const comment = commentsGroup[i];
70470
71264
  const groupItem = this.findGroupItem(comment.groupId);
@@ -70498,7 +71292,7 @@ ${codeText}
70498
71292
  return item;
70499
71293
  }
70500
71294
  findInsertPos(data2) {
70501
- const commentsMap = getCommentsGroupFromDoc(this.editor, this.commentsProvider);
71295
+ const commentsMap = getUnresolvedCommentsGroupFromDoc(this.editor, this.commentsProvider);
70502
71296
  const index2 = commentsMap.findIndex((group) => group.id === data2.id);
70503
71297
  if (index2 === -1) {
70504
71298
  return -1;
@@ -70634,6 +71428,8 @@ ${codeText}
70634
71428
  const comment = this.commentsProvider.getComment(commentId);
70635
71429
  this.list.handleUpdateComment(comment);
70636
71430
  }
71431
+ onUpdateCommentResolver(commentId, local) {
71432
+ }
70637
71433
  get commentOptions() {
70638
71434
  const commentOptions = this.editor.getComponentOptions("comment");
70639
71435
  return commentOptions;
@@ -70659,7 +71455,7 @@ ${codeText}
70659
71455
  }
70660
71456
  }
70661
71457
  function getMiniCommentsGroupFromDoc(editor, commentsProvider) {
70662
- const commentsGroupFromDoc = getCommentsGroupFromDoc(editor, commentsProvider);
71458
+ const commentsGroupFromDoc = getUnresolvedCommentsGroupFromDoc(editor, commentsProvider);
70663
71459
  const miniCommentGroups = /* @__PURE__ */ new Map();
70664
71460
  for (const commentGroup of commentsGroupFromDoc) {
70665
71461
  const blockId = getBlockIdByGroupId(editor, commentGroup.groupId);
@@ -70806,6 +71602,9 @@ ${codeText}
70806
71602
  }
70807
71603
  onUpdateComment(commentId, local) {
70808
71604
  }
71605
+ onUpdateCommentResolver(commentId, local) {
71606
+ this.list.updateMiniCommentsGroup();
71607
+ }
70809
71608
  show() {
70810
71609
  removeClass(this.root, "hidden");
70811
71610
  }
@@ -71034,12 +71833,18 @@ ${codeText}
71034
71833
  (_b = this.commentList) == null ? void 0 : _b.show(groupId);
71035
71834
  }
71036
71835
  });
71037
- __publicField(this, "showCommentList", (groupId) => {
71836
+ __publicField(this, "showCommentList", (groupId, type) => {
71837
+ var _a, _b;
71038
71838
  if (this.isMobile) {
71039
71839
  this.showComment("mobile", groupId);
71040
71840
  } else {
71041
71841
  this.showComment("web", groupId);
71042
71842
  }
71843
+ if (type) {
71844
+ (_a = this.getCommentList()) == null ? void 0 : _a.setListType(type);
71845
+ } else if (type === void 0) {
71846
+ (_b = this.getCommentList()) == null ? void 0 : _b.setListType("current");
71847
+ }
71043
71848
  });
71044
71849
  __publicField(this, "handleCommentListClose", () => {
71045
71850
  this.showComment("mini");
@@ -71074,6 +71879,15 @@ ${codeText}
71074
71879
  get isMobile() {
71075
71880
  return clientType.isMobile;
71076
71881
  }
71882
+ getCommentList() {
71883
+ return this.commentList;
71884
+ }
71885
+ getMobileCommentList() {
71886
+ return this.mobileCommentList;
71887
+ }
71888
+ getMiniCommentList() {
71889
+ return this.miniCommentList;
71890
+ }
71077
71891
  destroy() {
71078
71892
  var _a, _b;
71079
71893
  (_a = this.commentList) == null ? void 0 : _a.destroy();
@@ -71099,6 +71913,9 @@ ${codeText}
71099
71913
  if (containers.mobileContainer && this.mobileCommentList) {
71100
71914
  containers.mobileContainer.append(this.mobileCommentList.root);
71101
71915
  }
71916
+ if (containers.switchBarContainer && this.commentList) {
71917
+ this.commentList.setSwitcherParent(containers.switchBarContainer);
71918
+ }
71102
71919
  }
71103
71920
  }
71104
71921
  const style$7 = "";
@@ -71122,7 +71939,16 @@ ${codeText}
71122
71939
  more: "\u66F4\u591A",
71123
71940
  comment: "\u6DFB\u52A0\u6279\u6CE8",
71124
71941
  command: "\u6DFB\u52A0\u6279\u6CE8",
71125
- quickMenuCommand: "\u6DFB\u52A0\u6279\u6CE8"
71942
+ quickMenuCommand: "\u6DFB\u52A0\u6279\u6CE8",
71943
+ resolvedBy: '\u5DF2\u7531&nbsp;<span class="resolver-name">{name}</span>&nbsp;\u89E3\u51B3',
71944
+ reopen: "\u91CD\u65B0\u6253\u5F00",
71945
+ currentComment: "\u5F53\u524D\u6279\u6CE8",
71946
+ resolvedComment: "\u5DF2\u89E3\u51B3\u6279\u6CE8",
71947
+ removedFromDoc: "\u5F15\u7528\u5185\u5BB9\u5DF2\u5220\u9664",
71948
+ noCurrentComment: "\u6682\u65E0\u6279\u6CE8",
71949
+ noResolvedComment: "\u65E0\u5DF2\u89E3\u51B3\u6279\u6CE8",
71950
+ resolveComment: "\u6807\u8BB0\u4E3A\u5DF2\u89E3\u51B3",
71951
+ commentHasAlreadyRemoved: "\u5F15\u7528\u5185\u5BB9\u5DF2\u88AB\u5220\u9664\uFF0C\u4E0D\u53EF\u91CD\u65B0\u6253\u5F00\u6279\u6CE8"
71126
71952
  }
71127
71953
  };
71128
71954
  const zhHK$k = {
@@ -71168,7 +71994,16 @@ ${codeText}
71168
71994
  more: "More",
71169
71995
  comment: "Add annotation",
71170
71996
  command: "Add annotation",
71171
- quickMenuCommand: "Add annotation"
71997
+ quickMenuCommand: "Add annotation",
71998
+ resolvedBy: 'Resolved by&nbsp;<span class="resolver-name">{name}<span>',
71999
+ reopen: "Reopen",
72000
+ currentComment: "Unresolved annotations",
72001
+ resolvedComment: "Resolved annotations",
72002
+ removedFromDoc: "Quoted content deleted.",
72003
+ noCurrentComment: "No annotation.",
72004
+ noResolvedComment: "No resolved annotations.",
72005
+ resolveComment: "Mark as resolved",
72006
+ commentHasAlreadyRemoved: "Referenced content deleted. Comment can't be reopened."
71172
72007
  }
71173
72008
  };
71174
72009
  const jaJP$k = {
@@ -71191,7 +72026,16 @@ ${codeText}
71191
72026
  more: "\u305D\u306E\u4ED6",
71192
72027
  comment: "\u6CE8\u91C8\u3092\u8FFD\u52A0",
71193
72028
  command: "\u6CE8\u91C8\u3092\u8FFD\u52A0",
71194
- quickMenuCommand: "\u6CE8\u91C8\u3092\u8FFD\u52A0"
72029
+ quickMenuCommand: "\u6CE8\u91C8\u3092\u8FFD\u52A0",
72030
+ resolvedBy: '<span class="resolver-name">{name}</span>\u3055\u3093\u304C\u89E3\u6C7A\u3057\u307E\u3057\u305F',
72031
+ reopen: "\u518D\u958B",
72032
+ currentComment: "\u672A\u89E3\u6C7A\u30B3\u30E1\u30F3\u30C8",
72033
+ resolvedComment: "\u89E3\u6C7A\u6E08\u307F\u30B3\u30E1\u30F3\u30C8",
72034
+ removedFromDoc: "\u5F15\u7528\u3055\u308C\u305F\u5185\u5BB9\u306F\u524A\u9664\u3055\u308C\u307E\u3057\u305F\u3002",
72035
+ noCurrentComment: "\u6CE8\u91C8\u306A\u3057",
72036
+ noResolvedComment: "\u89E3\u6C7A\u6E08\u307F\u30B3\u30E1\u30F3\u30C8\u304C\u3042\u308A\u307E\u305B\u3093\u3002",
72037
+ resolveComment: "\u89E3\u6C7A\u3055\u308C\u307E\u3057\u305F",
72038
+ commentHasAlreadyRemoved: "\u5F15\u7528\u5143\u304C\u524A\u9664\u3055\u308C\u305F\u305F\u3081\u3001\u30B3\u30E1\u30F3\u30C8\u518D\u958B\u3067\u304D\u307E\u305B\u3093\u3002"
71195
72039
  }
71196
72040
  };
71197
72041
  i18n$1.mergeLang({
@@ -71200,61 +72044,6 @@ ${codeText}
71200
72044
  "en-US": enUS$k,
71201
72045
  "ja-JP": jaJP$k
71202
72046
  });
71203
- class OnesEditorCommentsRender {
71204
- renderText(editor, path, attributes) {
71205
- const classes = [];
71206
- const textAttributes = {};
71207
- Object.entries(attributes).forEach(([key, value]) => {
71208
- if (key.startsWith("comment-")) {
71209
- classes.push("comment");
71210
- textAttributes[key] = value;
71211
- }
71212
- });
71213
- return { classes, attributes: textAttributes };
71214
- }
71215
- renderBox(editor, path, attributes) {
71216
- const classes = [];
71217
- const textAttributes = {};
71218
- Object.entries(attributes).forEach(([key, value]) => {
71219
- if (key.startsWith("comment-")) {
71220
- classes.push("comment");
71221
- textAttributes[key] = value;
71222
- }
71223
- });
71224
- return { classes, attributes: textAttributes };
71225
- }
71226
- renderBlock(editor, path, blockData) {
71227
- const comments = blockData.comments;
71228
- if (!comments || comments.length === 0) {
71229
- return {};
71230
- }
71231
- const classes = ["comment"];
71232
- const attributes = {};
71233
- comments.forEach((commentId) => {
71234
- attributes[`comment-${commentId.toLocaleLowerCase()}`] = commentId;
71235
- });
71236
- return {
71237
- classes,
71238
- attributes
71239
- };
71240
- }
71241
- updateBlock(editor, path, blockElement, blockData) {
71242
- const comments = blockData.comments;
71243
- removeClass(blockElement, "comment");
71244
- Array.from(blockElement.attributes).forEach((a) => {
71245
- if (a.name.startsWith("comment-")) {
71246
- blockElement.removeAttribute(a.name);
71247
- }
71248
- });
71249
- if (!comments || comments.length === 0) {
71250
- return;
71251
- }
71252
- addClass(blockElement, "comment");
71253
- comments.forEach((commentId) => {
71254
- blockElement.setAttribute(`comment-${commentId.toLocaleLowerCase()}`, commentId);
71255
- });
71256
- }
71257
- }
71258
72047
  class OnesEditorCommentPlaceholderHandler {
71259
72048
  constructor(editor) {
71260
72049
  __publicField(this, "handleUpdateCompositionText", (editor, containerId, blockIndex, offset, end) => {
@@ -71406,6 +72195,21 @@ ${codeText}
71406
72195
  method: "delete"
71407
72196
  });
71408
72197
  }
72198
+ function updateCommentResolverToOldDoc(editor, version, commentId, resolver) {
72199
+ var _a, _b;
72200
+ const doc2 = editor.doc;
72201
+ const server = (_b = (_a = doc2.getServerMeta) == null ? void 0 : _a.call(doc2)) == null ? void 0 : _b.apiServer;
72202
+ assert(logger$16, server, "apiServer is not set");
72203
+ const api = `${server}/${version}/comments/${commentId}/resolver`;
72204
+ return doc2.request(api, {
72205
+ method: "put",
72206
+ data: {
72207
+ resolver
72208
+ }
72209
+ });
72210
+ }
72211
+ getLogger("resolved-comment-item");
72212
+ const styles = "";
71409
72213
  const isAllContainersSelected = (editor) => {
71410
72214
  var _a;
71411
72215
  const range = editor.selection.range;
@@ -71480,6 +72284,16 @@ ${codeText}
71480
72284
  await updateCommentToOldDoc(this.editor, this.version, commentId, comments.commentProvider.getCommentDoc(commentId));
71481
72285
  }
71482
72286
  }
72287
+ onUpdateCommentResolver(commentId, local) {
72288
+ const comments = this.editor.getCustom("editor-comments");
72289
+ const provider = comments.commentProvider;
72290
+ const comment = provider.getComment(commentId);
72291
+ if (!comment) {
72292
+ return;
72293
+ }
72294
+ const resolver = comment.resolver;
72295
+ updateCommentResolverToOldDoc(this.editor, this.version, commentId, resolver);
72296
+ }
71483
72297
  hideToolbar(editor) {
71484
72298
  const toolbar2 = editor.findCustom("toolbar-handler");
71485
72299
  toolbar2 == null ? void 0 : toolbar2.disableTextToolbar();
@@ -71506,6 +72320,7 @@ ${codeText}
71506
72320
  order: 60
71507
72321
  }],
71508
72322
  executeCommand: (editor2, block, item, child2) => {
72323
+ var _a2;
71509
72324
  if (!child2) {
71510
72325
  return;
71511
72326
  }
@@ -71516,6 +72331,7 @@ ${codeText}
71516
72331
  }
71517
72332
  this.hideToolbar(editor2);
71518
72333
  comments.showCommentList();
72334
+ (_a2 = comments.getCommentList()) == null ? void 0 : _a2.setListType("current");
71519
72335
  const offset = getChildOffset(block, child2);
71520
72336
  const range = createBlockSimpleRange(this.editor, block, offset.start, offset.end);
71521
72337
  const comment = addCommentToTextBlocks(editor2, range, comments.commentProvider);
@@ -71540,15 +72356,16 @@ ${codeText}
71540
72356
  order: 60
71541
72357
  }],
71542
72358
  executeCommand: (editor2, block, item) => {
72359
+ var _a2;
71543
72360
  if (item.id === "add-comment-to-old-doc") {
71544
72361
  const comments = editor2.getCustom("editor-comments");
71545
72362
  if (!comments) {
71546
72363
  return;
71547
72364
  }
71548
72365
  editor2.selection.selectBlock(block, 0, getBlockTextLength$6(editor2, block), { noScroll: true });
71549
- const editorComments = editor2.getCustom("editor-comments");
71550
- editorComments.showCommentList();
71551
- addCommentToBlock(editor2, block, editorComments.commentProvider);
72366
+ comments.showCommentList();
72367
+ (_a2 = comments.getCommentList()) == null ? void 0 : _a2.setListType("current");
72368
+ addCommentToBlock(editor2, block, comments.commentProvider);
71552
72369
  }
71553
72370
  }
71554
72371
  };
@@ -71573,12 +72390,14 @@ ${codeText}
71573
72390
  }];
71574
72391
  }
71575
72392
  executeCommand(editor, command, options) {
72393
+ var _a;
71576
72394
  if (command.id === "add-comment-to-old-doc/text") {
71577
72395
  const comments = editor.getCustom("editor-comments");
71578
72396
  if (!comments) {
71579
72397
  return;
71580
72398
  }
71581
72399
  comments.showCommentList();
72400
+ (_a = comments.getCommentList()) == null ? void 0 : _a.setListType("current");
71582
72401
  const range = editor.selection.range;
71583
72402
  if (!range.isSimple()) {
71584
72403
  if (isFullSelectedOneComplexBlock(editor, range)) {
@@ -76833,14 +77652,14 @@ ${docStr}
76833
77652
  }
76834
77653
  function isList(elem) {
76835
77654
  var _a;
76836
- const styles = Array.from(((_a = elem.getAttribute("style")) != null ? _a : "").split(" "));
76837
- return styles.findIndex((style2) => style2.startsWith("level")) !== -1;
77655
+ const styles2 = Array.from(((_a = elem.getAttribute("style")) != null ? _a : "").split(" "));
77656
+ return styles2.findIndex((style2) => style2.startsWith("level")) !== -1;
76838
77657
  }
76839
77658
  function getOfficeListGroupId(elem) {
76840
77659
  var _a;
76841
- const styles = Array.from(((_a = elem.getAttribute("style")) != null ? _a : "").split(" "));
76842
- for (let i = 0; i < styles.length; i++) {
76843
- const name = styles[i];
77660
+ const styles2 = Array.from(((_a = elem.getAttribute("style")) != null ? _a : "").split(" "));
77661
+ for (let i = 0; i < styles2.length; i++) {
77662
+ const name = styles2[i];
76844
77663
  if (name.startsWith("mso-list:")) {
76845
77664
  return name;
76846
77665
  }
@@ -76849,9 +77668,9 @@ ${docStr}
76849
77668
  }
76850
77669
  function getLevel(elem) {
76851
77670
  var _a, _b;
76852
- const styles = Array.from(((_a = elem.getAttribute("style")) != null ? _a : "").split(" "));
76853
- for (let i = 0; i < styles.length; i++) {
76854
- const name = styles[i];
77671
+ const styles2 = Array.from(((_a = elem.getAttribute("style")) != null ? _a : "").split(" "));
77672
+ for (let i = 0; i < styles2.length; i++) {
77673
+ const name = styles2[i];
76855
77674
  if (name.startsWith("level")) {
76856
77675
  const level = (_b = Number.parseInt(name.substring(5), 10)) != null ? _b : void 0;
76857
77676
  if (level) {
@@ -80542,6 +81361,8 @@ ${docStr}
80542
81361
  }
80543
81362
  onUpdateComment() {
80544
81363
  }
81364
+ onUpdateCommentResolver(commentId, local) {
81365
+ }
80545
81366
  }
80546
81367
  async function playHistoryData(doc2, versionHelper, historyData) {
80547
81368
  for (const data2 of historyData) {
@@ -90871,6 +91692,9 @@ ${data2.plantumlText}
90871
91692
  localUpdateComment(comment, doc2) {
90872
91693
  this.doc.localUpdateComment(comment, doc2);
90873
91694
  }
91695
+ localUpdateCommentResolver(commentId, resolver) {
91696
+ this.doc.localUpdateCommentResolver(commentId, resolver);
91697
+ }
90874
91698
  onCreateComment(commentId, local) {
90875
91699
  Array.from(this.listeners.values()).forEach((listener) => listener.onCreateComment(commentId, local));
90876
91700
  }
@@ -90880,6 +91704,9 @@ ${data2.plantumlText}
90880
91704
  onUpdateComment(commentId, local) {
90881
91705
  Array.from(this.listeners.values()).forEach((listener) => listener.onUpdateComment(commentId, local));
90882
91706
  }
91707
+ onUpdateCommentResolver(commentId, local) {
91708
+ Array.from(this.listeners.values()).forEach((listener) => listener.onUpdateCommentResolver(commentId, local));
91709
+ }
90883
91710
  addListener(callback) {
90884
91711
  this.listeners.add(callback);
90885
91712
  }
@@ -90905,9 +91732,10 @@ ${data2.plantumlText}
90905
91732
  constructor(editor, localDoc) {
90906
91733
  __publicField(this, "_listeners", /* @__PURE__ */ new Set());
90907
91734
  __publicField(this, "_doc");
91735
+ var _a, _b;
90908
91736
  this.editor = editor;
90909
91737
  this.localDoc = localDoc;
90910
- this._doc = this.localDoc.toJSON();
91738
+ this._doc = ((_b = (_a = this.localDoc).rawData) == null ? void 0 : _b.call(_a)) || this.localDoc.toJSON();
90911
91739
  }
90912
91740
  get doc() {
90913
91741
  return this._doc;
@@ -90962,6 +91790,17 @@ ${data2.plantumlText}
90962
91790
  this._doc.comments[id] = shareDBComment;
90963
91791
  Array.from(this._listeners.values()).forEach((listener) => listener.onUpdateComment(id, true));
90964
91792
  }
91793
+ localUpdateCommentResolver(commentId, resolver) {
91794
+ const comment = this.getComment(commentId);
91795
+ if (comment) {
91796
+ if (resolver) {
91797
+ comment.resolver = resolver;
91798
+ } else {
91799
+ delete comment.resolver;
91800
+ }
91801
+ Array.from(this._listeners.values()).forEach((listener) => listener.onUpdateCommentResolver(commentId, true));
91802
+ }
91803
+ }
90965
91804
  createCommentEditor(parent, childDoc) {
90966
91805
  const commentEditor = createCommentEditor(this.editor, {
90967
91806
  root: parent,
@@ -91334,7 +92173,8 @@ ${data2.plantumlText}
91334
92173
  this._editor = editor;
91335
92174
  }
91336
92175
  handleError(error2, customMessage) {
91337
- console.error("wiz-editor error:", error2);
92176
+ console.error(`[${new Date().toLocaleString()}] wiz-editor error: ${error2}
92177
+ ${JSON.stringify(error2, null, 2)}`);
91338
92178
  if (this._editor) {
91339
92179
  this._editor.readonly = true;
91340
92180
  }
@@ -91731,8 +92571,8 @@ ${data2.plantumlText}
91731
92571
  const inlineStyles = attributesOfText(text2, "inlineStyle");
91732
92572
  if (inlineStyles == null)
91733
92573
  return;
91734
- const styles = inlineStyles.split(";");
91735
- for (const style2 of styles) {
92574
+ const styles2 = inlineStyles.split(";");
92575
+ for (const style2 of styles2) {
91736
92576
  const pair = style2.split(":");
91737
92577
  if (pair.length !== 2)
91738
92578
  continue;
@@ -93563,6 +94403,7 @@ ${data2.plantumlText}
93563
94403
  id: options.id,
93564
94404
  scrollContainer: options == null ? void 0 : options.scrollContainer,
93565
94405
  enableComments: options == null ? void 0 : options.enableComments,
94406
+ enableResolveComments: options == null ? void 0 : options.enableResolveComments,
93566
94407
  enableContextMenu: options == null ? void 0 : options.enableContextMenu,
93567
94408
  components: {
93568
94409
  blocks: [...StandardBlocks, ...((_d = options == null ? void 0 : options.components) == null ? void 0 : _d.blocks) || []],
@@ -93800,7 +94641,7 @@ ${data2.plantumlText}
93800
94641
  }
93801
94642
  }
93802
94643
  });
93803
- editor.version = "2.8.34";
94644
+ editor.version = "2.8.36";
93804
94645
  return editor;
93805
94646
  }
93806
94647
  function isDoc(doc2) {
@@ -93822,6 +94663,7 @@ ${data2.plantumlText}
93822
94663
  const editor = createEditor(root2, doc2, {
93823
94664
  id: options.id,
93824
94665
  scrollContainer: options == null ? void 0 : options.scrollContainer,
94666
+ enableResolveComments: options == null ? void 0 : options.enableResolveComments,
93825
94667
  components: {
93826
94668
  blocks: [...StandardBlocks, ...(_f = (_e = options.components) == null ? void 0 : _e.blocks) != null ? _f : []],
93827
94669
  commandProviders: [new TableBlockCommandProvider()],
@@ -93913,7 +94755,7 @@ ${data2.plantumlText}
93913
94755
  }
93914
94756
  });
93915
94757
  OnesEditorToolbar.register(editor);
93916
- editor.version = "2.8.34";
94758
+ editor.version = "2.8.36";
93917
94759
  return editor;
93918
94760
  }
93919
94761
  async function showDocVersions(editor, options, serverUrl) {
@@ -139733,6 +140575,7 @@ ${data2.plantumlText}
139733
140575
  exports2.CheckMarkIcon = CheckMarkIcon;
139734
140576
  exports2.CheckboxIcon = CheckboxIcon;
139735
140577
  exports2.CircleAddIcon = CircleAddIcon;
140578
+ exports2.CircleCheckMarkIcon = CircleCheckMarkIcon;
139736
140579
  exports2.ClearIcon = ClearIcon;
139737
140580
  exports2.ClipboardProvider = ClipboardProvider;
139738
140581
  exports2.CloseIcon = CloseIcon;
@@ -139883,6 +140726,8 @@ ${data2.plantumlText}
139883
140726
  exports2.MoreItem = MoreItem;
139884
140727
  exports2.NextIcon = NextIcon;
139885
140728
  exports2.OnesEditorAutoSuggest = OnesEditorAutoSuggest;
140729
+ exports2.OnesEditorComments = OnesEditorComments;
140730
+ exports2.OnesEditorCommentsRender = OnesEditorCommentsRender;
139886
140731
  exports2.OnesEditorCustomDataWrapper = OnesEditorCustomDataWrapper;
139887
140732
  exports2.OnesEditorExclusiveBlock = OnesEditorExclusiveBlock;
139888
140733
  exports2.OnesEditorHoveringBlock = OnesEditorHoveringBlock;