codex-team / codex-team/editor.js

Placing the block tunes location next to the block item instead of on the far left/right

Open
#2,152 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
31.9k
Forks
2.2k
Avg merge
1d 1h
Merged PRs (30d)
1

Description

Having float left/right for images is a common thing when writing an article. Most editors have this feature. However, most editors will display their toolbar directly above the block and leave it open so any changes to the block is still clickable. However, for editor.js, it will be on the far left/right which is not so obvious and when you float, becomes difficult to select the element.

I managed to create a workaround this issue by adding the following inside moveAndOpen function:
this.nodes.wrapper.style.left="".concat(Math.floor(((t.holder.querySelector('.ce-block__content').firstChild.offsetLeft > 0)?t.holder.querySelector('.ce-block__content').offsetLeft:0) + t.holder.querySelector('.ce-block__content').firstChild.offsetLeft),"px")

The element with ce-block__content class would need to have a z-index high enough to make it selectable. Float should be on the image block (Eg: simple-image)

However, this method does not take into account rtl

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.