-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Root stylesheet refresh - Stylesheets in single <style>
tags
#8130
base: master
Are you sure you want to change the base?
Root stylesheet refresh - Stylesheets in single <style>
tags
#8130
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please take my ViewHandler comments with a "bit of salt", I think I'm not 100% sure what it actually should do.
The wiki itself seems to work, and the styles are added to the HEAD element
core/modules/startup/render.js
Outdated
$tw.styleElement.innerHTML = $tw.styleWidgetNode.assignedStyles; | ||
document.head.insertBefore($tw.styleElement,document.head.firstChild); | ||
|
||
var styleParser = $tw.wiki.parseTiddler("$:/core/ui/RootStylesheet",{parseAsInline: true}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO $:/core/ui/RootStylesheet
should also be added as a constant at the beginning of the code. see: PAGE_STYLESHEET_TITLE
but it should be named PAGE_STYLESHEET_ROOT
now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes you're right, I forgot to change that. Good thinking about the new name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @pmario - I wasn't sure about how to name the constant, so I left PAGE_STYLESHEET_TITLE
untouched and added ROOT_STYLESHEET_TITLE
and use that title
@@ -1,5 +1,7 @@ | |||
title: $:/themes/tiddlywiki/vanilla/reset | |||
type: text/css | |||
tags: $:/tags/Stylesheet $:/tags/Stylesheet/Static | |||
list-before: $:/themes/tiddlywiki/vanilla/base |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmmm, IMO that's not possible. If a user modifies the sort order by hand this shadow tiddler is converted to a system-tiddler and the list-before
field is removed. -> That can lead to future problems for the user, if we change the reset.css
again, because it is no shadow anymore
We will probably need to rename the tiddler to $:/themes/tiddlywiki/vanilla/_reset
, so it will be automatically listed in front.
@Jermolene -- The problem is, that renaming is not 100% backwards compatible
This PR now uses the |
This PR is a follow-up to #8106 , #8118 and #8125
It's also related to the discussion #8128
This puts every tiddler tagged
$:/tags/Stylesheet
into its own<style>
tag at theBOTTOM
of the<head>
section.Why at the bottom? The
list
widget in$:/core/ui/RootStylesheet
handles inserting and removing its list items all by itself. It does so by appending at the end of the<head>
section. That's why from the beginning inrender.js
andwindows.js
I render thestyleWidgetNode
into the end of the<head>
section and let thelist
widget do its "natural" flow.This uses a modified
view
widget that's included in this PR. I'm not sure if I got @Jermolene right how it should be done but that's my try on it. It updates thetextContent
of its generateddomNode
in case the format isplainwikified
,htmlwikified
orhtmlencodedplainwikified
and the content changes, through a contained macro for example that changes.The
$:/core/ui/RootStylesheet
distinguishes between standard Stylesheet tiddlers and Stylesheet tiddlers tagged$:/tags/Stylesheet/Static
. In the latter case they are rendered as text and not refreshed which (I hope) makes it possible to save refresh time if we put static content into static Stylesheet tiddlers.I open this as a draft PR since it has Performance Instrumentation enabled and the code might change based on the feedback I get.