@flozy/editor 3.7.9 → 3.8.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -163,20 +163,24 @@ export const isMarkBtnActive = (editor, format) => {
163
163
  }
164
164
  };
165
165
  export const getSelectedElementStyle = (styleProperty, editor) => {
166
- if (!editor.selection) {
167
- return "";
168
- }
169
- if (Range.isCollapsed(editor.selection)) {
170
- return "";
171
- }
172
- const domRange = ReactEditor.toDOMRange(editor, editor.selection);
173
- const selectedDomNode = domRange.commonAncestorContainer;
166
+ try {
167
+ if (!editor.selection) {
168
+ return "";
169
+ }
170
+ if (Range.isCollapsed(editor.selection)) {
171
+ return "";
172
+ }
173
+ const domRange = ReactEditor.toDOMRange(editor, editor.selection);
174
+ const selectedDomNode = domRange.commonAncestorContainer;
174
175
 
175
- // If it's a text node, get its parent element
176
- const selectedElement = selectedDomNode.nodeType === 3 ? selectedDomNode.parentElement : selectedDomNode;
177
- if (selectedElement) {
178
- const computedStyle = window.getComputedStyle(selectedElement);
179
- return computedStyle.getPropertyValue(styleProperty) || "";
176
+ // If it's a text node, get its parent element
177
+ const selectedElement = selectedDomNode.nodeType === 3 ? selectedDomNode.parentElement : selectedDomNode;
178
+ if (selectedElement) {
179
+ const computedStyle = window.getComputedStyle(selectedElement);
180
+ return computedStyle.getPropertyValue(styleProperty) || "";
181
+ }
182
+ } catch (err) {
183
+ console.log(err);
180
184
  }
181
185
  };
182
186
  export const isBlockActive = (editor, format) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flozy/editor",
3
- "version": "3.7.9",
3
+ "version": "3.8.1",
4
4
  "description": "An Editor for flozy app brain",
5
5
  "files": [
6
6
  "dist"