The getSelection function does not work correctly with text

  • 15 February 2023
  • 6 replies
  • 79 views

Badge +2

Hello.

I have selected a text widget on the board (Figure 1)

If you write such a code:
 

const selection = await miro.board.getSelection();
console.log(selection, 'selection');

and select the widget text, then the following is output to the console:

We see that the fields "content", "FontFamily" and "fontSize" are displayed incorrectly. Sometimes the widget creation date is incorrectly determined.

This code does not work in my plugin and in the console. At the same time, it WORKED yesterday! In addition, the code works correctly with other widgets (for example, stickers). Why is this happening?


6 replies

Userlevel 2
Badge +1

Hi @Anton Shherbinin

 

Thank you for reaching out, and apologies for the issue you encountered.

Timestamps related to creation (createdAt) and update (modifiedAt) are always in UTC time, regardless of the time offset configured on the machine where the app runs, or the code is executed.

The mention of a trailing Z offset in the reference documentation means UTC time. Apologies for this part being unclear: we'll make this point explicit.

The link below points to a video where I followed the steps to create a text item, select it, and then print the JSON representation of the text item to the console: I could not reproduce the issue.

Loom video reproducing the issue

Is the issue persisting on your end?

If so, could you share more details to help me reproduce it on my end?

 

Best,
marco
 
Technical writer | Developer support | DevX

Badge +2

Thank you for your response.
Yes, the problem remains. I have tried typing this code in different browsers (Mozilla Firefox and Google Chrome). I went to different teams on different boards. Moreover, I logged into another account on another computer, but that didn't help either, the code doesn't work correctly with the text.

Userlevel 2
Badge +1

Hi @Anton Shherbinin,

Thank you for your reply. I'm sorry that the problem persists. Let me check with the engineers who own the Web SDK to see if they can help me identify what is causing your issue.

Best,
marco
 
Technical writer | Developer support | DevX

Badge +2

Thank you very much, I will be waiting for an answer.

Userlevel 2
Badge +1

Hi @Anton Shherbinin,

A Web SDK engineer could reproduce your issue.
They just merged the PR with the fix to solve it. The fix should become available in production early next week.

Apologies for the nuisance this created for you, and thank you very much for reporting it so clearly!

Best,
marco
 
Technical writer | Developer support | DevX

Userlevel 2
Badge +1

Hi @Anton Shherbinin,

The fix is in production.

To check that the fix works:

  • Open a board in incognito mode.
  • or:
    1. Open the developer tools in your browser.
    2. Select the Application tab.
    3. On the left side navigation, go to Storage.
    4. Under Storage, clear any data related to Miro / miro.com
  • or: open a Miro board in a "clean" browser: a browser that you have not previously used to open Miro boards.

Best,
marco
 
Technical writer | Developer support | DevX

Reply