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

Axios is experiencing challenges in transmitting the cookie

Even after attempting to include {withCredentials: true}, I am still facing issues with sending the cookie to the backend server. return await axios.post(`${API_URL}/posts/category/${id}`, { withCredentials: true }) https://i.stack.imgur.com/Cr8xv.png ...

Ways to display a variable within an HTML element

What could be causing variable a to be undefined? export default function Surah() { let a; const updateVariable = (id) => { a = id; console.log(a); }; return ( <div> <div> <button onClick={() => ...

"After completing the survey form, the User Details form is displayed upon clicking the submit button

In my Quiz, each question loads on a separate page with clickable options. Some questions may have multiple answers, including an "Others" option. At the end of the quiz, users need to fill out a form. Although I've created a survey form, I'm fa ...

Configuring Laravel to operate on a specific port number?

Currently, I am utilizing nodejs, expressjs, and socket.io to trigger events on my web app via a mobile phone connected to the nodejs server. Although the app is primarily built in JavaScript, I have opted to use laravel for data storage within a database ...

How can we effectively manage form handling in Vue.js with Vuex in a controlled and rational manner?

I'm faced with a challenge of submitting a comprehensive form on a single page. <container> <formA> <formB> <formC> <submitButton> <container> This is how it appears, and I have a storage system in place t ...

Display a complete calendar with the date picker on a webpage

Currently experimenting with React to build a straightforward application. Admiring the appearance of full calendars from these date pickers (once clicked): Material-UI React-Toolbox Wondering if it's feasible to present the full calendar directly ...

Learn how to upload an image from Express.js to Google Cloud Storage or Firebase Storage

Currently, I am delving into the world of ExpressJS and attempting to upload an image to Firebase storage using Node. However, I encountered the error message: firebase.storage().ref() is not a function. After researching this issue, I stumbled upon this ...

What is the best way to refresh a page during an ajax call while also resetting all form fields?

Each time an ajax request is made, the page should refresh without clearing all form fields upon loading Custom Form <form method='post'> <input type='text' placeholder='product'/> <input type='number&a ...

Validation of forms in AngularJS/HTML5 that are nested within one another

Just starting out with AngularJS and experiencing issues with HTML5 nested form validation. I currently have 2 forms; mainFrm (parent form) and stateFrm (a child form). I am struggling to validate each form within its own scope. <form id="mainFrm" ng- ...

Encountering the error message "Unable to access /" on the browser when using express router

Just started working with the express Router for the first time. Here is my route.js: var express = require('express'); var router = express.Router(); router.get('/', function(req, res) { res.send('home page'); }); module.e ...

Tips for preventing a specific component from being cached with Nuxt.js keep-alive props

I am facing some challenges with the Nuxt.js keep-alive property. My goal is to cache all components except one, and reload dynamic data again. However, all components seem to be cached and I can't seem to figure out what I'm doing wrong. Is this ...

Guide on sending JSON messages between Node.js services within a Docker Compose environment

If I have two Node.js services running in a Docker Compose, one listening on port 4000 and the other on port 5000, how can I exchange JSON messages between them using Express? ...

Error: JSON parsing failed due to an unexpected character, resulting in null data

Many people have asked similar questions on the same topic, but I have not been able to find a solution for my specific problem. Below is the code snippet that I am working with: $.post("show_search_results.php", {location_name: ""+location_name+"", key: ...

What is the best way to send a parameter to a Vue component?

Recently, I started learning Vue and am trying to grasp fundamental concepts such as conditional rendering and passing data from the main app to a component. Let's say I have a Vue component like this: <div id="app"> <myComponen ...

Can anyone provide guidance on how to simulate a click on a JavaScript action for an iPhone?

I am attempting to trigger a click on a "javascript:void(0)" link so that I can retrieve HTML data within the script. Can someone advise me on how to achieve this without using illegal APIs like UITouchEvent, as I only work with NSUrl? Thank you in advan ...

Organize the strings by first sorting them alphabetically based on the first letter and then by length starting from the longest. Next, arrange the strings in ascending

After experimenting and seeking help on stackoverflow, I have managed to sort an array of objects based on the 'plate' key using the following function: sort(function(a, b) { return a.plate.toLowerCase() > b.plate.toLowerCase() ? a.pla ...

Organizing dates with Javascript

Is there a way to convert a string from this format : 2014-06-12T23:00:00 To another format using JavaScript, like so : 12/06/2014 23:00 ...

Top method for enhancing outside libraries in AngularJs

Currently, I am utilizing the angular bootstrap ui third party library as a dependency in my angular application. One question that is on my mind is what would be the most effective method to enhance the functionality of directives and controllers within t ...

Leveraging Vue.js's computed properties to access and manipulate elements within an

I have a simple template that displays text from a wysiwyg editor using two-way data binding, as shown below: <template> <div> <quill-editor v-model="debounceText" :options="editorOptionProTemplate" > </qu ...

When provided with varied inputs, new Date() yields distinct values for various time zones

var date1 = "2015-03-29"; console.log(new Date(date1)); //Output:Sun Mar 29 2015 05:30:00 GMT+0530 (India Standard Time) var date2 = "1869-12-31"; console.log(new Date(date2)); //Output:Fri Dec 31 1869 05:53:20 GMT+0553 (India Standard ...