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

feat(inline-toolbar): inline tools now can be used in the readonly mode #2832

Merged
merged 3 commits into from
Oct 8, 2024

Conversation

neSpecc
Copy link
Member

@neSpecc neSpecc commented Sep 28, 2024

Inline Toolbar now can be shown in read-only mode. Can be useful for tools like "Comments".

Inline Tools now can specify isReadOnlySupported static getter. If at least one such tool is available, the Inline Toolbar will be shown.

image

@@ -54,7 +55,7 @@ export default class InlineToolbar extends Module<InlineToolbarNodes> {
/**
* Currently visible tools instances
*/
private toolsInstances: Map<string, IInlineTool> | null = new Map();
private tools: Map<InlineToolAdapter, IInlineTool> = new Map();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WeakMap maybe?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can't iterate over WeakMap

return currentBlock.tool.inlineTools.size !== 0;
/**
* Inline toolbar will be shown only if the target is contenteditable
* In Read-Only mode, the target should be contenteditable with "false" value
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have this documented somewhere?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not yet, it's the new behavior

@neSpecc neSpecc merged commit 2275ddf into next Oct 8, 2024
6 checks passed
@neSpecc neSpecc deleted the inline-tools-readonly branch October 8, 2024 08:38
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

Successfully merging this pull request may close these issues.

2 participants