-
Notifications
You must be signed in to change notification settings - Fork 60
jwArrayHandler and dogeiscutObjectHandler now work for both strings and HTML #166
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
base: develop
Are you sure you want to change the base?
Conversation
|
i'm against this. in your screenshot, it shows invalid json. i don't think we should have raw html elements in json |
it alredy allows html(which is useful): https://github.com/PenguinMod/PenguinMod-ExtensionsGallery/blob/main/static/extensions/DogeisCut/dogeiscutObject.js#L181 |
|
It showing html when stringified is actually a bug, not sure when it came it as this used to work properly but- It's supposed to call toJson on the color value when stringified |
|
shouldn't the tostring method just be identical to array toString(pretty = false) {
return JSON.stringify(this.toJSON(), null, pretty ? "\t" : null)
} |
|
I cant remember why i overcomplicated it |
|
and indeed your function works fine, no idea why i had a custom solution |
|
ykw it might've been a leftover from when i was still trying to make this support recursive objects |
|
do we just change how dogeiscutObjectHandler is used? cause then we can just close the PR |
|
its important that not all javascript objects inside dogeiscut objects are displayed like a dogeiscut object |
|
? |
but the current solution can't be good either as it treats any JS object like a dogeiscutObject |




Resolves
dogeiscutObjectHandleris used to represent items of an object.(jwArrayHandleris the same for arrays) It is used both for conversiontoStringand to HTML element. This is problematic as the object item e.g. can't know if it needs escape a string or if it can use html elements or not.Proposed Changes
I tried another solution but it was rightfully rejected: PR 411.
Add arguments to these handlers that specify expected return type and environment context(e.g. for a string, array representation or object representation).
Important
As PM extensions are split between
PenguinMod-VmandPenguinMod-ExtensionsGallery, I had two create two seperate pull requests:this one and PR