feat: emoji picker for the RTE widget (#19767)
## Description Added support for emoji picker in RTE(#19450), Emoji can be added through the toolbar and editor as well.
This commit is contained in:
parent
12ea1b86ea
commit
107ead87e7
|
|
@ -286,6 +286,35 @@ describe("RichTextEditor Widget Functionality", function() {
|
|||
cy.get('[aria-label="Text color"]').should("have.length", 1);
|
||||
});
|
||||
|
||||
it("17. Check if able to add an emoji through toolbar", () => {
|
||||
cy.get('[aria-label="More..."]').click({ force: true });
|
||||
cy.wait(500);
|
||||
cy.get('[aria-label="Emoticons"]').click({ force: true });
|
||||
cy.wait(500);
|
||||
cy.get('[aria-label="grinning"]').click({ force: true });
|
||||
const getEditorContent = (win) => {
|
||||
const tinyMceId = "rte-6h8j08u7ea";
|
||||
const editor = win.tinymce.editors[tinyMceId];
|
||||
return editor.getContent();
|
||||
};
|
||||
|
||||
//contains emoji
|
||||
cy.window().then((win) => {
|
||||
expect(getEditorContent(win)).contains("😀");
|
||||
});
|
||||
|
||||
//trigger a backspace
|
||||
cy.get(formWidgetsPage.richTextEditorWidget + " iframe").then(($iframe) => {
|
||||
const $body = $iframe.contents().find("body");
|
||||
cy.get($body).type("{backspace}");
|
||||
});
|
||||
|
||||
// after backspace the emoji should not be present
|
||||
cy.window().then((win) => {
|
||||
expect(getEditorContent(win)).not.contains("😀");
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
cy.goToEditFromPublish();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -273,7 +273,7 @@ function RichtextEditorComponent(props: RichtextEditorComponentProps) {
|
|||
const initialRender = useRef(true);
|
||||
|
||||
const toolbarConfig =
|
||||
"insertfile undo redo | formatselect | bold italic underline backcolor forecolor | lineheight | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | removeformat | table | print preview media | emoticons' |help";
|
||||
"insertfile undo redo | formatselect | bold italic underline backcolor forecolor | lineheight | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | removeformat | table | print preview media | emoticons |help";
|
||||
|
||||
const handleEditorChange = useCallback(
|
||||
(newValue: string, editor: any) => {
|
||||
|
|
@ -362,6 +362,7 @@ function RichtextEditorComponent(props: RichtextEditorComponentProps) {
|
|||
"advlist autolink lists link image charmap print preview anchor",
|
||||
"searchreplace visualblocks code fullscreen",
|
||||
"insertdatetime media table paste code help",
|
||||
"emoticons",
|
||||
],
|
||||
contextmenu: "link useBrowserSpellcheck image table",
|
||||
setup: function(editor) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user