Opened 7 years ago

Closed 7 years ago

#16685 closed Bug (invalid)

writer.setRules Not Defined In 4.5

Reported by: Anthony Sherwood Owned by:
Priority: Normal Milestone:
Component: Core : Output Data Version: 4.5.1
Keywords: Cc:


This is a duplicate of #9430, which I believe was incorrectly closed. I have v 4.5.10 of ckeditor, which is supposed to have a writer.setRules function to enable formatting of output.

Steps to reproduce

  1. Install 4.5.10 of ckeditor
  2. Use the following code on the page (jquery document ready added to prove that all the other js on the page has already been loaded... console.log of writer shows that the object has fully loaded, but the setRules function does not exist.):
$( document ).ready(function() {
        on: {
            instanceReady: function( ev ) {
                this.dataProcessor.writer.setRules( 'p', {indent: true});
  1. View console output. Error "TypeError: this.dataProcessor.writer.setRules is not a function" will be present, and the object dump of writer will confirm that the writer object is fully loaded, but does not have a setRules function.

Expected result

Setting of the rules for the output writer.

Actual result

Javascript error stating that function is not defined.

Other details (browser, OS, CKEditor version, installed plugins)

Tested in Chrome, Firefox, and Safari on OS X CKEditor v 4.5.10, installed plugins: sourcearea

Change History (1)

comment:1 Changed 7 years ago by Jakub Ś

Keywords: setRules removed
Resolution: invalid
Status: newclosed

If you want to use rules for elements, please use htmlFilter and dataFilter and not the writer.

var editor = CKEDITOR.replace( 'editor1', {
	on: {
		pluginsLoaded: function( evt ) {
			evt.editor.dataProcessor.dataFilter.addRules( {
				elements: {
					img: function( el ) {
						//The dataFilter works when you load data into editor
						//e.g. load your custom url
			}, 1 );// default priority 10

			evt.editor.dataProcessor.htmlFilter.addRules( {
				elements: {
					img: function( el ) {
						//The Html filter works when you get data from editor.
						//e.g. bring back your fake url
			}, { applyToAll: true, priority: 1 } );
Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy