Restrict Images on Rich Text Editor in oracle apex 18.2 - oracle-apex

I am using Rich text editor of CLOB data type in apex 18.2, can I restrict users from pasting images in the field.
Can I show some error message when they are trying to paste images.
Please suggest.
Regards,
SwaZ

APEX uses CKEditor for the rich text editor. APEX 19.2 uses CKEditor v4.11.4. You can find the documentation here:
https://ckeditor.com/docs/ckeditor4/latest/api/
There's a configuration setting named pasteFilter:
https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_config.html#cfg-pasteFilter
Configuration options can be set using the JavaScript Initialization option (in the Advanced section) of the item. I added the following code to that setting and it prevented images from being pasted in:
function (options) {
options.pasteFilter = 'img';
return options;
}
pasteFromWord_inlineImages may be useful as well.
You can also play with the allowedContent and disallowedContent settings, which apply to more than just pasting.
Unfortunately, I couldn't find anything simple that allowed for the specification of a function that could do more interesting things on paste. I suspect if you need additional functionality, such at prompting the user about the removal of the image or differentiating images that have base64 encoded images vs URLs, things would get complicated quickly.

Related

Sitecore 8 - Adding images, callouts and videos in RTF field

I am working on a requirement in Sitecore 8 according to which there is a Rich text field and the content author can not only add html data but can also add predefined call outs/renderings/images directly in page editor mode.
Is there any way I can achieve this ? Please help.
We achieve this using Components in Experience Editor. As you create pages, we created components for Image, Video, Text and any Callouts. You will be able to drop components on the page based on specified placeholder settings. In my opinion it is the cleanest approach.
It sounds like 'snippets' is the way to go for you. There are some posts on the web about how to add snippets to RTF fields:
http://davetayls.me/blog/2011/02/07/adding-rich-snippets-to-sitecore-rich-text-editors/
http://sitecoreblog.blogspot.ca/2010/11/richtext-editor-add-code-snippet-or.html
http://learnsitecore.cmsuniverse.net/en/Editors/Articles/2009/06/How%20to%20use%20snippets.aspx

Sitecore field for selecting multiple files from media library with the ability to upload files

I'm looking for something that allow content editors to select multiple files from the media library, which will be listed in a rendering. They also need to be able upload files and to search. It has to work in the Page Editor (named Experience Editor in version 8).
What I have have considered so far:
A bunch of File fields - but I don't know how many files the editor need to select at most, and having something like 20 similar fields seems bad.
Using a field that supports multiple items like a Treelist with the datasource set to the Media Library allows the user to select files in an acceptable way but not uploading. I tested adding one File field just for the upload function, but was not really satisfied.
Notes:
Currently using Sitecore 7.5 but moving to 8 in a few days, so a solution working in Sitecore 8 is preferred.
I have asked the Sitecore support too and will update here if I get useful answers.
And the winner is.... the answer from Sitecore support:
In the Email Experience Manager module there is a field called "File List".
The image shows the dialog in Sitecore 8 and the field itself (below). It has search, supports multiple files and upload. It stores the value as pipe-separated GUIDs (just as similar fields like Treelist).
The Field Types Module on Sitecore Marketplace includes "Visual List" and "Carousel" custom field types which may provide what you need. I have used this in the past and found it to work well, though I'm not sure if it's compatible with Sitecore 8. As I remember, I don't think they provided the option for uploading new media from the field.
An alternative solution is to use a placeholder and a file component with a DataSource.
Give the component a standard File Field. So upload is possible.
But for every new file the editor must add a new component to the placeholder with the page editor. This is with a lot of files more work for the editor. But a standard solution. (and the ability to personalize the files with the rules engine)

How to Specify fonts for Text fields using muPDF

I am using muPDF library to add fields in existing PDF Documents.
I have successfully added a checkbox by defining its appearance.
But Text Fields are a problem as they need a Font Resource.
I cant figure out how to add fonts in a PDF document.
muPDF does have functions that deal with fonts, but I am unable to use them in a proper manner.
So i need to know how to load a font in a PDF document and how to reference them to my Text Field in the default appearance(DA).
----------------------------------------------------------EDIT------------------------------------------------------------------
Currently I am using the function pdf_set_free_text_details in pdf-annot-edit.c
But it only sets the predefined fonts . i wish to use other fonts as well
If this is not the right place to ask this question, then please if somebody could redirect me to the correct place. MuPDF only has a bug report site as far as i know.
Pass any of the font types specified on pdf-font.c as a string.
For eg: "Courier", "CourierNew", etc..

Sitecore how to hide/disable HTML tab from your Rich Text Editor

Could someone suggest how to hide/disable HTML tab from your Rich Text Editor on sitecore?
I had a look at this, but requires a change on Sitecore core rich text XML.
Problem with this solution is we need to modify the XML for each instance and what about upgrades?
Thanks.
In the Core database (you can switch using the icon in the bottom right next to the clock) you can go to /sitecore/system/Settings/Html Editor Profiles/*profile you want*/buttons/HTML view and deny read-access on that for your users. Alternatively, at least in Sitecore 6.5, there's a profile without the HTML view. It's called Rich Text IDE. You can set the datasource field of a Rich Text field to that one, and not have the HTML view.
That's only removing the HTML option on the bottom left though, I'm not sure how to remove the Edit HTML option you have before you've opened the RTE itself (where you have Show Editor/ Suggest Fix / Edit Html). Looking at This question it might be you'll have to change the XML anyway.
The way we've got upgrades and different instances handled is by having the changed file in source control, and making sure we include it when building a deployment package.
Adding onto Trayek's great answer - you can remove access to the "Edit HTML" as outlined by Alex Shyba below:
Go to the core database, locate the field definition item:
/sitecore/system/Field types/Simple Types/Rich Text/Menu/Edit Html
On the Security Tab, click “Assign” and select the role you don’t want this option to be available to. Deny inheritance of this item or specify other security settings that make sense for your needs.
I added "Everyone" and then selected the "X" by Inheritance for Items, and the "Edit HTML" option was removed.
Taken from:
http://sitecoreblog.alexshyba.com/2009/10/quick-tip-remove-edit-html-option-for.html

Customized Rich Text Editor in Sitecore to generate BBCode tags instead of HTML

I am currently creating a mobile site using Sitecore, where I cannot use HTML as markup instead need to use BML as markup language for mobile. Please let me know the following in this regard:
We have a field called Description and its of type RICH TEXT. Here we cannot use the normal Rich Text Editor given by the Sitecore as it generates HTML. So can anyone tell me if I can create a customized RICH TEXT Editor with a button Say "Mobile Bold" and which should generate tags for mobile instead of normal HTML <b></b> tags .
As you all know we can change the RICH TEXT Editor from Default to FULL by setting the source attribute of the field to /sitecore/system/Settings/Html Editor Profiles/Rich Text Full. So in the similar way can I create one more item in the Core DB as /sitecore/system/Settings/Html Editor Profiles/MobileRichTextFull and include customized buttons to it so as to generate BML tags as described above. If this is possible let me know what are all the settings need to be done and steps to be followed for the same.
do you want the users to edit BML directly, or are you able to transform HTML to BML?
For the latter, you'd better solve this in the presentation layer/pipeline.
HTML Agility Pack will be your friend when going for this last solution.
Otherwise, look at Teleriks resources about the editor.