TiddlyWiki5 icon indicating copy to clipboard operation
TiddlyWiki5 copied to clipboard

Fix/sjcl variable

Open linonetwo opened this issue 11 months ago • 1 comments

https://github.com/Jermolene/TiddlyWiki5/pull/8043#issuecomment-2009207102 does not fix my problem, I get error Can't create duplicate variable: 'A' on iOS webview on TidGi mobile when init TW.

And I find sjcl.js 's internal this.A=xxx leak to window, where this is window. And later it does function A(){xxx}, and cause error on iOS. See this on tw5-com

图片

In this PR I wrap IIFE to sjcl.js by using tiddlywiki.files. (I have to move sjcl.js to /lib, otherwise tiddlywiki.files will prevent boot.js from loading, don't know why.)

I also change sha256 to use $tw.sjcl, but this is not necessary, because we have to mount sjcl to window.sjcl before booting, when $tw is not init yet. Unless we can init $tw = {} before library.

linonetwo avatar Mar 21 '24 12:03 linonetwo

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

Name Status Preview Updated (UTC)
tiddlywiki5 ✅ Ready (Inspect) Visit Preview May 25, 2024 4:19am

vercel[bot] avatar Mar 21 '24 12:03 vercel[bot]

@linonetwo, I've committed a programmer sin; I just opened a PR for this fix without checking that anyone else already had. I just assumed that nobody else would have noticed this problem than me, the Uglify maker.

I actually think your fix is better, so I'll close my PR and vouch for yours.

flibbles avatar May 18 '24 15:05 flibbles

Thanks @linonetwo I think it would be better for backwards compatibility to move sjcl.js back into /boot. To avoid the problem you ran into we just need to explicitly list boot.css, boot.js and bootprefix.js in tiddlywiki.files

Jermolene avatar May 20 '24 17:05 Jermolene

I was about to write tiddlywiki galgame plugin today, but I think about it, if this PR only takes 5 min to refactor, then I should tend to this.

linonetwo avatar May 25 '24 04:05 linonetwo

Thanks @linonetwo much appreciated

Jermolene avatar May 26 '24 14:05 Jermolene

@Jermolene -- This PR breaks the RSOD popup.

I did test the following code with the latest master and it broke the popup See: screenshot

\define re() (color)|(colour)ed

\define str() Something coloured

{{{ [<str>splitregexp<re>] }}}

image

pmario avatar May 27 '24 10:05 pmario

截屏2024-05-27 18 15 47

Looks like some core css (.tc-error-form) is missing, maybe is caused by tiddlywiki.files added in last commit

linonetwo avatar May 27 '24 10:05 linonetwo

I forget to add style system tag to it, let me PR a quick fix.

linonetwo avatar May 27 '24 10:05 linonetwo