@okf/ootils 1.46.0 → 1.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.d.mts +42 -3
- package/dist/browser.d.ts +42 -3
- package/dist/browser.js +48 -6
- package/dist/browser.mjs +48 -6
- package/dist/node.d.mts +42 -3
- package/dist/node.d.ts +42 -3
- package/dist/node.js +48 -6
- package/dist/node.mjs +48 -6
- package/dist/universal.d.mts +42 -3
- package/dist/universal.d.ts +42 -3
- package/dist/universal.js +48 -6
- package/dist/universal.mjs +48 -6
- package/package.json +1 -1
package/dist/browser.d.mts
CHANGED
|
@@ -2005,8 +2005,39 @@ declare class BlockRegistry {
|
|
|
2005
2005
|
comp: string;
|
|
2006
2006
|
props?: any;
|
|
2007
2007
|
}): boolean;
|
|
2008
|
-
/**
|
|
2009
|
-
|
|
2008
|
+
/**
|
|
2009
|
+
* Check if a specific block has a specific capability.
|
|
2010
|
+
*
|
|
2011
|
+
* Type-level by default (keyed off `compType`). Pass the block INSTANCE as the
|
|
2012
|
+
* optional third arg to honour per-instance overrides — today the only one is
|
|
2013
|
+
* the annotation kill-switch: an annotation-capable block type returns `false`
|
|
2014
|
+
* for the `annotation` capability when the instance sets
|
|
2015
|
+
* `props.annotations.disable: true` in its tpl config. All other capabilities
|
|
2016
|
+
* (and the no-instance form) fall through to the plain type-level check, so
|
|
2017
|
+
* existing 2-arg callers are unaffected.
|
|
2018
|
+
*/
|
|
2019
|
+
hasCapability(compType: string, capability: keyof BlockCapabilities, block?: {
|
|
2020
|
+
props?: any;
|
|
2021
|
+
}): boolean;
|
|
2022
|
+
/**
|
|
2023
|
+
* Per-instance annotation kill-switch.
|
|
2024
|
+
*
|
|
2025
|
+
* A block type may be annotation-capable at the registry level (e.g.
|
|
2026
|
+
* LexicalTextEditor has `capabilities.annotation === true`), but an individual
|
|
2027
|
+
* block instance can be opted out of annotation entirely by setting
|
|
2028
|
+
* `props.annotations.disable: true` in its tpl config. Generic and config-only:
|
|
2029
|
+
* to stop annotation on any field, add that prop — no code change.
|
|
2030
|
+
*
|
|
2031
|
+
* The single home for this `props.annotations.disable` path (note: `annotations`
|
|
2032
|
+
* plural, distinct from the legacy singular `annotation.enable`). Consumed
|
|
2033
|
+
* internally by `hasCapability` and `getAnnotationEnabledBlocks`, and directly
|
|
2034
|
+
* by consumers that must actively suppress annotation UI (e.g. the FE block
|
|
2035
|
+
* generators forcing disableViewHighlights/disableCreateHighlights), where a
|
|
2036
|
+
* type-level `false` isn't enough on its own.
|
|
2037
|
+
*/
|
|
2038
|
+
isAnnotationDisabledForBlock(block: {
|
|
2039
|
+
props?: any;
|
|
2040
|
+
}): boolean;
|
|
2010
2041
|
/**
|
|
2011
2042
|
* Returns true if the block stores its value as an array (Mongo schema type is Array).
|
|
2012
2043
|
* Useful for callers that need to know whether to query `valuePath.0` for existence
|
|
@@ -2028,7 +2059,15 @@ declare class BlockRegistry {
|
|
|
2028
2059
|
* For backwards compat with un-migrated blocks (e.g. deprecated KPRichInput/RichTextEditor),
|
|
2029
2060
|
* falls back to the legacy per-instance `props.annotation.enable` toggle.
|
|
2030
2061
|
*
|
|
2031
|
-
*
|
|
2062
|
+
* Per-instance kill-switch: any block is excluded when its tpl config sets
|
|
2063
|
+
* `props.annotations.disable: true`, regardless of type-level capability. This
|
|
2064
|
+
* is the single, config-only way to turn off annotation for a specific field —
|
|
2065
|
+
* and because this method is the central gate used across every repo, the
|
|
2066
|
+
* switch applies everywhere (annotate UI, AI auto-annotation, explorer,
|
|
2067
|
+
* chunking/anno sync, filters).
|
|
2068
|
+
*
|
|
2069
|
+
* Today: every registered annotation-capable block (e.g. LexicalTextEditor) is
|
|
2070
|
+
* auto-enabled unless explicitly disabled on the instance.
|
|
2032
2071
|
*/
|
|
2033
2072
|
getAnnotationEnabledBlocks(allBlocks: Array<{
|
|
2034
2073
|
comp: string;
|
package/dist/browser.d.ts
CHANGED
|
@@ -2005,8 +2005,39 @@ declare class BlockRegistry {
|
|
|
2005
2005
|
comp: string;
|
|
2006
2006
|
props?: any;
|
|
2007
2007
|
}): boolean;
|
|
2008
|
-
/**
|
|
2009
|
-
|
|
2008
|
+
/**
|
|
2009
|
+
* Check if a specific block has a specific capability.
|
|
2010
|
+
*
|
|
2011
|
+
* Type-level by default (keyed off `compType`). Pass the block INSTANCE as the
|
|
2012
|
+
* optional third arg to honour per-instance overrides — today the only one is
|
|
2013
|
+
* the annotation kill-switch: an annotation-capable block type returns `false`
|
|
2014
|
+
* for the `annotation` capability when the instance sets
|
|
2015
|
+
* `props.annotations.disable: true` in its tpl config. All other capabilities
|
|
2016
|
+
* (and the no-instance form) fall through to the plain type-level check, so
|
|
2017
|
+
* existing 2-arg callers are unaffected.
|
|
2018
|
+
*/
|
|
2019
|
+
hasCapability(compType: string, capability: keyof BlockCapabilities, block?: {
|
|
2020
|
+
props?: any;
|
|
2021
|
+
}): boolean;
|
|
2022
|
+
/**
|
|
2023
|
+
* Per-instance annotation kill-switch.
|
|
2024
|
+
*
|
|
2025
|
+
* A block type may be annotation-capable at the registry level (e.g.
|
|
2026
|
+
* LexicalTextEditor has `capabilities.annotation === true`), but an individual
|
|
2027
|
+
* block instance can be opted out of annotation entirely by setting
|
|
2028
|
+
* `props.annotations.disable: true` in its tpl config. Generic and config-only:
|
|
2029
|
+
* to stop annotation on any field, add that prop — no code change.
|
|
2030
|
+
*
|
|
2031
|
+
* The single home for this `props.annotations.disable` path (note: `annotations`
|
|
2032
|
+
* plural, distinct from the legacy singular `annotation.enable`). Consumed
|
|
2033
|
+
* internally by `hasCapability` and `getAnnotationEnabledBlocks`, and directly
|
|
2034
|
+
* by consumers that must actively suppress annotation UI (e.g. the FE block
|
|
2035
|
+
* generators forcing disableViewHighlights/disableCreateHighlights), where a
|
|
2036
|
+
* type-level `false` isn't enough on its own.
|
|
2037
|
+
*/
|
|
2038
|
+
isAnnotationDisabledForBlock(block: {
|
|
2039
|
+
props?: any;
|
|
2040
|
+
}): boolean;
|
|
2010
2041
|
/**
|
|
2011
2042
|
* Returns true if the block stores its value as an array (Mongo schema type is Array).
|
|
2012
2043
|
* Useful for callers that need to know whether to query `valuePath.0` for existence
|
|
@@ -2028,7 +2059,15 @@ declare class BlockRegistry {
|
|
|
2028
2059
|
* For backwards compat with un-migrated blocks (e.g. deprecated KPRichInput/RichTextEditor),
|
|
2029
2060
|
* falls back to the legacy per-instance `props.annotation.enable` toggle.
|
|
2030
2061
|
*
|
|
2031
|
-
*
|
|
2062
|
+
* Per-instance kill-switch: any block is excluded when its tpl config sets
|
|
2063
|
+
* `props.annotations.disable: true`, regardless of type-level capability. This
|
|
2064
|
+
* is the single, config-only way to turn off annotation for a specific field —
|
|
2065
|
+
* and because this method is the central gate used across every repo, the
|
|
2066
|
+
* switch applies everywhere (annotate UI, AI auto-annotation, explorer,
|
|
2067
|
+
* chunking/anno sync, filters).
|
|
2068
|
+
*
|
|
2069
|
+
* Today: every registered annotation-capable block (e.g. LexicalTextEditor) is
|
|
2070
|
+
* auto-enabled unless explicitly disabled on the instance.
|
|
2032
2071
|
*/
|
|
2033
2072
|
getAnnotationEnabledBlocks(allBlocks: Array<{
|
|
2034
2073
|
comp: string;
|
package/dist/browser.js
CHANGED
|
@@ -625,11 +625,44 @@ var BlockRegistry = class {
|
|
|
625
625
|
return value === cond.equals;
|
|
626
626
|
});
|
|
627
627
|
}
|
|
628
|
-
/**
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
628
|
+
/**
|
|
629
|
+
* Check if a specific block has a specific capability.
|
|
630
|
+
*
|
|
631
|
+
* Type-level by default (keyed off `compType`). Pass the block INSTANCE as the
|
|
632
|
+
* optional third arg to honour per-instance overrides — today the only one is
|
|
633
|
+
* the annotation kill-switch: an annotation-capable block type returns `false`
|
|
634
|
+
* for the `annotation` capability when the instance sets
|
|
635
|
+
* `props.annotations.disable: true` in its tpl config. All other capabilities
|
|
636
|
+
* (and the no-instance form) fall through to the plain type-level check, so
|
|
637
|
+
* existing 2-arg callers are unaffected.
|
|
638
|
+
*/
|
|
639
|
+
hasCapability(compType, capability, block) {
|
|
640
|
+
const def = this.blocks.get(compType);
|
|
641
|
+
if (!def) return false;
|
|
642
|
+
if (!def.capabilities[capability]) return false;
|
|
643
|
+
if (capability === "annotation" && block && this.isAnnotationDisabledForBlock(block)) {
|
|
644
|
+
return false;
|
|
645
|
+
}
|
|
646
|
+
return true;
|
|
647
|
+
}
|
|
648
|
+
/**
|
|
649
|
+
* Per-instance annotation kill-switch.
|
|
650
|
+
*
|
|
651
|
+
* A block type may be annotation-capable at the registry level (e.g.
|
|
652
|
+
* LexicalTextEditor has `capabilities.annotation === true`), but an individual
|
|
653
|
+
* block instance can be opted out of annotation entirely by setting
|
|
654
|
+
* `props.annotations.disable: true` in its tpl config. Generic and config-only:
|
|
655
|
+
* to stop annotation on any field, add that prop — no code change.
|
|
656
|
+
*
|
|
657
|
+
* The single home for this `props.annotations.disable` path (note: `annotations`
|
|
658
|
+
* plural, distinct from the legacy singular `annotation.enable`). Consumed
|
|
659
|
+
* internally by `hasCapability` and `getAnnotationEnabledBlocks`, and directly
|
|
660
|
+
* by consumers that must actively suppress annotation UI (e.g. the FE block
|
|
661
|
+
* generators forcing disableViewHighlights/disableCreateHighlights), where a
|
|
662
|
+
* type-level `false` isn't enough on its own.
|
|
663
|
+
*/
|
|
664
|
+
isAnnotationDisabledForBlock(block) {
|
|
665
|
+
return block?.props?.annotations?.disable === true;
|
|
633
666
|
}
|
|
634
667
|
/**
|
|
635
668
|
* Returns true if the block stores its value as an array (Mongo schema type is Array).
|
|
@@ -659,10 +692,19 @@ var BlockRegistry = class {
|
|
|
659
692
|
* For backwards compat with un-migrated blocks (e.g. deprecated KPRichInput/RichTextEditor),
|
|
660
693
|
* falls back to the legacy per-instance `props.annotation.enable` toggle.
|
|
661
694
|
*
|
|
662
|
-
*
|
|
695
|
+
* Per-instance kill-switch: any block is excluded when its tpl config sets
|
|
696
|
+
* `props.annotations.disable: true`, regardless of type-level capability. This
|
|
697
|
+
* is the single, config-only way to turn off annotation for a specific field —
|
|
698
|
+
* and because this method is the central gate used across every repo, the
|
|
699
|
+
* switch applies everywhere (annotate UI, AI auto-annotation, explorer,
|
|
700
|
+
* chunking/anno sync, filters).
|
|
701
|
+
*
|
|
702
|
+
* Today: every registered annotation-capable block (e.g. LexicalTextEditor) is
|
|
703
|
+
* auto-enabled unless explicitly disabled on the instance.
|
|
663
704
|
*/
|
|
664
705
|
getAnnotationEnabledBlocks(allBlocks) {
|
|
665
706
|
return allBlocks.filter((block) => {
|
|
707
|
+
if (this.isAnnotationDisabledForBlock(block)) return false;
|
|
666
708
|
const blockDef = this.blocks.get(block.comp);
|
|
667
709
|
if (blockDef) return !!blockDef.capabilities.annotation;
|
|
668
710
|
return block.props?.annotation?.enable === true;
|
package/dist/browser.mjs
CHANGED
|
@@ -553,11 +553,44 @@ var BlockRegistry = class {
|
|
|
553
553
|
return value === cond.equals;
|
|
554
554
|
});
|
|
555
555
|
}
|
|
556
|
-
/**
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
556
|
+
/**
|
|
557
|
+
* Check if a specific block has a specific capability.
|
|
558
|
+
*
|
|
559
|
+
* Type-level by default (keyed off `compType`). Pass the block INSTANCE as the
|
|
560
|
+
* optional third arg to honour per-instance overrides — today the only one is
|
|
561
|
+
* the annotation kill-switch: an annotation-capable block type returns `false`
|
|
562
|
+
* for the `annotation` capability when the instance sets
|
|
563
|
+
* `props.annotations.disable: true` in its tpl config. All other capabilities
|
|
564
|
+
* (and the no-instance form) fall through to the plain type-level check, so
|
|
565
|
+
* existing 2-arg callers are unaffected.
|
|
566
|
+
*/
|
|
567
|
+
hasCapability(compType, capability, block) {
|
|
568
|
+
const def = this.blocks.get(compType);
|
|
569
|
+
if (!def) return false;
|
|
570
|
+
if (!def.capabilities[capability]) return false;
|
|
571
|
+
if (capability === "annotation" && block && this.isAnnotationDisabledForBlock(block)) {
|
|
572
|
+
return false;
|
|
573
|
+
}
|
|
574
|
+
return true;
|
|
575
|
+
}
|
|
576
|
+
/**
|
|
577
|
+
* Per-instance annotation kill-switch.
|
|
578
|
+
*
|
|
579
|
+
* A block type may be annotation-capable at the registry level (e.g.
|
|
580
|
+
* LexicalTextEditor has `capabilities.annotation === true`), but an individual
|
|
581
|
+
* block instance can be opted out of annotation entirely by setting
|
|
582
|
+
* `props.annotations.disable: true` in its tpl config. Generic and config-only:
|
|
583
|
+
* to stop annotation on any field, add that prop — no code change.
|
|
584
|
+
*
|
|
585
|
+
* The single home for this `props.annotations.disable` path (note: `annotations`
|
|
586
|
+
* plural, distinct from the legacy singular `annotation.enable`). Consumed
|
|
587
|
+
* internally by `hasCapability` and `getAnnotationEnabledBlocks`, and directly
|
|
588
|
+
* by consumers that must actively suppress annotation UI (e.g. the FE block
|
|
589
|
+
* generators forcing disableViewHighlights/disableCreateHighlights), where a
|
|
590
|
+
* type-level `false` isn't enough on its own.
|
|
591
|
+
*/
|
|
592
|
+
isAnnotationDisabledForBlock(block) {
|
|
593
|
+
return block?.props?.annotations?.disable === true;
|
|
561
594
|
}
|
|
562
595
|
/**
|
|
563
596
|
* Returns true if the block stores its value as an array (Mongo schema type is Array).
|
|
@@ -587,10 +620,19 @@ var BlockRegistry = class {
|
|
|
587
620
|
* For backwards compat with un-migrated blocks (e.g. deprecated KPRichInput/RichTextEditor),
|
|
588
621
|
* falls back to the legacy per-instance `props.annotation.enable` toggle.
|
|
589
622
|
*
|
|
590
|
-
*
|
|
623
|
+
* Per-instance kill-switch: any block is excluded when its tpl config sets
|
|
624
|
+
* `props.annotations.disable: true`, regardless of type-level capability. This
|
|
625
|
+
* is the single, config-only way to turn off annotation for a specific field —
|
|
626
|
+
* and because this method is the central gate used across every repo, the
|
|
627
|
+
* switch applies everywhere (annotate UI, AI auto-annotation, explorer,
|
|
628
|
+
* chunking/anno sync, filters).
|
|
629
|
+
*
|
|
630
|
+
* Today: every registered annotation-capable block (e.g. LexicalTextEditor) is
|
|
631
|
+
* auto-enabled unless explicitly disabled on the instance.
|
|
591
632
|
*/
|
|
592
633
|
getAnnotationEnabledBlocks(allBlocks) {
|
|
593
634
|
return allBlocks.filter((block) => {
|
|
635
|
+
if (this.isAnnotationDisabledForBlock(block)) return false;
|
|
594
636
|
const blockDef = this.blocks.get(block.comp);
|
|
595
637
|
if (blockDef) return !!blockDef.capabilities.annotation;
|
|
596
638
|
return block.props?.annotation?.enable === true;
|
package/dist/node.d.mts
CHANGED
|
@@ -2013,8 +2013,39 @@ declare class BlockRegistry {
|
|
|
2013
2013
|
comp: string;
|
|
2014
2014
|
props?: any;
|
|
2015
2015
|
}): boolean;
|
|
2016
|
-
/**
|
|
2017
|
-
|
|
2016
|
+
/**
|
|
2017
|
+
* Check if a specific block has a specific capability.
|
|
2018
|
+
*
|
|
2019
|
+
* Type-level by default (keyed off `compType`). Pass the block INSTANCE as the
|
|
2020
|
+
* optional third arg to honour per-instance overrides — today the only one is
|
|
2021
|
+
* the annotation kill-switch: an annotation-capable block type returns `false`
|
|
2022
|
+
* for the `annotation` capability when the instance sets
|
|
2023
|
+
* `props.annotations.disable: true` in its tpl config. All other capabilities
|
|
2024
|
+
* (and the no-instance form) fall through to the plain type-level check, so
|
|
2025
|
+
* existing 2-arg callers are unaffected.
|
|
2026
|
+
*/
|
|
2027
|
+
hasCapability(compType: string, capability: keyof BlockCapabilities, block?: {
|
|
2028
|
+
props?: any;
|
|
2029
|
+
}): boolean;
|
|
2030
|
+
/**
|
|
2031
|
+
* Per-instance annotation kill-switch.
|
|
2032
|
+
*
|
|
2033
|
+
* A block type may be annotation-capable at the registry level (e.g.
|
|
2034
|
+
* LexicalTextEditor has `capabilities.annotation === true`), but an individual
|
|
2035
|
+
* block instance can be opted out of annotation entirely by setting
|
|
2036
|
+
* `props.annotations.disable: true` in its tpl config. Generic and config-only:
|
|
2037
|
+
* to stop annotation on any field, add that prop — no code change.
|
|
2038
|
+
*
|
|
2039
|
+
* The single home for this `props.annotations.disable` path (note: `annotations`
|
|
2040
|
+
* plural, distinct from the legacy singular `annotation.enable`). Consumed
|
|
2041
|
+
* internally by `hasCapability` and `getAnnotationEnabledBlocks`, and directly
|
|
2042
|
+
* by consumers that must actively suppress annotation UI (e.g. the FE block
|
|
2043
|
+
* generators forcing disableViewHighlights/disableCreateHighlights), where a
|
|
2044
|
+
* type-level `false` isn't enough on its own.
|
|
2045
|
+
*/
|
|
2046
|
+
isAnnotationDisabledForBlock(block: {
|
|
2047
|
+
props?: any;
|
|
2048
|
+
}): boolean;
|
|
2018
2049
|
/**
|
|
2019
2050
|
* Returns true if the block stores its value as an array (Mongo schema type is Array).
|
|
2020
2051
|
* Useful for callers that need to know whether to query `valuePath.0` for existence
|
|
@@ -2036,7 +2067,15 @@ declare class BlockRegistry {
|
|
|
2036
2067
|
* For backwards compat with un-migrated blocks (e.g. deprecated KPRichInput/RichTextEditor),
|
|
2037
2068
|
* falls back to the legacy per-instance `props.annotation.enable` toggle.
|
|
2038
2069
|
*
|
|
2039
|
-
*
|
|
2070
|
+
* Per-instance kill-switch: any block is excluded when its tpl config sets
|
|
2071
|
+
* `props.annotations.disable: true`, regardless of type-level capability. This
|
|
2072
|
+
* is the single, config-only way to turn off annotation for a specific field —
|
|
2073
|
+
* and because this method is the central gate used across every repo, the
|
|
2074
|
+
* switch applies everywhere (annotate UI, AI auto-annotation, explorer,
|
|
2075
|
+
* chunking/anno sync, filters).
|
|
2076
|
+
*
|
|
2077
|
+
* Today: every registered annotation-capable block (e.g. LexicalTextEditor) is
|
|
2078
|
+
* auto-enabled unless explicitly disabled on the instance.
|
|
2040
2079
|
*/
|
|
2041
2080
|
getAnnotationEnabledBlocks(allBlocks: Array<{
|
|
2042
2081
|
comp: string;
|
package/dist/node.d.ts
CHANGED
|
@@ -2013,8 +2013,39 @@ declare class BlockRegistry {
|
|
|
2013
2013
|
comp: string;
|
|
2014
2014
|
props?: any;
|
|
2015
2015
|
}): boolean;
|
|
2016
|
-
/**
|
|
2017
|
-
|
|
2016
|
+
/**
|
|
2017
|
+
* Check if a specific block has a specific capability.
|
|
2018
|
+
*
|
|
2019
|
+
* Type-level by default (keyed off `compType`). Pass the block INSTANCE as the
|
|
2020
|
+
* optional third arg to honour per-instance overrides — today the only one is
|
|
2021
|
+
* the annotation kill-switch: an annotation-capable block type returns `false`
|
|
2022
|
+
* for the `annotation` capability when the instance sets
|
|
2023
|
+
* `props.annotations.disable: true` in its tpl config. All other capabilities
|
|
2024
|
+
* (and the no-instance form) fall through to the plain type-level check, so
|
|
2025
|
+
* existing 2-arg callers are unaffected.
|
|
2026
|
+
*/
|
|
2027
|
+
hasCapability(compType: string, capability: keyof BlockCapabilities, block?: {
|
|
2028
|
+
props?: any;
|
|
2029
|
+
}): boolean;
|
|
2030
|
+
/**
|
|
2031
|
+
* Per-instance annotation kill-switch.
|
|
2032
|
+
*
|
|
2033
|
+
* A block type may be annotation-capable at the registry level (e.g.
|
|
2034
|
+
* LexicalTextEditor has `capabilities.annotation === true`), but an individual
|
|
2035
|
+
* block instance can be opted out of annotation entirely by setting
|
|
2036
|
+
* `props.annotations.disable: true` in its tpl config. Generic and config-only:
|
|
2037
|
+
* to stop annotation on any field, add that prop — no code change.
|
|
2038
|
+
*
|
|
2039
|
+
* The single home for this `props.annotations.disable` path (note: `annotations`
|
|
2040
|
+
* plural, distinct from the legacy singular `annotation.enable`). Consumed
|
|
2041
|
+
* internally by `hasCapability` and `getAnnotationEnabledBlocks`, and directly
|
|
2042
|
+
* by consumers that must actively suppress annotation UI (e.g. the FE block
|
|
2043
|
+
* generators forcing disableViewHighlights/disableCreateHighlights), where a
|
|
2044
|
+
* type-level `false` isn't enough on its own.
|
|
2045
|
+
*/
|
|
2046
|
+
isAnnotationDisabledForBlock(block: {
|
|
2047
|
+
props?: any;
|
|
2048
|
+
}): boolean;
|
|
2018
2049
|
/**
|
|
2019
2050
|
* Returns true if the block stores its value as an array (Mongo schema type is Array).
|
|
2020
2051
|
* Useful for callers that need to know whether to query `valuePath.0` for existence
|
|
@@ -2036,7 +2067,15 @@ declare class BlockRegistry {
|
|
|
2036
2067
|
* For backwards compat with un-migrated blocks (e.g. deprecated KPRichInput/RichTextEditor),
|
|
2037
2068
|
* falls back to the legacy per-instance `props.annotation.enable` toggle.
|
|
2038
2069
|
*
|
|
2039
|
-
*
|
|
2070
|
+
* Per-instance kill-switch: any block is excluded when its tpl config sets
|
|
2071
|
+
* `props.annotations.disable: true`, regardless of type-level capability. This
|
|
2072
|
+
* is the single, config-only way to turn off annotation for a specific field —
|
|
2073
|
+
* and because this method is the central gate used across every repo, the
|
|
2074
|
+
* switch applies everywhere (annotate UI, AI auto-annotation, explorer,
|
|
2075
|
+
* chunking/anno sync, filters).
|
|
2076
|
+
*
|
|
2077
|
+
* Today: every registered annotation-capable block (e.g. LexicalTextEditor) is
|
|
2078
|
+
* auto-enabled unless explicitly disabled on the instance.
|
|
2040
2079
|
*/
|
|
2041
2080
|
getAnnotationEnabledBlocks(allBlocks: Array<{
|
|
2042
2081
|
comp: string;
|
package/dist/node.js
CHANGED
|
@@ -3063,11 +3063,44 @@ var BlockRegistry = class {
|
|
|
3063
3063
|
return value === cond.equals;
|
|
3064
3064
|
});
|
|
3065
3065
|
}
|
|
3066
|
-
/**
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3066
|
+
/**
|
|
3067
|
+
* Check if a specific block has a specific capability.
|
|
3068
|
+
*
|
|
3069
|
+
* Type-level by default (keyed off `compType`). Pass the block INSTANCE as the
|
|
3070
|
+
* optional third arg to honour per-instance overrides — today the only one is
|
|
3071
|
+
* the annotation kill-switch: an annotation-capable block type returns `false`
|
|
3072
|
+
* for the `annotation` capability when the instance sets
|
|
3073
|
+
* `props.annotations.disable: true` in its tpl config. All other capabilities
|
|
3074
|
+
* (and the no-instance form) fall through to the plain type-level check, so
|
|
3075
|
+
* existing 2-arg callers are unaffected.
|
|
3076
|
+
*/
|
|
3077
|
+
hasCapability(compType, capability, block) {
|
|
3078
|
+
const def = this.blocks.get(compType);
|
|
3079
|
+
if (!def) return false;
|
|
3080
|
+
if (!def.capabilities[capability]) return false;
|
|
3081
|
+
if (capability === "annotation" && block && this.isAnnotationDisabledForBlock(block)) {
|
|
3082
|
+
return false;
|
|
3083
|
+
}
|
|
3084
|
+
return true;
|
|
3085
|
+
}
|
|
3086
|
+
/**
|
|
3087
|
+
* Per-instance annotation kill-switch.
|
|
3088
|
+
*
|
|
3089
|
+
* A block type may be annotation-capable at the registry level (e.g.
|
|
3090
|
+
* LexicalTextEditor has `capabilities.annotation === true`), but an individual
|
|
3091
|
+
* block instance can be opted out of annotation entirely by setting
|
|
3092
|
+
* `props.annotations.disable: true` in its tpl config. Generic and config-only:
|
|
3093
|
+
* to stop annotation on any field, add that prop — no code change.
|
|
3094
|
+
*
|
|
3095
|
+
* The single home for this `props.annotations.disable` path (note: `annotations`
|
|
3096
|
+
* plural, distinct from the legacy singular `annotation.enable`). Consumed
|
|
3097
|
+
* internally by `hasCapability` and `getAnnotationEnabledBlocks`, and directly
|
|
3098
|
+
* by consumers that must actively suppress annotation UI (e.g. the FE block
|
|
3099
|
+
* generators forcing disableViewHighlights/disableCreateHighlights), where a
|
|
3100
|
+
* type-level `false` isn't enough on its own.
|
|
3101
|
+
*/
|
|
3102
|
+
isAnnotationDisabledForBlock(block) {
|
|
3103
|
+
return block?.props?.annotations?.disable === true;
|
|
3071
3104
|
}
|
|
3072
3105
|
/**
|
|
3073
3106
|
* Returns true if the block stores its value as an array (Mongo schema type is Array).
|
|
@@ -3097,10 +3130,19 @@ var BlockRegistry = class {
|
|
|
3097
3130
|
* For backwards compat with un-migrated blocks (e.g. deprecated KPRichInput/RichTextEditor),
|
|
3098
3131
|
* falls back to the legacy per-instance `props.annotation.enable` toggle.
|
|
3099
3132
|
*
|
|
3100
|
-
*
|
|
3133
|
+
* Per-instance kill-switch: any block is excluded when its tpl config sets
|
|
3134
|
+
* `props.annotations.disable: true`, regardless of type-level capability. This
|
|
3135
|
+
* is the single, config-only way to turn off annotation for a specific field —
|
|
3136
|
+
* and because this method is the central gate used across every repo, the
|
|
3137
|
+
* switch applies everywhere (annotate UI, AI auto-annotation, explorer,
|
|
3138
|
+
* chunking/anno sync, filters).
|
|
3139
|
+
*
|
|
3140
|
+
* Today: every registered annotation-capable block (e.g. LexicalTextEditor) is
|
|
3141
|
+
* auto-enabled unless explicitly disabled on the instance.
|
|
3101
3142
|
*/
|
|
3102
3143
|
getAnnotationEnabledBlocks(allBlocks) {
|
|
3103
3144
|
return allBlocks.filter((block) => {
|
|
3145
|
+
if (this.isAnnotationDisabledForBlock(block)) return false;
|
|
3104
3146
|
const blockDef = this.blocks.get(block.comp);
|
|
3105
3147
|
if (blockDef) return !!blockDef.capabilities.annotation;
|
|
3106
3148
|
return block.props?.annotation?.enable === true;
|
package/dist/node.mjs
CHANGED
|
@@ -2971,11 +2971,44 @@ var BlockRegistry = class {
|
|
|
2971
2971
|
return value === cond.equals;
|
|
2972
2972
|
});
|
|
2973
2973
|
}
|
|
2974
|
-
/**
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2974
|
+
/**
|
|
2975
|
+
* Check if a specific block has a specific capability.
|
|
2976
|
+
*
|
|
2977
|
+
* Type-level by default (keyed off `compType`). Pass the block INSTANCE as the
|
|
2978
|
+
* optional third arg to honour per-instance overrides — today the only one is
|
|
2979
|
+
* the annotation kill-switch: an annotation-capable block type returns `false`
|
|
2980
|
+
* for the `annotation` capability when the instance sets
|
|
2981
|
+
* `props.annotations.disable: true` in its tpl config. All other capabilities
|
|
2982
|
+
* (and the no-instance form) fall through to the plain type-level check, so
|
|
2983
|
+
* existing 2-arg callers are unaffected.
|
|
2984
|
+
*/
|
|
2985
|
+
hasCapability(compType, capability, block) {
|
|
2986
|
+
const def = this.blocks.get(compType);
|
|
2987
|
+
if (!def) return false;
|
|
2988
|
+
if (!def.capabilities[capability]) return false;
|
|
2989
|
+
if (capability === "annotation" && block && this.isAnnotationDisabledForBlock(block)) {
|
|
2990
|
+
return false;
|
|
2991
|
+
}
|
|
2992
|
+
return true;
|
|
2993
|
+
}
|
|
2994
|
+
/**
|
|
2995
|
+
* Per-instance annotation kill-switch.
|
|
2996
|
+
*
|
|
2997
|
+
* A block type may be annotation-capable at the registry level (e.g.
|
|
2998
|
+
* LexicalTextEditor has `capabilities.annotation === true`), but an individual
|
|
2999
|
+
* block instance can be opted out of annotation entirely by setting
|
|
3000
|
+
* `props.annotations.disable: true` in its tpl config. Generic and config-only:
|
|
3001
|
+
* to stop annotation on any field, add that prop — no code change.
|
|
3002
|
+
*
|
|
3003
|
+
* The single home for this `props.annotations.disable` path (note: `annotations`
|
|
3004
|
+
* plural, distinct from the legacy singular `annotation.enable`). Consumed
|
|
3005
|
+
* internally by `hasCapability` and `getAnnotationEnabledBlocks`, and directly
|
|
3006
|
+
* by consumers that must actively suppress annotation UI (e.g. the FE block
|
|
3007
|
+
* generators forcing disableViewHighlights/disableCreateHighlights), where a
|
|
3008
|
+
* type-level `false` isn't enough on its own.
|
|
3009
|
+
*/
|
|
3010
|
+
isAnnotationDisabledForBlock(block) {
|
|
3011
|
+
return block?.props?.annotations?.disable === true;
|
|
2979
3012
|
}
|
|
2980
3013
|
/**
|
|
2981
3014
|
* Returns true if the block stores its value as an array (Mongo schema type is Array).
|
|
@@ -3005,10 +3038,19 @@ var BlockRegistry = class {
|
|
|
3005
3038
|
* For backwards compat with un-migrated blocks (e.g. deprecated KPRichInput/RichTextEditor),
|
|
3006
3039
|
* falls back to the legacy per-instance `props.annotation.enable` toggle.
|
|
3007
3040
|
*
|
|
3008
|
-
*
|
|
3041
|
+
* Per-instance kill-switch: any block is excluded when its tpl config sets
|
|
3042
|
+
* `props.annotations.disable: true`, regardless of type-level capability. This
|
|
3043
|
+
* is the single, config-only way to turn off annotation for a specific field —
|
|
3044
|
+
* and because this method is the central gate used across every repo, the
|
|
3045
|
+
* switch applies everywhere (annotate UI, AI auto-annotation, explorer,
|
|
3046
|
+
* chunking/anno sync, filters).
|
|
3047
|
+
*
|
|
3048
|
+
* Today: every registered annotation-capable block (e.g. LexicalTextEditor) is
|
|
3049
|
+
* auto-enabled unless explicitly disabled on the instance.
|
|
3009
3050
|
*/
|
|
3010
3051
|
getAnnotationEnabledBlocks(allBlocks) {
|
|
3011
3052
|
return allBlocks.filter((block) => {
|
|
3053
|
+
if (this.isAnnotationDisabledForBlock(block)) return false;
|
|
3012
3054
|
const blockDef = this.blocks.get(block.comp);
|
|
3013
3055
|
if (blockDef) return !!blockDef.capabilities.annotation;
|
|
3014
3056
|
return block.props?.annotation?.enable === true;
|
package/dist/universal.d.mts
CHANGED
|
@@ -2005,8 +2005,39 @@ declare class BlockRegistry {
|
|
|
2005
2005
|
comp: string;
|
|
2006
2006
|
props?: any;
|
|
2007
2007
|
}): boolean;
|
|
2008
|
-
/**
|
|
2009
|
-
|
|
2008
|
+
/**
|
|
2009
|
+
* Check if a specific block has a specific capability.
|
|
2010
|
+
*
|
|
2011
|
+
* Type-level by default (keyed off `compType`). Pass the block INSTANCE as the
|
|
2012
|
+
* optional third arg to honour per-instance overrides — today the only one is
|
|
2013
|
+
* the annotation kill-switch: an annotation-capable block type returns `false`
|
|
2014
|
+
* for the `annotation` capability when the instance sets
|
|
2015
|
+
* `props.annotations.disable: true` in its tpl config. All other capabilities
|
|
2016
|
+
* (and the no-instance form) fall through to the plain type-level check, so
|
|
2017
|
+
* existing 2-arg callers are unaffected.
|
|
2018
|
+
*/
|
|
2019
|
+
hasCapability(compType: string, capability: keyof BlockCapabilities, block?: {
|
|
2020
|
+
props?: any;
|
|
2021
|
+
}): boolean;
|
|
2022
|
+
/**
|
|
2023
|
+
* Per-instance annotation kill-switch.
|
|
2024
|
+
*
|
|
2025
|
+
* A block type may be annotation-capable at the registry level (e.g.
|
|
2026
|
+
* LexicalTextEditor has `capabilities.annotation === true`), but an individual
|
|
2027
|
+
* block instance can be opted out of annotation entirely by setting
|
|
2028
|
+
* `props.annotations.disable: true` in its tpl config. Generic and config-only:
|
|
2029
|
+
* to stop annotation on any field, add that prop — no code change.
|
|
2030
|
+
*
|
|
2031
|
+
* The single home for this `props.annotations.disable` path (note: `annotations`
|
|
2032
|
+
* plural, distinct from the legacy singular `annotation.enable`). Consumed
|
|
2033
|
+
* internally by `hasCapability` and `getAnnotationEnabledBlocks`, and directly
|
|
2034
|
+
* by consumers that must actively suppress annotation UI (e.g. the FE block
|
|
2035
|
+
* generators forcing disableViewHighlights/disableCreateHighlights), where a
|
|
2036
|
+
* type-level `false` isn't enough on its own.
|
|
2037
|
+
*/
|
|
2038
|
+
isAnnotationDisabledForBlock(block: {
|
|
2039
|
+
props?: any;
|
|
2040
|
+
}): boolean;
|
|
2010
2041
|
/**
|
|
2011
2042
|
* Returns true if the block stores its value as an array (Mongo schema type is Array).
|
|
2012
2043
|
* Useful for callers that need to know whether to query `valuePath.0` for existence
|
|
@@ -2028,7 +2059,15 @@ declare class BlockRegistry {
|
|
|
2028
2059
|
* For backwards compat with un-migrated blocks (e.g. deprecated KPRichInput/RichTextEditor),
|
|
2029
2060
|
* falls back to the legacy per-instance `props.annotation.enable` toggle.
|
|
2030
2061
|
*
|
|
2031
|
-
*
|
|
2062
|
+
* Per-instance kill-switch: any block is excluded when its tpl config sets
|
|
2063
|
+
* `props.annotations.disable: true`, regardless of type-level capability. This
|
|
2064
|
+
* is the single, config-only way to turn off annotation for a specific field —
|
|
2065
|
+
* and because this method is the central gate used across every repo, the
|
|
2066
|
+
* switch applies everywhere (annotate UI, AI auto-annotation, explorer,
|
|
2067
|
+
* chunking/anno sync, filters).
|
|
2068
|
+
*
|
|
2069
|
+
* Today: every registered annotation-capable block (e.g. LexicalTextEditor) is
|
|
2070
|
+
* auto-enabled unless explicitly disabled on the instance.
|
|
2032
2071
|
*/
|
|
2033
2072
|
getAnnotationEnabledBlocks(allBlocks: Array<{
|
|
2034
2073
|
comp: string;
|
package/dist/universal.d.ts
CHANGED
|
@@ -2005,8 +2005,39 @@ declare class BlockRegistry {
|
|
|
2005
2005
|
comp: string;
|
|
2006
2006
|
props?: any;
|
|
2007
2007
|
}): boolean;
|
|
2008
|
-
/**
|
|
2009
|
-
|
|
2008
|
+
/**
|
|
2009
|
+
* Check if a specific block has a specific capability.
|
|
2010
|
+
*
|
|
2011
|
+
* Type-level by default (keyed off `compType`). Pass the block INSTANCE as the
|
|
2012
|
+
* optional third arg to honour per-instance overrides — today the only one is
|
|
2013
|
+
* the annotation kill-switch: an annotation-capable block type returns `false`
|
|
2014
|
+
* for the `annotation` capability when the instance sets
|
|
2015
|
+
* `props.annotations.disable: true` in its tpl config. All other capabilities
|
|
2016
|
+
* (and the no-instance form) fall through to the plain type-level check, so
|
|
2017
|
+
* existing 2-arg callers are unaffected.
|
|
2018
|
+
*/
|
|
2019
|
+
hasCapability(compType: string, capability: keyof BlockCapabilities, block?: {
|
|
2020
|
+
props?: any;
|
|
2021
|
+
}): boolean;
|
|
2022
|
+
/**
|
|
2023
|
+
* Per-instance annotation kill-switch.
|
|
2024
|
+
*
|
|
2025
|
+
* A block type may be annotation-capable at the registry level (e.g.
|
|
2026
|
+
* LexicalTextEditor has `capabilities.annotation === true`), but an individual
|
|
2027
|
+
* block instance can be opted out of annotation entirely by setting
|
|
2028
|
+
* `props.annotations.disable: true` in its tpl config. Generic and config-only:
|
|
2029
|
+
* to stop annotation on any field, add that prop — no code change.
|
|
2030
|
+
*
|
|
2031
|
+
* The single home for this `props.annotations.disable` path (note: `annotations`
|
|
2032
|
+
* plural, distinct from the legacy singular `annotation.enable`). Consumed
|
|
2033
|
+
* internally by `hasCapability` and `getAnnotationEnabledBlocks`, and directly
|
|
2034
|
+
* by consumers that must actively suppress annotation UI (e.g. the FE block
|
|
2035
|
+
* generators forcing disableViewHighlights/disableCreateHighlights), where a
|
|
2036
|
+
* type-level `false` isn't enough on its own.
|
|
2037
|
+
*/
|
|
2038
|
+
isAnnotationDisabledForBlock(block: {
|
|
2039
|
+
props?: any;
|
|
2040
|
+
}): boolean;
|
|
2010
2041
|
/**
|
|
2011
2042
|
* Returns true if the block stores its value as an array (Mongo schema type is Array).
|
|
2012
2043
|
* Useful for callers that need to know whether to query `valuePath.0` for existence
|
|
@@ -2028,7 +2059,15 @@ declare class BlockRegistry {
|
|
|
2028
2059
|
* For backwards compat with un-migrated blocks (e.g. deprecated KPRichInput/RichTextEditor),
|
|
2029
2060
|
* falls back to the legacy per-instance `props.annotation.enable` toggle.
|
|
2030
2061
|
*
|
|
2031
|
-
*
|
|
2062
|
+
* Per-instance kill-switch: any block is excluded when its tpl config sets
|
|
2063
|
+
* `props.annotations.disable: true`, regardless of type-level capability. This
|
|
2064
|
+
* is the single, config-only way to turn off annotation for a specific field —
|
|
2065
|
+
* and because this method is the central gate used across every repo, the
|
|
2066
|
+
* switch applies everywhere (annotate UI, AI auto-annotation, explorer,
|
|
2067
|
+
* chunking/anno sync, filters).
|
|
2068
|
+
*
|
|
2069
|
+
* Today: every registered annotation-capable block (e.g. LexicalTextEditor) is
|
|
2070
|
+
* auto-enabled unless explicitly disabled on the instance.
|
|
2032
2071
|
*/
|
|
2033
2072
|
getAnnotationEnabledBlocks(allBlocks: Array<{
|
|
2034
2073
|
comp: string;
|
package/dist/universal.js
CHANGED
|
@@ -625,11 +625,44 @@ var BlockRegistry = class {
|
|
|
625
625
|
return value === cond.equals;
|
|
626
626
|
});
|
|
627
627
|
}
|
|
628
|
-
/**
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
628
|
+
/**
|
|
629
|
+
* Check if a specific block has a specific capability.
|
|
630
|
+
*
|
|
631
|
+
* Type-level by default (keyed off `compType`). Pass the block INSTANCE as the
|
|
632
|
+
* optional third arg to honour per-instance overrides — today the only one is
|
|
633
|
+
* the annotation kill-switch: an annotation-capable block type returns `false`
|
|
634
|
+
* for the `annotation` capability when the instance sets
|
|
635
|
+
* `props.annotations.disable: true` in its tpl config. All other capabilities
|
|
636
|
+
* (and the no-instance form) fall through to the plain type-level check, so
|
|
637
|
+
* existing 2-arg callers are unaffected.
|
|
638
|
+
*/
|
|
639
|
+
hasCapability(compType, capability, block) {
|
|
640
|
+
const def = this.blocks.get(compType);
|
|
641
|
+
if (!def) return false;
|
|
642
|
+
if (!def.capabilities[capability]) return false;
|
|
643
|
+
if (capability === "annotation" && block && this.isAnnotationDisabledForBlock(block)) {
|
|
644
|
+
return false;
|
|
645
|
+
}
|
|
646
|
+
return true;
|
|
647
|
+
}
|
|
648
|
+
/**
|
|
649
|
+
* Per-instance annotation kill-switch.
|
|
650
|
+
*
|
|
651
|
+
* A block type may be annotation-capable at the registry level (e.g.
|
|
652
|
+
* LexicalTextEditor has `capabilities.annotation === true`), but an individual
|
|
653
|
+
* block instance can be opted out of annotation entirely by setting
|
|
654
|
+
* `props.annotations.disable: true` in its tpl config. Generic and config-only:
|
|
655
|
+
* to stop annotation on any field, add that prop — no code change.
|
|
656
|
+
*
|
|
657
|
+
* The single home for this `props.annotations.disable` path (note: `annotations`
|
|
658
|
+
* plural, distinct from the legacy singular `annotation.enable`). Consumed
|
|
659
|
+
* internally by `hasCapability` and `getAnnotationEnabledBlocks`, and directly
|
|
660
|
+
* by consumers that must actively suppress annotation UI (e.g. the FE block
|
|
661
|
+
* generators forcing disableViewHighlights/disableCreateHighlights), where a
|
|
662
|
+
* type-level `false` isn't enough on its own.
|
|
663
|
+
*/
|
|
664
|
+
isAnnotationDisabledForBlock(block) {
|
|
665
|
+
return block?.props?.annotations?.disable === true;
|
|
633
666
|
}
|
|
634
667
|
/**
|
|
635
668
|
* Returns true if the block stores its value as an array (Mongo schema type is Array).
|
|
@@ -659,10 +692,19 @@ var BlockRegistry = class {
|
|
|
659
692
|
* For backwards compat with un-migrated blocks (e.g. deprecated KPRichInput/RichTextEditor),
|
|
660
693
|
* falls back to the legacy per-instance `props.annotation.enable` toggle.
|
|
661
694
|
*
|
|
662
|
-
*
|
|
695
|
+
* Per-instance kill-switch: any block is excluded when its tpl config sets
|
|
696
|
+
* `props.annotations.disable: true`, regardless of type-level capability. This
|
|
697
|
+
* is the single, config-only way to turn off annotation for a specific field —
|
|
698
|
+
* and because this method is the central gate used across every repo, the
|
|
699
|
+
* switch applies everywhere (annotate UI, AI auto-annotation, explorer,
|
|
700
|
+
* chunking/anno sync, filters).
|
|
701
|
+
*
|
|
702
|
+
* Today: every registered annotation-capable block (e.g. LexicalTextEditor) is
|
|
703
|
+
* auto-enabled unless explicitly disabled on the instance.
|
|
663
704
|
*/
|
|
664
705
|
getAnnotationEnabledBlocks(allBlocks) {
|
|
665
706
|
return allBlocks.filter((block) => {
|
|
707
|
+
if (this.isAnnotationDisabledForBlock(block)) return false;
|
|
666
708
|
const blockDef = this.blocks.get(block.comp);
|
|
667
709
|
if (blockDef) return !!blockDef.capabilities.annotation;
|
|
668
710
|
return block.props?.annotation?.enable === true;
|
package/dist/universal.mjs
CHANGED
|
@@ -553,11 +553,44 @@ var BlockRegistry = class {
|
|
|
553
553
|
return value === cond.equals;
|
|
554
554
|
});
|
|
555
555
|
}
|
|
556
|
-
/**
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
556
|
+
/**
|
|
557
|
+
* Check if a specific block has a specific capability.
|
|
558
|
+
*
|
|
559
|
+
* Type-level by default (keyed off `compType`). Pass the block INSTANCE as the
|
|
560
|
+
* optional third arg to honour per-instance overrides — today the only one is
|
|
561
|
+
* the annotation kill-switch: an annotation-capable block type returns `false`
|
|
562
|
+
* for the `annotation` capability when the instance sets
|
|
563
|
+
* `props.annotations.disable: true` in its tpl config. All other capabilities
|
|
564
|
+
* (and the no-instance form) fall through to the plain type-level check, so
|
|
565
|
+
* existing 2-arg callers are unaffected.
|
|
566
|
+
*/
|
|
567
|
+
hasCapability(compType, capability, block) {
|
|
568
|
+
const def = this.blocks.get(compType);
|
|
569
|
+
if (!def) return false;
|
|
570
|
+
if (!def.capabilities[capability]) return false;
|
|
571
|
+
if (capability === "annotation" && block && this.isAnnotationDisabledForBlock(block)) {
|
|
572
|
+
return false;
|
|
573
|
+
}
|
|
574
|
+
return true;
|
|
575
|
+
}
|
|
576
|
+
/**
|
|
577
|
+
* Per-instance annotation kill-switch.
|
|
578
|
+
*
|
|
579
|
+
* A block type may be annotation-capable at the registry level (e.g.
|
|
580
|
+
* LexicalTextEditor has `capabilities.annotation === true`), but an individual
|
|
581
|
+
* block instance can be opted out of annotation entirely by setting
|
|
582
|
+
* `props.annotations.disable: true` in its tpl config. Generic and config-only:
|
|
583
|
+
* to stop annotation on any field, add that prop — no code change.
|
|
584
|
+
*
|
|
585
|
+
* The single home for this `props.annotations.disable` path (note: `annotations`
|
|
586
|
+
* plural, distinct from the legacy singular `annotation.enable`). Consumed
|
|
587
|
+
* internally by `hasCapability` and `getAnnotationEnabledBlocks`, and directly
|
|
588
|
+
* by consumers that must actively suppress annotation UI (e.g. the FE block
|
|
589
|
+
* generators forcing disableViewHighlights/disableCreateHighlights), where a
|
|
590
|
+
* type-level `false` isn't enough on its own.
|
|
591
|
+
*/
|
|
592
|
+
isAnnotationDisabledForBlock(block) {
|
|
593
|
+
return block?.props?.annotations?.disable === true;
|
|
561
594
|
}
|
|
562
595
|
/**
|
|
563
596
|
* Returns true if the block stores its value as an array (Mongo schema type is Array).
|
|
@@ -587,10 +620,19 @@ var BlockRegistry = class {
|
|
|
587
620
|
* For backwards compat with un-migrated blocks (e.g. deprecated KPRichInput/RichTextEditor),
|
|
588
621
|
* falls back to the legacy per-instance `props.annotation.enable` toggle.
|
|
589
622
|
*
|
|
590
|
-
*
|
|
623
|
+
* Per-instance kill-switch: any block is excluded when its tpl config sets
|
|
624
|
+
* `props.annotations.disable: true`, regardless of type-level capability. This
|
|
625
|
+
* is the single, config-only way to turn off annotation for a specific field —
|
|
626
|
+
* and because this method is the central gate used across every repo, the
|
|
627
|
+
* switch applies everywhere (annotate UI, AI auto-annotation, explorer,
|
|
628
|
+
* chunking/anno sync, filters).
|
|
629
|
+
*
|
|
630
|
+
* Today: every registered annotation-capable block (e.g. LexicalTextEditor) is
|
|
631
|
+
* auto-enabled unless explicitly disabled on the instance.
|
|
591
632
|
*/
|
|
592
633
|
getAnnotationEnabledBlocks(allBlocks) {
|
|
593
634
|
return allBlocks.filter((block) => {
|
|
635
|
+
if (this.isAnnotationDisabledForBlock(block)) return false;
|
|
594
636
|
const blockDef = this.blocks.get(block.comp);
|
|
595
637
|
if (blockDef) return !!blockDef.capabilities.annotation;
|
|
596
638
|
return block.props?.annotation?.enable === true;
|