This fixes a bug where the event could be triggered before the
WikiEditor context was ready. Also make sure that the fragment monitor
takes into account the possible disabled state of the CodeEditor.
Bug: T103802
Change-Id: Id5564c4a91a0a14632024781f3e57b68c4803970
The setting of the width is not necessary and sometimes it generates
a width which is to wide.
Bug: T102736
Change-Id: I7ed715fba4d65e7a571421b7a06d604e6b0958f7
- toggle invisible characters.
- search and replace (disabled)
- indent/outdent
- line wrapping
- go to line
Icons by Connor Shea
Bug: T61923
Change-Id: I9e434d1b23f8254bc654ebbd31b5e4b70bbf5fe1
In the past I had made the annotation indicators clickable, and your
cursor will in this case navigate to the next annotation in editor.
This was not really easily discoverable, so I have added a tooltip to
make it slightly more discoverable.
I also added a CSS line to prevent users from accidently selecting the
text (or rather numbers) in this area, which I had noticed happened to
me at times when trying to click it.
Change-Id: I47ecba232ff925169d0f64d85ae34ff6564cc1a5
Depends on I30bd709d8 in mediawiki-core.
The '#wpTextbox1' gets read by textSelection( 'getContents' ).
The trigger is not necessary anymore.
Change-Id: Iae54a2422ff1814f8858723d51fcb10d04645c51
There isn't much in it yet, but it's a start.
Also needs a patch in WikiEditor, which is forcing some elements to be
visible for no apparent reason.
Change-Id: I6b57e5c11066a104a89bef3b7c8efd2129a80a8f
Split context.evt up into 2 objects
- context.fn, where WikiEditor API functions are defined
- textSelectionFn, where all textSelection API function are defined.
- scrollToTop() is moved to the WikiEditor API block
- getElementAtCursor() is removed. It is no longer in use by the
WikiEditor API or the textSelection API.
This depends on MediaWiki core change I14492572
Bug: 29328
Change-Id: I57bc7791dc61b7edcf258e6c16445d5a4a8783cf
Follows-up 86622b6.
While these functions looked like placeholders in a configuration
object to allow calling them unconditionally, they actually had
meaning. They were event overrides to prevent WikiEditor from
running its own event handlers.
They were implicitly returning false by having no return statement
(implying a 'return undefined', which casts to false).
The separate functions were already quite obfuscated as returning
false, using $.noop made it even harder to understand what's
going on.
Use an explicit return value instead.
Change-Id: I0852fbc9225d069f50085787d2d0105fd7b1743c
This makes it so that if you do not have WikiEditor enabled, you also
will not have CodeEditor enabled. In the feedback we have seen so far,
this seems to be desirable for those users (bug 55936).
Also people were not able with the cookie pref for the editor, because
it can easily expire. This introduces a hidden pref, controlled by the
enable/disable CodeEditor button, to preserve this value instead (bug
46779).
It also gives a more reliable way to detect if the editor is enabled or
disabled. mw.user.options.get( 'usebetatoolbar' ) and
mw.user.options.get( 'usecodeeditor' ) combined should be able to convey
this information to something like WikEd (bug 62250).
Bug: 46779
Bug: 62250
Bug: 55936
Change-Id: I4639f68c00a2b9183a6f89b5e00983c07a8592a2
IE8 uses innerText, which is a bit more sloppy with line ending
preservation than other browsers are. Instead of copying the value into
the DOM and have the Editor pick it up during init, just set it directly
on the EditSession. Should even be faster.
Bug: 64559
Change-Id: Iafbb07afb6d06ed94057f8ddf8b080fd136d7fb3
- Show counts of errors/warnings/info annotations. This is useful
because the annotations are in the gutter, so in big files it takes
a lot of scrolling to look for errors
- Clicking the totals count skips you to the 'next' annotation
- If the current line contains an error, show the message of the error
in the status bar.
- Show the current line:column number, the selection range and the
editor mode.
- Degrades to a useful and readable but not pretty state in IE7
More complex version of: Ib9f08fcbc0365302756095b9027289736856fc73
Bug: 63294
Change-Id: Ided0804d5eb7864452287087dd1cf5a3dd8ff078
This hook is never fired, therefore, per code review of
Ife952fc165dacea3ae7726e09bf61279f4bdae59 it should be
removed from CodeEditor.
Bug: 47235
Bug: 52071
Change-Id: Ic9dd9066f7d1676f45381cb6796425f13490fea3
Now that the RL path is set correctly we can enable the webworkers
This adds syntax checker and linting
Change-Id: Ie9177d4acae45f2aadb1dfd3e66049195056bca0
ACE defaults to a white background now. I have no preference in
this, but it is caused by a change in the TextMate theme. There is a
bugreport (Bug 55423) about the old blue background.
This fixes an annoying problem with Safari 7, where characters are no
longer properly measured by ACE.
https://github.com/ajaxorg/ace/issues/1534
Fixes double-click to select:
https://github.com/ajaxorg/ace/issues/956
Set proper basePath so that require works, allowing conditional loading
of ACE resources. Need for Find to work after this update
Bug: 55423
Bug: 45876
Bug: 58521
Change-Id: Ia64b67b4553f77c6ba3d2aefec4bab62d111deb7
LivePreview takes the text from the textarea and sends it to the server
via an Ajax call to handle preview and diff. But CodeEditor hides that
textarea, and only updates it when the form is submitted or the "disable
CodeEditor" button is used.
Fortunately, LivePreview already provides a custom JavaScript event to
indicate when it is about to pull the textarea contents. So all we have
to do is listen for that and update it.
Bug: 47235
Change-Id: Iba1b727c55aabcd31afc06cec99618fcdce207d8
Ace uses JavaScript Web Workers for linting code. Ace's attempt to load workers
in JS and JSON modes runs into the mismatch between its require()
implementation and ResourceLoader, resulting in a request for
/worker_<lang>.js, which 404s.
Change-Id: Ia60ef2122c015635ef0ad963a956b4f77cd6f7e8
Presumably the unbind was meant to refer to the event which was bound in
setupCodeEditor(), not a nonexistent function. It appeared to work because
passing an undefined value as the second argument to unbind() causes all
event handlers to be unbound.
Change-Id: I51b8e7de5e95cb17b595a6b8022a6216048cdb41
Remove the "using CodeEditor" automatic edit summary. Maybe this makes
sense for a gadget, but it certainly doesn't make sense as an extension
enabled by default for all JS, CSS and Lua pages.
Change-Id: If3b29d3878f5b8b43727ae34e4b5e3a2f4137a6f
* Scroll up a few lines so that the user can see the error context
* Defer processing of the fragment until the load event, otherwise the code editor is not fully initialised and does not properly respond to the navigateTo() call.