How can the CSS inside the editor be customized in ng2-ckeditor?

I am looking to customize the functionality of the ENTER key in ng2-ckeditor. I have read about a config option that can help with this on this site.

It seems that custom CSS is recommended for making these changes:

To adjust paragraph spacing, it is suggested to utilize stylesheets instead. By editing the contents.css file and defining an appropriate margin value for <p> elements, such as:

p { margin: 0; }

Based on information from this question on Stack Overflow, it is possible to load a custom CSS file by using a config option, like so:

config.contentsCss = 'mystyles.css'

I attempted to include a single file in my project and set up the configuration in an Angular 2 component, but unfortunately, the file does not seem to be loading.

  private setConfig(): void {
    this.ckConfig = {
      height: '250',
      extraPlugins: 'divarea',
      contentsCss: '/theme/styles/ckeditor.css',
      toolbar: [... toolbar configurations ...]
    };
  }

So, how do I ensure that ng2-ckeditor loads this file correctly?

Answer №1

If you happen to activate the DIVAREA plugin, this setup will encounter issues.

Edit (from comment):

The reason for this problem is that contentsCss fails to load when using DIVAREA. It's logical because the CSS would need to be contained within the DIV (which is simple with an iFrame).

Perhaps implementing new CSS layers could provide a solution here? You can find more information at: github.com/ckeditor/ckeditor4/issues/4640 github.com/ckeditor/ckeditor4/issues/4642

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

Why does routing function correctly in a browser with AngularUI Router and Ionic, but not in Ionic View?

My Ionic App runs smoothly in the browser when using ionic serve. However, I encounter issues with routing when running the app in Ionic View (view.ionic.io) after uploading it with ionic upload. The index.html loads but nothing within <div ui-view=""& ...

Is it possible to include various texts in several spans simultaneously?

I need assistance with the following code. I would like to populate different data in all spans using a single function. <div id="teacher_data"> <p>Name : <span></span></p> <p>Address : <span></span&g ...

Issue with Inline Block Display not functioning correctly

My issue arises when trying to move multiple boxes at once on a mobile screen using display inline-block. Instead of all 3 "single-facilities" boxes moving together, they shift one by one. This problem occurs when I apply display inline-block within the me ...

Utilize the Material UI SelectField component as a reference for handling onChange events

I'm facing a challenge with my form that contains over 15 SelectField components. I want to avoid creating multiple change handler functions, but I can't figure out how to identify the specific select field that triggered the change event in orde ...

Guide to creating two-way data binding using ngModel for custom input elements like radio buttons

I am currently facing an issue with implementing a custom radio button element in Angular. Below is the code snippet for the markup I want to make functional within the parent component: <form> <my-radio [(ngModel)]="radioBoundProperty" value= ...

Converting an object with a combination of different index types into a string representation

I'm dealing with a unique object structure that behaves similarly to an array, except it contains a mix of index types (numbers and strings). Here's an example: var myObj = []; myObj[0] = 'a'; myObj[1] = 'b'; myObj[2] = &apos ...

DevExpress popup remains contained within the iframe and does not overflow beyond its boundaries

My dilemma involves incorporating a FilterControl within an iframe popup. My issue arises when using the column selector (or any other DevExpress combobox), as the popup remains confined within the frame without extending beyond its borders. I am seeking a ...

The output of $cordovaGeolocation is stored in an array

I've been struggling with this for a few hours without success. I have a promise from $cordovaGeolocation that returns latitude and longitude, similar to the ngCordova documentation. My goal is to store the latitude and longitude in an array outside ...

Construction of jQuery Events

I have experience working with jquery tools and recently started exploring the twitter bootstrap src. One interesting thing I've observed is the utilization of the $.Event constructor for event triggering. For example, in cases like the bootstrap mo ...

Is there a way to alter the footer across all my pages using just one document?

I'm having trouble coming up with a title for my question, so please bear with me. I am working on a Bootstrap website and I want to create a consistent navbar and footer across all pages without duplicating the code in each document. How can I achiev ...

Use JavaScript to limit Google Analytics and Yandex.Metrica to track only the referral sources and screen sizes

I prefer not to include external JavaScript on my website for unnecessary tracking purposes. However, I do need to gather referrer and screen size information, which cannot be achieved with a regular HTML img tag alone. What is the most standard-complian ...

Is it necessary to release a new library version for non-functional updates?

As the maintainer of several JavaScript libraries, I often find myself needing to update dependencies that don't necessarily require any functional changes. This is especially true when my library is not impacted by a breaking change in one of its dep ...

Is there a method to enclose a Grafana row with a border?

I recently created a Grafana dashboard using JavaScript and I realized that adding a border around each row would enhance readability. Here is how the current view looks like: https://i.stack.imgur.com/itKYR.png However, it can be difficult to differenti ...

Tips for creating a corner border using svg illustrations

I've created a div with a dynamic size and border but I'm looking to add corner borders, including one skewed corner, using svg. However, I'm running into an issue where the vertical and horizontal lines are not appearing at the same size. ...

Select a random index and modify it until all unique options have been exhausted, then restart the process

My image gallery has 6 slots for images, and I have an array with a certain number of image objects: "src" : { "1x" : "/clients/Logo-1.png", "2x" : "/clients/<a href="/cdn-cg ...

Discovering mouse clicks outside of the region in angularjs

Is there a way to reset an angular controller whenever the user clicks outside of the controller's scope? How can this be achieved? Here is a sample HTML structure: <div id='parent'> <div id='1' ng-controller="ctrl1" ...

AngularJS Issue [$injector:modulerr]

My AngularJS module, developed following these tutorials, is not working properly in conjunction with ASP.NET MVC. I have encountered an error [$injector:modulerr] and I am unsure of how to resolve it. (function () { var AAngScript = angular.module(&a ...

Ways to verify if an image is captured from the device's camera using HTML5

I'm facing a unique challenge that may be considered an edge case. The situation is that I am currently in the process of developing a website that functions as a mobile application (similar to a mobile-first website). In order to achieve this, I have ...

Unable to utilize a custom function within JQuery

I'm facing an issue with using the function I created. The codes are provided below and I keep encountering a "not a function error." var adjustTransparency = function () { //defining the function if ($(this).css('opacity&apo ...

Step-by-step guide to aligning layout using material design in generator-gulp-angular

I am currently using generator-gulp-angular with angular-material-design and ui-router All views are loaded into index.html in the <div ui-view></div> element However, when I attempt to center the element with material design directives insid ...