Extension talk:CharInsert

Jump to navigation Jump to search

About this board

Archives 


Fokebox (talkcontribs)

Hello. Is it possible to create a button like with simple text "Python code" and it would insert a piece of text like

<syntaxhighlight lang="Python"></syntaxhighlight>
Reply to "How to create a button"

This is a great extension. Loved it

1
RIT RAJARSHI (talkcontribs)

It is a very useful tool. Please do not obsolete it. RIT RAJARSHI (talk) 06:29, 6 April 2020 (UTC)

Reply to "This is a great extension. Loved it"

Suggestions for improvement of documentation

1
Escalatr (talkcontribs)

I am using the CharInsert extension on a local wiki installation. However I find the information in Extension:CharInsert#Notes confusing, not very helpful.

I actually found important information for customization at other places.

Following explanations:

  • Use &#10; to add new lines (\n).
    • I had to use \\n with double backslashes
  • Enclose white spaces in nowiki tags when needed.
    • <nowiki> tag might actually work (not sure here), however using just the dot sign . is much more convenient
  • And probably the most confusing issue was: depending on the wiki configuration it might take quite a while till the changes in Gadget-charinsert-core.js are actually used, in my case the toolbar used an older version from the cache for certain time.
Reply to "Suggestions for improvement of documentation"

MediaWiki:Gadget-Edittools.js needs to be updated

2
Dalba (talkcontribs)

I believe the code in MediaWiki:Gadget-Edittools.js is broken after phab:T30856. Clicking on buttons prints the following error into browsers console:

TypeError: mw.toolbar is undefined; can't access its "insertTags" property

Dalba (talkcontribs)

Can you move the location of the Edittools box?

4
ElectricRay (talkcontribs)

his might not be the most appropriate location for this query (I have also posted it to Mediawiki:Edittools, but is it possible to adjust preferences, skin, common.css etc to have the edittools/charinsert box ABOVE the edit window rather than below it? ElectricRay (talk) 14:44, 9 May 2018 (UTC)

Perhelion (talkcontribs)

I posted a code there. There is also on Commons a default gadget which does this for the Wikieditor (converts them all).

101.26.42.115 (talkcontribs)

Excuse me, where can I see Commons a default gadget? Thank you!

Perhelion (talkcontribs)
Reply to "Can you move the location of the Edittools box?"
24pm (talkcontribs)

Is it a way how to exlude (or not to include) Edittools page (with CharInsert) from Forms? Since CharInsert does not work there properly, at least on MW 1.27. I mean do not include in edit mode, in view mode Forms look fine.

Quiddity (WMF) (talkcontribs)

Hi. Please could you clarify which specific Forms you mean? I don't think you mean Extension:InputBox which is the usual meaning that I'm familiar with, on wikimedia wikis. Thanks! (direct example links almost always help.)

24pm (talkcontribs)

I mean form pages which are created with Extension:Page Forms...

I have found out that is was my fault. I've added Edittools in MediaWiki:Summary for better access durint the editing. So this updated Summary massage was shown in forms as plain text without parsing by CharInsert.

Solution: remove Summary from forms.

Reply to "Exclude from Forms"
Ineuw (talkcontribs)

For what it's worth, I like it. For text editing in Wikisource it's very helpful. Thanks to those who designed and implemented it.

2A01:E35:8A8D:FE80:9A7:81B4:B3AB:846F (talkcontribs)

Not very informative.

Reply to "Just my personal comment"
Subfader (talkcontribs)

Previously (<=MW 1.25) we could add code that adds linebreaks on insert with &#13;.

E.g.

<charinsert label="Foo Bar"><nowiki>Foo&#13;Bar</charinsert></nowiki>

inserts

Foo
Bar

In MW 1.27.1 these are returned as �.

Quiddity (WMF) (talkcontribs)

Hmm, does this work?

#x0A; instead of #13;

(Note: I am not a dev. I just poked around on google a bit, and also noticed that roundtripping #13; in parsoid resulted in #x0A;...)

Subfader (talkcontribs)

Tried it before. It's also not working, but differently:

&#13;:

&#x0A; does the linebreak in the links (but we want them in the inserted text):

Can't you try on mediawiki.org?

<charinsert label="Foo Bar"><nowiki>Foo&#13;Bar</charinsert></nowiki>
Quiddity (WMF) (talkcontribs)

I assume you've tried a raw linebreak, too?

(I'm not comfortable with personally testing things on such a prominent interface element on mediawiki.org, and the CharInsert doesn't appear to be functional at Testwiki: or https://en.wikipedia.beta.wmflabs.org ... so I can't do testing there... :/ )

I'll try to find a dev to take a look...

Bawolff (talkcontribs)

&#x0a (newline) is much more correct than #13 (carriage return)

I cant really reproduce what you are describing. It sounds almost like you are running into doBlockLevels() (aka pre formatting when you start a line with a space). Can you paste the exact code you are using?

The syntax you are using is a bit odd. Nowiki is misnested, and you have a label attribute which isnt part of the extension...

As an aside you can test charinsert on any page during preview. You do not need to edit mediawiki ns to test.

Subfader (talkcontribs)
Bawolff (talkcontribs)

Try killing the space between the &#10; and the |:

<charinsert>{{Infobox&#10;|&#10;}}</charinsert>

Perhaps the extension should be changed so that charInsertHook() returns an array with first parameter the current return value and a 'markerType' => 'nowiki' parameter.

Subfader (talkcontribs)

Fixed it already using the labels, thanks.

Reply to "Insert linebreaks?"

Character insertion stopped working after 1.25wmf14 rollout

4
George Orwell III (talkcontribs)

Subject says it all.

See task T86715 Regression: No longer able to insert characters using CharInsert gadget based on extension after 1.25wmf14 roll-out.

Londonjackbooks (talkcontribs)

Anxious for this to be resolved, as the work I am editing requires the gadget's use on almost every page. Thanks, Londonjackbooks (talk) 00:23, 14 January 2015 (UTC)

George Orwell III (talkcontribs)

"The gadget needs to be made dependent on mediawiki.toolbar in the gadgets definition:

charinsert-core[ResourceLoader|hidden|rights=hidden|dependencies=mediawiki.action.edit,mediawiki.toolbar,jquery.textSelection,user]|charinsert-core.js|charinsert-core.css

Added the dependency on en.wikisource and character insertion works again. Hat-tip to TTO.

Gigajoule (talkcontribs)
Reply to "Character insertion stopped working after 1.25wmf14 rollout"
Prod (talkcontribs)

What is the difference between this extension and the charinsert gadget? Do I need to install both or only one of them to get the the drop-down box like wikipedia?

Quiddity (WMF) (talkcontribs)
Prod (talkcontribs)

What does this extension provide that the gadget doesn't?

Prod (talkcontribs)

I've deployed the gadget, and removed this extension, and I get all the features that I required. It seems this extension is only required if one doesn't want to deploy the gadgets extension.

Reply to "Extension vs Gadget"