How to get and set the markdown for what's selected in wysiwyg mode? - toast-ui-editor

I'm trying to add some extra toolbar tools and need to get and set the markup for what's selected while in wysiwyg mode.
When i use tuiEditor.getSelectedText on a link i just get the text label, and when i use tuiEditor.replaceSelection with the correct syntax it escapes the brackets to that text appears in the page (i.e. converts [text](url) to \[text\]\(url\).
It works fine in markdown mode.

Related

How to make the emojis display well in windows android studio code editor view?

How to use emoji in the Android source code in Android studio or IntelliJ in Windows OS? I want to use emojis in the logcat print messages by choosing emojis from the context-sensitive popup. I could not find the right plugin.
I need the plugin that is used in the picture below. But don't know how to achieve the same. When I googled I get references to emoji-compat for showing emoji in the android application's soft keyboard dialog. But I want to use emoji in the source code in the comments and logcat only.
Update: I thought it is an android studio feature. But it is available as soft touch keyboard in windows 10. "WIN + ;" is the shortcut for launching the same.
Now, my next question is how to make the emojis display colorful in windows android studio's code editor and logcat like the way it appears in the Mac.
In Mac it appears like this:
In windows it appears like this in the editor after adding the emoji:
On mac position the cursor in any text field you'd like to insert an
emoji, like posting a tweet for example.
Use the keyboard shortcut Command - Control - Space bar to access
emoji.
Double-click the emoji you'd like to use and it'll be inserted where
you left your cursor.
In your screenshots, the emojis appear to be rendered in a monochrome version in your editor. I've experienced a similar problem with the display of emojis in IntelliJ on macOS.
At first, I thought it was due to a character encoding setting. This turned out to be unrelated as my file encoding is set to UTF-8 everywhere.
After living with the problem for quite some time, the solution I've found to have emojis display right for me is to set the fallback font (for symbols not supported by the main font) to "Apple Color Emoji" for both the editor and the console.
The corresponding UI path for this setting is listed below.
Preferences > Editor > Font
When a color scheme font setting overrides the editor font, then the following paths can apply.
Preferences > Editor > Color Scheme > Color Scheme Font
Preferences > Editor > Color Scheme > Console Font
"Show only monospaced fonts" will need to be disabled temporarily to show the emoji font under "Fallback font".
Additionally, I made "Paste without Formatting" be my default paste option so that emojis can be pasted directly, without risk of being transformed into Unicode escape sequences.
The result is that emojis display as expected for me throughout the IDE, making a big difference to my coding pleasure!
The code editor now correctly handles Unicode emoji characters. On Mac OS X emoji characters are rendered as colored images. On Windows and Linux emoji are rendered as monochrome characters.
Source: https://blog.jetbrains.com/idea/2016/12/intellij-idea-2017-1-eap-is-open/

Sublime Text Editor with '+' sign on the left side

Why there are plus signs on the left side of my sublime text 3 text editor on every line? How to remove it?
You have probably installed the GitGutter package. It highlights additions to your code with a + symbol, removal with a - symbol and changes with a circle.
If you don't like this feature, you can either disable (or uninstall) the entire package or use the GitGutter: Disable for View command to disable the markers for the current document.
If you don't like the appearance of those markers, you can change the styles by running the Preferences: GitGutter Popup Stylesheet command and edit the styles.

LiClipse theme: Theme does not apply to strings

I use a particular color theme in the appearance preferences of LiClipse to change the appearance of the text in my editor for my PyDev projects.
I can easily change the color of any type of data that the editor interprets, except for strings. (Perhaps there's more but I have yet to discover them)
I am able in the Preference setting window to set any colors for strings, and I do see it being applied in the preview that the window shows, but when I click Apply, the strings in my code stays plain white. I've tried editing a couple of other data's color, and they all work great.
Following is two screenshots showing the settings window just before pressing "Apply", and my resulting code, in that order.
In the Preferences window, we can see in the preview that the "String" part is colored. Any color works. But then in my editor we can see that it did not apply, but all the other word object colors did.
My guess is that perhaps the strings in the PyDev editor are not interpreted as string, but instead something else.
I'm using LiClipse 4.5.2.201803171104
On Windows 7.
After a couple of trial and errors, I found out that by default, strings in the LiClipse PyDev editor are interpreted as constant.
Therefore, editing the color of constant changes the display colors of strings in the editor.

Apply background color to text region only

In my theme, I've set the background color for comments. But the color is applied to the entire row, rather than just the area with text. Is there a theme setting I can use to fix that?
The Sublime Text theme engine relies on the scopes defined in the language syntax.
Executing view.scope_name(view.sel()[0].begin()) in the Sublime Console when the cursor is inside the comment shows source.python string.quoted.double.block.python - and is the same when the cursor is in a whitespace section of the string and when it isn't.
This means you would need to alter the python language definition that Sublime uses to report a different scope when relevant, for example, string.quoted.double.block.whitespace.python, before you can use it in your theme.

Sharepoint: display plain text field as html

I have a Sharepoint list, where one of the columns is plain text - Description. When you edit a list item, Description field is normally a TextArea. I have it programmed that this TextArea is extended with JavaScript to accept rich text (html really), so I have my custom rich text field. The problem is that when I input the rich data everything looks fine but when I save the edited item and then display it, the text is displayed as plain text, not html, so instead of a bold text I get "< b >text< /b >". And I would like it to be displayed as html. What can I do with it?
Edit: I don't want to use the built-in editor, because I need some different behavious.
The code that reads in the text input from the form and saves it to the list will be doing a HTMLEncode operation that replaces
< with <
> with >
and so on (look at the source of the page after a save)
This occurs 'server side' so you won't be able to change this using JavaScript.
You've got two options I think
As F5 mentioned you can create a custom field type with your own behaviour for rendering and update. This is the 'correct' way to do this.
You could change your funky javascript to work on a rich text field, hack into the rendering of the built in RTE and replace it with your own.
Of cource as soon as you are taking input from a user and then rendering it back to your web page you open yourself up to all sorts of nasties such as Cross Site Scripting if you are not filtering out potential bad stuff (the very reason why the HtmlEncode is used) - less of a problem in a typical SharePoint site on an Intranet than a public facing site.
SharePoint supports rich text columns using its own in-built editor. You just have to change the column settings so it allows rich text.
If you are using a JavaScript editor because of browser compatability with the built-in rich text editor then SharePoint will always strip the html from whatever is entered as it expects the input to be plain text.
Re your comments
If you want the field to display in rich text it needs to be a rich text field, by setting it to plain text you are always going to lose your custom formatting.
You need to look into custom field types
So where exactly are the data being displayed incorrectly: on the List Display Form or on a Page Layout? If it's on the Page Layout the fix is easy: create a custom Field Control which will retrieve the value of the field (like SPContext.Current.ListItem["YourField"]) and decode the contents to get HTML instead of encoded HTML entities.

Resources