Commit abfc5c69 authored by Michael Chaudhary's avatar Michael Chaudhary

Merge branch 'update/133/CodeEditor' into 'master'

Update CodeEditor for 1.33

See merge request !43
parents 0cb5c48d 3cab502b
{
"root": true,
"extends": [
"wikimedia/client",
"wikimedia/jquery"
],
"globals": {
"mw": false,
"OO": false
},
"rules": {
"max-len": 0
}
}
node_modules/
vendor/
ace-git/
composer.lock
.eslintcache
# Editors
*.kate-swp
*~
\#*#
.#*
.*.swp
.project
.buildpath
.classpath
.settings
cscope.files
cscope.out
*.orig
## NetBeans
nbproject*
project.index
## Sublime
sublime-*
sftp-config.json
[gerrit]
host=gerrit.wikimedia.org
port=29418
project=mediawiki/extensions/CodeEditor.git
track=1
defaultrebase=0
\ No newline at end of file
<?php
return require __DIR__ . '/../vendor/mediawiki/mediawiki-phan-config/src/config.php';
<?xml version="1.0"?>
<ruleset>
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki" />
<file>.</file>
<arg name="extensions" value="php,php5,inc" />
<arg name="encoding" value="UTF-8" />
</ruleset>
{
"extends": "stylelint-config-wikimedia"
}
The development of this software is covered by a [Code of Conduct](https://www.mediawiki.org/wiki/Special:MyLanguage/Code_of_Conduct).
<?php
/**
* Helper to load syntax-highlighting editor for JavaScript and CSS pages
* on-wiki.
*
* Extends and requires WikiEditor extension.
*
* Extension code is GPLv2 following MediaWiki base.
* Ace editor JS code follows its own license, see in the 'ace' subdir.
*/
/**
* This PHP entry point is deprecated.
* Please use wfLoadExtension() and the extension.json file instead.
* See https://www.mediawiki.org/wiki/Manual:Extension_registration for more details.
*/
if ( function_exists( 'wfLoadExtension' ) ) {
wfLoadExtension( 'CodeEditor' );
// Keep i18n globals so mergeMessageFileList.php doesn't break
$wgMessagesDirs['CodeEditor'] = __DIR__ . '/i18n';
/* wfWarn(
'Deprecated PHP entry point used for CodeEditor extension. ' .
'Please use wfLoadExtension instead, ' .
'see https://www.mediawiki.org/wiki/Extension_registration for more details.'
); */
return;
} else {
die( 'This version of the CodeEditor extension requires MediaWiki 1.25+' );
}
......@@ -9,12 +9,19 @@
module.exports = function ( grunt ) {
var conf = grunt.file.readJSON( 'extension.json' );
grunt.loadNpmTasks( 'grunt-banana-checker' );
grunt.loadNpmTasks( 'grunt-contrib-clean' );
grunt.loadNpmTasks( 'grunt-contrib-copy' );
grunt.loadNpmTasks( 'grunt-eslint' );
grunt.loadNpmTasks( 'grunt-exec' );
grunt.loadNpmTasks( 'grunt-stylelint' );
grunt.loadNpmTasks( 'grunt-jsonlint' );
grunt.initConfig( {
eslint: {
options: {
reportUnusedDisableDirectives: true,
cache: true
},
all: [
'**/*.js',
'!node_modules/**',
......@@ -38,9 +45,42 @@ module.exports = function ( grunt ) {
'!node_modules/**',
'!vendor/**'
]
},
exec: {
'npm-update-ace': {
cmd: 'npm update ace-builds',
callback: function ( error, stdout, stderr ) {
grunt.log.write( stdout );
if ( stderr ) {
grunt.log.write( 'Error: ' + stderr );
}
if ( error !== null ) {
grunt.log.error( 'update error: ' + error );
}
}
}
},
clean: {
ace: [ 'modules/ace/*' ]
},
copy: {
ace: {
expand: true,
cwd: 'node_modules/ace-builds/src-noconflict/',
src: [ '**' ],
dest: 'modules/ace/'
},
'ace-license': {
expand: true,
cwd: 'node_modules/ace-builds/',
src: [ 'LICENSE' ],
dest: 'modules/ace/'
}
}
} );
grunt.registerTask( 'update-ace', [ 'exec:npm-update-ace', 'clean:ace', 'copy:ace', 'copy:ace-license' ] );
grunt.registerTask( 'test', [ 'eslint', 'stylelint', 'jsonlint', 'banana' ] );
grunt.registerTask( 'default', 'test' );
};
# Helper to pull the ace goodies
.PHONY: all clean refresh
all: refresh
clean:
rm -rf modules/ace ace-git
refresh: ace-git
test -d modules/ace || mkdir modules/ace
(cd ace-git && git checkout master && git pull origin master)
(cd ace-git && npm install && node ./Makefile.dryice.js -nc)
rsync -av ace-git/build/src-noconflict/ modules/ace/
cp ace-git/LICENSE modules/ace/LICENSE
ace-git:
git clone git://github.com/ajaxorg/ace.git ace-git
{
"require-dev": {
"jakub-onderka/php-parallel-lint": "1.0.0",
"mediawiki/mediawiki-codesniffer": "18.0.0",
"mediawiki/mediawiki-codesniffer": "24.0.0",
"jakub-onderka/php-console-highlighter": "0.3.2",
"mediawiki/minus-x": "0.3.1",
"mediawiki/mediawiki-phan-config": "0.2.0"
"mediawiki/mediawiki-phan-config": "0.5.0"
},
"scripts": {
"test": [
......@@ -18,6 +18,6 @@
]
},
"extra": {
"phan-taint-check-plugin": "1.2.0"
"phan-taint-check-plugin": "1.5.0"
}
}
......@@ -10,9 +10,9 @@
"license-name": "GPL-2.0-or-later AND BSD-3-Clause",
"type": "editor",
"requires": {
"MediaWiki": ">= 1.29.0",
"MediaWiki": ">= 1.32.0",
"extensions": {
"WikiEditor": "*"
"WikiEditor": ">= 0.5.2"
}
},
"Hooks": {
......@@ -53,7 +53,6 @@
"ext.codeEditor.ace",
"jquery.ui.resizable",
"mediawiki.api",
"mediawiki.api.options",
"mediawiki.user",
"user.options",
"mediawiki.cookie",
......
{"head": "bfb8a3adb8aa453758516feee5ce9fc1601be586\n", "remoteURL": "https://gerrit.wikimedia.org/r/mediawiki/extensions/CodeEditor", "headCommitDate": "1554063372", "branch": "bfb8a3adb8aa453758516feee5ce9fc1601be586\n", "headSHA1": "bfb8a3adb8aa453758516feee5ce9fc1601be586\n"}
\ No newline at end of file
{
"@metadata": {
"authors": [
"StanProg",
"Vlad5250"
]
},
"codeeditor-desc": "Редактиране с оцветяване на синтаксиса за JavaScript и каскадни стилови множества (CSS), използвайки редактора [https://ace.c9.io/ Ace]",
"codeeditor-next-annotation": "Към следващата анотация",
"codeeditor-toolbar-toggle": "Превключване на редактора на код"
}
{
"@metadata": {
"authors": [
"Aftabuzzaman"
"Aftabuzzaman",
"আফতাবুজ্জামান"
]
},
"codeeditor-desc": "[https://ace.c9.io/ Ace সম্পাদক] সম্পাদক ব্যবহার করে জাভাস্ক্রিপ্ট ও সিএসএস পাতাগুলির জন্য সিনট্যাক্স-আলোকপাতসহ সম্পাদনা করতে দেয়",
......
......@@ -5,5 +5,6 @@
]
},
"codeeditor-desc": "Синтаксисан беснашца тадар JavaScript and CSSн [https://ace.c9.io/ Ace тадаран] гӀоьнца",
"codeeditor-toolbar-toggle": "Кодан тадерг кхечутӀеерзор",
"codeeditor-save-with-errors": "Документан чохь гӀалаташ ду. Лаьий хьуна, и дӀаяздан?"
}
......@@ -2,7 +2,8 @@
"@metadata": {
"authors": [
"Mormegil",
"Matěj Suchánek"
"Matěj Suchánek",
"Patriccck"
]
},
"codeeditor-desc": "Editace stránek s JavaScriptem a CSS se zvýrazňováním syntaxe prostřednictvím [https://ace.c9.io/ editoru Ace]",
......@@ -18,5 +19,5 @@
"codeeditor-indent": "Odsadit",
"codeeditor-outdent": "Zmenšit odsazení",
"codeeditor-error-title": "Nevyplněná závislost",
"codeeditor-error-message": "CodeEditor vyžaduje, aby byl načten WikiEditor."
"codeeditor-error-message": "Editor zdrojového kódu vyžaduje, aby byl načten wiki editor."
}
......@@ -5,6 +5,13 @@
"Nikosgranturismogt"
]
},
"codeeditor-next-annotation": "Πηγαίνετε στην επόμενη σημείωση",
"codeeditor-toolbar-toggle": "Επεξεργαστής κώδικα εναλλαγής",
"codeeditor-indent": "Οδόντωση"
"codeeditor-save-with-errors": "Το έγγραφο περιέχει σφάλματα. Είστε σίγουρος ότι θέλετε να το αποθηκεύσετε;",
"codeeditor-gotoline": "Πηγαίνετε στον αριθμό γραμμής...",
"codeeditor-gotoline-placeholder": "γραμμή[:στήλη]",
"codeeditor-gotoline-prompt": "Εισαγωγή ενός αριθμού γραμμής",
"codeeditor-indent": "Οδόντωση",
"codeeditor-error-title": "Η εξάρτηση απέτυχε",
"codeeditor-error-message": "Το CodeEditor χρειάζεται το WikiEditor για να φορτωθεί."
}
......@@ -8,6 +8,7 @@
]
},
"codeeditor-desc": "رنگی‌کنندهٔ ساختار زبانی برای جاوااسکریپت و صفحات سی‌اس‌اس از [https://ace.c9.io/ ویرایشگر آس] استفاده می‌کند",
"codeeditor-next-annotation": "برو به نشان‌گذاری بعدی",
"codeeditor-toolbar-toggle": "ضامن ویرایشگر کد",
"codeeditor-save-with-errors": "این سند دارای اشکال‌هایی است. اطمینان دارید که می‌خواهید ذخیره‌اش کنید؟",
"codeeditor-gotoline": "برو به خط شماره...",
......
......@@ -4,7 +4,8 @@
"Toliño",
"Elisardojm",
"Banjo",
"McDutchie"
"McDutchie",
"Navhy"
]
},
"codeeditor-desc": "Edición de páxinas en JavaScript e CSS con realce sintáctico que emprega o [https://ace.c9.io/ editor Ace]",
......@@ -13,7 +14,7 @@
"codeeditor-save-with-errors": "O documento contén varios erros. Está seguro de querer gardar o texto?",
"codeeditor-invisibleChars-toggle": "Amosar ou ocultar caracteres invisibles",
"codeeditor-lineWrapping-toggle": "Activar ou desactivar liñas envolventes",
"codeeditor-searchReplace-toggle": "Activar xanela de buscar e reemprazar",
"codeeditor-searchReplace-toggle": "Activar xanela de procurar e reemprazar",
"codeeditor-gotoline": "Ir á liña número...",
"codeeditor-gotoline-placeholder": "liña[:columna]",
"codeeditor-gotoline-prompt": "Introduce un número de liña",
......
......@@ -14,6 +14,6 @@
"codeeditor-searchReplace-toggle": "Mostra/nascondi cerca e sostituisci",
"codeeditor-gotoline": "Vai alla riga numero...",
"codeeditor-gotoline-placeholder": "linea[:colonna]",
"codeeditor-indent": "Rientro",
"codeeditor-outdent": "rientro negativo"
"codeeditor-indent": "Indentazione",
"codeeditor-outdent": "Riduci indentazione"
}
......@@ -13,6 +13,7 @@
"codeeditor-toolbar-toggle": "코드 편집기 전환",
"codeeditor-save-with-errors": "문서에 오류가 들어 있습니다. 저장하겠습니까?",
"codeeditor-gotoline": "...줄로 넘어가기",
"codeeditor-gotoline-placeholder": "행[:열]",
"codeeditor-gotoline-prompt": "줄 번호를 입력하십시오",
"codeeditor-indent": "들여쓰기",
"codeeditor-outdent": "내어쓰기",
......
{
"@metadata": {
"authors": [
"Obsuser"
"Obsuser",
"BadDog"
]
},
"codeeditor-toolbar-toggle": "Укључи/искључи уређивач кода"
"codeeditor-desc": "Уређивање са истакнутом синтаксом за JavaScript и CSS странице помоћу [https://ace.c9.io/ Ace уређивача]",
"codeeditor-next-annotation": "Иди на следећу белешку",
"codeeditor-toolbar-toggle": "Уређивач кода",
"codeeditor-save-with-errors": "Документ садржи грешке. Желите ли заиста да га сачувате?",
"codeeditor-invisibleChars-toggle": "Невидљиви знакови",
"codeeditor-lineWrapping-toggle": "Преламање редова",
"codeeditor-searchReplace-toggle": "Претражи и замени",
"codeeditor-gotoline": "Иди на број реда…",
"codeeditor-gotoline-placeholder": "ред[:колона]",
"codeeditor-gotoline-prompt": "Унос броја реда",
"codeeditor-indent": "Увуци",
"codeeditor-outdent": "Извуци",
"codeeditor-error-title": "Грешка зависности",
"codeeditor-error-message": "Уређивачу кода потребан је учитан „Вики уређивач”"
}
{
"@metadata": {
"authors": [
"Ильнар"
]
},
"codeeditor-desc": "[https://ace.c9.io/ Ace мөхәррире] ярдәмендә JavaScript- һәм CSS-битләрендә синтакс-аеру куллану",
"codeeditor-next-annotation": "Киләсе аннотацияга күчү",
"codeeditor-toolbar-toggle": "Код мөхәррирен алыштыру",
"codeeditor-save-with-errors": "Документта хаталар бар. Сакларга телисезме?",
"codeeditor-invisibleChars-toggle": "Яшерен символларны күрсәтү",
"codeeditor-lineWrapping-toggle": "Юлларны күчерү",
"codeeditor-searchReplace-toggle": "Эзләү диалогын һәм текстны алмаштыруны күчерү",
"codeeditor-gotoline": "... номерлы юлга күчү",
"codeeditor-gotoline-placeholder": "юл[:багана]",
"codeeditor-gotoline-prompt": "Юлның номерын кертегез",
"codeeditor-indent": "Чигенеш",
"codeeditor-outdent": "Сулга күчеш",
"codeeditor-error-title": "Бәйлелек хатасы",
"codeeditor-error-message": "CodeEditor өчен WikiEditor кушымтасын йөкләү кирәк."
}
......@@ -31,22 +31,20 @@ class CodeEditorHooks {
/**
* @param User $user
* @param array &$defaultPreferences
* @return bool
*/
public static function getPreferences( $user, &$defaultPreferences ) {
public static function getPreferences( User $user, &$defaultPreferences ) {
$defaultPreferences['usecodeeditor'] = [
'type' => 'api',
'default' => '1',
];
return true;
}
/**
* @param EditPage $editpage
* @param OutputPage $output
* @return bool
* @throws ErrorPageError
*/
public static function editPageShowEditFormInitial( $editpage, $output ) {
public static function editPageShowEditFormInitial( EditPage $editpage, OutputPage $output ) {
$title = $editpage->getContextTitle();
$model = $editpage->contentModel;
$format = $editpage->contentFormat;
......@@ -58,6 +56,5 @@ class CodeEditorHooks {
} elseif ( !ExtensionRegistry::getInstance()->isLoaded( "WikiEditor" ) ) {
throw new ErrorPageError( "codeeditor-error-title", "codeeditor-error-message" );
}
return true;
}
}
......@@ -22,6 +22,7 @@
*/
$( function () {
// eslint-disable-next-line no-jquery/no-global-selector
var $wpTextbox1 = $( '#wpTextbox1' );
// Code is supposed to be always LTR. See bug 39364.
......
/* Ace syntax-highlighting code editor extension for wikiEditor */
/* global ace */
( function ( $, mw, OO ) {
/* eslint-disable no-jquery/no-global-selector */
( function () {
$.wikiEditor.modules.codeEditor = {
/**
* Core Requirements
......@@ -216,7 +217,7 @@
tools: {
codeEditor: {
labelMsg: 'codeeditor-toolbar-toggle',
type: 'button',
type: 'toggle',
oouiIcon: 'markup',
action: {
type: 'callback',
......@@ -252,7 +253,7 @@
tools: {
invisibleChars: {
labelMsg: 'codeeditor-invisibleChars-toggle',
type: 'button',
type: 'toggle',
oouiIcon: 'pilcrow',
action: {
type: 'callback',
......@@ -261,7 +262,7 @@
},
lineWrapping: {
labelMsg: 'codeeditor-lineWrapping-toggle',
type: 'button',
type: 'toggle',
oouiIcon: 'wrapping',
action: {
type: 'callback',
......@@ -279,7 +280,7 @@
},
toggleSearchReplace: {
labelMsg: 'codeeditor-searchReplace-toggle',
type: 'button',
type: 'toggle',
oouiIcon: 'articleSearch',
action: {
type: 'callback',
......@@ -358,6 +359,7 @@
// Ace doesn't like replacing a textarea directly.
// We'll stub this out to sit on top of it...
// line-height is needed to compensate for oddity in WikiEditor extension, which zeroes the line-height on a parent container
// eslint-disable-next-line no-jquery/no-parse-html-literal
container = context.$codeEditorContainer = $( '<div style="position: relative"><div class="editor" style="line-height: 1.5em; top: 0; left: 0; right: 0; bottom: 0; position: absolute;"></div></div>' ).insertAfter( box );
editdiv = container.find( '.editor' );
......@@ -506,9 +508,9 @@
delayedUpdate,
editor = context.codeEditor,
lang = ace.require( 'ace/lib/lang' ),
$errors = $( '<span class="codeEditor-status-worker-cell ace_gutter-cell ace_error">0</span>' ),
$warnings = $( '<span class="codeEditor-status-worker-cell ace_gutter-cell ace_warning">0</span>' ),
$infos = $( '<span class="codeEditor-status-worker-cell ace_gutter-cell ace_info">0</span>' ),
$errors = $( '<span>' ).addClass( 'codeEditor-status-worker-cell ace_gutter-cell ace_error' ).text( '0' ),
$warnings = $( '<span>' ).addClass( 'codeEditor-status-worker-cell ace_gutter-cell ace_warning' ).text( '0' ),
$infos = $( '<span>' ).addClass( 'codeEditor-status-worker-cell ace_gutter-cell ace_info' ).text( '0' ),
$message = $( '<div>' ).addClass( 'codeEditor-status-message' ),
$lineAndMode = $( '<div>' ).addClass( 'codeEditor-status-line' ),
$workerStatus = $( '<div>' )
......@@ -683,6 +685,7 @@
* @param {Object} extended
*/
saveAndExtend = function ( base, extended ) {
// eslint-disable-next-line no-jquery/no-map-util
$.map( extended, function ( func, name ) {
var orig;
if ( name in base ) {
......@@ -848,4 +851,4 @@
}
};
}( jQuery, mediaWiki, OO ) );
}() );
{
"name": "codeeditor",
"version": "0.0.0",
"private": true,
"description": "Build tools for the CodeEditor extension.",
"scripts": {
"test": "grunt test"
},
"devDependencies": {
"ace-builds": "1.2.9",
"eslint-config-wikimedia": "0.11.0",
"grunt": "1.0.3",
"grunt-banana-checker": "0.6.0",
"grunt-contrib-clean": "2.0.0",
"grunt-contrib-copy": "1.0.0",
"grunt-eslint": "21.0.0",
"grunt-exec": "3.0.0",
"grunt-jsonlint": "1.1.0",
"grunt-stylelint": "0.10.1",
"postcss-less": "1.1.3",
"stylelint-config-wikimedia": "0.5.0"
}
}
{
"extends": [
"wikimedia/qunit",
"../.eslintrc.json"
]
}
<?php
return require __DIR__ . '/../../vendor/mediawiki/mediawiki-phan-config/src/config.php';
CodeEditor: REL1_33
2019-06-17T19:06:29
bfb8a3a
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment