Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/src/actions/preview.js b/src/actions/preview.js
- index 5055466..2ba459c 100644
- --- a/src/actions/preview.js
- +++ b/src/actions/preview.js
- @@ -131,16 +131,21 @@ export function updatePreview(target: HTMLElement, editor: any) {
- }
- if (preview) {
- + console.log(`> preview`, { preview, target, tokenPos, cursorPos });
- // Return early if we are currently showing another preview or
- // if we are mousing over the same token as before
- if (preview.updating || isEqual(preview.tokenPos, tokenPos)) {
- + console.log("> bailing early");
- return;
- }
- // We are mousing over a new token that is not in the preview
- - if (!target.classList.contains("debug-expression")) {
- + if (!target.classList.contains("preview-selection")) {
- + console.log("> Clearing!");
- dispatch(clearPreview());
- }
- + } else {
- + console.log(`> no preview`);
- }
- if (isInvalidTarget(target)) {
- @@ -154,6 +159,16 @@ export function updatePreview(target: HTMLElement, editor: any) {
- return;
- }
- + target.onmouseleave = e => {
- + console.log(`leaving`, target, `currently on`, e.target);
- +
- + // if we want to clear it
- +
- + // clear preview
- + // unbind the handler
- + target.onmouseleave = null;
- + };
- +
- const source = getSelectedSource(getState());
- const symbols = getSymbols(getState(), source);
- diff --git a/src/components/Editor/Preview/index.js b/src/components/Editor/Preview/index.js
- index 1077ed6..bd34f1c 100644
- --- a/src/components/Editor/Preview/index.js
- +++ b/src/components/Editor/Preview/index.js
- @@ -65,6 +65,7 @@ class Preview extends PureComponent<Props, State> {
- onMouseOver = e => {
- const { target } = e;
- + console.log("> mouse over", e);
- this.props.updatePreview(target, this.props.editor);
- };
- @@ -75,6 +76,7 @@ class Preview extends PureComponent<Props, State> {
- onMouseDown = () => {
- this.setState({ selecting: true });
- + this.props.clearPreview();
- return true;
- };
Add Comment
Please, Sign In to add comment