MDL-41098 Atto Text editor: Add new text editor to core
This is an alternative to the TinyMCE text editor that is based on HTML5 content editable regions. It has been designed to "gel" with Moodle and uses YUI for javascript, Moodle standard dialogs and standard moodle buttons. It has also been designed to work well on mobile devices and can collapse down to a narrow column if required. Imported from the plugins database here: https://moodle.org/plugins/view.php?plugin=editor_contenteditable Original git repository here: https://github.com/damyon/contenteditable
@@ -0,0 +1,27 @@
|
||||
<?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 <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$subplugins = array('atto' => 'lib/editor/atto/plugins');
|
||||
@@ -0,0 +1,25 @@
|
||||
<?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 <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['pluginname'] = 'Atto HTML editor';
|
||||
@@ -0,0 +1,128 @@
|
||||
<?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 <[email protected]>
|
||||
* @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 <[email protected]>
|
||||
* @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, $CFG;
|
||||
$PAGE->requires->yui_module('moodle-editor_atto-editor',
|
||||
'M.editor_atto.init',
|
||||
array($this->get_init_params($elementid, $options, $fpoptions)), true);
|
||||
require_once($CFG->libdir . '/pluginlib.php');
|
||||
|
||||
$pluginman = plugin_manager::instance();
|
||||
$plugins = $pluginman->get_subplugins_of_plugin('editor_atto');
|
||||
|
||||
$sortedplugins = array();
|
||||
|
||||
foreach ($plugins as $id => $plugin) {
|
||||
$sortorder = component_callback($plugin->type . '_' . $plugin->name, 'sort_order', array($elementid));
|
||||
$sortedplugins[$sortorder] = $plugin;
|
||||
}
|
||||
|
||||
ksort($sortedplugins);
|
||||
foreach ($sortedplugins as $plugin) {
|
||||
component_callback($plugin->type . '_' . $plugin->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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?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 'atto_bold', language 'en'.
|
||||
*
|
||||
* @package atto_bold
|
||||
* @copyright 2013 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['pluginname'] = 'Bold';
|
||||
$string['bold'] = 'Bold';
|
||||
@@ -0,0 +1,49 @@
|
||||
<?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 integration version file.
|
||||
*
|
||||
* @package atto_bold
|
||||
* @copyright 2013 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Initialise this plugin
|
||||
* @param string $elementid
|
||||
*/
|
||||
function atto_bold_init_editor($elementid) {
|
||||
global $PAGE, $OUTPUT;
|
||||
|
||||
$icon = $OUTPUT->pix_icon('bold', get_string('bold', 'atto_bold'), 'atto_bold', array('class'=>'icon'));
|
||||
|
||||
$PAGE->requires->yui_module('moodle-atto_bold-button',
|
||||
'M.atto_bold.init',
|
||||
array(array('elementid'=>$elementid, 'icon'=>$icon)),
|
||||
true);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the order this plugin should be displayed in the toolbar
|
||||
* @return int
|
||||
*/
|
||||
function atto_bold_sort_order() {
|
||||
return 0;
|
||||
}
|
||||
|
After Width: | Height: | Size: 446 B |
@@ -0,0 +1,68 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="16"
|
||||
height="16"
|
||||
id="svg2"
|
||||
version="1.1"
|
||||
inkscape:version="0.48.3.1 r9886"
|
||||
sodipodi:docname="bold.svg">
|
||||
<defs
|
||||
id="defs4" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="15.839192"
|
||||
inkscape:cx="-8.2482624"
|
||||
inkscape:cy="15.312045"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
inkscape:window-width="1122"
|
||||
inkscape:window-height="685"
|
||||
inkscape:window-x="162"
|
||||
inkscape:window-y="57"
|
||||
inkscape:window-maximized="0" />
|
||||
<metadata
|
||||
id="metadata7">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(0,-1036.3622)">
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:64px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Comic Sans MS;-inkscape-font-specification:Arial Bold"
|
||||
x="7.2604713"
|
||||
y="1049.6475"
|
||||
id="text2984"
|
||||
sodipodi:linespacing="125%"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan2986"
|
||||
x="7.2604713"
|
||||
y="1049.6475"
|
||||
style="font-size:14px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;fill:#999999;fill-opacity:1;font-family:Arial;-inkscape-font-specification:Arial Bold">b</tspan></text>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.3 KiB |
@@ -0,0 +1,29 @@
|
||||
<?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 integration version file.
|
||||
*
|
||||
* @package atto_bold
|
||||
* @copyright 2013 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2013080900; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2013050100; // Requires this Moodle version.
|
||||
$plugin->component = 'atto_bold'; // Full name of the plugin (used for diagnostics).
|
||||
@@ -0,0 +1,40 @@
|
||||
YUI.add('moodle-atto_bold-button', function (Y, NAME) {
|
||||
|
||||
// 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 bold plugin.
|
||||
*
|
||||
* @package editor-atto
|
||||
* @copyright 2013 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
M.atto_bold = M.atto_bold || {
|
||||
init : function(params) {
|
||||
var click = function(e, elementid) {
|
||||
e.preventDefault();
|
||||
if (!M.editor_atto.is_active(elementid)) {
|
||||
M.editor_atto.focus(elementid);
|
||||
}
|
||||
document.execCommand('bold', false, null);
|
||||
};
|
||||
|
||||
M.editor_atto.add_toolbar_button(params.elementid, 'bold', params.icon, click);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}, '@VERSION@', {"requires": ["node"]});
|
||||
@@ -0,0 +1 @@
|
||||
YUI.add("moodle-atto_bold-button",function(e,t){M.atto_bold=M.atto_bold||{init:function(e){var t=function(e,t){e.preventDefault(),M.editor_atto.is_active(t)||M.editor_atto.focus(t),document.execCommand("bold",!1,null)};M.editor_atto.add_toolbar_button(e.elementid,"bold",e.icon,t)}}},"@VERSION@",{requires:["node"]});
|
||||
@@ -0,0 +1,40 @@
|
||||
YUI.add('moodle-atto_bold-button', function (Y, NAME) {
|
||||
|
||||
// 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 bold plugin.
|
||||
*
|
||||
* @package editor-atto
|
||||
* @copyright 2013 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
M.atto_bold = M.atto_bold || {
|
||||
init : function(params) {
|
||||
var click = function(e, elementid) {
|
||||
e.preventDefault();
|
||||
if (!M.editor_atto.is_active(elementid)) {
|
||||
M.editor_atto.focus(elementid);
|
||||
}
|
||||
document.execCommand('bold', false, null);
|
||||
};
|
||||
|
||||
M.editor_atto.add_toolbar_button(params.elementid, 'bold', params.icon, click);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}, '@VERSION@', {"requires": ["node"]});
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "moodle-atto_bold-button",
|
||||
"builds": {
|
||||
"moodle-atto_bold-button": {
|
||||
"jsfiles": [
|
||||
"button.js"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
// 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 bold plugin.
|
||||
*
|
||||
* @package editor-atto
|
||||
* @copyright 2013 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
M.atto_bold = M.atto_bold || {
|
||||
init : function(params) {
|
||||
var click = function(e, elementid) {
|
||||
e.preventDefault();
|
||||
if (!M.editor_atto.is_active(elementid)) {
|
||||
M.editor_atto.focus(elementid);
|
||||
}
|
||||
document.execCommand('bold', false, null);
|
||||
};
|
||||
|
||||
M.editor_atto.add_toolbar_button(params.elementid, 'bold', params.icon, click);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"moodle-atto_bold-button": {
|
||||
"requires": ["node"]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?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 'atto_clear', language 'en'.
|
||||
*
|
||||
* @package atto_clear
|
||||
* @copyright 2013 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['pluginname'] = 'Clear formatting';
|
||||
$string['clear'] = 'Clear formatting';
|
||||
@@ -0,0 +1,52 @@
|
||||
<?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 integration version file.
|
||||
*
|
||||
* @package atto_clear
|
||||
* @copyright 2013 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Initialise this plugin
|
||||
* @param string $elementid
|
||||
*/
|
||||
function atto_clear_init_editor($elementid) {
|
||||
global $PAGE, $OUTPUT;
|
||||
|
||||
$icon = $OUTPUT->pix_icon('clear',
|
||||
get_string('clear', 'atto_clear'),
|
||||
'atto_clear',
|
||||
array('class'=>'icon'));
|
||||
|
||||
$PAGE->requires->yui_module('moodle-atto_clear-button',
|
||||
'M.atto_clear.init',
|
||||
array(array('elementid'=>$elementid, 'icon'=>$icon)),
|
||||
true);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the order this plugin should be displayed in the toolbar
|
||||
* @return int
|
||||
*/
|
||||
function atto_clear_sort_order() {
|
||||
return 10;
|
||||
}
|
||||
|
After Width: | Height: | Size: 468 B |
@@ -0,0 +1,85 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="16"
|
||||
height="16"
|
||||
id="svg2"
|
||||
version="1.1"
|
||||
inkscape:version="0.48.3.1 r9886"
|
||||
sodipodi:docname="clear.svg">
|
||||
<defs
|
||||
id="defs4" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="15.839192"
|
||||
inkscape:cx="-3.8870379"
|
||||
inkscape:cy="15.312045"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
inkscape:window-width="1122"
|
||||
inkscape:window-height="685"
|
||||
inkscape:window-x="162"
|
||||
inkscape:window-y="57"
|
||||
inkscape:window-maximized="0" />
|
||||
<metadata
|
||||
id="metadata7">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:clear />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(0,-1036.3622)">
|
||||
<g
|
||||
id="g3756"
|
||||
transform="translate(0,-0.44194174)">
|
||||
<rect
|
||||
ry="0"
|
||||
transform="translate(0,1036.3622)"
|
||||
y="2.3629408"
|
||||
x="7.0079331"
|
||||
height="5.3664355"
|
||||
width="2.0203052"
|
||||
id="rect2982"
|
||||
style="fill:#999999;fill-opacity:1;stroke:#999999;stroke-width:1;stroke-linecap:round;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
|
||||
<rect
|
||||
ry="0.4152233"
|
||||
y="1043.2078"
|
||||
x="3.9774756"
|
||||
height="2.7870839"
|
||||
width="8.0812302"
|
||||
id="rect2984"
|
||||
style="fill:#999999;fill-opacity:1;stroke:#999999;stroke-width:0.82672101;stroke-linecap:round;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
|
||||
<rect
|
||||
ry="0.053281363"
|
||||
y="1045.6699"
|
||||
x="4.4825521"
|
||||
height="3.1562684"
|
||||
width="7.0079417"
|
||||
id="rect3754"
|
||||
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#999999;stroke-width:1;stroke-linecap:round;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.7 KiB |
@@ -0,0 +1,29 @@
|
||||
<?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 integration version file.
|
||||
*
|
||||
* @package atto_clear
|
||||
* @copyright 2013 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2013080900; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2013050100; // Requires this Moodle version.
|
||||
$plugin->component = 'atto_clear'; // Full name of the plugin (used for diagnostics).
|
||||
@@ -0,0 +1,40 @@
|
||||
YUI.add('moodle-atto_clear-button', function (Y, NAME) {
|
||||
|
||||
// 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 clear plugin.
|
||||
*
|
||||
* @package editor-atto
|
||||
* @copyright 2013 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
M.atto_clear = M.atto_clear || {
|
||||
init : function(params) {
|
||||
var click = function(e, elementid) {
|
||||
e.preventDefault();
|
||||
if (!M.editor_atto.is_active(elementid)) {
|
||||
M.editor_atto.focus(elementid);
|
||||
}
|
||||
document.execCommand('removeFormat', false);
|
||||
};
|
||||
|
||||
M.editor_atto.add_toolbar_button(params.elementid, 'clear', params.icon, click);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}, '@VERSION@', {"requires": ["node"]});
|
||||
@@ -0,0 +1 @@
|
||||
YUI.add("moodle-atto_clear-button",function(e,t){M.atto_clear=M.atto_clear||{init:function(e){var t=function(e,t){e.preventDefault(),M.editor_atto.is_active(t)||M.editor_atto.focus(t),document.execCommand("removeFormat",!1)};M.editor_atto.add_toolbar_button(e.elementid,"clear",e.icon,t)}}},"@VERSION@",{requires:["node"]});
|
||||
@@ -0,0 +1,40 @@
|
||||
YUI.add('moodle-atto_clear-button', function (Y, NAME) {
|
||||
|
||||
// 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 clear plugin.
|
||||
*
|
||||
* @package editor-atto
|
||||
* @copyright 2013 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
M.atto_clear = M.atto_clear || {
|
||||
init : function(params) {
|
||||
var click = function(e, elementid) {
|
||||
e.preventDefault();
|
||||
if (!M.editor_atto.is_active(elementid)) {
|
||||
M.editor_atto.focus(elementid);
|
||||
}
|
||||
document.execCommand('removeFormat', false);
|
||||
};
|
||||
|
||||
M.editor_atto.add_toolbar_button(params.elementid, 'clear', params.icon, click);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}, '@VERSION@', {"requires": ["node"]});
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "moodle-atto_clear-button",
|
||||
"builds": {
|
||||
"moodle-atto_clear-button": {
|
||||
"jsfiles": [
|
||||
"button.js"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
// 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 clear plugin.
|
||||
*
|
||||
* @package editor-atto
|
||||
* @copyright 2013 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
M.atto_clear = M.atto_clear || {
|
||||
init : function(params) {
|
||||
var click = function(e, elementid) {
|
||||
e.preventDefault();
|
||||
if (!M.editor_atto.is_active(elementid)) {
|
||||
M.editor_atto.focus(elementid);
|
||||
}
|
||||
document.execCommand('removeFormat', false);
|
||||
};
|
||||
|
||||
M.editor_atto.add_toolbar_button(params.elementid, 'clear', params.icon, click);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"moodle-atto_clear-button": {
|
||||
"requires": ["node"]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?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 'atto_html', language 'en'.
|
||||
*
|
||||
* @package atto_html
|
||||
* @copyright 2013 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['pluginname'] = 'HTML';
|
||||
$string['html'] = 'HTML';
|
||||
@@ -0,0 +1,49 @@
|
||||
<?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 integration version file.
|
||||
*
|
||||
* @package atto_html
|
||||
* @copyright 2013 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Initialise this plugin
|
||||
* @param string $elementid
|
||||
*/
|
||||
function atto_html_init_editor($elementid) {
|
||||
global $PAGE, $OUTPUT;
|
||||
|
||||
$icon = $OUTPUT->pix_icon('html', get_string('html', 'atto_html'), 'atto_html', array('class'=>'icon'));
|
||||
|
||||
$PAGE->requires->yui_module('moodle-atto_html-button',
|
||||
'M.atto_html.init',
|
||||
array(array('elementid'=>$elementid, 'icon'=>$icon)),
|
||||
true);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the order this plugin should be displayed in the toolbar
|
||||
* @return int
|
||||
*/
|
||||
function atto_html_sort_order() {
|
||||
return 15;
|
||||
}
|
||||
|
After Width: | Height: | Size: 466 B |
@@ -0,0 +1,69 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="16"
|
||||
height="16"
|
||||
id="svg2"
|
||||
version="1.1"
|
||||
inkscape:version="0.48.3.1 r9886"
|
||||
sodipodi:docname="html.svg">
|
||||
<defs
|
||||
id="defs4" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="11.313709"
|
||||
inkscape:cx="-8.155614"
|
||||
inkscape:cy="13.234355"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
inkscape:window-width="1122"
|
||||
inkscape:window-height="685"
|
||||
inkscape:window-x="162"
|
||||
inkscape:window-y="57"
|
||||
inkscape:window-maximized="0" />
|
||||
<metadata
|
||||
id="metadata7">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>media/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillMedia" />
|
||||
<dc:title />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(0,-1036.3622)">
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:52.96332169000000079px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#999999;fill-opacity:1;stroke:none;font-family:Comic Sans MS;-inkscape-font-specification:Comic Sans MS"
|
||||
x="10.191385"
|
||||
y="836.76996"
|
||||
id="text2988"
|
||||
sodipodi:linespacing="125%"
|
||||
transform="scale(0.79843788,1.2524456)"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan2990"
|
||||
x="10.191385"
|
||||
y="836.76996"
|
||||
style="font-size:9.93062304999999945px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:FreeMono;-inkscape-font-specification:FreeMono Bold;fill:#999999;fill-opacity:1"></></tspan></text>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.4 KiB |
@@ -0,0 +1,29 @@
|
||||
<?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 integration version file.
|
||||
*
|
||||
* @package atto_html
|
||||
* @copyright 2013 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2013080900; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2013050100; // Requires this Moodle version.
|
||||
$plugin->component = 'atto_html'; // Full name of the plugin (used for diagnostics).
|
||||
@@ -0,0 +1,59 @@
|
||||
YUI.add('moodle-atto_html-button', function (Y, NAME) {
|
||||
|
||||
// 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 html plugin.
|
||||
*
|
||||
* @package editor-atto
|
||||
* @copyright 2013 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
M.atto_html = M.atto_html || {
|
||||
/**
|
||||
* Are we in html editing mode or not?
|
||||
*/
|
||||
ishtml : false,
|
||||
|
||||
init : function(params) {
|
||||
var click = function(e, elementid) {
|
||||
e.preventDefault();
|
||||
var textarea = Y.one('#' + elementid);
|
||||
var atto = Y.one('#' + elementid + 'editable');
|
||||
|
||||
if (M.atto_html.ishtml) {
|
||||
M.editor_atto.enable_all_widgets(elementid);
|
||||
atto.setHTML('');
|
||||
atto.append(textarea.get('value'));
|
||||
textarea.hide();
|
||||
atto.show();
|
||||
} else {
|
||||
M.editor_atto.disable_all_widgets(elementid);
|
||||
M.editor_atto.enable_widget(elementid, 'html');
|
||||
textarea.set('value', atto.getHTML());
|
||||
atto.hide();
|
||||
textarea.show();
|
||||
}
|
||||
|
||||
M.atto_html.ishtml = !M.atto_html.ishtml;
|
||||
};
|
||||
|
||||
M.editor_atto.add_toolbar_button(params.elementid, 'html', params.icon, click);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}, '@VERSION@', {"requires": ["node"]});
|
||||
@@ -0,0 +1 @@
|
||||
YUI.add("moodle-atto_html-button",function(e,t){M.atto_html=M.atto_html||{ishtml:!1,init:function(t){var n=function(t,n){t.preventDefault();var r=e.one("#"+n),i=e.one("#"+n+"editable");M.atto_html.ishtml?(M.editor_atto.enable_all_widgets(n),i.setHTML(""),i.append(r.get("value")),r.hide(),i.show()):(M.editor_atto.disable_all_widgets(n),M.editor_atto.enable_widget(n,"html"),r.set("value",i.getHTML()),i.hide(),r.show()),M.atto_html.ishtml=!M.atto_html.ishtml};M.editor_atto.add_toolbar_button(t.elementid,"html",t.icon,n)}}},"@VERSION@",{requires:["node"]});
|
||||
@@ -0,0 +1,59 @@
|
||||
YUI.add('moodle-atto_html-button', function (Y, NAME) {
|
||||
|
||||
// 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 html plugin.
|
||||
*
|
||||
* @package editor-atto
|
||||
* @copyright 2013 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
M.atto_html = M.atto_html || {
|
||||
/**
|
||||
* Are we in html editing mode or not?
|
||||
*/
|
||||
ishtml : false,
|
||||
|
||||
init : function(params) {
|
||||
var click = function(e, elementid) {
|
||||
e.preventDefault();
|
||||
var textarea = Y.one('#' + elementid);
|
||||
var atto = Y.one('#' + elementid + 'editable');
|
||||
|
||||
if (M.atto_html.ishtml) {
|
||||
M.editor_atto.enable_all_widgets(elementid);
|
||||
atto.setHTML('');
|
||||
atto.append(textarea.get('value'));
|
||||
textarea.hide();
|
||||
atto.show();
|
||||
} else {
|
||||
M.editor_atto.disable_all_widgets(elementid);
|
||||
M.editor_atto.enable_widget(elementid, 'html');
|
||||
textarea.set('value', atto.getHTML());
|
||||
atto.hide();
|
||||
textarea.show();
|
||||
}
|
||||
|
||||
M.atto_html.ishtml = !M.atto_html.ishtml;
|
||||
};
|
||||
|
||||
M.editor_atto.add_toolbar_button(params.elementid, 'html', params.icon, click);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}, '@VERSION@', {"requires": ["node"]});
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "moodle-atto_html-button",
|
||||
"builds": {
|
||||
"moodle-atto_html-button": {
|
||||
"jsfiles": [
|
||||
"button.js"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
// 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 html plugin.
|
||||
*
|
||||
* @package editor-atto
|
||||
* @copyright 2013 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
M.atto_html = M.atto_html || {
|
||||
/**
|
||||
* Are we in html editing mode or not?
|
||||
*/
|
||||
ishtml : false,
|
||||
|
||||
init : function(params) {
|
||||
var click = function(e, elementid) {
|
||||
e.preventDefault();
|
||||
var textarea = Y.one('#' + elementid);
|
||||
var atto = Y.one('#' + elementid + 'editable');
|
||||
|
||||
if (M.atto_html.ishtml) {
|
||||
M.editor_atto.enable_all_widgets(elementid);
|
||||
atto.setHTML('');
|
||||
atto.append(textarea.get('value'));
|
||||
textarea.hide();
|
||||
atto.show();
|
||||
} else {
|
||||
M.editor_atto.disable_all_widgets(elementid);
|
||||
M.editor_atto.enable_widget(elementid, 'html');
|
||||
textarea.set('value', atto.getHTML());
|
||||
atto.hide();
|
||||
textarea.show();
|
||||
}
|
||||
|
||||
M.atto_html.ishtml = !M.atto_html.ishtml;
|
||||
};
|
||||
|
||||
M.editor_atto.add_toolbar_button(params.elementid, 'html', params.icon, click);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"moodle-atto_html-button": {
|
||||
"requires": [
|
||||
"node"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?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 'atto_image', language 'en'.
|
||||
*
|
||||
* @package atto_image
|
||||
* @copyright 2013 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['pluginname'] = 'Image';
|
||||
$string['image'] = 'Image';
|
||||
$string['createimage'] = 'Insert image';
|
||||
$string['enterurl'] = 'Enter URL';
|
||||
$string['enteralt'] = 'Enter alternative text';
|
||||
$string['browserepositories'] = 'Browse repositories...';
|
||||
$string['accessibilityhint'] = '<p>Web content accessibility guidelines (WCAG):<br/><ul><li><a href="http://www.w3.org/TR/WCAG20/#text-equiv" target="_blank">Text Alternatives</a></li></ul></p>';
|
||||
$string['width'] = 'Width';
|
||||
$string['height'] = 'Height';
|
||||
$string['preview'] = 'Preview';
|
||||
@@ -0,0 +1,60 @@
|
||||
<?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 integration version file.
|
||||
*
|
||||
* @package atto_image
|
||||
* @copyright 2013 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Initialise this plugin
|
||||
* @param string $elementid
|
||||
*/
|
||||
function atto_image_init_editor($elementid) {
|
||||
global $PAGE, $OUTPUT;
|
||||
|
||||
$icon = $OUTPUT->pix_icon('image',
|
||||
get_string('image', 'atto_image'),
|
||||
'atto_image',
|
||||
array('class'=>'icon'));
|
||||
|
||||
$PAGE->requires->strings_for_js(array('createimage',
|
||||
'enterurl',
|
||||
'enteralt',
|
||||
'preview',
|
||||
'browserepositories',
|
||||
'accessibilityhint',
|
||||
'width',
|
||||
'height'), 'atto_image');
|
||||
$PAGE->requires->yui_module('moodle-atto_image-button',
|
||||
'M.atto_image.init',
|
||||
array(array('elementid'=>$elementid, 'icon'=>$icon)),
|
||||
true);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the order this plugin should be displayed in the toolbar
|
||||
* @return int
|
||||
*/
|
||||
function atto_image_sort_order() {
|
||||
return 13;
|
||||
}
|
||||
|
After Width: | Height: | Size: 506 B |
@@ -0,0 +1,77 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="16"
|
||||
height="16"
|
||||
id="svg2"
|
||||
version="1.1"
|
||||
inkscape:version="0.48.3.1 r9886"
|
||||
sodipodi:docname="image.svg">
|
||||
<defs
|
||||
id="defs4" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="32"
|
||||
inkscape:cx="11.577509"
|
||||
inkscape:cy="9.3016902"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
inkscape:window-width="1122"
|
||||
inkscape:window-height="685"
|
||||
inkscape:window-x="162"
|
||||
inkscape:window-y="57"
|
||||
inkscape:window-maximized="0" />
|
||||
<metadata
|
||||
id="metadata7">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(0,-1036.3622)">
|
||||
<rect
|
||||
style="fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#999999;stroke-opacity:1"
|
||||
id="rect2986"
|
||||
width="14.142136"
|
||||
height="13.131983"
|
||||
x="1.0101526"
|
||||
y="1.4159228"
|
||||
transform="translate(0,1036.3622)"
|
||||
ry="0.053281363" />
|
||||
<path
|
||||
style="fill:#999999;fill-opacity:1;stroke:none"
|
||||
d="m 13.794977,1041.1242 c 0,0.9241 -0.749059,1.6732 -1.673146,1.6732 -0.9241,0 -1.673146,-0.7491 -1.673146,-1.6732 0,-0.924 0.749059,-1.6731 1.673146,-1.6731 0.9241,0 1.673146,0.7491 1.673146,1.6731 z"
|
||||
id="path3761"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
transform="translate(0,1036.3622)"
|
||||
style="fill:#999999;fill-opacity:1;fill-rule:nonzero;stroke:#999999;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dashoffset:0"
|
||||
d="m 1.5711386,10.553572 c 1.7890625,-0.125 3.8205354,-3.734909 6.286004,-3.75 2.4654684,-0.015091 3.8591064,3.4375 6.4645754,3.75 0.01465,0.0018 0.02808,0.0059 0.03771,0.01557 0.0096,0.0096 0.01557,0.02295 0.01557,0.03771 l 0,3.018437 c 0,0.02952 -0.02376,0.05328 -0.05328,0.05328 l -12.7505794,0 c -0.029518,0 -0.053281,-0.02376 -0.053281,-0.05328 l 0,-3.018437 c 0,-0.01476 0.00594,-0.02808 0.015572,-0.03771 0.00963,-0.0096 0.022987,-0.01454 0.037709,-0.01557 z"
|
||||
id="rect3753"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="szssssssssss" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.9 KiB |
@@ -0,0 +1,29 @@
|
||||
<?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 integration version file.
|
||||
*
|
||||
* @package atto_image
|
||||
* @copyright 2013 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2013080900; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2013050100; // Requires this Moodle version.
|
||||
$plugin->component = 'atto_image'; // Full name of the plugin (used for diagnostics).
|
||||
@@ -0,0 +1,184 @@
|
||||
YUI.add('moodle-atto_image-button', function (Y, NAME) {
|
||||
|
||||
// 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 image plugin.
|
||||
*
|
||||
* @package editor-atto
|
||||
* @copyright 2013 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
M.atto_image = M.atto_image || {
|
||||
dialogue : null,
|
||||
selection : null,
|
||||
init : function(params) {
|
||||
var display_chooser = function(e, elementid) {
|
||||
e.preventDefault();
|
||||
if (!M.editor_atto.is_active(elementid)) {
|
||||
M.editor_atto.focus(elementid);
|
||||
}
|
||||
M.atto_image.selection = M.editor_atto.get_selection();
|
||||
if (M.atto_image.selection !== false) {
|
||||
var dialogue;
|
||||
if (!M.atto_image.dialogue) {
|
||||
dialogue = new M.core.dialogue({
|
||||
visible: false,
|
||||
modal: true,
|
||||
close: true,
|
||||
draggable: true
|
||||
});
|
||||
} else {
|
||||
dialogue = M.atto_image.dialogue;
|
||||
}
|
||||
|
||||
dialogue.set('bodyContent', M.atto_image.get_form_content(elementid));
|
||||
dialogue.set('headerContent', M.util.get_string('createimage', 'atto_image'));
|
||||
dialogue.render();
|
||||
dialogue.centerDialogue();
|
||||
M.atto_image.dialogue = dialogue;
|
||||
|
||||
var selectedText = M.editor_atto.get_selection_text();
|
||||
var i = 0;
|
||||
|
||||
var images = [];
|
||||
for (i = 0; i < selectedText.childNodes.length; i++) {
|
||||
var child = selectedText.childNodes[0];
|
||||
if (images.length === 0) {
|
||||
if (child.nodeName.toLowerCase() === 'img') {
|
||||
images[0] = child;
|
||||
} else {
|
||||
if (child.getElementsByTagName) {
|
||||
images = child.getElementsByTagName('img');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (images.length > 0) {
|
||||
var image = Y.one(images[0]);
|
||||
var width = image.getAttribute('width');
|
||||
var height = image.getAttribute('height');
|
||||
if (width > 0) {
|
||||
Y.one('#atto_image_widthentry').set('value', width);
|
||||
}
|
||||
if (height > 0) {
|
||||
Y.one('#atto_image_heightentry').set('value', height);
|
||||
}
|
||||
Y.one('#atto_image_preview').set('src', image.get('src'));
|
||||
Y.one('#atto_image_preview').setStyle('display', 'inline');
|
||||
Y.one('#atto_image_altentry').set('value', image.get('alt'));
|
||||
Y.one('#atto_image_urlentry').set('value', image.get('src'));
|
||||
}
|
||||
dialogue.show();
|
||||
}
|
||||
};
|
||||
|
||||
M.editor_atto.add_toolbar_button(params.elementid, 'image', params.icon, display_chooser, this);
|
||||
},
|
||||
open_filepicker : function(e) {
|
||||
var elementid = this.getAttribute('data-editor');
|
||||
e.preventDefault();
|
||||
|
||||
M.editor_atto.show_filepicker(elementid, 'image', M.atto_image.filepicker_callback);
|
||||
},
|
||||
filepicker_callback : function(params) {
|
||||
if (params.url !== '') {
|
||||
var input = Y.one('#atto_image_urlentry');
|
||||
input.set('value', params.url);
|
||||
input = Y.one('#atto_image_altentry');
|
||||
input.set('value', params.file);
|
||||
|
||||
// Auto set the width and height.
|
||||
var image = new Image();
|
||||
image.onload = function() {
|
||||
Y.one('#atto_image_widthentry').set('value', this.width);
|
||||
Y.one('#atto_image_heightentry').set('value', this.height);
|
||||
Y.one('#atto_image_preview').set('src', this.src);
|
||||
Y.one('#atto_image_preview').setStyle('display', 'inline');
|
||||
};
|
||||
image.src = params.url;
|
||||
}
|
||||
},
|
||||
set_image : function(e) {
|
||||
e.preventDefault();
|
||||
M.atto_image.dialogue.hide();
|
||||
|
||||
var input = e.currentTarget.get('parentNode').one('#atto_image_urlentry');
|
||||
|
||||
var url = input.get('value');
|
||||
input = e.currentTarget.get('parentNode').one('#atto_image_altentry');
|
||||
var alt = input.get('value');
|
||||
input = e.currentTarget.get('parentNode').one('#atto_image_widthentry');
|
||||
var width = input.get('value');
|
||||
input = e.currentTarget.get('parentNode').one('#atto_image_heightentry');
|
||||
var height = input.get('value');
|
||||
if (url !== '' && alt !== '') {
|
||||
M.editor_atto.set_selection(M.atto_image.selection);
|
||||
var imagehtml = '<img src="' + Y.Escape.html(url) + '" alt="' + Y.Escape.html(alt) + '"';
|
||||
|
||||
if (width) {
|
||||
imagehtml += ' width="' + Y.Escape.html(width) + '"';
|
||||
}
|
||||
if (height) {
|
||||
imagehtml += ' height="' + Y.Escape.html(height) + '"';
|
||||
}
|
||||
imagehtml += '"/>';
|
||||
|
||||
if (document.selection && document.selection.createRange().pasteHTML) {
|
||||
document.selection.createRange().pasteHTML(imagehtml);
|
||||
} else {
|
||||
document.execCommand('insertHTML', false, imagehtml);
|
||||
}
|
||||
}
|
||||
},
|
||||
get_form_content : function(elementid) {
|
||||
var content = Y.Node.create('<form class="atto_form">' +
|
||||
'<label for="atto_image_urlentry">' + M.util.get_string('enterurl', 'atto_image') +
|
||||
'</label>' +
|
||||
'<input type="url" value="" id="atto_image_urlentry" size="32"/>' +
|
||||
'<label for="atto_image_altentry">' + M.util.get_string('enteralt', 'atto_image') +
|
||||
'</label>' +
|
||||
'<input type="text" value="" id="atto_image_altentry" size="32" required="true"/>' +
|
||||
'<label for="atto_image_widthentry">' + M.util.get_string('width', 'atto_image') +
|
||||
'</label>' +
|
||||
'<input type="text" value="" id="atto_image_widthentry" size="10"/>' +
|
||||
'<br/>' +
|
||||
'<label for="atto_image_heightentry">' + M.util.get_string('height', 'atto_image') +
|
||||
'</label>' +
|
||||
'<input type="text" value="" id="atto_image_heightentry" size="10"/>' +
|
||||
'<label for="atto_image_preview">' + M.util.get_string('preview', 'atto_image') +
|
||||
'</label>' +
|
||||
'<img src="#" width="200" id="atto_image_preview" alt="" style="display: none;"/>' +
|
||||
'<hr/>' +
|
||||
'<button id="openimagebrowser" data-editor="' + Y.Escape.html(elementid) + '">' +
|
||||
M.util.get_string('browserepositories', 'atto_image') +
|
||||
'</button>' +
|
||||
'<hr/>' +
|
||||
'<button id="atto_image_urlentrysubmit">' +
|
||||
M.util.get_string('createimage', 'atto_image') +
|
||||
'</button>' +
|
||||
'</form>' +
|
||||
'<hr/>' + M.util.get_string('accessibilityhint', 'atto_image'));
|
||||
|
||||
content.one('#atto_image_urlentrysubmit').on('click', M.atto_image.set_image);
|
||||
content.one('#openimagebrowser').on('click', M.atto_image.open_filepicker);
|
||||
return content;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}, '@VERSION@', {"requires": ["node", "escape"]});
|
||||
@@ -0,0 +1 @@
|
||||
YUI.add("moodle-atto_image-button",function(e,t){M.atto_image=M.atto_image||{dialogue:null,selection:null,init:function(t){var n=function(t,n){t.preventDefault(),M.editor_atto.is_active(n)||M.editor_atto.focus(n),M.atto_image.selection=M.editor_atto.get_selection();if(M.atto_image.selection!==!1){var r;M.atto_image.dialogue?r=M.atto_image.dialogue:r=new M.core.dialogue({visible:!1,modal:!0,close:!0,draggable:!0}),r.set("bodyContent",M.atto_image.get_form_content(n)),r.set("headerContent",M.util.get_string("createimage","atto_image")),r.render(),r.centerDialogue(),M.atto_image.dialogue=r;var i=M.editor_atto.get_selection_text(),s=0,o=[];for(s=0;s<i.childNodes.length;s++){var u=i.childNodes[0];o.length===0&&(u.nodeName.toLowerCase()==="img"?o[0]=u:u.getElementsByTagName&&(o=u.getElementsByTagName("img")))}if(o.length>0){var a=e.one(o[0]),f=a.getAttribute("width"),l=a.getAttribute("height");f>0&&e.one("#atto_image_widthentry").set("value",f),l>0&&e.one("#atto_image_heightentry").set("value",l),e.one("#atto_image_preview").set("src",a.get("src")),e.one("#atto_image_preview").setStyle("display","inline"),e.one("#atto_image_altentry").set("value",a.get("alt")),e.one("#atto_image_urlentry").set("value",a.get("src"))}r.show()}};M.editor_atto.add_toolbar_button(t.elementid,"image",t.icon,n,this)},open_filepicker:function(e){var t=this.getAttribute("data-editor");e.preventDefault(),M.editor_atto.show_filepicker(t,"image",M.atto_image.filepicker_callback)},filepicker_callback:function(t){if(t.url!==""){var n=e.one("#atto_image_urlentry");n.set("value",t.url),n=e.one("#atto_image_altentry"),n.set("value",t.file);var r=new Image;r.onload=function(){e.one("#atto_image_widthentry").set("value",this.width),e.one("#atto_image_heightentry").set("value",this.height),e.one("#atto_image_preview").set("src",this.src),e.one("#atto_image_preview").setStyle("display","inline")},r.src=t.url}},set_image:function(t){t.preventDefault(),M.atto_image.dialogue.hide();var n=t.currentTarget.get("parentNode").one("#atto_image_urlentry"),r=n.get("value");n=t.currentTarget.get("parentNode").one("#atto_image_altentry");var i=n.get("value");n=t.currentTarget.get("parentNode").one("#atto_image_widthentry");var s=n.get("value");n=t.currentTarget.get("parentNode").one("#atto_image_heightentry");var o=n.get("value");if(r!==""&&i!==""){M.editor_atto.set_selection(M.atto_image.selection);var u='<img src="'+e.Escape.html(r)+'" alt="'+e.Escape.html(i)+'"';s&&(u+=' width="'+e.Escape.html(s)+'"'),o&&(u+=' height="'+e.Escape.html(o)+'"'),u+='"/>',document.selection&&document.selection.createRange().pasteHTML?document.selection.createRange().pasteHTML(u):document.execCommand("insertHTML",!1,u)}},get_form_content:function(t){var n=e.Node.create('<form class="atto_form"><label for="atto_image_urlentry">'+M.util.get_string("enterurl","atto_image")+"</label>"+'<input type="url" value="" id="atto_image_urlentry" size="32"/>'+'<label for="atto_image_altentry">'+M.util.get_string("enteralt","atto_image")+"</label>"+'<input type="text" value="" id="atto_image_altentry" size="32" required="true"/>'+'<label for="atto_image_widthentry">'+M.util.get_string("width","atto_image")+"</label>"+'<input type="text" value="" id="atto_image_widthentry" size="10"/>'+"<br/>"+'<label for="atto_image_heightentry">'+M.util.get_string("height","atto_image")+"</label>"+'<input type="text" value="" id="atto_image_heightentry" size="10"/>'+'<label for="atto_image_preview">'+M.util.get_string("preview","atto_image")+"</label>"+'<img src="#" width="200" id="atto_image_preview" alt="" style="display: none;"/>'+"<hr/>"+'<button id="openimagebrowser" data-editor="'+e.Escape.html(t)+'">'+M.util.get_string("browserepositories","atto_image")+"</button>"+"<hr/>"+'<button id="atto_image_urlentrysubmit">'+M.util.get_string("createimage","atto_image")+"</button>"+"</form>"+"<hr/>"+M.util.get_string("accessibilityhint","atto_image"));return n.one("#atto_image_urlentrysubmit").on("click",M.atto_image.set_image),n.one("#openimagebrowser").on("click",M.atto_image.open_filepicker),n}}},"@VERSION@",{requires:["node","escape"]});
|
||||
@@ -0,0 +1,184 @@
|
||||
YUI.add('moodle-atto_image-button', function (Y, NAME) {
|
||||
|
||||
// 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 image plugin.
|
||||
*
|
||||
* @package editor-atto
|
||||
* @copyright 2013 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
M.atto_image = M.atto_image || {
|
||||
dialogue : null,
|
||||
selection : null,
|
||||
init : function(params) {
|
||||
var display_chooser = function(e, elementid) {
|
||||
e.preventDefault();
|
||||
if (!M.editor_atto.is_active(elementid)) {
|
||||
M.editor_atto.focus(elementid);
|
||||
}
|
||||
M.atto_image.selection = M.editor_atto.get_selection();
|
||||
if (M.atto_image.selection !== false) {
|
||||
var dialogue;
|
||||
if (!M.atto_image.dialogue) {
|
||||
dialogue = new M.core.dialogue({
|
||||
visible: false,
|
||||
modal: true,
|
||||
close: true,
|
||||
draggable: true
|
||||
});
|
||||
} else {
|
||||
dialogue = M.atto_image.dialogue;
|
||||
}
|
||||
|
||||
dialogue.set('bodyContent', M.atto_image.get_form_content(elementid));
|
||||
dialogue.set('headerContent', M.util.get_string('createimage', 'atto_image'));
|
||||
dialogue.render();
|
||||
dialogue.centerDialogue();
|
||||
M.atto_image.dialogue = dialogue;
|
||||
|
||||
var selectedText = M.editor_atto.get_selection_text();
|
||||
var i = 0;
|
||||
|
||||
var images = [];
|
||||
for (i = 0; i < selectedText.childNodes.length; i++) {
|
||||
var child = selectedText.childNodes[0];
|
||||
if (images.length === 0) {
|
||||
if (child.nodeName.toLowerCase() === 'img') {
|
||||
images[0] = child;
|
||||
} else {
|
||||
if (child.getElementsByTagName) {
|
||||
images = child.getElementsByTagName('img');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (images.length > 0) {
|
||||
var image = Y.one(images[0]);
|
||||
var width = image.getAttribute('width');
|
||||
var height = image.getAttribute('height');
|
||||
if (width > 0) {
|
||||
Y.one('#atto_image_widthentry').set('value', width);
|
||||
}
|
||||
if (height > 0) {
|
||||
Y.one('#atto_image_heightentry').set('value', height);
|
||||
}
|
||||
Y.one('#atto_image_preview').set('src', image.get('src'));
|
||||
Y.one('#atto_image_preview').setStyle('display', 'inline');
|
||||
Y.one('#atto_image_altentry').set('value', image.get('alt'));
|
||||
Y.one('#atto_image_urlentry').set('value', image.get('src'));
|
||||
}
|
||||
dialogue.show();
|
||||
}
|
||||
};
|
||||
|
||||
M.editor_atto.add_toolbar_button(params.elementid, 'image', params.icon, display_chooser, this);
|
||||
},
|
||||
open_filepicker : function(e) {
|
||||
var elementid = this.getAttribute('data-editor');
|
||||
e.preventDefault();
|
||||
|
||||
M.editor_atto.show_filepicker(elementid, 'image', M.atto_image.filepicker_callback);
|
||||
},
|
||||
filepicker_callback : function(params) {
|
||||
if (params.url !== '') {
|
||||
var input = Y.one('#atto_image_urlentry');
|
||||
input.set('value', params.url);
|
||||
input = Y.one('#atto_image_altentry');
|
||||
input.set('value', params.file);
|
||||
|
||||
// Auto set the width and height.
|
||||
var image = new Image();
|
||||
image.onload = function() {
|
||||
Y.one('#atto_image_widthentry').set('value', this.width);
|
||||
Y.one('#atto_image_heightentry').set('value', this.height);
|
||||
Y.one('#atto_image_preview').set('src', this.src);
|
||||
Y.one('#atto_image_preview').setStyle('display', 'inline');
|
||||
};
|
||||
image.src = params.url;
|
||||
}
|
||||
},
|
||||
set_image : function(e) {
|
||||
e.preventDefault();
|
||||
M.atto_image.dialogue.hide();
|
||||
|
||||
var input = e.currentTarget.get('parentNode').one('#atto_image_urlentry');
|
||||
|
||||
var url = input.get('value');
|
||||
input = e.currentTarget.get('parentNode').one('#atto_image_altentry');
|
||||
var alt = input.get('value');
|
||||
input = e.currentTarget.get('parentNode').one('#atto_image_widthentry');
|
||||
var width = input.get('value');
|
||||
input = e.currentTarget.get('parentNode').one('#atto_image_heightentry');
|
||||
var height = input.get('value');
|
||||
if (url !== '' && alt !== '') {
|
||||
M.editor_atto.set_selection(M.atto_image.selection);
|
||||
var imagehtml = '<img src="' + Y.Escape.html(url) + '" alt="' + Y.Escape.html(alt) + '"';
|
||||
|
||||
if (width) {
|
||||
imagehtml += ' width="' + Y.Escape.html(width) + '"';
|
||||
}
|
||||
if (height) {
|
||||
imagehtml += ' height="' + Y.Escape.html(height) + '"';
|
||||
}
|
||||
imagehtml += '"/>';
|
||||
|
||||
if (document.selection && document.selection.createRange().pasteHTML) {
|
||||
document.selection.createRange().pasteHTML(imagehtml);
|
||||
} else {
|
||||
document.execCommand('insertHTML', false, imagehtml);
|
||||
}
|
||||
}
|
||||
},
|
||||
get_form_content : function(elementid) {
|
||||
var content = Y.Node.create('<form class="atto_form">' +
|
||||
'<label for="atto_image_urlentry">' + M.util.get_string('enterurl', 'atto_image') +
|
||||
'</label>' +
|
||||
'<input type="url" value="" id="atto_image_urlentry" size="32"/>' +
|
||||
'<label for="atto_image_altentry">' + M.util.get_string('enteralt', 'atto_image') +
|
||||
'</label>' +
|
||||
'<input type="text" value="" id="atto_image_altentry" size="32" required="true"/>' +
|
||||
'<label for="atto_image_widthentry">' + M.util.get_string('width', 'atto_image') +
|
||||
'</label>' +
|
||||
'<input type="text" value="" id="atto_image_widthentry" size="10"/>' +
|
||||
'<br/>' +
|
||||
'<label for="atto_image_heightentry">' + M.util.get_string('height', 'atto_image') +
|
||||
'</label>' +
|
||||
'<input type="text" value="" id="atto_image_heightentry" size="10"/>' +
|
||||
'<label for="atto_image_preview">' + M.util.get_string('preview', 'atto_image') +
|
||||
'</label>' +
|
||||
'<img src="#" width="200" id="atto_image_preview" alt="" style="display: none;"/>' +
|
||||
'<hr/>' +
|
||||
'<button id="openimagebrowser" data-editor="' + Y.Escape.html(elementid) + '">' +
|
||||
M.util.get_string('browserepositories', 'atto_image') +
|
||||
'</button>' +
|
||||
'<hr/>' +
|
||||
'<button id="atto_image_urlentrysubmit">' +
|
||||
M.util.get_string('createimage', 'atto_image') +
|
||||
'</button>' +
|
||||
'</form>' +
|
||||
'<hr/>' + M.util.get_string('accessibilityhint', 'atto_image'));
|
||||
|
||||
content.one('#atto_image_urlentrysubmit').on('click', M.atto_image.set_image);
|
||||
content.one('#openimagebrowser').on('click', M.atto_image.open_filepicker);
|
||||
return content;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}, '@VERSION@', {"requires": ["node", "escape"]});
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "moodle-atto_image-button",
|
||||
"builds": {
|
||||
"moodle-atto_image-button": {
|
||||
"jsfiles": [
|
||||
"button.js"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,179 @@
|
||||
// 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 image plugin.
|
||||
*
|
||||
* @package editor-atto
|
||||
* @copyright 2013 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
M.atto_image = M.atto_image || {
|
||||
dialogue : null,
|
||||
selection : null,
|
||||
init : function(params) {
|
||||
var display_chooser = function(e, elementid) {
|
||||
e.preventDefault();
|
||||
if (!M.editor_atto.is_active(elementid)) {
|
||||
M.editor_atto.focus(elementid);
|
||||
}
|
||||
M.atto_image.selection = M.editor_atto.get_selection();
|
||||
if (M.atto_image.selection !== false) {
|
||||
var dialogue;
|
||||
if (!M.atto_image.dialogue) {
|
||||
dialogue = new M.core.dialogue({
|
||||
visible: false,
|
||||
modal: true,
|
||||
close: true,
|
||||
draggable: true
|
||||
});
|
||||
} else {
|
||||
dialogue = M.atto_image.dialogue;
|
||||
}
|
||||
|
||||
dialogue.set('bodyContent', M.atto_image.get_form_content(elementid));
|
||||
dialogue.set('headerContent', M.util.get_string('createimage', 'atto_image'));
|
||||
dialogue.render();
|
||||
dialogue.centerDialogue();
|
||||
M.atto_image.dialogue = dialogue;
|
||||
|
||||
var selectedText = M.editor_atto.get_selection_text();
|
||||
var i = 0;
|
||||
|
||||
var images = [];
|
||||
for (i = 0; i < selectedText.childNodes.length; i++) {
|
||||
var child = selectedText.childNodes[0];
|
||||
if (images.length === 0) {
|
||||
if (child.nodeName.toLowerCase() === 'img') {
|
||||
images[0] = child;
|
||||
} else {
|
||||
if (child.getElementsByTagName) {
|
||||
images = child.getElementsByTagName('img');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (images.length > 0) {
|
||||
var image = Y.one(images[0]);
|
||||
var width = image.getAttribute('width');
|
||||
var height = image.getAttribute('height');
|
||||
if (width > 0) {
|
||||
Y.one('#atto_image_widthentry').set('value', width);
|
||||
}
|
||||
if (height > 0) {
|
||||
Y.one('#atto_image_heightentry').set('value', height);
|
||||
}
|
||||
Y.one('#atto_image_preview').set('src', image.get('src'));
|
||||
Y.one('#atto_image_preview').setStyle('display', 'inline');
|
||||
Y.one('#atto_image_altentry').set('value', image.get('alt'));
|
||||
Y.one('#atto_image_urlentry').set('value', image.get('src'));
|
||||
}
|
||||
dialogue.show();
|
||||
}
|
||||
};
|
||||
|
||||
M.editor_atto.add_toolbar_button(params.elementid, 'image', params.icon, display_chooser, this);
|
||||
},
|
||||
open_filepicker : function(e) {
|
||||
var elementid = this.getAttribute('data-editor');
|
||||
e.preventDefault();
|
||||
|
||||
M.editor_atto.show_filepicker(elementid, 'image', M.atto_image.filepicker_callback);
|
||||
},
|
||||
filepicker_callback : function(params) {
|
||||
if (params.url !== '') {
|
||||
var input = Y.one('#atto_image_urlentry');
|
||||
input.set('value', params.url);
|
||||
input = Y.one('#atto_image_altentry');
|
||||
input.set('value', params.file);
|
||||
|
||||
// Auto set the width and height.
|
||||
var image = new Image();
|
||||
image.onload = function() {
|
||||
Y.one('#atto_image_widthentry').set('value', this.width);
|
||||
Y.one('#atto_image_heightentry').set('value', this.height);
|
||||
Y.one('#atto_image_preview').set('src', this.src);
|
||||
Y.one('#atto_image_preview').setStyle('display', 'inline');
|
||||
};
|
||||
image.src = params.url;
|
||||
}
|
||||
},
|
||||
set_image : function(e) {
|
||||
e.preventDefault();
|
||||
M.atto_image.dialogue.hide();
|
||||
|
||||
var input = e.currentTarget.get('parentNode').one('#atto_image_urlentry');
|
||||
|
||||
var url = input.get('value');
|
||||
input = e.currentTarget.get('parentNode').one('#atto_image_altentry');
|
||||
var alt = input.get('value');
|
||||
input = e.currentTarget.get('parentNode').one('#atto_image_widthentry');
|
||||
var width = input.get('value');
|
||||
input = e.currentTarget.get('parentNode').one('#atto_image_heightentry');
|
||||
var height = input.get('value');
|
||||
if (url !== '' && alt !== '') {
|
||||
M.editor_atto.set_selection(M.atto_image.selection);
|
||||
var imagehtml = '<img src="' + Y.Escape.html(url) + '" alt="' + Y.Escape.html(alt) + '"';
|
||||
|
||||
if (width) {
|
||||
imagehtml += ' width="' + Y.Escape.html(width) + '"';
|
||||
}
|
||||
if (height) {
|
||||
imagehtml += ' height="' + Y.Escape.html(height) + '"';
|
||||
}
|
||||
imagehtml += '"/>';
|
||||
|
||||
if (document.selection && document.selection.createRange().pasteHTML) {
|
||||
document.selection.createRange().pasteHTML(imagehtml);
|
||||
} else {
|
||||
document.execCommand('insertHTML', false, imagehtml);
|
||||
}
|
||||
}
|
||||
},
|
||||
get_form_content : function(elementid) {
|
||||
var content = Y.Node.create('<form class="atto_form">' +
|
||||
'<label for="atto_image_urlentry">' + M.util.get_string('enterurl', 'atto_image') +
|
||||
'</label>' +
|
||||
'<input type="url" value="" id="atto_image_urlentry" size="32"/>' +
|
||||
'<label for="atto_image_altentry">' + M.util.get_string('enteralt', 'atto_image') +
|
||||
'</label>' +
|
||||
'<input type="text" value="" id="atto_image_altentry" size="32" required="true"/>' +
|
||||
'<label for="atto_image_widthentry">' + M.util.get_string('width', 'atto_image') +
|
||||
'</label>' +
|
||||
'<input type="text" value="" id="atto_image_widthentry" size="10"/>' +
|
||||
'<br/>' +
|
||||
'<label for="atto_image_heightentry">' + M.util.get_string('height', 'atto_image') +
|
||||
'</label>' +
|
||||
'<input type="text" value="" id="atto_image_heightentry" size="10"/>' +
|
||||
'<label for="atto_image_preview">' + M.util.get_string('preview', 'atto_image') +
|
||||
'</label>' +
|
||||
'<img src="#" width="200" id="atto_image_preview" alt="" style="display: none;"/>' +
|
||||
'<hr/>' +
|
||||
'<button id="openimagebrowser" data-editor="' + Y.Escape.html(elementid) + '">' +
|
||||
M.util.get_string('browserepositories', 'atto_image') +
|
||||
'</button>' +
|
||||
'<hr/>' +
|
||||
'<button id="atto_image_urlentrysubmit">' +
|
||||
M.util.get_string('createimage', 'atto_image') +
|
||||
'</button>' +
|
||||
'</form>' +
|
||||
'<hr/>' + M.util.get_string('accessibilityhint', 'atto_image'));
|
||||
|
||||
content.one('#atto_image_urlentrysubmit').on('click', M.atto_image.set_image);
|
||||
content.one('#openimagebrowser').on('click', M.atto_image.open_filepicker);
|
||||
return content;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"moodle-atto_image-button": {
|
||||
"requires": [
|
||||
"node",
|
||||
"escape"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?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 'atto_indent', language 'en'.
|
||||
*
|
||||
* @package atto_indent
|
||||
* @copyright 2013 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['pluginname'] = 'Indent';
|
||||
$string['indent'] = 'Indent';
|
||||
@@ -0,0 +1,52 @@
|
||||
<?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 integration version file.
|
||||
*
|
||||
* @package atto_indent
|
||||
* @copyright 2013 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Initialise this plugin
|
||||
* @param string $elementid
|
||||
*/
|
||||
function atto_indent_init_editor($elementid) {
|
||||
global $PAGE, $OUTPUT;
|
||||
|
||||
$icon = $OUTPUT->pix_icon('indent',
|
||||
get_string('indent', 'atto_indent'),
|
||||
'atto_indent',
|
||||
array('class'=>'icon'));
|
||||
|
||||
$PAGE->requires->yui_module('moodle-atto_indent-button',
|
||||
'M.atto_indent.init',
|
||||
array(array('elementid'=>$elementid, 'icon'=>$icon)),
|
||||
true);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the order this plugin should be displayed in the toolbar
|
||||
* @return int
|
||||
*/
|
||||
function atto_indent_sort_order() {
|
||||
return 5;
|
||||
}
|
||||
|
After Width: | Height: | Size: 439 B |
@@ -0,0 +1,68 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="16"
|
||||
height="16"
|
||||
id="svg2"
|
||||
version="1.1"
|
||||
inkscape:version="0.48.3.1 r9886"
|
||||
sodipodi:docname="indent.svg">
|
||||
<defs
|
||||
id="defs4" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="15.839192"
|
||||
inkscape:cx="-8.2482624"
|
||||
inkscape:cy="15.312045"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
inkscape:window-width="1122"
|
||||
inkscape:window-height="685"
|
||||
inkscape:window-x="162"
|
||||
inkscape:window-y="57"
|
||||
inkscape:window-maximized="0" />
|
||||
<metadata
|
||||
id="metadata7">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(0,-1036.3622)">
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:64px;font-style:normal;font-variant:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Comic Sans MS;-inkscape-font-specification:Arial Indent"
|
||||
x="7.2604713"
|
||||
y="1049.6475"
|
||||
id="text2984"
|
||||
sodipodi:linespacing="125%"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan2986"
|
||||
x="7.2604713"
|
||||
y="1049.6475"
|
||||
style="font-size:14px;font-style:normal;font-variant:normal;font-stretch:normal;fill:#999999;fill-opacity:1;font-family:Arial;-inkscape-font-specification:Arial Indent">></tspan></text>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.3 KiB |
@@ -0,0 +1,29 @@
|
||||
<?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 integration version file.
|
||||
*
|
||||
* @package atto_indent
|
||||
* @copyright 2013 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2013080900; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2013050100; // Requires this Moodle version.
|
||||
$plugin->component = 'atto_indent'; // Full name of the plugin (used for diagnostics).
|
||||
@@ -0,0 +1,40 @@
|
||||
YUI.add('moodle-atto_indent-button', function (Y, NAME) {
|
||||
|
||||
// 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 indent plugin.
|
||||
*
|
||||
* @package editor-atto
|
||||
* @copyright 2013 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
M.atto_indent = M.atto_indent || {
|
||||
init : function(params) {
|
||||
var click = function(e, elementid) {
|
||||
e.preventDefault();
|
||||
if (!M.editor_atto.is_active(elementid)) {
|
||||
M.editor_atto.focus(elementid);
|
||||
}
|
||||
document.execCommand('indent', false, null);
|
||||
};
|
||||
|
||||
M.editor_atto.add_toolbar_button(params.elementid, 'indent', params.icon, click);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}, '@VERSION@', {"requires": ["node"]});
|
||||
@@ -0,0 +1 @@
|
||||
YUI.add("moodle-atto_indent-button",function(e,t){M.atto_indent=M.atto_indent||{init:function(e){var t=function(e,t){e.preventDefault(),M.editor_atto.is_active(t)||M.editor_atto.focus(t),document.execCommand("indent",!1,null)};M.editor_atto.add_toolbar_button(e.elementid,"indent",e.icon,t)}}},"@VERSION@",{requires:["node"]});
|
||||
@@ -0,0 +1,40 @@
|
||||
YUI.add('moodle-atto_indent-button', function (Y, NAME) {
|
||||
|
||||
// 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 indent plugin.
|
||||
*
|
||||
* @package editor-atto
|
||||
* @copyright 2013 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
M.atto_indent = M.atto_indent || {
|
||||
init : function(params) {
|
||||
var click = function(e, elementid) {
|
||||
e.preventDefault();
|
||||
if (!M.editor_atto.is_active(elementid)) {
|
||||
M.editor_atto.focus(elementid);
|
||||
}
|
||||
document.execCommand('indent', false, null);
|
||||
};
|
||||
|
||||
M.editor_atto.add_toolbar_button(params.elementid, 'indent', params.icon, click);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}, '@VERSION@', {"requires": ["node"]});
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "moodle-atto_indent-button",
|
||||
"builds": {
|
||||
"moodle-atto_indent-button": {
|
||||
"jsfiles": [
|
||||
"button.js"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
// 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 indent plugin.
|
||||
*
|
||||
* @package editor-atto
|
||||
* @copyright 2013 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
M.atto_indent = M.atto_indent || {
|
||||
init : function(params) {
|
||||
var click = function(e, elementid) {
|
||||
e.preventDefault();
|
||||
if (!M.editor_atto.is_active(elementid)) {
|
||||
M.editor_atto.focus(elementid);
|
||||
}
|
||||
document.execCommand('indent', false, null);
|
||||
};
|
||||
|
||||
M.editor_atto.add_toolbar_button(params.elementid, 'indent', params.icon, click);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"moodle-atto_indent-button": {
|
||||
"requires": ["node"]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?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 'atto_italic', language 'en'.
|
||||
*
|
||||
* @package atto_italic
|
||||
* @copyright 2013 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['pluginname'] = 'Italic';
|
||||
$string['italic'] = 'Italic';
|
||||
@@ -0,0 +1,52 @@
|
||||
<?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 integration version file.
|
||||
*
|
||||
* @package atto_italic
|
||||
* @copyright 2013 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Initialise this plugin
|
||||
* @param string $elementid
|
||||
*/
|
||||
function atto_italic_init_editor($elementid) {
|
||||
global $PAGE, $OUTPUT;
|
||||
|
||||
$icon = $OUTPUT->pix_icon('italic',
|
||||
get_string('italic', 'atto_italic'),
|
||||
'atto_italic',
|
||||
array('class'=>'icon'));
|
||||
|
||||
$PAGE->requires->yui_module('moodle-atto_italic-button',
|
||||
'M.atto_italic.init',
|
||||
array(array('elementid'=>$elementid, 'icon'=>$icon)),
|
||||
true);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the order this plugin should be displayed in the toolbar
|
||||
* @return int
|
||||
*/
|
||||
function atto_italic_sort_order() {
|
||||
return 1;
|
||||
}
|
||||
|
After Width: | Height: | Size: 418 B |
@@ -0,0 +1,68 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="16"
|
||||
height="16"
|
||||
id="svg2"
|
||||
version="1.1"
|
||||
inkscape:version="0.48.3.1 r9886"
|
||||
sodipodi:docname="italic.svg">
|
||||
<defs
|
||||
id="defs4" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="15.839192"
|
||||
inkscape:cx="-8.2482624"
|
||||
inkscape:cy="15.312045"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
inkscape:window-width="1122"
|
||||
inkscape:window-height="685"
|
||||
inkscape:window-x="162"
|
||||
inkscape:window-y="57"
|
||||
inkscape:window-maximized="0" />
|
||||
<metadata
|
||||
id="metadata7">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(0,-1036.3622)">
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:64px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Comic Sans MS;-inkscape-font-specification:Comic Sans MS"
|
||||
x="7.2604713"
|
||||
y="1049.6475"
|
||||
id="text2984"
|
||||
sodipodi:linespacing="125%"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan2986"
|
||||
x="7.2604713"
|
||||
y="1049.6475"
|
||||
style="font-size:14px;font-style:italic;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Arial;-inkscape-font-specification:Arial Italic;fill:#999999;fill-opacity:1">i</tspan></text>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.3 KiB |
@@ -0,0 +1,29 @@
|
||||
<?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 integration version file.
|
||||
*
|
||||
* @package atto_italic
|
||||
* @copyright 2013 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2013080900; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2013050100; // Requires this Moodle version.
|
||||
$plugin->component = 'atto_italic'; // Full name of the plugin (used for diagnostics).
|
||||
@@ -0,0 +1,40 @@
|
||||
YUI.add('moodle-atto_italic-button', function (Y, NAME) {
|
||||
|
||||
// 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 italic plugin.
|
||||
*
|
||||
* @package editor-atto
|
||||
* @copyright 2013 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
M.atto_italic = M.atto_italic || {
|
||||
init : function(params) {
|
||||
var click = function(e, elementid) {
|
||||
e.preventDefault();
|
||||
if (!M.editor_atto.is_active(elementid)) {
|
||||
M.editor_atto.focus(elementid);
|
||||
}
|
||||
document.execCommand('italic', false, null);
|
||||
};
|
||||
|
||||
M.editor_atto.add_toolbar_button(params.elementid, 'italic', params.icon, click);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}, '@VERSION@', {"requires": ["node"]});
|
||||
@@ -0,0 +1 @@
|
||||
YUI.add("moodle-atto_italic-button",function(e,t){M.atto_italic=M.atto_italic||{init:function(e){var t=function(e,t){e.preventDefault(),M.editor_atto.is_active(t)||M.editor_atto.focus(t),document.execCommand("italic",!1,null)};M.editor_atto.add_toolbar_button(e.elementid,"italic",e.icon,t)}}},"@VERSION@",{requires:["node"]});
|
||||
@@ -0,0 +1,40 @@
|
||||
YUI.add('moodle-atto_italic-button', function (Y, NAME) {
|
||||
|
||||
// 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 italic plugin.
|
||||
*
|
||||
* @package editor-atto
|
||||
* @copyright 2013 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
M.atto_italic = M.atto_italic || {
|
||||
init : function(params) {
|
||||
var click = function(e, elementid) {
|
||||
e.preventDefault();
|
||||
if (!M.editor_atto.is_active(elementid)) {
|
||||
M.editor_atto.focus(elementid);
|
||||
}
|
||||
document.execCommand('italic', false, null);
|
||||
};
|
||||
|
||||
M.editor_atto.add_toolbar_button(params.elementid, 'italic', params.icon, click);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}, '@VERSION@', {"requires": ["node"]});
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "moodle-atto_italic-button",
|
||||
"builds": {
|
||||
"moodle-atto_italic-button": {
|
||||
"jsfiles": [
|
||||
"button.js"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
// 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 italic plugin.
|
||||
*
|
||||
* @package editor-atto
|
||||
* @copyright 2013 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
M.atto_italic = M.atto_italic || {
|
||||
init : function(params) {
|
||||
var click = function(e, elementid) {
|
||||
e.preventDefault();
|
||||
if (!M.editor_atto.is_active(elementid)) {
|
||||
M.editor_atto.focus(elementid);
|
||||
}
|
||||
document.execCommand('italic', false, null);
|
||||
};
|
||||
|
||||
M.editor_atto.add_toolbar_button(params.elementid, 'italic', params.icon, click);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"moodle-atto_italic-button": {
|
||||
"requires": ["node"]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?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 'atto_link', language 'en'.
|
||||
*
|
||||
* @package atto_link
|
||||
* @copyright 2013 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['pluginname'] = 'Link';
|
||||
$string['link'] = 'Link';
|
||||
$string['createlink'] = 'Create link';
|
||||
$string['enterurl'] = 'Enter a URL';
|
||||
$string['browserepositories'] = 'Browse repositories...';
|
||||
$string['accessibilityhint'] = '<p>Web content accessibility guidelines (WCAG):<br/><ul><li><a href="http://www.w3.org/TR/WCAG20/#navigation-mechanisms-refs" target="_blank">2.4.4 Link Purpose (In Context)</a></li><li><a href="http://www.w3.org/TR/WCAG20/#navigation-mechanisms-link" target="_blank">2.4.9 Link Purpose (Link Only)</a></li></ul></p>';
|
||||
@@ -0,0 +1,58 @@
|
||||
<?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 integration version file.
|
||||
*
|
||||
* @package atto_link
|
||||
* @copyright 2013 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Initialise this plugin
|
||||
* @param string $elementid
|
||||
*/
|
||||
function atto_link_init_editor($elementid) {
|
||||
global $PAGE, $OUTPUT;
|
||||
|
||||
$icon = $OUTPUT->pix_icon('link',
|
||||
get_string('link', 'atto_link'),
|
||||
'atto_link',
|
||||
array('class'=>'icon'));
|
||||
|
||||
$PAGE->requires->strings_for_js(array('createlink',
|
||||
'enterurl',
|
||||
'browserepositories',
|
||||
'accessibilityhint'),
|
||||
'atto_link');
|
||||
|
||||
$PAGE->requires->yui_module('moodle-atto_link-button',
|
||||
'M.atto_link.init',
|
||||
array(array('elementid'=>$elementid, 'icon'=>$icon)),
|
||||
true);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the order this plugin should be displayed in the toolbar
|
||||
* @return int
|
||||
*/
|
||||
function atto_link_sort_order() {
|
||||
return 11;
|
||||
}
|
||||
|
After Width: | Height: | Size: 471 B |
@@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="16"
|
||||
height="16"
|
||||
id="svg2"
|
||||
version="1.1"
|
||||
inkscape:version="0.48.3.1 r9886"
|
||||
sodipodi:docname="link.svg">
|
||||
<defs
|
||||
id="defs4" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="22.4"
|
||||
inkscape:cx="-3.7446839"
|
||||
inkscape:cy="10.171143"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
inkscape:window-width="1440"
|
||||
inkscape:window-height="872"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1" />
|
||||
<metadata
|
||||
id="metadata7">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(0,-1036.3622)">
|
||||
<rect
|
||||
style="fill:none;stroke:#999999;stroke-width:2.89999999999999991;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
|
||||
id="rect2984"
|
||||
width="19.107143"
|
||||
height="6.8750005"
|
||||
x="-13.535714"
|
||||
y="1040.9337"
|
||||
ry="0.053281363" />
|
||||
<rect
|
||||
ry="0.053281363"
|
||||
y="1040.9337"
|
||||
x="10.432884"
|
||||
height="6.8750005"
|
||||
width="19.107143"
|
||||
id="rect3754"
|
||||
style="fill:none;stroke:#999999;stroke-width:2.90000010000000019;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
|
||||
<rect
|
||||
style="fill:none;stroke:#999999;stroke-width:2.90000010000000019;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
|
||||
id="rect3756"
|
||||
width="9.0510426"
|
||||
height="0.26916784"
|
||||
x="3.5273302"
|
||||
y="1044.2031"
|
||||
ry="0.053281363" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.6 KiB |
@@ -0,0 +1,29 @@
|
||||
<?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 integration version file.
|
||||
*
|
||||
* @package atto_link
|
||||
* @copyright 2013 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2013080900; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2013050100; // Requires this Moodle version.
|
||||
$plugin->component = 'atto_link'; // Full name of the plugin (used for diagnostics).
|
||||
@@ -0,0 +1,132 @@
|
||||
YUI.add('moodle-atto_link-button', function (Y, NAME) {
|
||||
|
||||
// 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 link plugin.
|
||||
*
|
||||
* @package editor-atto
|
||||
* @copyright 2013 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
M.atto_link = M.atto_link || {
|
||||
dialogue : null,
|
||||
selection : null,
|
||||
init : function(params) {
|
||||
var display_chooser = function(e, elementid) {
|
||||
e.preventDefault();
|
||||
if (!M.editor_atto.is_active(elementid)) {
|
||||
M.editor_atto.focus(elementid);
|
||||
}
|
||||
M.atto_link.selection = M.editor_atto.get_selection();
|
||||
if (M.atto_link.selection !== false && (!M.atto_link.selection.collapsed)) {
|
||||
var dialogue;
|
||||
if (!M.atto_link.dialogue) {
|
||||
dialogue = new M.core.dialogue({
|
||||
visible: false,
|
||||
modal: true,
|
||||
close: true,
|
||||
draggable: true
|
||||
});
|
||||
} else {
|
||||
dialogue = M.atto_link.dialogue;
|
||||
}
|
||||
|
||||
dialogue.render();
|
||||
dialogue.set('bodyContent', M.atto_link.get_form_content(elementid));
|
||||
dialogue.set('headerContent', M.util.get_string('createlink', 'atto_link'));
|
||||
|
||||
M.atto_link.resolve_anchors();
|
||||
|
||||
dialogue.show();
|
||||
M.atto_link.dialogue = dialogue;
|
||||
}
|
||||
};
|
||||
|
||||
M.editor_atto.add_toolbar_button(params.elementid, 'link', params.icon, display_chooser, this);
|
||||
},
|
||||
resolve_anchors : function() {
|
||||
// Find the first anchor tag in the selection.
|
||||
var selectednode = M.editor_atto.get_selection_parent_node(),
|
||||
anchornode,
|
||||
url;
|
||||
|
||||
// Note this is a document fragment and YUI doesn't like them.
|
||||
if (!selectednode) {
|
||||
return;
|
||||
}
|
||||
|
||||
anchornode = Y.one(selectednode).ancestor('a');
|
||||
|
||||
if (anchornode) {
|
||||
url = anchornode.getAttribute('href');
|
||||
if (url !== '') {
|
||||
M.atto_link.selection = M.editor_atto.get_selection_from_node(anchornode);
|
||||
Y.one('#atto_link_urlentry').set('value', url);
|
||||
}
|
||||
}
|
||||
},
|
||||
open_filepicker : function(e) {
|
||||
var elementid = this.getAttribute('data-editor');
|
||||
e.preventDefault();
|
||||
|
||||
M.editor_atto.show_filepicker(elementid, 'link', M.atto_link.filepicker_callback);
|
||||
},
|
||||
filepicker_callback : function(params) {
|
||||
M.atto_link.dialogue.hide();
|
||||
if (params.url !== '') {
|
||||
M.editor_atto.set_selection(M.atto_link.selection);
|
||||
document.execCommand('unlink', false, null);
|
||||
document.execCommand('createLink', false, params.url);
|
||||
}
|
||||
},
|
||||
set_link : function(e) {
|
||||
e.preventDefault();
|
||||
M.atto_link.dialogue.hide();
|
||||
|
||||
var input = e.currentTarget.get('parentNode').one('input');
|
||||
|
||||
var value = input.get('value');
|
||||
if (value !== '') {
|
||||
M.editor_atto.set_selection(M.atto_link.selection);
|
||||
document.execCommand('unlink', false, null);
|
||||
document.execCommand('createLink', false, value);
|
||||
}
|
||||
},
|
||||
get_form_content : function(elementid) {
|
||||
var content = Y.Node.create('<form>' +
|
||||
'<label for="atto_link_urlentry">' + M.util.get_string('enterurl', 'atto_link') +
|
||||
'</label><br/>' +
|
||||
'<input type="url" value="" id="atto_link_urlentry" size="32"/>' +
|
||||
'<br/>' +
|
||||
'<button id="openlinkbrowser" data-editor="' + Y.Escape.html(elementid) + '">' +
|
||||
M.util.get_string('browserepositories', 'atto_link') +
|
||||
'</button>' +
|
||||
'<hr/>' +
|
||||
'<button id="atto_link_urlentrysubmit">' +
|
||||
M.util.get_string('createlink', 'atto_link') +
|
||||
'</button>' +
|
||||
'</form>' +
|
||||
'<hr/>' + M.util.get_string('accessibilityhint', 'atto_link'));
|
||||
|
||||
content.one('#atto_link_urlentrysubmit').on('click', M.atto_link.set_link);
|
||||
content.one('#openlinkbrowser').on('click', M.atto_link.open_filepicker);
|
||||
return content;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}, '@VERSION@', {"requires": ["node", "escape"]});
|
||||
@@ -0,0 +1 @@
|
||||
YUI.add("moodle-atto_link-button",function(e,t){M.atto_link=M.atto_link||{dialogue:null,selection:null,init:function(e){var t=function(e,t){e.preventDefault(),M.editor_atto.is_active(t)||M.editor_atto.focus(t),M.atto_link.selection=M.editor_atto.get_selection();if(M.atto_link.selection!==!1&&!M.atto_link.selection.collapsed){var n;M.atto_link.dialogue?n=M.atto_link.dialogue:n=new M.core.dialogue({visible:!1,modal:!0,close:!0,draggable:!0}),n.render(),n.set("bodyContent",M.atto_link.get_form_content(t)),n.set("headerContent",M.util.get_string("createlink","atto_link")),M.atto_link.resolve_anchors(),n.show(),M.atto_link.dialogue=n}};M.editor_atto.add_toolbar_button(e.elementid,"link",e.icon,t,this)},resolve_anchors:function(){var t=M.editor_atto.get_selection_parent_node(),n,r;if(!t)return;n=e.one(t).ancestor("a"),n&&(r=n.getAttribute("href"),r!==""&&(M.atto_link.selection=M.editor_atto.get_selection_from_node(n),e.one("#atto_link_urlentry").set("value",r)))},open_filepicker:function(e){var t=this.getAttribute("data-editor");e.preventDefault(),M.editor_atto.show_filepicker(t,"link",M.atto_link.filepicker_callback)},filepicker_callback:function(e){M.atto_link.dialogue.hide(),e.url!==""&&(M.editor_atto.set_selection(M.atto_link.selection),document.execCommand("unlink",!1,null),document.execCommand("createLink",!1,e.url))},set_link:function(e){e.preventDefault(),M.atto_link.dialogue.hide();var t=e.currentTarget.get("parentNode").one("input"),n=t.get("value");n!==""&&(M.editor_atto.set_selection(M.atto_link.selection),document.execCommand("unlink",!1,null),document.execCommand("createLink",!1,n))},get_form_content:function(t){var n=e.Node.create('<form><label for="atto_link_urlentry">'+M.util.get_string("enterurl","atto_link")+"</label><br/>"+'<input type="url" value="" id="atto_link_urlentry" size="32"/>'+"<br/>"+'<button id="openlinkbrowser" data-editor="'+e.Escape.html(t)+'">'+M.util.get_string("browserepositories","atto_link")+"</button>"+"<hr/>"+'<button id="atto_link_urlentrysubmit">'+M.util.get_string("createlink","atto_link")+"</button>"+"</form>"+"<hr/>"+M.util.get_string("accessibilityhint","atto_link"));return n.one("#atto_link_urlentrysubmit").on("click",M.atto_link.set_link),n.one("#openlinkbrowser").on("click",M.atto_link.open_filepicker),n}}},"@VERSION@",{requires:["node","escape"]});
|
||||
@@ -0,0 +1,132 @@
|
||||
YUI.add('moodle-atto_link-button', function (Y, NAME) {
|
||||
|
||||
// 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 link plugin.
|
||||
*
|
||||
* @package editor-atto
|
||||
* @copyright 2013 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
M.atto_link = M.atto_link || {
|
||||
dialogue : null,
|
||||
selection : null,
|
||||
init : function(params) {
|
||||
var display_chooser = function(e, elementid) {
|
||||
e.preventDefault();
|
||||
if (!M.editor_atto.is_active(elementid)) {
|
||||
M.editor_atto.focus(elementid);
|
||||
}
|
||||
M.atto_link.selection = M.editor_atto.get_selection();
|
||||
if (M.atto_link.selection !== false && (!M.atto_link.selection.collapsed)) {
|
||||
var dialogue;
|
||||
if (!M.atto_link.dialogue) {
|
||||
dialogue = new M.core.dialogue({
|
||||
visible: false,
|
||||
modal: true,
|
||||
close: true,
|
||||
draggable: true
|
||||
});
|
||||
} else {
|
||||
dialogue = M.atto_link.dialogue;
|
||||
}
|
||||
|
||||
dialogue.render();
|
||||
dialogue.set('bodyContent', M.atto_link.get_form_content(elementid));
|
||||
dialogue.set('headerContent', M.util.get_string('createlink', 'atto_link'));
|
||||
|
||||
M.atto_link.resolve_anchors();
|
||||
|
||||
dialogue.show();
|
||||
M.atto_link.dialogue = dialogue;
|
||||
}
|
||||
};
|
||||
|
||||
M.editor_atto.add_toolbar_button(params.elementid, 'link', params.icon, display_chooser, this);
|
||||
},
|
||||
resolve_anchors : function() {
|
||||
// Find the first anchor tag in the selection.
|
||||
var selectednode = M.editor_atto.get_selection_parent_node(),
|
||||
anchornode,
|
||||
url;
|
||||
|
||||
// Note this is a document fragment and YUI doesn't like them.
|
||||
if (!selectednode) {
|
||||
return;
|
||||
}
|
||||
|
||||
anchornode = Y.one(selectednode).ancestor('a');
|
||||
|
||||
if (anchornode) {
|
||||
url = anchornode.getAttribute('href');
|
||||
if (url !== '') {
|
||||
M.atto_link.selection = M.editor_atto.get_selection_from_node(anchornode);
|
||||
Y.one('#atto_link_urlentry').set('value', url);
|
||||
}
|
||||
}
|
||||
},
|
||||
open_filepicker : function(e) {
|
||||
var elementid = this.getAttribute('data-editor');
|
||||
e.preventDefault();
|
||||
|
||||
M.editor_atto.show_filepicker(elementid, 'link', M.atto_link.filepicker_callback);
|
||||
},
|
||||
filepicker_callback : function(params) {
|
||||
M.atto_link.dialogue.hide();
|
||||
if (params.url !== '') {
|
||||
M.editor_atto.set_selection(M.atto_link.selection);
|
||||
document.execCommand('unlink', false, null);
|
||||
document.execCommand('createLink', false, params.url);
|
||||
}
|
||||
},
|
||||
set_link : function(e) {
|
||||
e.preventDefault();
|
||||
M.atto_link.dialogue.hide();
|
||||
|
||||
var input = e.currentTarget.get('parentNode').one('input');
|
||||
|
||||
var value = input.get('value');
|
||||
if (value !== '') {
|
||||
M.editor_atto.set_selection(M.atto_link.selection);
|
||||
document.execCommand('unlink', false, null);
|
||||
document.execCommand('createLink', false, value);
|
||||
}
|
||||
},
|
||||
get_form_content : function(elementid) {
|
||||
var content = Y.Node.create('<form>' +
|
||||
'<label for="atto_link_urlentry">' + M.util.get_string('enterurl', 'atto_link') +
|
||||
'</label><br/>' +
|
||||
'<input type="url" value="" id="atto_link_urlentry" size="32"/>' +
|
||||
'<br/>' +
|
||||
'<button id="openlinkbrowser" data-editor="' + Y.Escape.html(elementid) + '">' +
|
||||
M.util.get_string('browserepositories', 'atto_link') +
|
||||
'</button>' +
|
||||
'<hr/>' +
|
||||
'<button id="atto_link_urlentrysubmit">' +
|
||||
M.util.get_string('createlink', 'atto_link') +
|
||||
'</button>' +
|
||||
'</form>' +
|
||||
'<hr/>' + M.util.get_string('accessibilityhint', 'atto_link'));
|
||||
|
||||
content.one('#atto_link_urlentrysubmit').on('click', M.atto_link.set_link);
|
||||
content.one('#openlinkbrowser').on('click', M.atto_link.open_filepicker);
|
||||
return content;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}, '@VERSION@', {"requires": ["node", "escape"]});
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "moodle-atto_link-button",
|
||||
"builds": {
|
||||
"moodle-atto_link-button": {
|
||||
"jsfiles": [
|
||||
"button.js"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
// 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 link plugin.
|
||||
*
|
||||
* @package editor-atto
|
||||
* @copyright 2013 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
M.atto_link = M.atto_link || {
|
||||
dialogue : null,
|
||||
selection : null,
|
||||
init : function(params) {
|
||||
var display_chooser = function(e, elementid) {
|
||||
e.preventDefault();
|
||||
if (!M.editor_atto.is_active(elementid)) {
|
||||
M.editor_atto.focus(elementid);
|
||||
}
|
||||
M.atto_link.selection = M.editor_atto.get_selection();
|
||||
if (M.atto_link.selection !== false && (!M.atto_link.selection.collapsed)) {
|
||||
var dialogue;
|
||||
if (!M.atto_link.dialogue) {
|
||||
dialogue = new M.core.dialogue({
|
||||
visible: false,
|
||||
modal: true,
|
||||
close: true,
|
||||
draggable: true
|
||||
});
|
||||
} else {
|
||||
dialogue = M.atto_link.dialogue;
|
||||
}
|
||||
|
||||
dialogue.render();
|
||||
dialogue.set('bodyContent', M.atto_link.get_form_content(elementid));
|
||||
dialogue.set('headerContent', M.util.get_string('createlink', 'atto_link'));
|
||||
|
||||
M.atto_link.resolve_anchors();
|
||||
|
||||
dialogue.show();
|
||||
M.atto_link.dialogue = dialogue;
|
||||
}
|
||||
};
|
||||
|
||||
M.editor_atto.add_toolbar_button(params.elementid, 'link', params.icon, display_chooser, this);
|
||||
},
|
||||
resolve_anchors : function() {
|
||||
// Find the first anchor tag in the selection.
|
||||
var selectednode = M.editor_atto.get_selection_parent_node(),
|
||||
anchornode,
|
||||
url;
|
||||
|
||||
// Note this is a document fragment and YUI doesn't like them.
|
||||
if (!selectednode) {
|
||||
return;
|
||||
}
|
||||
|
||||
anchornode = Y.one(selectednode).ancestor('a');
|
||||
|
||||
if (anchornode) {
|
||||
url = anchornode.getAttribute('href');
|
||||
if (url !== '') {
|
||||
M.atto_link.selection = M.editor_atto.get_selection_from_node(anchornode);
|
||||
Y.one('#atto_link_urlentry').set('value', url);
|
||||
}
|
||||
}
|
||||
},
|
||||
open_filepicker : function(e) {
|
||||
var elementid = this.getAttribute('data-editor');
|
||||
e.preventDefault();
|
||||
|
||||
M.editor_atto.show_filepicker(elementid, 'link', M.atto_link.filepicker_callback);
|
||||
},
|
||||
filepicker_callback : function(params) {
|
||||
M.atto_link.dialogue.hide();
|
||||
if (params.url !== '') {
|
||||
M.editor_atto.set_selection(M.atto_link.selection);
|
||||
document.execCommand('unlink', false, null);
|
||||
document.execCommand('createLink', false, params.url);
|
||||
}
|
||||
},
|
||||
set_link : function(e) {
|
||||
e.preventDefault();
|
||||
M.atto_link.dialogue.hide();
|
||||
|
||||
var input = e.currentTarget.get('parentNode').one('input');
|
||||
|
||||
var value = input.get('value');
|
||||
if (value !== '') {
|
||||
M.editor_atto.set_selection(M.atto_link.selection);
|
||||
document.execCommand('unlink', false, null);
|
||||
document.execCommand('createLink', false, value);
|
||||
}
|
||||
},
|
||||
get_form_content : function(elementid) {
|
||||
var content = Y.Node.create('<form>' +
|
||||
'<label for="atto_link_urlentry">' + M.util.get_string('enterurl', 'atto_link') +
|
||||
'</label><br/>' +
|
||||
'<input type="url" value="" id="atto_link_urlentry" size="32"/>' +
|
||||
'<br/>' +
|
||||
'<button id="openlinkbrowser" data-editor="' + Y.Escape.html(elementid) + '">' +
|
||||
M.util.get_string('browserepositories', 'atto_link') +
|
||||
'</button>' +
|
||||
'<hr/>' +
|
||||
'<button id="atto_link_urlentrysubmit">' +
|
||||
M.util.get_string('createlink', 'atto_link') +
|
||||
'</button>' +
|
||||
'</form>' +
|
||||
'<hr/>' + M.util.get_string('accessibilityhint', 'atto_link'));
|
||||
|
||||
content.one('#atto_link_urlentrysubmit').on('click', M.atto_link.set_link);
|
||||
content.one('#openlinkbrowser').on('click', M.atto_link.open_filepicker);
|
||||
return content;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"moodle-atto_link-button": {
|
||||
"requires": [
|
||||
"node",
|
||||
"escape"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?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 'atto_media', language 'en'.
|
||||
*
|
||||
* @package atto_media
|
||||
* @copyright 2013 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['pluginname'] = 'Media';
|
||||
$string['media'] = 'Media';
|
||||
$string['createmedia'] = 'Insert media';
|
||||
$string['enterurl'] = 'Enter URL';
|
||||
$string['entername'] = 'Enter name';
|
||||
$string['browserepositories'] = 'Browse repositories...';
|
||||
$string['accessibilityhint'] = '<p>Web content accessibility guidelines (WCAG):<br/><ul><li><a href="http://www.w3.org/TR/WCAG20/#text-equiv" target="_blank">Text Alternatives</a></li></ul></p>';
|
||||
$string['width'] = 'Width';
|
||||
$string['height'] = 'Height';
|
||||
@@ -0,0 +1,56 @@
|
||||
<?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 integration version file.
|
||||
*
|
||||
* @package atto_media
|
||||
* @copyright 2013 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
/**
|
||||
* Initialise this plugin
|
||||
* @param string $elementid
|
||||
*/
|
||||
function atto_media_init_editor($elementid) {
|
||||
global $PAGE, $OUTPUT;
|
||||
|
||||
$icon = $OUTPUT->pix_icon('media',
|
||||
get_string('media', 'atto_media'),
|
||||
'atto_media',
|
||||
array('class'=>'icon'));
|
||||
|
||||
$PAGE->requires->strings_for_js(array('createmedia',
|
||||
'enterurl',
|
||||
'entername',
|
||||
'browserepositories',
|
||||
'accessibilityhint'),
|
||||
'atto_media');
|
||||
$PAGE->requires->yui_module('moodle-atto_media-button',
|
||||
'M.atto_media.init',
|
||||
array(array('elementid'=>$elementid, 'icon'=>$icon)),
|
||||
true);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the order this plugin should be displayed in the toolbar
|
||||
* @return int
|
||||
*/
|
||||
function atto_media_sort_order() {
|
||||
return 14;
|
||||
}
|
||||
|
After Width: | Height: | Size: 489 B |
@@ -0,0 +1,105 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="16"
|
||||
height="16"
|
||||
id="svg2"
|
||||
version="1.1"
|
||||
inkscape:version="0.48.3.1 r9886"
|
||||
sodipodi:docname="media.svg">
|
||||
<defs
|
||||
id="defs4" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="32"
|
||||
inkscape:cx="6.077509"
|
||||
inkscape:cy="9.3016902"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
inkscape:window-width="1122"
|
||||
inkscape:window-height="685"
|
||||
inkscape:window-x="162"
|
||||
inkscape:window-y="57"
|
||||
inkscape:window-maximized="0" />
|
||||
<metadata
|
||||
id="metadata7">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>media/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillMedia" />
|
||||
<dc:title />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(0,-1036.3622)">
|
||||
<rect
|
||||
style="fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#999999;stroke-opacity:1"
|
||||
id="rect2986"
|
||||
width="14.142136"
|
||||
height="13.131983"
|
||||
x="1.0101526"
|
||||
y="1.4159228"
|
||||
transform="translate(0,1036.3622)"
|
||||
ry="0.053281363" />
|
||||
<g
|
||||
id="g3766"
|
||||
transform="matrix(0.84027762,0,0,0.84027762,1.3177096,166.78804)">
|
||||
<path
|
||||
transform="matrix(1.5411765,0,0,1.5411765,-1.938603,1033.428)"
|
||||
d="M 5.71875,5.421875 C 5.71875,6.1553782 5.1241282,6.75 4.390625,6.75 3.6571218,6.75 3.0625,6.1553782 3.0625,5.421875 c 0,-0.7335032 0.5946218,-1.328125 1.328125,-1.328125 0.7335032,0 1.328125,0.5946218 1.328125,1.328125 z"
|
||||
sodipodi:ry="1.328125"
|
||||
sodipodi:rx="1.328125"
|
||||
sodipodi:cy="5.421875"
|
||||
sodipodi:cx="4.390625"
|
||||
id="path3756"
|
||||
style="fill:#999999;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
sodipodi:type="arc" />
|
||||
<path
|
||||
sodipodi:type="arc"
|
||||
style="fill:#999999;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
id="path3760"
|
||||
sodipodi:cx="4.390625"
|
||||
sodipodi:cy="5.421875"
|
||||
sodipodi:rx="1.328125"
|
||||
sodipodi:ry="1.328125"
|
||||
d="M 5.71875,5.421875 C 5.71875,6.1553782 5.1241282,6.75 4.390625,6.75 3.6571218,6.75 3.0625,6.1553782 3.0625,5.421875 c 0,-0.7335032 0.5946218,-1.328125 1.328125,-1.328125 0.7335032,0 1.328125,0.5946218 1.328125,1.328125 z"
|
||||
transform="matrix(1.5411765,0,0,1.5411765,2.655147,1033.428)" />
|
||||
<rect
|
||||
ry="0.74078137"
|
||||
y="1043.9247"
|
||||
x="2.375"
|
||||
height="4.8125"
|
||||
width="9.625"
|
||||
id="rect3762"
|
||||
style="fill:#999999;fill-opacity:1;fill-rule:nonzero;stroke:none" />
|
||||
<rect
|
||||
ry="0.74078137"
|
||||
y="1045.4247"
|
||||
x="12.09375"
|
||||
height="2"
|
||||
width="2.03125"
|
||||
id="rect3764"
|
||||
style="fill:#999999;fill-opacity:1;fill-rule:nonzero;stroke:none" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.5 KiB |
@@ -0,0 +1,29 @@
|
||||
<?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 integration version file.
|
||||
*
|
||||
* @package atto_media
|
||||
* @copyright 2013 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2013080900; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2013050100; // Requires this Moodle version.
|
||||
$plugin->component = 'atto_media'; // Full name of the plugin (used for diagnostics).
|
||||
@@ -0,0 +1,119 @@
|
||||
YUI.add('moodle-atto_media-button', function (Y, NAME) {
|
||||
|
||||
// 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 media plugin.
|
||||
*
|
||||
* @package editor-atto
|
||||
* @copyright 2013 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
M.atto_media = M.atto_media || {
|
||||
dialogue : null,
|
||||
selection : null,
|
||||
init : function(params) {
|
||||
var display_chooser = function(e, elementid) {
|
||||
e.preventDefault();
|
||||
if (!M.editor_atto.is_active(elementid)) {
|
||||
M.editor_atto.focus(elementid);
|
||||
}
|
||||
M.atto_media.selection = M.editor_atto.get_selection();
|
||||
if (M.atto_media.selection !== false) {
|
||||
var dialogue;
|
||||
if (!M.atto_media.dialogue) {
|
||||
dialogue = new M.core.dialogue({
|
||||
visible: false,
|
||||
modal: true,
|
||||
close: true,
|
||||
draggable: true
|
||||
});
|
||||
} else {
|
||||
dialogue = M.atto_media.dialogue;
|
||||
}
|
||||
|
||||
dialogue.render();
|
||||
dialogue.set('bodyContent', M.atto_media.get_form_content(elementid));
|
||||
dialogue.set('headerContent', M.util.get_string('createmedia', 'atto_media'));
|
||||
dialogue.centerDialogue();
|
||||
dialogue.show();
|
||||
M.atto_media.dialogue = dialogue;
|
||||
}
|
||||
};
|
||||
|
||||
M.editor_atto.add_toolbar_button(params.elementid, 'media', params.icon, display_chooser, this);
|
||||
},
|
||||
open_browser : function(e) {
|
||||
var elementid = this.getAttribute('data-editor');
|
||||
e.preventDefault();
|
||||
|
||||
M.editor_atto.show_filepicker(elementid, 'media', M.atto_media.filepicker_callback);
|
||||
},
|
||||
filepicker_callback : function(params) {
|
||||
if (params.url !== '') {
|
||||
var input = Y.one('#atto_media_urlentry');
|
||||
input.set('value', params.url);
|
||||
input = Y.one('#atto_media_nameentry');
|
||||
input.set('value', params.file);
|
||||
}
|
||||
},
|
||||
set_media : function(e) {
|
||||
e.preventDefault();
|
||||
M.atto_media.dialogue.hide();
|
||||
|
||||
var input = e.currentTarget.get('parentNode').one('#atto_media_urlentry');
|
||||
var url = input.get('value');
|
||||
input = e.currentTarget.get('parentNode').one('#atto_media_nameentry');
|
||||
var name = input.get('value');
|
||||
|
||||
if (url !== '' && name !== '') {
|
||||
M.editor_atto.set_selection(M.atto_media.selection);
|
||||
var mediahtml = '<a href="' + Y.Escape.html(url) + '">' + name + '</a>';
|
||||
|
||||
if (document.selection && document.selection.createRange().pasteHTML) {
|
||||
document.selection.createRange().pasteHTML(mediahtml);
|
||||
} else {
|
||||
document.execCommand('insertHTML', false, mediahtml);
|
||||
}
|
||||
}
|
||||
},
|
||||
get_form_content : function(elementid) {
|
||||
var content = Y.Node.create('<form class="atto_form">' +
|
||||
'<label for="atto_media_urlentry">' + M.util.get_string('enterurl', 'atto_media') +
|
||||
'</label>' +
|
||||
'<input type="url" value="" id="atto_media_urlentry" size="32"/>' +
|
||||
'<label for="atto_media_nameentry">' + M.util.get_string('entername', 'atto_media') +
|
||||
'</label>' +
|
||||
'<input type="text" value="" id="atto_media_nameentry" size="32" required="true"/>' +
|
||||
'<hr/>' +
|
||||
'<button id="openmediabrowser" data-editor="' + Y.Escape.html(elementid) + '">' +
|
||||
M.util.get_string('browserepositories', 'atto_media') +
|
||||
'</button>' +
|
||||
'<hr/>' +
|
||||
'<button id="atto_media_urlentrysubmit">' +
|
||||
M.util.get_string('createmedia', 'atto_media') +
|
||||
'</button>' +
|
||||
'</form>' +
|
||||
'<hr/>' + M.util.get_string('accessibilityhint', 'atto_media'));
|
||||
|
||||
content.one('#atto_media_urlentrysubmit').on('click', M.atto_media.set_media);
|
||||
content.one('#openmediabrowser').on('click', M.atto_media.open_browser);
|
||||
return content;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}, '@VERSION@', {"requires": ["node", "escape"]});
|
||||
@@ -0,0 +1 @@
|
||||
YUI.add("moodle-atto_media-button",function(e,t){M.atto_media=M.atto_media||{dialogue:null,selection:null,init:function(e){var t=function(e,t){e.preventDefault(),M.editor_atto.is_active(t)||M.editor_atto.focus(t),M.atto_media.selection=M.editor_atto.get_selection();if(M.atto_media.selection!==!1){var n;M.atto_media.dialogue?n=M.atto_media.dialogue:n=new M.core.dialogue({visible:!1,modal:!0,close:!0,draggable:!0}),n.render(),n.set("bodyContent",M.atto_media.get_form_content(t)),n.set("headerContent",M.util.get_string("createmedia","atto_media")),n.centerDialogue(),n.show(),M.atto_media.dialogue=n}};M.editor_atto.add_toolbar_button(e.elementid,"media",e.icon,t,this)},open_browser:function(e){var t=this.getAttribute("data-editor");e.preventDefault(),M.editor_atto.show_filepicker(t,"media",M.atto_media.filepicker_callback)},filepicker_callback:function(t){if(t.url!==""){var n=e.one("#atto_media_urlentry");n.set("value",t.url),n=e.one("#atto_media_nameentry"),n.set("value",t.file)}},set_media:function(t){t.preventDefault(),M.atto_media.dialogue.hide();var n=t.currentTarget.get("parentNode").one("#atto_media_urlentry"),r=n.get("value");n=t.currentTarget.get("parentNode").one("#atto_media_nameentry");var i=n.get("value");if(r!==""&&i!==""){M.editor_atto.set_selection(M.atto_media.selection);var s='<a href="'+e.Escape.html(r)+'">'+i+"</a>";document.selection&&document.selection.createRange().pasteHTML?document.selection.createRange().pasteHTML(s):document.execCommand("insertHTML",!1,s)}},get_form_content:function(t){var n=e.Node.create('<form class="atto_form"><label for="atto_media_urlentry">'+M.util.get_string("enterurl","atto_media")+"</label>"+'<input type="url" value="" id="atto_media_urlentry" size="32"/>'+'<label for="atto_media_nameentry">'+M.util.get_string("entername","atto_media")+"</label>"+'<input type="text" value="" id="atto_media_nameentry" size="32" required="true"/>'+"<hr/>"+'<button id="openmediabrowser" data-editor="'+e.Escape.html(t)+'">'+M.util.get_string("browserepositories","atto_media")+"</button>"+"<hr/>"+'<button id="atto_media_urlentrysubmit">'+M.util.get_string("createmedia","atto_media")+"</button>"+"</form>"+"<hr/>"+M.util.get_string("accessibilityhint","atto_media"));return n.one("#atto_media_urlentrysubmit").on("click",M.atto_media.set_media),n.one("#openmediabrowser").on("click",M.atto_media.open_browser),n}}},"@VERSION@",{requires:["node","escape"]});
|
||||
@@ -0,0 +1,119 @@
|
||||
YUI.add('moodle-atto_media-button', function (Y, NAME) {
|
||||
|
||||
// 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 media plugin.
|
||||
*
|
||||
* @package editor-atto
|
||||
* @copyright 2013 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
M.atto_media = M.atto_media || {
|
||||
dialogue : null,
|
||||
selection : null,
|
||||
init : function(params) {
|
||||
var display_chooser = function(e, elementid) {
|
||||
e.preventDefault();
|
||||
if (!M.editor_atto.is_active(elementid)) {
|
||||
M.editor_atto.focus(elementid);
|
||||
}
|
||||
M.atto_media.selection = M.editor_atto.get_selection();
|
||||
if (M.atto_media.selection !== false) {
|
||||
var dialogue;
|
||||
if (!M.atto_media.dialogue) {
|
||||
dialogue = new M.core.dialogue({
|
||||
visible: false,
|
||||
modal: true,
|
||||
close: true,
|
||||
draggable: true
|
||||
});
|
||||
} else {
|
||||
dialogue = M.atto_media.dialogue;
|
||||
}
|
||||
|
||||
dialogue.render();
|
||||
dialogue.set('bodyContent', M.atto_media.get_form_content(elementid));
|
||||
dialogue.set('headerContent', M.util.get_string('createmedia', 'atto_media'));
|
||||
dialogue.centerDialogue();
|
||||
dialogue.show();
|
||||
M.atto_media.dialogue = dialogue;
|
||||
}
|
||||
};
|
||||
|
||||
M.editor_atto.add_toolbar_button(params.elementid, 'media', params.icon, display_chooser, this);
|
||||
},
|
||||
open_browser : function(e) {
|
||||
var elementid = this.getAttribute('data-editor');
|
||||
e.preventDefault();
|
||||
|
||||
M.editor_atto.show_filepicker(elementid, 'media', M.atto_media.filepicker_callback);
|
||||
},
|
||||
filepicker_callback : function(params) {
|
||||
if (params.url !== '') {
|
||||
var input = Y.one('#atto_media_urlentry');
|
||||
input.set('value', params.url);
|
||||
input = Y.one('#atto_media_nameentry');
|
||||
input.set('value', params.file);
|
||||
}
|
||||
},
|
||||
set_media : function(e) {
|
||||
e.preventDefault();
|
||||
M.atto_media.dialogue.hide();
|
||||
|
||||
var input = e.currentTarget.get('parentNode').one('#atto_media_urlentry');
|
||||
var url = input.get('value');
|
||||
input = e.currentTarget.get('parentNode').one('#atto_media_nameentry');
|
||||
var name = input.get('value');
|
||||
|
||||
if (url !== '' && name !== '') {
|
||||
M.editor_atto.set_selection(M.atto_media.selection);
|
||||
var mediahtml = '<a href="' + Y.Escape.html(url) + '">' + name + '</a>';
|
||||
|
||||
if (document.selection && document.selection.createRange().pasteHTML) {
|
||||
document.selection.createRange().pasteHTML(mediahtml);
|
||||
} else {
|
||||
document.execCommand('insertHTML', false, mediahtml);
|
||||
}
|
||||
}
|
||||
},
|
||||
get_form_content : function(elementid) {
|
||||
var content = Y.Node.create('<form class="atto_form">' +
|
||||
'<label for="atto_media_urlentry">' + M.util.get_string('enterurl', 'atto_media') +
|
||||
'</label>' +
|
||||
'<input type="url" value="" id="atto_media_urlentry" size="32"/>' +
|
||||
'<label for="atto_media_nameentry">' + M.util.get_string('entername', 'atto_media') +
|
||||
'</label>' +
|
||||
'<input type="text" value="" id="atto_media_nameentry" size="32" required="true"/>' +
|
||||
'<hr/>' +
|
||||
'<button id="openmediabrowser" data-editor="' + Y.Escape.html(elementid) + '">' +
|
||||
M.util.get_string('browserepositories', 'atto_media') +
|
||||
'</button>' +
|
||||
'<hr/>' +
|
||||
'<button id="atto_media_urlentrysubmit">' +
|
||||
M.util.get_string('createmedia', 'atto_media') +
|
||||
'</button>' +
|
||||
'</form>' +
|
||||
'<hr/>' + M.util.get_string('accessibilityhint', 'atto_media'));
|
||||
|
||||
content.one('#atto_media_urlentrysubmit').on('click', M.atto_media.set_media);
|
||||
content.one('#openmediabrowser').on('click', M.atto_media.open_browser);
|
||||
return content;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}, '@VERSION@', {"requires": ["node", "escape"]});
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "moodle-atto_media-button",
|
||||
"builds": {
|
||||
"moodle-atto_media-button": {
|
||||
"jsfiles": [
|
||||
"button.js"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
// 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 media plugin.
|
||||
*
|
||||
* @package editor-atto
|
||||
* @copyright 2013 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
M.atto_media = M.atto_media || {
|
||||
dialogue : null,
|
||||
selection : null,
|
||||
init : function(params) {
|
||||
var display_chooser = function(e, elementid) {
|
||||
e.preventDefault();
|
||||
if (!M.editor_atto.is_active(elementid)) {
|
||||
M.editor_atto.focus(elementid);
|
||||
}
|
||||
M.atto_media.selection = M.editor_atto.get_selection();
|
||||
if (M.atto_media.selection !== false) {
|
||||
var dialogue;
|
||||
if (!M.atto_media.dialogue) {
|
||||
dialogue = new M.core.dialogue({
|
||||
visible: false,
|
||||
modal: true,
|
||||
close: true,
|
||||
draggable: true
|
||||
});
|
||||
} else {
|
||||
dialogue = M.atto_media.dialogue;
|
||||
}
|
||||
|
||||
dialogue.render();
|
||||
dialogue.set('bodyContent', M.atto_media.get_form_content(elementid));
|
||||
dialogue.set('headerContent', M.util.get_string('createmedia', 'atto_media'));
|
||||
dialogue.centerDialogue();
|
||||
dialogue.show();
|
||||
M.atto_media.dialogue = dialogue;
|
||||
}
|
||||
};
|
||||
|
||||
M.editor_atto.add_toolbar_button(params.elementid, 'media', params.icon, display_chooser, this);
|
||||
},
|
||||
open_browser : function(e) {
|
||||
var elementid = this.getAttribute('data-editor');
|
||||
e.preventDefault();
|
||||
|
||||
M.editor_atto.show_filepicker(elementid, 'media', M.atto_media.filepicker_callback);
|
||||
},
|
||||
filepicker_callback : function(params) {
|
||||
if (params.url !== '') {
|
||||
var input = Y.one('#atto_media_urlentry');
|
||||
input.set('value', params.url);
|
||||
input = Y.one('#atto_media_nameentry');
|
||||
input.set('value', params.file);
|
||||
}
|
||||
},
|
||||
set_media : function(e) {
|
||||
e.preventDefault();
|
||||
M.atto_media.dialogue.hide();
|
||||
|
||||
var input = e.currentTarget.get('parentNode').one('#atto_media_urlentry');
|
||||
var url = input.get('value');
|
||||
input = e.currentTarget.get('parentNode').one('#atto_media_nameentry');
|
||||
var name = input.get('value');
|
||||
|
||||
if (url !== '' && name !== '') {
|
||||
M.editor_atto.set_selection(M.atto_media.selection);
|
||||
var mediahtml = '<a href="' + Y.Escape.html(url) + '">' + name + '</a>';
|
||||
|
||||
if (document.selection && document.selection.createRange().pasteHTML) {
|
||||
document.selection.createRange().pasteHTML(mediahtml);
|
||||
} else {
|
||||
document.execCommand('insertHTML', false, mediahtml);
|
||||
}
|
||||
}
|
||||
},
|
||||
get_form_content : function(elementid) {
|
||||
var content = Y.Node.create('<form class="atto_form">' +
|
||||
'<label for="atto_media_urlentry">' + M.util.get_string('enterurl', 'atto_media') +
|
||||
'</label>' +
|
||||
'<input type="url" value="" id="atto_media_urlentry" size="32"/>' +
|
||||
'<label for="atto_media_nameentry">' + M.util.get_string('entername', 'atto_media') +
|
||||
'</label>' +
|
||||
'<input type="text" value="" id="atto_media_nameentry" size="32" required="true"/>' +
|
||||
'<hr/>' +
|
||||
'<button id="openmediabrowser" data-editor="' + Y.Escape.html(elementid) + '">' +
|
||||
M.util.get_string('browserepositories', 'atto_media') +
|
||||
'</button>' +
|
||||
'<hr/>' +
|
||||
'<button id="atto_media_urlentrysubmit">' +
|
||||
M.util.get_string('createmedia', 'atto_media') +
|
||||
'</button>' +
|
||||
'</form>' +
|
||||
'<hr/>' + M.util.get_string('accessibilityhint', 'atto_media'));
|
||||
|
||||
content.one('#atto_media_urlentrysubmit').on('click', M.atto_media.set_media);
|
||||
content.one('#openmediabrowser').on('click', M.atto_media.open_browser);
|
||||
return content;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"moodle-atto_media-button": {
|
||||
"requires": [
|
||||
"node",
|
||||
"escape"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?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 'atto_orderedlist', language 'en'.
|
||||
*
|
||||
* @package atto_orderedlist
|
||||
* @copyright 2013 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['pluginname'] = 'Ordered list';
|
||||
$string['orderedlist'] = 'Ordered list';
|
||||
@@ -0,0 +1,52 @@
|
||||
<?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 integration version file.
|
||||
*
|
||||
* @package atto_orderedlist
|
||||
* @copyright 2013 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Initialise this plugin
|
||||
* @param string $elementid
|
||||
*/
|
||||
function atto_orderedlist_init_editor($elementid) {
|
||||
global $PAGE, $OUTPUT;
|
||||
|
||||
$icon = $OUTPUT->pix_icon('orderedlist',
|
||||
get_string('orderedlist', 'atto_orderedlist'),
|
||||
'atto_orderedlist',
|
||||
array('class'=>'icon'));
|
||||
|
||||
$PAGE->requires->yui_module('moodle-atto_orderedlist-button',
|
||||
'M.atto_orderedlist.init',
|
||||
array(array('elementid'=>$elementid, 'icon'=>$icon)),
|
||||
true);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the order this plugin should be displayed in the toolbar
|
||||
* @return int
|
||||
*/
|
||||
function atto_orderedlist_sort_order() {
|
||||
return 6;
|
||||
}
|
||||
|
After Width: | Height: | Size: 465 B |
@@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="16"
|
||||
height="16"
|
||||
id="svg2"
|
||||
version="1.1"
|
||||
inkscape:version="0.48.3.1 r9886"
|
||||
sodipodi:docname="orderedlist.svg">
|
||||
<defs
|
||||
id="defs4" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="15.839192"
|
||||
inkscape:cx="-8.2482624"
|
||||
inkscape:cy="4.0559186"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
inkscape:window-width="1122"
|
||||
inkscape:window-height="685"
|
||||
inkscape:window-x="162"
|
||||
inkscape:window-y="57"
|
||||
inkscape:window-maximized="0" />
|
||||
<metadata
|
||||
id="metadata7">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(0,-1036.3622)">
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:64px;font-style:normal;font-variant:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Comic Sans MS;-inkscape-font-specification:Arial Ordered list"
|
||||
x="6.2503185"
|
||||
y="1043.1448"
|
||||
id="text2984"
|
||||
sodipodi:linespacing="125%"><tspan
|
||||
sodipodi:role="line"
|
||||
x="6.2503185"
|
||||
y="1043.1448"
|
||||
style="font-size:9px;font-style:normal;font-variant:normal;font-stretch:normal;fill:#999999;fill-opacity:1;font-family:Arial;-inkscape-font-specification:Arial Ordered list"
|
||||
id="tspan2984">1-</tspan></text>
|
||||
<text
|
||||
sodipodi:linespacing="125%"
|
||||
id="text2987"
|
||||
y="1051.6046"
|
||||
x="6.2503185"
|
||||
style="font-size:64px;font-style:normal;font-variant:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Comic Sans MS;-inkscape-font-specification:Arial Ordered list"
|
||||
xml:space="preserve"><tspan
|
||||
id="tspan2989"
|
||||
style="font-size:9px;font-style:normal;font-variant:normal;font-stretch:normal;fill:#999999;fill-opacity:1;font-family:Arial;-inkscape-font-specification:Arial Ordered list"
|
||||
y="1051.6046"
|
||||
x="6.2503185"
|
||||
sodipodi:role="line">2-</tspan></text>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.0 KiB |
@@ -0,0 +1,29 @@
|
||||
<?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 integration version file.
|
||||
*
|
||||
* @package atto_orderedlist
|
||||
* @copyright 2013 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2013080900; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2013050100; // Requires this Moodle version.
|
||||
$plugin->component = 'atto_orderedlist'; // Full name of the plugin (used for diagnostics).
|
||||
@@ -0,0 +1,40 @@
|
||||
YUI.add('moodle-atto_orderedlist-button', function (Y, NAME) {
|
||||
|
||||
// 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 orderedlist plugin.
|
||||
*
|
||||
* @package editor-atto
|
||||
* @copyright 2013 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
M.atto_orderedlist = M.atto_orderedlist || {
|
||||
init : function(params) {
|
||||
var click = function(e, elementid) {
|
||||
e.preventDefault();
|
||||
if (!M.editor_atto.is_active(elementid)) {
|
||||
M.editor_atto.focus(elementid);
|
||||
}
|
||||
document.execCommand('insertOrderedList', false, null);
|
||||
};
|
||||
|
||||
M.editor_atto.add_toolbar_button(params.elementid, 'orderedlist', params.icon, click);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}, '@VERSION@', {"requires": ["node"]});
|
||||
@@ -0,0 +1 @@
|
||||
YUI.add("moodle-atto_orderedlist-button",function(e,t){M.atto_orderedlist=M.atto_orderedlist||{init:function(e){var t=function(e,t){e.preventDefault(),M.editor_atto.is_active(t)||M.editor_atto.focus(t),document.execCommand("insertOrderedList",!1,null)};M.editor_atto.add_toolbar_button(e.elementid,"orderedlist",e.icon,t)}}},"@VERSION@",{requires:["node"]});
|
||||
@@ -0,0 +1,40 @@
|
||||
YUI.add('moodle-atto_orderedlist-button', function (Y, NAME) {
|
||||
|
||||
// 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 orderedlist plugin.
|
||||
*
|
||||
* @package editor-atto
|
||||
* @copyright 2013 Damyon Wiese <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
M.atto_orderedlist = M.atto_orderedlist || {
|
||||
init : function(params) {
|
||||
var click = function(e, elementid) {
|
||||
e.preventDefault();
|
||||
if (!M.editor_atto.is_active(elementid)) {
|
||||
M.editor_atto.focus(elementid);
|
||||
}
|
||||
document.execCommand('insertOrderedList', false, null);
|
||||
};
|
||||
|
||||
M.editor_atto.add_toolbar_button(params.elementid, 'orderedlist', params.icon, click);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}, '@VERSION@', {"requires": ["node"]});
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "moodle-atto_orderedlist-button",
|
||||
"builds": {
|
||||
"moodle-atto_orderedlist-button": {
|
||||
"jsfiles": [
|
||||
"button.js"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||