dojoattributes for Rich Text Field - dojo

I am trying to set the default Font and Font size in a RT Field on my XPage. I have this code:
<xp:inputRichText value="#{document1.Body}" id="body1" >
<xp:this.dojoAttributes>
<xp:dojoAttribute name="font-family" value="Tahoma"></xp:dojoAttribute>
<xp:dojoAttribute name="font-size" value="16pt"></xp:dojoAttribute>
</xp:this.dojoAttributes>
</xp:inputRichText>
When the XPage with this RT Control is displayed the default is unchanged so I'm guessing that the "font-family" is not a RTF attribute that dojo can set. Am I on the right track with this or is there another way.

XPages uses the CK Editor to handle mime entry (commonly referred to as RichText). Head over to the CKeditor website. There you will find extensive documentation how to set defaults and customize it

There is a small issue hereā€¦ the "default" font and size will be determined by CSS applied to the surrounding tags, as the editor by default does not add font family nor font size to the content until a selection is made from the drop down list. The editor does not know what CSS is applied by default to the content, but you can make the selects match the default that is being applied by setting the variables font_defaultLabel and fontSize_defaultLabel (see the documentation here: http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html). To apply CSS to the editor content, use the variable contentsCss to point to a CSS file, just make sure to make the CSS in that file match what will be applied to the field contents when it is in read mode for consistency.

Related

CKeditor image toolbar without upload

CKeditor5 by default has image plugins that support toolbar icons which can insert an image by (a) uploading the image and (b) insert an IMG tag into the HTML.
We do not want any capability to upload an image, but we need a simple widget that takes user input and inserts an image tag with attributes (user supplied) including e.g. SRC, HEIGHT, WIDTH, CLASS.
Seems strange that this isn't available in the standard build, have I missed it somehow?
Do we have to write our own plugin?
Custom build your CKeditor here:
https://ckeditor.com/ckeditor-5/online-builder/
Use toolbar item 'imageInsert'
relevant plugins:
Image,
ImageCaption, // adds ability to caption image via the toolbar
ImageInsert,
ImageResize, // this will cause resize handles to appear in the editor, operates by applying CSS to the enclosing <figure> tag
Also useful plugin
LinkImage, // adds link capability when editing an inserted image
Found the relevant doc here
https://ckeditor.com/docs/ckeditor5/latest/features/images/image-upload/images-inserting.html

How to force font on RDLC - interpret html tags

I chose in RDLC (VS 2017) the Markup Type option: interpret HTML tags
can I force font for those placeHolders?
I would like to get the tags but to override the font. (I need ol, ul but not styles).
Any idea how to do it?
FontFamily can be override by setting the font property to a different size then default.
For example: setting the HTML placeholder to 10pt was ignored but setting to 12pt forced the whole HTML to be 12 pt.

Toggle vue2-editor view content to html

I am using vue2-editor and i want to toggle the content view of the editor like ckeditor or mailchimp editor does
It is possible using vue2-editor or quill?
You can have a computed property that either returns the actual text or uses a library like hypertext to generate html, the return value of the html would be contingent on another computed property and returns the html you want.
I also have a simpler solution, which I used once but need to take a look at my code in a few hours which is not in front of me.

How to set color of link in wxWidgets wxHtmlWindow?

The wxWidgets library includes a simple HTML parser and viewer, which I'm trying to use to display some simple HTML. I'd like to make certain links (the ones that go to items that don't yet exist) a different color, or otherwise indicate that they need to be created, but I don't see any obvious way to do so.
Does anyone know of a way to do this?
Use the color CSS Style for span (Something like
<span style='color:red;'>Red Link</span>). Here is a quote from class' documentation here
List of supported styles
wxHTML doesn't really have CSS support but it does support a few
simple styles: you can use "text-align", "width", "vertical-align" and
"background" with all elements and for SPAN elements a few other
styles are additionally recognized:
color
font-family
font-size (only in point units)
font-style (only "oblique", "italic" and "normal" values are supported)
font-weight (only "bold" and "normal" values are supported)
text-decoration (only "underline" value is supported)
See: https://docs.wxwidgets.org/3.1/overview_html.html

Alter Rendered Page in Webbrowser Control

is there a way to alter the rendered HTML page in webbrowser control? What i need is to alter the rendered HTML Page in my webbrowser control to highlight selected text.
What i did is use a webclient and use the webclient.Downloadstring() to get the source code of the page, Highlight specific text then write it again in webbrowser. problm is, images along with that page does not appear since they are rendered as relative path.
Is there a way to solve this problem? Is there a way to detect images in a webbrowser control?
Not sure why you need to change the HTML to lighlight text, why not use IHighlightRenderingServices?
To specify a base url when loading HTML string you need to use the document's IPersistMoniker interface and specify a url in your IMoniker implementation.
I suggest you do it a different way, download and replace the text using the webbrowser control, this way your links will work. All you do is replace whatever is in the Search TextBox with the following, say the search term is "hello", then you replace all occurances of hello with the following:
<font color="yellow">hello</font>
Of course, this HTML can be replaced with the SPAN tag (which is an inline version of the DIV tag, so your lines wont break using SPAN, but will using DIV). But in either case, both these tags have a style attribute, where you can use CSS to change its color or a zillion other properties that are CSS compatible, like follows:
<SPAN style="background-color: yellow;">hello</SPAN>
Of course, there are a zillion other ways to change color using HTML, feel free to search the web for more if you want.
Now, you can use the .Replace() function in dotnet to do this (replace the searched text), it's very easy. So, you can Get the Whole document as a string using .DocumentText, and once all occurances are replaced (using .Replace()), you can set it back to .DocumentText (so, you're using .DocumentText to get the original string, and setting .DocumentText with the replaced string). Of course, you probably don't want to do this to items inside the actual HTML, so you can just loop through all the elements on the page by doing a For Each loop over all elements like below:
For Each someElement as HTMLElement in WebBrowser1.Document.All
And each element will have a .InnerText/.InnerHTML and .OuterText/.OuterHTML that you can Get (read from) and Set (overwrite with replaced text).
Of course, for your needs, you'd probably just want to be replacing and overwriting the .InnerText and/or the .OuterText.
If you need more help, let me know. In either case, i'd like to know how it worked out for you anyway, or if there is anything more any of us can do to add value to your problem. Cheers.