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:
@ -5,6 +5,12 @@ module PageObjects
|
||||
class Composer < PageObjects::Components::Base
|
||||
COMPOSER_ID = "#reply-control"
|
||||
AUTOCOMPLETE_MENU = ".autocomplete.ac-emoji"
|
||||
HASHTAG_MENU = ".autocomplete.hashtag-autocomplete"
|
||||
MENTION_MENU = ".autocomplete.ac-user"
|
||||
|
||||
def rich_editor
|
||||
find(".d-editor-input.ProseMirror")
|
||||
end
|
||||
|
||||
def opened?
|
||||
page.has_css?("#{COMPOSER_ID}.open")
|
||||
@ -113,6 +119,14 @@ module PageObjects
|
||||
page.has_css?(".discard-draft-modal")
|
||||
end
|
||||
|
||||
def has_hashtag_autocomplete?
|
||||
has_css?(HASHTAG_MENU)
|
||||
end
|
||||
|
||||
def has_mention_autocomplete?
|
||||
has_css?(MENTION_MENU)
|
||||
end
|
||||
|
||||
def has_emoji_autocomplete?
|
||||
has_css?(AUTOCOMPLETE_MENU)
|
||||
end
|
||||
@ -273,6 +287,11 @@ module PageObjects
|
||||
select_kit.collapse
|
||||
end
|
||||
|
||||
def toggle_rich_editor
|
||||
find("#{COMPOSER_ID} .composer-toggle-switch").click
|
||||
self
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def emoji_preview_selector(emoji)
|
||||
|
Reference in New Issue
Block a user