codex-team / codex-team/editor.js

Paste Config Improvement: add support for a filter function in pasteConfig to allow matching elements by attributes

Open
#2,959 17 comments 2 reactions 0 assignees View on GitHub
good first issue
Dominant language
TypeScript
Stars
31.9k
Forks
2.2k
Avg merge
1d 1h
Merged PRs (30d)
1

Description

**Motivation**

* Need a central place to validate/normalize app-generated paste payloads.
* Current gaps:

* Multiline paste: `patterns` aren’t applied because payload is treated as HTML.
* Can’t apply cross-line rules (e.g., “entire bold line → header”) before blocks are created.
* Special formatting cases are hard to solve tool-by-tool (see #2909).

**Proposal**

* Add a top-level `pasteInterceptor` option that receives `PasteData`(s) and can transform/validate them **before** insertion.

**Prior art / PoC**

* Special formatting context: [https://github.com/codex-team/editor.js/issues/2909](https://github.com/codex-team/editor.js/issues/2909)
* Minimal implementation sketch: [https://github.com/tylox-team/editor.js/commit/d3d88da262541257c3659ea827a35692445360e4](https://github.com/tylox-team/editor.js/commit/d3d88da262541257c3659ea827a35692445360e4)

**Next steps**

* If this sounds reasonable, I can open a PR with the solution.

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.