I wanted to have a dialog that lists available external stylesheet files and then allow the user to select which ones they want. However, I don't see any api for then adding these external css links to the editor. Is this possible?
3 Answers, 1 is accepted
0
Rumen
Telerik team
answered on 24 Jan 2011, 05:33 PM
Hi Pat,
My suggestion is to try the Apply Class dropdown of RadEditor which could be helpful for your scenario. You can populate it with CSS Classes using the CssFiles property.
But this requires me to know the list of CSS files in advance and set them into the editor before sending back to the browser.
However, what if I want to allow the user to pick from available files? I don't just want to blindly include every css file I find. I have an editor interface with your editor on the first tab. I wanted to add another tab that would list the css files and then as the user checked off which css files they wanted to include, then I was hoping to use javascript to tell the editor to import that css file. Afterward when they save the file, I would also save the css files they included. Next time they go to edit the file, I would parse the file, determine the css files and preset these into the editor. But I would still have that tab to allow the user to change which css files to use.
0
Rumen
Telerik team
answered on 27 Jan 2011, 03:15 PM
Hi Pat,
The "Apply Class" dropdown could not be customized on the client, because it is populated with items on the server. The case with setting a CSS file on the client is the same - you cannot modify the CssFiles collection client-side. Also it is not possible to reload the RadEditor's document because it is modified during the load of the control and will not be editable and any added content will be lost.
What you can do is to update the editor using AJAX when the user selects a CSS file from the list. Once the request is send to the server, set the CssFiles property to load the selected by the user class.