mirror of
https://github.com/discourse/discourse.git
synced 2025-05-28 13:51:18 +08:00
FEATURE: introduce a ProseMirror editor (#30815)
This is the first in a series of PRs to introduce a ProseMirror-based WYSIWYM editor experience alongside our current textarea Markdown editor. Behind a hidden site setting, this PR adds a toggle to the composer toolbar, allowing users to switch between the two options. Our implementation builds upon the excellent ProseMirror and its non-core Markdown module, using the module's schema, parsing, and serialization definitions as the base for further Discourse-specific features. An extension API is included to enable further customizations. The necessary extensions to support all Discourse's core and core plugins features **will be implemented in subsequent PRs**. --------- Co-authored-by: David Taylor <david@taylorhq.com>
This commit is contained in:
@ -658,7 +658,11 @@ export default class ChatChannel extends Component {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!target || /^(INPUT|TEXTAREA|SELECT)$/.test(target.tagName)) {
|
||||
if (
|
||||
!target ||
|
||||
/^(INPUT|TEXTAREA|SELECT)$/.test(target.tagName) ||
|
||||
target.closest('[contenteditable="true"]')
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -58,10 +58,10 @@ export default {
|
||||
const inputs = ["input", "textarea", "select", "button"];
|
||||
const elementTagName = el?.tagName.toLowerCase();
|
||||
|
||||
if (inputs.includes(elementTagName)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return (
|
||||
inputs.includes(elementTagName) ||
|
||||
!!el?.closest('[contenteditable="true"]')
|
||||
);
|
||||
};
|
||||
const modifyComposerSelection = (event, type) => {
|
||||
if (!isChatComposer(event.target)) {
|
||||
@ -87,7 +87,7 @@ export default {
|
||||
};
|
||||
|
||||
const openChatDrawer = (event) => {
|
||||
if (!isInputSelection(event.target)) {
|
||||
if (isInputSelection(event.target)) {
|
||||
return;
|
||||
}
|
||||
event.preventDefault();
|
||||
|
Reference in New Issue
Block a user