Suggest popular background colors, add transparency support

Making the UI more user-friendly by suggesting some commonly used colors in the Settings menu
This commit is contained in:
MassiveBox 2025-05-05 19:17:59 +02:00
parent 1ad26d1e23
commit fa3eba219e
Signed by: massivebox
GPG key ID: 9B74D3A59181947D
4 changed files with 52 additions and 21 deletions

View file

@ -80,6 +80,11 @@ export class PluginEditor {
const toolbar = this.editor.addToolbar();
// save button
const saveButton = toolbar.addSaveButton(async () => {
await this.saveCallback(saveButton);
});
// restore toolbarFile state
this.toolbarFile = new PluginFile(STORAGE_PATH, TOOLBAR_FILENAME, JSON_MIME);
await this.toolbarFile.loadFromSiYuanFS();
@ -87,11 +92,6 @@ export class PluginEditor {
toolbar.deserializeState(this.toolbarFile.getContent());
}
// save button
const saveButton = toolbar.addSaveButton(async () => {
await this.saveCallback(saveButton);
});
// save toolbar config on tool change (toolbar state is not saved in SVGs!)
this.editor.notifier.on(EditorEventType.ToolUpdated, () => {
this.toolbarFile.setContent(toolbar.serializeState());