seatable-html-page-sdk 0.0.13-beta.2 → 0.0.13-beta.3

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/index.js CHANGED
@@ -4636,22 +4636,19 @@
4636
4636
  event.stopPropagation();
4637
4637
  event.stopImmediatePropagation();
4638
4638
  const target = event.target;
4639
+ const isBodyOrHtml = target === document.body || target === document.documentElement;
4639
4640
  if (event.type === 'mouseover') {
4640
- const data = this.buildElementData(target);
4641
- if (data) {
4642
- window.parent.postMessage({
4643
- type: POST_MESSAGE_TYPE.HTML_PAGE_COMMENT_MODE_ELEMENT_HOVER,
4644
- data
4645
- }, '*');
4646
- }
4641
+ const data = isBodyOrHtml ? null : this.buildElementData(target);
4642
+ window.parent.postMessage({
4643
+ type: POST_MESSAGE_TYPE.HTML_PAGE_COMMENT_MODE_ELEMENT_HOVER,
4644
+ data
4645
+ }, '*');
4647
4646
  } else if (event.type === 'click') {
4648
- const data = this.buildElementData(target);
4649
- if (data) {
4650
- window.parent.postMessage({
4651
- type: POST_MESSAGE_TYPE.HTML_PAGE_COMMENT_MODE_ELEMENT_SELECTED,
4652
- data
4653
- }, '*');
4654
- }
4647
+ const data = isBodyOrHtml ? null : this.buildElementData(target);
4648
+ window.parent.postMessage({
4649
+ type: POST_MESSAGE_TYPE.HTML_PAGE_COMMENT_MODE_ELEMENT_SELECTED,
4650
+ data
4651
+ }, '*');
4655
4652
  }
4656
4653
  }
4657
4654
  buildElementData(target) {
@@ -4876,6 +4873,9 @@
4876
4873
  eventType,
4877
4874
  payload
4878
4875
  } = event.data;
4876
+ if (type && type.includes('COMMENT')) {
4877
+ console.log('--- SDK handleMessage ---', type);
4878
+ }
4879
4879
  if (type === POST_MESSAGE_TYPE.HTML_PAGE_RESPONSE) {
4880
4880
  const pending = this.pendingRequests[requestId];
4881
4881
  if (pending) {