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

Fix per-tiddler previews #7900

Merged
merged 3 commits into from
Dec 21, 2023
Merged

Conversation

yaisog
Copy link
Contributor

@yaisog yaisog commented Dec 20, 2023

This is a fix for #7893.

Basically, it reverts the parts of #7747 that use a function in the EditTemplate in favor of setting the variable editPreviewStateTiddler which is also referred to in the preview button code. Otherwise, the qualify macro yields different state tiddlers and previews cannot be activated.

In one fell swoop, I also streamlined the preview button code to make use of inline filters instead of multiple RevealWidgets. This reduces it to three lines. It could be rolled back, of course, if we want to be conservative there.

Needed in case this is targeted in CSS; DOM structure should not be changed.
Copy link

vercel bot commented Dec 20, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
tiddlywiki5 ✅ Ready (Inspect) Visit Preview Dec 20, 2023 8:26am

Do it once, do it right.
@Jermolene
Copy link
Member

Thank you @yaisog I've added this to #7856 where we're tracking the fixes for 5.3.3

@pmario
Copy link
Member

pmario commented Dec 20, 2023

Basically, it reverts the parts of #7747 that use a function in the EditTemplate in favor of setting the variable editPreviewStateTiddler which is also referred to in the preview button code. Otherwise, the qualify macro yields different state tiddlers and previews cannot be activated.

If it does revert #7747 it also re-introduces the problem for issue #7745 with the codemirror 6 plugin.

So I think we should not use the qualify-macro to create a state name, IMO we should use the draft-tiddler-title to create a unique state tiddler.

Since the button and the editor preview should know this title, it should be possible to toggle the preview without redrawing the editor section.


@BurningTreeC ... Please test this preview https://tiddlywiki5-c5ljtb9p0-jermolene.vercel.app/ with the CM-6 plugin. Is the #7745 problem back with this preview version?

@BurningTreeC ... Does TW v5.3.2 work as expected with the CM6 plugin. If I do test the UI with the browser "paint flashing" active, it seems to redraw the editor

@yaisog
Copy link
Contributor Author

yaisog commented Dec 20, 2023

If I put a <$log /> into $:/core/ui/EditTemplate/body/editor, I can see in the console that the editor is redrawn upon turning the preview on/off. The behavior is the same in the PR preview as it is on tiddlywiki.com.

Since the class on the DIV surrounding the editor changes when the preview is toggled, I think it might not be possible to prevent the child redraw.

Maybe @Jermolene solved the problem by setting the focus back to the editor at the end of the button code? That is still in there, so it might work. I guess we'll have to wait for feedback from @BurningTreeC.

@Jermolene Jermolene merged commit 95e270a into TiddlyWiki:master Dec 21, 2023
4 checks passed
@yaisog yaisog deleted the fix-per-tiddler-preview branch December 21, 2023 11:40
munnox pushed a commit to munnox/TiddlyWiki5 that referenced this pull request Dec 24, 2023
* Initial commit

* Put SVG back into a span

Needed in case this is targeted in CSS; DOM structure should not be changed.

* Fix the fix

Do it once, do it right.
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