Hi Ton

> On 28 Jan 2018, at 19:06, Ton Gerner <[email protected]> wrote:
> 
> To be honest I do not have an explanation why it does not work with the 
> iframe editor.
> Maybe someone else can help you.

The reason that custom fonts doesn’t work with the editor toolbar is because of 
the way that it creates the textarea element within an embedded iframe (this is 
done so that the selection in the textarea isn’t lost when the user clicks on a 
toolbar button and the textarea loses focus).

The iframe doesn’t inherit any of the styles in the main document, so the code 
actually creates a hidden textarea and then reads back the styles, and then 
applies them to the textarea in the iframe. That means that any formatting 
applied to the textarea will be faithfully reproduced within the iframe. 
However, it only works for CSS properties applied directly to the textarea; it 
doesn’t transfer fonts, animations or other resources that can be defined in 
CSS.

(The code is here: 
https://github.com/Jermolene/TiddlyWiki5/blob/master/core/modules/editor/engines/framed.js
 
<https://github.com/Jermolene/TiddlyWiki5/blob/master/core/modules/editor/engines/framed.js>)

We could update things so that special stylesheets identified by a new system 
tag such as $:/tags/Stylesheet/FramedEditor would be automatically inserted 
within the iframe. 

Best wishes

Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/6750CC67-E81F-41DC-8440-AF7964058DFA%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to