Commit adca7326 authored by Damyon Wiese's avatar Damyon Wiese
Browse files

MDL-43842: Import atto back into core

parent 46c627cf
......@@ -930,6 +930,11 @@ class core_plugin_manager {
$standard_plugins = array(
'atto' => array(
'bold', 'html', 'indent', 'link', 'orderedlist', 'strike', 'title', 'unlink',
'clear', 'image', 'italic', 'media', 'outdent', 'table', 'underline', 'unorderedlist'
),
'assignment' => array(
'offline', 'online', 'upload', 'uploadsingle'
),
......
......@@ -40,7 +40,7 @@ class editor extends base {
global $CFG;
if (empty($CFG->texteditors)) {
return array('tinymce'=>'tinymce', 'textarea'=>'textarea');
return array('atto'=>'atto', 'tinymce'=>'tinymce', 'textarea'=>'textarea');
}
$enabled = array();
......
This diff is collapsed.
Small, fast, accessible, mobile friendly text editor for Moodle
QUICK INSTALL
=============
Put this entire directory at:
PATHTOMOODLE/lib/editors/atto
Visit your site notifications page to install the new plugins.
Enable the new editor on the page:
Site administration / ► Plugins / ► Text editors / ► Manage editors
To make it the default, change the order so this editor is the first in the list.
In Moodle 2.6 users can also choose this editor from their profile preferences.
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Subplugin info class.
*
* @package editor_atto
* @copyright 2013 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace editor_atto\plugininfo;
use core\plugininfo\base;
defined('MOODLE_INTERNAL') || die();
class atto extends base {
public function is_uninstall_allowed() {
return true;
}
}
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Atto text editor installation steps.
*
* @package editor_atto
* @copyright 2013 Damyon Wiese <damyon@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
/**
* Enable this text editor by default.
*
* @return bool
*/
function xmldb_editor_atto_install() {
global $CFG;
// Get the current list of editors.
$currentconfig = $CFG->texteditors;
if (is_null($currentconfig)) {
$currentconfig = '';
}
$editors = explode(',', $currentconfig);
// Insert atto in the second position.
array_splice($editors, 1, 0, array('atto'));
// Remove duplicates.
$editors = array_unique($editors);
// Set the new config.
unset_config('texteditors');
set_config('texteditors', implode(',', $editors));
return true;
}
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Yui Editor
*
* @package editor_atto
* @copyright 2013 Damyon Wiese <damyon@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$subplugins = array('atto' => 'lib/editor/atto/plugins');
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Strings for component 'editor_atto', language 'en'.
*
* @package editor_atto
* @copyright 2013 Damyon Wiese <damyon@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$string['pluginname'] = 'Atto HTML editor';
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* YUI text editor integration.
*
* @package editor_atto
* @copyright 2013 Damyon Wiese <damyon@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
/**
* This is the texteditor implementation.
* @copyright 2013 Damyon Wiese <damyon@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class atto_texteditor extends texteditor {
/**
* Is the current browser supported by this editor?
*
* Of course!
* @return bool
*/
public function supported_by_browser() {
return true;
}
/**
* Returns array of supported text formats.
* @return array
*/
public function get_supported_formats() {
// FORMAT_MOODLE is not supported here, sorry.
return array(FORMAT_HTML => FORMAT_HTML);
}
/**
* Returns text format preferred by this editor.
* @return int
*/
public function get_preferred_format() {
return FORMAT_HTML;
}
/**
* Does this editor support picking from repositories?
* @return bool
*/
public function supports_repositories() {
return true;
}
/**
* Use this editor for give element.
*
* @param string $elementid
* @param array $options
* @param null $fpoptions
*/
public function use_editor($elementid, array $options=null, $fpoptions=null) {
global $PAGE;
$PAGE->requires->yui_module('moodle-editor_atto-editor',
'M.editor_atto.init',
array($this->get_init_params($elementid, $options, $fpoptions)));
$plugins = core_component::get_plugin_list('atto');
foreach ($plugins as $name => $fulldir) {
$PAGE->requires->string_for_js('pluginname', 'atto_' . $name);
$plugins[$name] = component_callback('atto_' . $name, 'sort_order', array($elementid));
}
asort($plugins);
foreach ($plugins as $name => $sort) {
component_callback('atto_' . $name, 'init_editor', array($elementid));
}
}
/**
* Create a params array to init the editor.
*
* @param string $elementid
* @param array $options
* @param array $fpoptions
*/
protected function get_init_params($elementid, array $options=null, array $fpoptions=null) {
global $PAGE;
$directionality = get_string('thisdirection', 'langconfig');
$strtime = get_string('strftimetime');
$strdate = get_string('strftimedaydate');
$lang = current_language();
$contentcss = $PAGE->theme->editor_css_url()->out(false);
$params = array(
'elementid' => $elementid,
'content_css' => $contentcss,
'language' => $lang,
'directionality' => $directionality,
'filepickeroptions' => array()
);
if ($fpoptions) {
$params['filepickeroptions'] = $fpoptions;
}
return $params;
}
}
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 15.1.0, SVG Export Plug-In -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
<!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
]>
<svg version="1.1"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
x="0px" y="0px" width="16px" height="16px" viewBox="-0.3 -3.6 16 16"
style="overflow:visible;enable-background:new -0.3 -3.6 16 16;" xml:space="preserve" preserveAspectRatio="xMinYMid meet">
<defs>
</defs>
<path style="fill:#999999;" d="M0,8c0.3,0,0.5-0.2,0.7-0.4c0.1-0.2,0.3-0.5,0.5-1L3.8,0h0.3l2.7,6.3C7.2,7,7.4,7.5,7.5,7.7
S7.9,8,8.2,8v0.3H4.3V8c0.4,0,0.6,0,0.8-0.1s0.2-0.2,0.2-0.4c0-0.1,0-0.2-0.1-0.4c0-0.1-0.1-0.2-0.2-0.4L4.7,5.9H2
C1.8,6.4,1.7,6.7,1.6,6.8C1.5,7.2,1.5,7.4,1.5,7.5c0,0.2,0.1,0.3,0.3,0.4C2,7.9,2.2,8,2.4,8v0.3H0V8z M4.5,5.4L3.4,2.7H3.2L2.2,5.4
H4.5z M9.8,0.2v3.1C10,3.1,10.1,3,10.3,2.9c0.3-0.2,0.6-0.2,0.9-0.2c0.7,0,1.2,0.3,1.6,0.8s0.6,1.2,0.6,1.9c0,1-0.3,1.8-0.8,2.3
s-1.2,0.8-2,0.8c-0.3,0-0.6-0.1-0.8-0.2S9.4,8,9.2,7.8L8.3,8.4H8.1V1.1c0-0.3,0-0.4-0.1-0.5C7.9,0.5,7.7,0.5,7.5,0.5V0.2H9.8z
M9.9,7.6c0.1,0.3,0.4,0.4,0.7,0.4c0.4,0,0.7-0.2,0.9-0.7c0.2-0.4,0.3-1,0.3-1.8c0-0.6-0.1-1.2-0.2-1.6s-0.4-0.7-0.9-0.7
c-0.3,0-0.5,0.1-0.6,0.3C9.9,3.7,9.8,3.9,9.8,4v3.2C9.8,7.3,9.8,7.5,9.9,7.6z M14,6.7c0.2-0.2,0.4-0.3,0.7-0.3s0.5,0.1,0.7,0.3
s0.3,0.4,0.3,0.7S15.6,8,15.4,8.1S15,8.4,14.7,8.4S14.2,8.3,14,8.1s-0.3-0.4-0.3-0.7S13.8,6.9,14,6.7z"/>
</svg>
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 15.1.0, SVG Export Plug-In -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
<!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
]>
<svg version="1.1"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
x="0px" y="0px" width="16px" height="16px" viewBox="0 0 16 16" style="overflow:visible;enable-background:new 0 0 16 16;"
xml:space="preserve" preserveAspectRatio="xMinYMid meet">
<defs>
</defs>
<path style="fill:#999999;" d="M16,14c0,1.1-0.9,2-2,2H8c-1.1,0-2-0.9-2-2V8c0-1.1,0.9-2,2-2h6c1.1,0,2,0.9,2,2V14z M8,3H5V0H3v3H0
v2h3v3h2V5h3V3z"/>
</svg>
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 15.1.0, SVG Export Plug-In -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
<!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
]>
<svg version="1.1"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
x="0px" y="0px" width="16px" height="16px" viewBox="0 -4.6 16 16" style="overflow:visible;enable-background:new 0 -4.6 16 16;"
xml:space="preserve" preserveAspectRatio="xMinYMid meet">
<defs>
</defs>
<path style="fill:#999999;" d="M0,6c0.2,0,0.4-0.1,0.5-0.3c0.1-0.1,0.2-0.4,0.4-0.8l2-4.9h0.3l2,4.7c0.2,0.5,0.4,0.9,0.5,1
C5.8,5.9,5.9,6,6.1,6v0.2H3.2V6c0.3,0,0.5,0,0.6-0.1c0.1,0,0.1-0.1,0.1-0.3c0-0.1,0-0.2-0.1-0.3c0-0.1-0.1-0.2-0.1-0.3L3.5,4.4h-2
C1.4,4.8,1.3,5,1.2,5.1C1.2,5.4,1.1,5.5,1.1,5.6c0,0.1,0.1,0.2,0.3,0.3C1.5,6,1.6,6,1.8,6v0.2H0V6z M3.4,4.1L2.5,2H2.4L1.6,4.1H3.4z
M5.6,6c0.2,0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>
<!-- Generator: Adobe Illustrator 15.1.0, SVG Export Plug-In -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
<!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
]>
<svg version="1.1"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
x="0px" y="0px" width="16px" height="16px" viewBox="0 -5 16 16" style="overflow:visible;enable-background:new 0 -5 16 16;"
xml:space="preserve" preserveAspectRatio="xMinYMid meet">
<defs>
</defs>
<path style="fill:#999999;" d="M0,0v6h16V0H0z M14,4H2V2h12V4z"/>
</svg>
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 15.1.0, SVG Export Plug-In -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
<!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
]>
<svg version="1.1"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
x="0px" y="0px" width="16px" height="16px" viewBox="0 -1 16 16" style="overflow:visible;enable-background:new 0 -1 16 16;"
xml:space="preserve" preserveAspectRatio="xMinYMid meet">
<defs>
</defs>
<path style="fill:#999999;" d="M0,0h16v2H0V0z M0,6h16v2H0V6z M0,12h16v2H0V12z M3,3h10v2H3V3z M3,9h10v2H3V9z"/>
</svg>
Supports Markdown
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