Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CodeMirror tag insert and selection problem (Wikipedia editor with MW syntax highlighting) #1

Open
Eccenux opened this issue Oct 10, 2022 · 3 comments

Comments

@Eccenux
Copy link
Owner

Eccenux commented Oct 10, 2022

CodeMirror is used for syntax highlighting on Wikipedia (for wikicode).

Test code:

setTimeout(function(){
	console.log('2 sek')
},7000)
setTimeout(function(){
	console.log('1 sek')
},8000)
setTimeout(function(){
	sel_t3.insertText('<b>', '</b>', 'bold')
},9000)

Edit field before insertText ("d.e.f" is selected):

a
b
c
d
e
f
g
h

After:

a
b
c<b>d

e

f</b>
g
h

Problem is from invalid selection text (note double \n):

{ isEditable: true, isInput: false, selected: "d\n\ne\n\nf" }
@Eccenux
Copy link
Owner Author

Eccenux commented Oct 10, 2022

On Windows this used to return multiple \r\n, which made things worse (added new line and space upon insert). But fixed that in 3.0.1.

@Eccenux
Copy link
Owner Author

Eccenux commented Oct 19, 2022

Not a CodeMirror bug. It is fine on CM site (screen).
obraz

It's a bug in CM from MediWiki or some plugins loaded for it.

Reported upstream:
https://phabricator.wikimedia.org/T321144

@Eccenux
Copy link
Owner Author

Eccenux commented Nov 7, 2022

Should be fixed by update to CM6:
T259059 Upgrade to CodeMirror 6

@Eccenux Eccenux changed the title CodeMirror tag insert and selection problem CodeMirror tag insert and selection problem (Wikipedia editor with MW syntax highlighting) Jan 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant