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

extending table inside rich text editor plugin

  • October 16, 2015
  • 22 replies
  • 6407 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
Level 7
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

Ojjis
Level 7
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

chrisu168Author
Level 4
October 16, 2015

I am uploading the files and it even says 2 files chosen but I do not understand where the files have gone

chrisu168Author
Level 4
October 16, 2015

chrisu168 wrote...

I will upload again

 

chrisu168Author
Level 4
October 16, 2015

I will upload again

Ojjis
Level 7
October 16, 2015

Hmm i can't see them :S

chrisu168Author
Level 4
October 16, 2015

Hi,

 

I have attached files as requested. 

 

Chris 

Ojjis
Level 7
October 16, 2015

Is it possible that you could supply some sample code to facilitate the trouble shooting ? :)

chrisu168Author
Level 4
October 16, 2015

Hi,

Just to give you some background we are using cq5.5.

I have copied tableplugin.js and tablepropertiesdialog.js and made a local copy inside the apps directory for my app

the names are customtableplugin and customtablepropertiesdialog.

I have changed the customtableplugin code to refer to the customtablepropertiesdialog file. Inside the customtablepropertiesdialog file I have added the 2 new properties table name and category name. When I click on the table inside the rich text editor I can see the dialog come up with my 2 new fields along with the existing fields like number of rows and number of columns. However when I submit the dialog I can see inside firebug that the post does not contain my 2 new fields.

 

Chris 

Sham_HC
Level 10
October 16, 2015

I do not have the sample.  What are the properties you are trying to add? What exact change you have done so far?  In the firebox are you seeing the addition properties are passed on POST request?