extending table inside rich text editor plugin | Community
Skip to main content
New Participant
October 16, 2015
Solved

extending table inside rich text editor plugin

  • October 16, 2015
  • 22 replies
  • 6376 views

Hi,

 

I am currently using the rich text editor table plugin. I would like to extend it to include two more extra properties I was wondering whether this is possible and if there is any examples.

 

Chris 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Ojjis

Hmm,
I would overlay the file in "/apps" with the same name/structure so you wont have to worry about that later one since it's quite a lot of scripts and different functions involved. 

Glad it worked out
/Johan

22 replies

Ojjis
New Participant
October 16, 2015

maybe try to zip or just upload one file, or paste snippets in here if it's not a lot of code

Ojjis
New Participant
October 16, 2015

Ah, first of it looks like you have two items with the same id there (width and width). This might cause some problems.
Also make sure that the other file knows about these items later on. I have managed to sort my table out with some
custom properties just for test. Ended up with this:

//...code <table cellpadding="1" myvalue="66" cellspacing="0" border="1"> //.. more code

I added the following to the tablePropertiesDialog:

editItems.push({ "itemId": "myvalue", "name": "myvalue", "xtype": "textfield", "width": 50, "fieldLabel": CQ.I18n.getMessage("MyValue"), "regex": /^[0-9][0-9]?$/ });

Then i added the following to the TablePlugin (in the default values initiation in the notifyPluginConfig):

"myvalue": "66",

Then the last thing i did was to add the following lines in Table.js (in the transferConfigToTalbe method):

if (config.myvalue) { com.setAttribute(dom, "myvalue", config.myvalue); } else { com.removeAttribute(dom, "myvalue"); }


That worked just fine :)

Good Luck

chrisu168Author
New Participant
October 16, 2015
first file
chrisu168Author
New Participant
October 16, 2015

2nd file

chrisu168Author
New Participant
October 16, 2015

doesnt looked like it worked in a nutshell. I copied the tableplugin.js and tablepropertiesdialog.js 

I added the following code for the propertiesdialog.js and in the new tableplugin.js I just refer to this propertiesdialog. Everything is the same between these files and the ones that come from the foundation lib

 

if (basicDefs) { if (!this.table) { editItems.push({ "itemId": "columns", "name": "columns", "allowBlank": false, "xtype": "textfield", "width": 50, "fieldLabel": CQ.I18n.getMessage("Columns"), "regex": /^[1-9][0-9]*$/ }); editItems.push({ "itemId": "rows", "name": "rows", "allowBlank": false, "xtype": "textfield", "width": 50, "fieldLabel": CQ.I18n.getMessage("Rows"), "regex": /^[1-9][0-9]*$/ }); editItems.push({ "itemId": "header", "name": "header", "xtype": "selection", "type": "select", "options": [ { "value": "none", "text": CQ.I18n.getMessage("No header") }, { "value": "top", "text": CQ.I18n.getMessage("First row") }, { "value": "left", "text": CQ.I18n.getMessage("First column") }, { "value": "topleft", "text": CQ.I18n.getMessage("First row and column") } ], "fieldLabel": CQ.I18n.getMessage("Header") }); } editItems.push({ "itemId": "heading", "name": "heading", "xtype": "textfield", "width": 50, "fieldLabel": CQ.I18n.getMessage("Heading"), "regex": /[a-zA-Z0-9]+\ ?/ }); editItems.push({ "itemId": "category", "name": "category", "xtype": "textfield", "width": 50, "fieldLabel": CQ.I18n.getMessage("Category"), "regex": /[a-zA-Z0-9]+\ ?/ }); editItems.push({ "itemId": "width", "name": "width", "xtype": "textfield", "width": 50, "fieldLabel": CQ.I18n.getMessage("Width"), "regex": /(^[1-9][0-9]*$)|(^1?[0-9][0-9]%$)/ }); editItems.push({ "itemId": "width", "name": "width", "xtype": "textfield", "width": 50, "fieldLabel": CQ.I18n.getMessage("Width"), "regex": /(^[1-9][0-9]*$)|(^1?[0-9][0-9]%$)/ }); editItems.push({ "itemId": "height", "name": "height", "xtype": "textfield", "width": 50, "fieldLabel": CQ.I18n.getMessage("Height"), "regex": /(^[1-9][0-9]*$)|(^1?[0-9][0-9]%$)/ }); }
chrisu168Author
New Participant
October 16, 2015

Hi,

 

thanks for your reply much appreciated. I would like to ask where this transferConfigoTable method is, I cannot find it inside my TablePlugin.js

 

Chris

chrisu168Author
New Participant
October 16, 2015

Hi,

 

thanks for everything...

Ojjis
New Participant
October 16, 2015

Hi,
sorry it's not in that file. That method is found in the file called "Table.js"
 

Ojjis
New Participant
October 16, 2015

Under 5.5 it should be located under
/libs/cq/ui/widgets/source/widgets/form/rte/commands 

/Johan

chrisu168Author
New Participant
October 16, 2015

Hi,

 

sorry but where is this table.js I am using cq5.5

Thanks