execCommand("bold") when text is between symbols - editor

I want to create a very simple markdown editor with contentEditable and execCommand. I can only find examples where you select a text and press a button to make the selected text bold (or other stuff). But I would like to be able to write **bold text** and that it automatically makes the text between ** bold. Same like the editor from stackoverflow, but I don't want the ** to be removed. They should still be there, but maybe in another style. I don't know how to do it. Do you do that with Regex or how?

Related

How to format a text like bold/italic in UITextField in Swift iOS?

Here consider this image. I have taken a toolbar with icons for text formatting. After selecting that sentence if I hit B (bold) it should be bold. Even I need that too if I select bold then further text to be show as bold. Consider this textbox UITextField. Incase you have some good reference like github you are welcome. I have already spend two days in a row in SO but not get any proper solution. One bold function is enough for me.

Multiline find & replace in Xcode

I would like to replace
import Quick
import Nimble
with
import XCTest
Is it possible to do it in Xcode find and replace or I have to use Xcode regular expressions?
I have tried: import Quick\nimport Nimble but it doesn't work as expected
You can find for multiline text and replace it (cmd+opt+f) with new text. make sure to copy and paste multiline text as it is written on the Xcode file.
I don't know how you tried and failed. But I tried and it worked. Procedures as bellow:
First select and copy the lines you wanna replace.
Shift+Option+CMD+F to open Find navigator in Xcode, then CMD+V to paste the multiline text.
You can also choose a scope for search. Then input the new line.
THE FAST WAY:
You can simply copy both lines dragging with the mouse and the paste them on find textfield.
THE COOL LEEMUR'S WAY:
But also there is a great way to find expressions:
Press CMD + f
A find field will appear on the top of the editor.
At the right side of the find field there is a "+" sign
Press "+" will display a list of special characters
Its very useful, you can make something similar to regular expressions, mixing literal text with patterns
You can try to find the expression just in the current file writing it in the top find field. Or you can try to find the expression in the whole project using the Find Navigation tab on the left. As you will see the expression will appear there also.
Moreover if you want you can use an actual regular expression to find something if you press in the word "Contains" at the left of the "+" sign. It will show a list where you can select the option "Regular Expression"
If you want to find text select "Find" at the left of the editor. If you want to replace it, select "Replace" and a new field will appear below.
You can replace the text with another pattern, using some of the words that you used to find the text. If you double clic on "Word1" at the find field it will appear at the replace field.
In this example I'm changing the order of two words around MyText

How to add some text above the special Latex arrow `\hookrightarrow`?

I wanna add some text such as true:coin above the special Latex arrow \hookrightarrow.Any methods I tried is doesn't work.
I use Latex in the markdown editor in web browser.
Both
$$\hookrightarrow^{xxx}$$
and
$$\hookrightarrow[]{xxx}$$
isn't work.
I want the result is that the xxx is abolve the arrow \hookrightarrow.
I am sorry i get it.
Using $$\xhookrightarrow[]{true:coin}$$.It is useful.

Set default text size/color for text boxes in Master Slide PowerPoint 2013

I'm working with a PowerPoint document which annoyingly sets all newly inserted text boxes' color to Red and uses Century Gothic. I believe this is due to the Master Slide being used by the document.
I would like to remove this automatic setting from text boxes in the Master Slide but I cannot figure out how?
I have gone into the Master Slide view and found that there are no text physical text boxes, there are however "Text Placeholders" but no text boxes. I find it strange and wonder:
how are these newly inserted text boxes contain pre-set font type and color?
If you aren't trying to do this in code, StackOverflow isn't really the right place for the question; you want SuperUser for "How do I ..." questions that don't involve code.
But what you want to do is select a text box that's formatted the way you want default text to be, then right click it and choose Set As Default Text Box. You won't get that option if you've clicked WITHIN the text box and have an insertion cursor; in that case press ESC, then rightclick.
If you're trying to do this in code, select a text box formatted to taste then do something like this:
Sub SetMeAsDefault()
Dim oSh As Shape
Set oSh = ActiveWindow.Selection.ShapeRange(1)
With oSh
.SetShapesDefaultProperties
End With
End Sub
The shape and text box defaults are independent of master formatting, which controls only the formatting of placeholders and text within placeholders. Text/shapes inserted via the Insert ribbon/menu follow the defaults set for the presentation as I've described above. Each presentation (and template) can have its own set of defaults.

data-placeholder and jQueryUI autocomplete

Is there a simple way to have a default text in the textbox using jQueryUI's autocomplete ?
I have tried using data-placeholder but it doesn't seem to work.
I have searched online, and people suggest using the textbox value to display the text, and clear it on focus. But then I would need to change the font style just for the default text, and check onKeyUp when the text is manually erased etc...
Is there no easier way to do this ? or am I missing something ?
A lot of people will use a span that is positioned to be over the text box. When the text box gets focus then you hide the span. When the text box blurs and has a value, you don't show it. If it doesn't have a value then you can show it again.
You can style the span however you want independently of the text box so you would not have to change the font style on the text box itself. You would have to subscribe to the focus and blur events, but it would be much easier if you created a jQuery plugin to do this. In fact, I'm sure there are ones that already exist that do this.

Resources