antvis / G6VP

G6VP is an online visual analysis tool for graphs and a low-code platform for building graph applications.

Home Page:https://insight.antv.antgroup.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Recommendation

RackweLLizm opened this issue · comments

@pomelo-nwu
I am actively using the New Tab feature on G6VP.
In addition, there are many plugins and codes I have written externally in the project.
For example; I use CTRL-C CTRL-V CTRL-A key combinations to perform operations on the canvas

Issue:
When I ctrl c in any new tab, context.GISDK id does not give the id of the currently active tab. it operates on the default tab.

Solution:
Path: node_modules@antv\gi-assets-advance\es\components\Sheetbar

 return /*#__PURE__*/React.createElement("div", {
        key: sheetId,
        onClick: function onClick() {
          handleReCover(sheetId);
        },
        className: isActive ? `active ${sheetId}` : `${sheetId}`,
        style: {
          colour: "".concat(isActive ? 'var(--primary-color)' : 'var(--text-color)'),
          padding: '0px 0px 0px 0px 12px',
          cursor: 'pointer',
          background: "".concat(isActive ? 'var(--background-color-2)' : 'var(--background-color)')
        }
      },

className: isActive ?active ${sheetId}:${sheetId},
In this way, by adding the id of the current sheet to the active classname, I can ensure that the user always operates on the active tab.

In my comprehensive solution, I can save the context of each tab in the store and, for example, access the context instance with store.contextId.find(activeContextId) and perform operations on that tab.

I wanted to share it in case it would be useful

With love