How to style CKEditor content for read-only display - ckeditor

I am using CKEditor 5 in my application for users to input documents with images, media, tables and styled text. Once the user stores the document and I pull it out again for display. In the past when I only had the most generic styling I displayed the content like this:
<div [innerHTML]="doc.text"></div>
This is an Angular application which explains the syntax used above. The problem is that the text renders but the CSS that is effective makes it looks different. For example CKEditor has a feature for the user to automatically resize an image to 50% and flow text around it. It looks really nice in the editor but when displayed as above the image reverts to full size.
My workaround for now is to invoke a ckeditor in disabled mode like this:
<ckeditor [editor]="Editor" [config]="{ toolbar: [ ] }"
[disabled]="true" [data]="doc.text"></ckeditor>
That works but I would prefer to have a solution where I don't have to import the ckeditor into components that don't need to let the user edit the document. Does anyone know how to do this?

I'd say it is not passible to have all the ckeditor features working in Angular only by using a div with innerHTML as a viewer... I was using same approach but some of the "figures" weren't shown, concretely embedded videos...
In order to have a disabled and pure read-only viewer I created a dedicated wrapper component and I used some global CSS styles to get rid of that unwanted UI behavior in this scenario.
Here is my rich text viewer component HTML, it is a ckeditor with an empty toolbar, same as in the question indeed:
<ckeditor class="ckeditor-viewer" *ngIf="isBrowser" [editor]="editor" [ngModel]="data" [config]="{ toolbar: []}" [disabled]="true"></ckeditor>
Here are some global styles that hide borders on figure hover and table handlers:
// These styles hide weird "things" in CKeditor Viewer (read only mode)
.ckeditor-viewer .ck.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected, .ck.ck-editor__editable.ck-blurred .ck-widget.ck-widget_selected:hover{
outline-width: 0;
}
.ckeditor-viewer .ck .ck-editor__nested-editable {
border: 1px solid transparent;
height: 0;
margin: 0;
}
.ckeditor-viewer .ck-content .image>figcaption{
background-color: transparent !important;
}
.ckeditor-viewer .ck .ck-widget__selection-handle{
width: 0;
height: 0;
display: none;
}
// These styles hide weird "things" in CKeditor Viewer (read only mode)
I hope it helps.

Related

How to apply custom style to Google reCAPTCHA?

https://developers.google.com/recaptcha/docs/display
I would like to know how to apply styling to the image selector.
grecaptcha.render(
container,
parameters
)
According to the document: container is the HTML element to render the reCAPTCHA widget. Specify either the ID of the container (string) or the DOM element itself.
Then, I try to apply css to the container and pass it to the render method. However, it only applies to the grecaptcha-badge div.
I have no idea how to adjust the image-selector position.
visibility: visible; position: absolute; width: 1303px; top: 146px;
It seems the style is controlled by the google js: https://www.google.com/recaptcha/api.js
What could I do to edit the image-selector's style?
This question is quite old, but for those who want to customize the reCAPTCHA here is a solution: https://custom-captcha.com/
It has no image captchas but instead uses the new reCAPTCHA v3 in the background. You can customize the logo, the text, and the brand name as well. Also you can apply any CSS you want to it.

fontsize in dropdown menus in ckeditor in TYPO3

the style dropdown menus in ck_editor in TYPO3 8.7 shows the labels in the same font size as in the editied text. E. G. when h1 is in the rte.css formatted as 30 px the text in the dropdown is 30px too and therefore the entry is not readable. Is there a possibilty to fix the font size in the dropdown menus to 12-15px, always and in every context? Without destroying the wysiwyg in the editable text?
Thanks
As far as I can see you can do that by using in your rte.css something like:
.cke_panel_listItem h1{
font-size:15px;
}
h1{
font-size:60px;
}
h2{
font-size:40px;
}
h3{
font-size:20px;
}
Please note that as the dropdown is loaded inside an iframe, you might have to kill your browser's cache to see some change.
See also CKEditor remove style preview from Styles dropdown

Oracle Apex 5.1 - Theme Style, referenc custom image in custom css code

I'd like to use the theme styles to generate different CI for sub companies of our main company. I would like to insert every sub-companies logo into the top naviagtion bar. The plan was to have a seperate theme style for each sub company and within each style have a custom css code which sets the background image to a referenced static file (or theme file). Unfortunately the custom css code does not seem to evaluate the substitution strings so the images can not be rendered. e.g.
div.t-Header-logo {
background-image: url(#APP_IMAGES#COMPANY1_LOGO.png);
background-repeat: no-repeat;
width: 250px; /*or your image's width*/
height: auto; /*or your image's height*/
margin: 0;
padding: 0;
}
Is there any way to achive different logos per theme style?
Thanks for your support
replace the #WORKSPACE_IMAGES# reference with it's resolved name in the CSS file.
e.g. #WORKSPACE_IMAGES#add.gif becomes-
http://apex.oracle.com/pls/otn/wwv_flow_file_mgr.get_file?p_security_group_id=441224701954687600&p_fname=add.gif
Get the resolved name for your workspace by viewing page source, copy and replace #WORKSPACE_IMAGES# with the same. It will work.
Note: make sure that the image file you have uploaded is not specific to an application.

TabStrip doesn't render data-badge when using custom icons

In Kendo UI Mobile, version v2013.1.621, I use a TabStrip with custom icons. This all works well, except for when I want to add data-badges to it. Somehow, the webkit-mask for the custom icon/image completely 'hides' the data-badges.
My example is as follows, using Kendo's documented approach on custom icons with webkit masks:
<div id="footer-tab">
<style scoped>
/* Custom TabStrip Icons */
#footer-tab .km-icon {
background-size: 100% 100%;
-webkit-background-clip: border-box;
background-color: gray;
}
.km-demo-icon1 {
-webkit-mask-box-image: url("images/icons/icon-1.png");
background-color: #b2f23d;
}
.km-demo-icon2 {
/* ISSUE IS HERE: Remove the -webkit below, and the badge works. */
-webkit-mask-box-image: url("images/icons/icon-2.png");
background-color: #b2f23d;
}
</style>
<div data-role="tabstrip">
<!-- Custom Icons be here... -->
PAGE1
PAGE2
</div>
</div>
Again, the custom icons work well, on both iOS as well as Android. But when I append the data-badge="99" attribute, the badge doesn't show up at all. By inspecting the DOM it looks like it's in place, but is just completely not visible.
Removing the wekit-mask-box-image line, as specified in the sample above, makes the data-badge appear, but doesn't render the custom TabStrip icon.
Seems quite straight-forward, but I can't seem to put my finger on what is wrong here. Any suggestions?
Yes, the TabStrip button's badge is rendered inside the icon and the mask is hiding it. I've fixed this for the Q2 2013 release, which will be out this week.

site has a background image - cannot remove it from the editor

I'm moving from FCK editor to CK editor 3.6.3 and the site has a background image, which is appearing in the CK editor. I need to remove this while using the same CSS file for both the general site and the CK editor (to pick up on CSS for the styles dropdown).
I tried setting config.BodyClass to a style with no image - this works on FCK2.x but not the CK3. I also found via google a config.extraCss setting but I don't see it in the docs, and it does not appear to do anything anyway.
Fullpage is off (i.e. editor is not producing <body><head> etc tags))
I've got a workaround by having two CSS files, one for the site and one for CK with a different body style, but there must be a better way?
Thanks,
Kevin
Config section:
config.stylesSet = 'my_styles:/admin/ckeditor/styles_dropdown.js';
config.contentsCss = '/newdesign/style.css';
//config.extraCss = 'body {background: none;background-image: none;}';
config.BodyClass = 'fckbody' ;
CSS section (of the 'main' css file)
body{
margin:0px; padding:0px; background-image:url(/newdesign/site_bg19.jpg); repeat; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px; color:#393939;
}
.fckbody {
background-color: white;
background: none;
background-image: none;
text-align:left;
}
The correct name in CKEditor is bodyClass with an initial lower case.
Thought I should post my insight here for my findings. I came across this page while looking for a reason why my CKEditor was showing a background image of my site.
If you CKEditor is showing a background image on the Make a Comment section of a node :
1 - Head to "admin/config/content/wysiwyg"
2 - click edit to the text format for which text format is showing the background image
3 - click the CSS tab drop down
4 - change the Editor CSS to "Editor Default CSS".
Hope this helps someone!

Resources