Guide on incorporating a customized HTML tag into ckeditor5

Can someone help me with integrating CKEditor and inserting HTML tag of a clicked image into the editor? I've tried different solutions but haven't been successful. I understand that doing this directly in CKEditor may not be secure.

This is a Vue.js component

<div class="emoji">
    <img @click="sendEmoji($event)" src="/assets/images/facebook/expressionless-face_1f611.png" alt="emoji">
</div>
<textarea id="comment_editor"></textarea>

    <script>
     export default {
      mounted() {
        ClassicEditor
            .create( document.querySelector( '#comment_editor' ), {
              toolbar: {
                items: [
                  'bold',
                  'italic',
                  'underline',
                  'link',
                  'fontColor',
                  'fontSize',
                  'fontFamily',
                  'codeBlock',
                  'specialCharacters',
                  'superscript',
                  'subscript',
                ]
              },
              language: 'ru',
              licenseKey: '',

            } )
            .then( comment_editor => {
              window.comment_editor = comment_editor;
            } )
            .catch( error => {
              console.error( 'Oops, something gone wrong!' );
              console.error( 'Please, report the following error in the https://github.com/ckeditor/ckeditor5 with the build id and the error stack trace:' );
              console.warn( 'Build id: 1elt9gdr81je-u3jmkfuwv026' );
              console.error( error );
            } );
        },
        methods: {
          sendEmoji: function(event){
            let img = event.target.outerHTML;
            console.log(img);
            window.comment_editor.setData(img)
            console.log(window.comment_editor.getData());
          },
        }
    }

Answer №1

Resolved! All that's required is the inclusion of the Image plugin. The current appearance may not be ideal, but I believe it can be improved.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Looking for a .NET MVC AJAX search solution. How can I enhance the code below?

I am looking to implement a search functionality using AJAX. I have tried using the get method in my controller by passing the search string, but it is not working as expected. Below is a snippet of my controller code, where I retrieve the search value fr ...

Accessing JSON data and populating a dropdown menu with JQuery

I am facing an issue with extracting values from a JSON array using jQuery. The structure of the array is as follows: [{ "": "Select your State/Region" }, { "BAL": "Balkh" }, { "BAM": "Bamian" }] Although I have attempted to loop through the array in ord ...

Hide Navbar when clicking on menu item

I'm struggling with finding a solution to this issue, as I am unsure of how to proceed. The problem I am facing is that when I click on an item, the router-view changes correctly, but the menu remains open. I would like it to close after a click. ...

Error encountered when attempting to use the submit button in AngularJS

My goal is to create a simple Angular application that takes input of two numbers (n1 and n2) and then prints their sum. I have integrated Bootstrap for styling, but noticed that nothing was happening upon submission. To troubleshoot, I added an alert() fu ...

Search MongoDB to find, update, and validate any empty fields in the body

I'm currently working on updating a user's profile information, but I'm facing a problem with checking for empty values before proceeding with the update. The code I've written so far is not displaying error messages and is preventing m ...

Show the value of a JavaScript object in VueJS

New to Vue and need some guidance... I'm having trouble accessing the values in a JS object displayed in the DevTools within one of my routes in a Vue app. Specifically, how can I display the values from filteredData:Array[1]? https://i.sstatic.net/ ...

The error message "Unable to call mxgraph function during Jest unit testing" occurred during the execution of

My Vue JS Component is utilizing the mxgraph package, which can be found at: https://www.npmjs.com/package/mxgraph The component imports the package like so: import * as mxgraph from 'mxgraph'; const { mxClient, mxStackLayout, mxGraph, ...

Unable to input text using Python Selenium in a textbox

Currently, I am attempting to input text into a specific textarea HTML element using Python Selenium: <div class="spk-c spH-d"><div id="gwt-uid-23" class="sppb-a"> <div class="sppb-b spk-b">For example, flowers or used cars</div> & ...

Parsing JSON data to extract values stored in a two-dimensional array

In order to develop a basic version of Tic Tac Toe, I decided to store game data in a JSON file. Here is an example of how the file is structured: [ { "turn": "x", "board": [ [ " ...

Having a quandary with Socket.io when using clients.length (where clients refers to io.sockets.clients();)

Typically, when sending JSON from one client to another, everything works smoothly. However, if there is only one client, packets are still being sent. To address this issue (on the server-side in node.js), I implemented the following solution: var client ...

Is there a way to eliminate duplicate pages from an EJS template pagination system?

I stumbled upon this helpful article that guides in implementing a pagination feature for my MEN stack app. The article provides a comprehensive overview from frontend to backend. While everything is working smoothly, I'm looking to make some adjustme ...

The disappearing act: Nativescript-vue's native iOS Navigation button vanishes when setting the title on ActionBar

When I utilize a plain ActionBar: <ActionBar/> and then navigate with: this.$navigateTo(Catalog) the default iOS Back button appears as expected. However, when I modify the action-bar like this: <ActionBar title="some title"/> or add othe ...

Utilize JavaScript to establish an object with key and value pairings

Wanting to loop through and create an object that contains key => [value], if the key already exists, simply add the value. Here is what I have tried so far: let dataName = []; let obj = {}; checkboxes.forEach(checkbox => { if (checkbox.che ...

jQuery unable to find designated elements in uploaded templates

I have a specific route linked to a specific controller and view: app.config(['$routeProvider', function ($routeProvider) { $routeProvider .when('/create', { templateUrl: 'partials/form/form.html', controlle ...

Is there a way to personalize the chart tooltip in jqplot to fit my preferences?

I have a chart that displays data. I would like the x-axis labels to show in the format MM/DD, and in the tooltip, I want to display data in the format HH:y-axis. For example, in the chart below, I want the x-axis labels to be 'Oct 15','Oct ...

Troubles with creating promises in Node.js

Currently, I am facing a challenge in Nodejs where I need to execute asynchronous tasks. Specifically, I need to navigate through all levels of a JSON object sequentially but synchronously. I am experimenting with the following code snippet, which is a si ...

Unable to invoke function on HTML element

Recently, I've ventured into writing jQuery-like functions in Vanilla JS. While my selectors seem to be working fine, I encounter an "is not a function" error when trying to call the append function on an HTML element. var $ = function(){ this.se ...

Having trouble loading a React component

I've been working on breaking down modules from a monolithic React project to store them separately in my npm registry. However, I'm encountering issues with exporting and importing them correctly. Previously, I was using the following code: con ...

Error: "openerp" is undefined in version 10 of Odoo

I encountered an issue while trying to install a module on Odoo version 10. The JavaScript file begins with this code snippet: openerp.my_module_name = function(instance) { console.log('Something'); } When I checked the browser conso ...

Leverage Vue data within your stylesheet

Is there a way to access Vue data within my style sheet? I typically write in Sass, but I don't believe that is the root of the problem. The following attempt did not yield the desired results: #app background-color: {{ myText }} ...