diff --git a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/RTE/RichTextEditor_spec.js b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/RTE/RichTextEditor_spec.js index 5f27f01583..35064579c5 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/RTE/RichTextEditor_spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Widgets/RTE/RichTextEditor_spec.js @@ -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(); }); diff --git a/app/client/src/widgets/RichTextEditorWidget/component/index.tsx b/app/client/src/widgets/RichTextEditorWidget/component/index.tsx index cc0dbe459e..2955ce86d7 100644 --- a/app/client/src/widgets/RichTextEditorWidget/component/index.tsx +++ b/app/client/src/widgets/RichTextEditorWidget/component/index.tsx @@ -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) {