Skip to content

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

Merged
neSpecc merged 3 commits intonextfrom
inline-tools-readonly
Oct 8, 2024
Merged

feat(inline-toolbar): inline tools now can be used in the readonly mode#2832
neSpecc merged 3 commits intonextfrom
inline-tools-readonly

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

* 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
@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