Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(inspectorMode): move inspectorMode outlines on top of the iframe [] #405

Merged
merged 2 commits into from
Nov 15, 2023

Conversation

chrishelgert
Copy link
Contributor

@chrishelgert chrishelgert commented Nov 7, 2023

Move the outlines and interactions of the tagged elements on top of the iframe

Benefit:

  • better handling
  • easier to add more integrations in contentful

Refactored:

  • Move types, constants and enums to the inspectorMode directory

Deprecates:

  • styles.css

@chrishelgert chrishelgert force-pushed the feat/inspector-interactions branch from 89953b0 to 4dddebb Compare November 7, 2023 15:03
@chrishelgert chrishelgert force-pushed the feat/inspector-interactions branch 3 times, most recently from d4588b6 to 9a336cb Compare November 13, 2023 14:41
@chrishelgert chrishelgert force-pushed the feat/inspector-interactions branch 7 times, most recently from 7b9d52d to 69dee6a Compare November 14, 2023 15:16
@chrishelgert chrishelgert requested a review from a team November 14, 2023 15:17
@chrishelgert chrishelgert marked this pull request as ready for review November 14, 2023 15:19
@chrishelgert chrishelgert force-pushed the feat/inspector-interactions branch from 69dee6a to f95a340 Compare November 14, 2023 15:41
...data,
method,
from: 'live-preview',
source: LIVE_PREVIEW_SDK_SOURCE,
location: window.location.href,
version,
};
} as MessageFromSDK;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

out of curiosity, why?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some overlap/confusion inside of typescript due all the different message types.
I will create a story to improve the types for the messages in general as it could produce errors

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay cool, thanks for explaining!

@@ -5,6 +5,15 @@ import type { SysLink } from 'contentful-management';

import type { LIVE_PREVIEW_EDITOR_SOURCE, LIVE_PREVIEW_SDK_SOURCE } from './constants';
import { sendMessageToEditor } from './helpers';
import {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import type for any of these?

@chrishelgert chrishelgert force-pushed the feat/inspector-interactions branch from f95a340 to cec5b46 Compare November 14, 2023 16:41
this.handleTaggedElement = this.handleTaggedElement.bind(this);
this.sendAllElements = this.sendAllElements.bind(this);

// Attach interaction listeners
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: maybe it's just me being super picky but I think the naming is a little confusing here as these functions are already "bound", I do understand that it's a different type of binding just as a suggestion maybe something like

  this.handleHoverEvents();
  this.handleScrollEvents();
  this.handleMutationObserverEvents();
  this.handleResizeEvents();

then the handlers are bound to the class instance 🤷🏻‍♂️

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or even this.addHoverEventListener... etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you want it, you get it :)
instead of bind it's now addXYZ

Copy link
Collaborator

@aodhagan-cf aodhagan-cf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! ⭐️

Copy link
Contributor

@YvesRijckaert YvesRijckaert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯 nice work!

@chrishelgert chrishelgert merged commit 473c8f5 into main Nov 15, 2023
3 checks passed
@chrishelgert chrishelgert deleted the feat/inspector-interactions branch November 15, 2023 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants