Skip to content

Best way to set view theme when adding new view to workspace through contextmenu #1936

Answered by GREEB
GREEB asked this question in Q&A
Discussion options

You must be logged in to vote

for now i fixed this with this. i'm sure there is a better way

    workspace.current.addEventListener(
      "workspace-new-view", async () => {

          if (workspace.current.children[0].attributes.getNamedItem('name') === null){           
            for (let i = 0; i < workspace.current.children.length; i++) {
              await workspace.current.children[i].restore({ theme: (theme === "light") ? "Material Light" : "Material Dark" })
            }
            await workspace.current.flush()
          }

      }
    );

update above version only works when workspace empty something like that would help if you add a new empty table to a workspace with views:

 for (let index = 0; index < 

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@texodus
Comment options

@GREEB
Comment options

Answer selected by GREEB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants