Change layout (RTL/LTR) when editing tiddler

86 views
Skip to first unread message

Amit Shady

unread,
Apr 17, 2023, 2:05:29 PM4/17/23
to TiddlyWiki
Hello,

I'm facing an issue while editing a tiddler where I'm unable to switch between RTL/TLR using the "Control+Shift" shortcut. I have noticed that this problem is resolved when I hide the toolbar, but I haven't been able to find any solutions to this issue online.

Can anyone suggest a possible solution to fix this issue?

Amit Shady

unread,
Apr 21, 2023, 4:07:34 PM4/21/23
to TiddlyWiki
found a possible solution, I've modified the copyStyles function in    $:/core/modules/editor/engines/framed.js 
by adding removeProperty('direction'), it is no longer forces the direction to 'ltr'
FramedEngine.prototype.copyStyles = function() { // Copy all styles $tw.utils.copyStyles(this.dummyTextArea,this.domNode); // Override the ones that should not be set the same as the dummy textarea this.domNode.style.display = "block"; this.domNode.style.width = "100%"; this.domNode.style.margin = "0"; // In Chrome setting -webkit-text-fill-color overrides the placeholder text colour this.domNode.style["-webkit-text-fill-color"] = "currentcolor"; this.domNode.style.removeProperty('direction'); /// <-- this will remove the direction:ltr from the editor style };

Mohammad

unread,
Apr 22, 2023, 12:36:12 AM4/22/23
to TiddlyWiki
To be seen correctly in Talk. The original post is re-formatted.

found a possible solution, I've modified the `copyStyles` function in    `$:/core/modules/editor/engines/framed.js`
by adding `removeProperty('direction')`, it is no longer forces the direction to `ltr`

```
FramedEngine.prototype.copyStyles = function() {
    // Copy all styles
    $tw.utils.copyStyles(this.dummyTextArea,this.domNode);
    // Override the ones that should not be set the same as the dummy textarea
    this.domNode.style.display = "block";
    this.domNode.style.width = "100%";
    this.domNode.style.margin = "0";
    // In Chrome setting -webkit-text-fill-color overrides the placeholder text colour
    this.domNode.style["-webkit-text-fill-color"] = "currentcolor";
    this.domNode.style.removeProperty('direction'); /// <-- this will remove the direction:ltr from the editor style
};
```

Jeremy Ruston

unread,
Apr 22, 2023, 4:40:30 AM4/22/23
to TiddlyWiki
Thanks Amit, Mohammad,

I've created a PR with this change, please let me know how it works for you,


Best wishes

Jeremy

Reply all
Reply to author
Forward
0 new messages