-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Fix and enhance comment editor monospace toggle #36181
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: main
Are you sure you want to change the base?
Changes from all commits
4f9c25b
8fcfbb7
439bf5a
f45185d
f29f63a
9f13c21
f10ab8d
f30f4a0
8dea163
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| /** Get a setting from localStorage */ | ||
| export function getLocalStorageSetting(key: string) { | ||
| return localStorage?.getItem(key); | ||
| } | ||
|
|
||
| /** Set a setting in localStorage */ | ||
| export function setLocalStorageSetting(key: string, value: string) { | ||
| return localStorage?.setItem(key, value); | ||
| } | ||
|
Comment on lines
+1
to
+9
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How do these two wrapper functions help? Why not just write
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The wrappers are in preparation to synchronize these settings with the server, e.g. the current settings would be rendered into Maybe the functions should have a better name like
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thought this |
||
|
|
||
| /** Add a listener to the 'storage' event for given setting key. This event only fires in non-current tabs. */ | ||
| export function addLocalStorageChangeListener(key: string, listener: (e: StorageEvent) => void) { | ||
| window.addEventListener('storage', (e: StorageEvent) => { | ||
| if (e.storageArea === localStorage && e.key === key) { | ||
| listener(e); | ||
| } | ||
| }); | ||
| } | ||
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.
It should be a method of
ComboMarkdownEditorAnd to change others,
getComboMarkdownEditorand call their instance's method.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.
Might be possible if there's a way to get references to all current
ComboMarkdownEditoron the page.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.
Use
getComboMarkdownEditorfor the related elements to get all current ComboMarkdownEditor instances