Skip to content
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

[BUG] The buttons on the left panel are displayed incorrectly. #230

Open
bav2653 opened this issue Sep 15, 2024 · 1 comment
Open

[BUG] The buttons on the left panel are displayed incorrectly. #230

bav2653 opened this issue Sep 15, 2024 · 1 comment

Comments

@bav2653
Copy link

bav2653 commented Sep 15, 2024

If all buttons are enabled, they are displayed incorrectly on the left panel. This is noticeable when the program is restarted.

Another extension, "Commander", helps me solve this problem.

Obsidian_rB6TqK8R2o_1222.mp4
@doug-w
Copy link

doug-w commented Sep 30, 2024

The issue is in configureRibbonIcons:

  private configureRibbonIcons() {
    this.ribbonEl?.detach();

    const configuredGranularities = this.calendarSetManager.getActiveGranularities();
    if (configuredGranularities.length) {
      const granularity = configuredGranularities[0];
      const config = displayConfigs[granularity];
      this.ribbonEl = this.addRibbonIcon(
        `calendar-${granularity}`,
        config.labelOpenPresent,
        (e: MouseEvent) => {
          if (e.type !== "auxclick") {
            this.openPeriodicNote(granularity, window.moment(), {
              inNewSplit: isMetaPressed(e),
            });
          }
        }
      );
      this.ribbonEl.addEventListener("contextmenu", (e: MouseEvent) => {
        e.preventDefault();
        showFileMenu(this.app, this, {
          x: e.pageX,
          y: e.pageY,
        });
      });
    }
  }

it only looks at configuredGranularities[0] and so only the first active Granularity is added after the Layout is ready. I've worked around this with 2 active configurations one with daily/weekly the other weekly only, and a hotkey to swap between them. After load I push that. ribbonEl isn't an array so I didn't easily fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants