Hi,
I did the tutorial “Use highlighted text in Confluence Forge app” described here: https://developer.atlassian.com/platform/forge/create-confluence-contextmenu-module/
First, I recognized that the following code ist not correct
import ForgeUI, { render, ContextMenu, InlineDialog, Text, Strong, useProductContext } from '@forge/ui';
const App = () => {
const { extensionContext: { selectedText } } = useProductContext();
return (
<InlineDialog>
<Text><Strong>Selected text</Strong></Text>
<Text>selectedText</Text>
</InlineDialog>
);
};
export const run = render(
<ContextMenu><App/></ContextMenu>
);
It leads to this result
It needs to be {selectedText} to be correct.
However, this is just a small issue. What I want to ask is if it is possible to provide the selected text not trimmed and ignoring line breaks but the actual selectedText, meaning HTML or wiki style?
If I select a text containing a line break it removes the line break completely and shows the words directly after each other:
Also, if you have a space at beginning or end of the selected text it gets trimmed and displayed without those spaces.
Is it already possible to get the actual selected string or is it planned to change that?