@trebco/treb 31.7.8 → 31.8.2

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.
@@ -956,6 +956,33 @@ export class Grid extends GridBase {
956
956
 
957
957
  const elements = [node, ...this.layout.GetFrozenAnnotations(annotation)];
958
958
 
959
+ if (event.ctrlKey || (UA.is_mac && event.metaKey)) {
960
+
961
+ const annotation_style = annotation.data.style ? { ...annotation.data.style } : {};
962
+ let handled = true;
963
+
964
+ switch (event.key) {
965
+ case 'b':
966
+ this.ApplyAnnotationStyle({bold: !annotation_style.bold});
967
+ break;
968
+ case 'i':
969
+ this.ApplyAnnotationStyle({italic: !annotation_style.italic});
970
+ break;
971
+ case 'u':
972
+ this.ApplyAnnotationStyle({underline: !annotation_style.underline});
973
+ break;
974
+ default:
975
+ handled = false;
976
+ }
977
+
978
+ if (handled) {
979
+ event.stopPropagation();
980
+ event.preventDefault();
981
+ return;
982
+ }
983
+
984
+ }
985
+
959
986
  const target = { x: rect.left, y: rect.top };
960
987
  switch (event.key) {
961
988
  case 'ArrowUp':
@@ -1773,9 +1800,17 @@ export class Grid extends GridBase {
1773
1800
  if (this.selected_annotation) {
1774
1801
 
1775
1802
  const annotation = this.selected_annotation;
1803
+
1804
+ // we need to adjust textbox paragraph styles so they don't
1805
+ // override the annotation style. OR, we need to apply this
1806
+ // styling to the paragraphs. the former sounds better to me,
1807
+ // but then if we allow you to edit the paragraphs we'll have
1808
+ // to adjust the annotation style later. not sure which is
1809
+ // preferable.
1810
+
1776
1811
  annotation.data.style = JSON.parse(JSON.stringify(
1777
- delta ? Style.Composite([annotation.data.style || {}, style]) : style
1778
- ));
1812
+ delta ? Style.Composite([annotation.data.style || {}, style]) : style));
1813
+
1779
1814
  const node = annotation.view[this.view_index]?.node;
1780
1815
 
1781
1816
  this.layout.UpdateAnnotation(annotation, this.theme);