���ѧۧݧ�ӧ�� �ާ֧ߧ֧էا֧� - ���֧էѧܧ�ڧ��ӧѧ�� - /home3/cpr76684/public_html/indent.tar
���ѧ٧ѧ�
tests/behat/indent.feature 0000644 00000003014 15152164371 0011632 0 ustar 00 @editor @editor_atto @atto @atto_indent Feature: Indent text in Atto To write rich text - I need to indent and outdent things. @javascript Scenario: Indent Given I log in as "admin" And I follow "Profile" in the user menu When I click on "Edit profile" "link" in the "region-main" "region" And I set the field "Description" to "<p>I need some space.</p>" And I select the text in the "Description" Atto editor And I click on "Show more buttons" "button" And I click on "Indent" "button" And I press "Update profile" And I follow "Preferences" in the user menu And I follow "Editor preferences" And I set the field "Text editor" to "Plain text area" And I press "Save changes" And I click on "Edit profile" "link" in the "region-main" "region" Then I should see "class=\"editor-indent\"" @javascript Scenario: Indent and outdent Given I log in as "admin" And I open my profile in edit mode And I set the field "Description" to "<p>I need some space.</p>" And I select the text in the "Description" Atto editor And I click on "Show more buttons" "button" And I click on "Indent" "button" And I click on "Outdent" "button" And I press "Update profile" And I follow "Preferences" in the user menu And I follow "Editor preferences" And I set the field "Text editor" to "Plain text area" And I press "Save changes" And I click on "Edit profile" "link" in the "region-main" "region" Then I should not see "class=\"editor-indent\"" lib.php 0000644 00000002137 15152164371 0006033 0 ustar 00 <?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 align plugin lib. * * @package atto_align * @copyright 2014 Jason Fowler * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); /** * Initialise the strings required for JS. * * @return void */ function atto_indent_strings_for_js() { global $PAGE; $PAGE->requires->strings_for_js(array('indent', 'outdent'), 'atto_indent'); } version.php 0000644 00000002246 15152164371 0006753 0 ustar 00 <?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 <damyon@moodle.com> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); $plugin->version = 2022112800; // The current plugin version (Date: YYYYMMDDXX). $plugin->requires = 2022111800; // Requires this Moodle version. $plugin->component = 'atto_indent'; // Full name of the plugin (used for diagnostics). classes/privacy/provider.php 0000644 00000002776 15152164371 0012242 0 ustar 00 <?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/>. /** * Privacy Subsystem implementation for block_activity_modules. * * @package atto_indent * @copyright 2018 Andrew Nicols <andrew@nicols.co.uk> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ namespace atto_indent\privacy; defined('MOODLE_INTERNAL') || die(); /** * Privacy Subsystem for atto_indent implementing null_provider. * * @copyright 2018 Andrew Nicols <andrew@nicols.co.uk> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class provider implements \core_privacy\local\metadata\null_provider { /** * Get the language string identifier with the component's language * file to explain why this plugin stores no data. * * @return string */ public static function get_reason() : string { return 'privacy:metadata'; } } yui/build/moodle-atto_indent-button/moodle-atto_indent-button.js 0000644 00000020143 15152164371 0021210 0 ustar 00 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/>. /* * @package atto_indent * @copyright 2013 Damyon Wiese <damyon@moodle.com> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ /** * @module moodle-atto_indent-button */ /** * Atto text editor indent plugin. * * @namespace M.atto_indent * @class button * @extends M.editor_atto.EditorPlugin */ Y.namespace('M.atto_indent').Button = Y.Base.create('button', Y.M.editor_atto.EditorPlugin, [], { initializer: function() { this.addButton({ icon: 'e/decrease_indent', title: 'outdent', buttonName: 'outdent', callback: this.outdent }); this.addButton({ icon: 'e/increase_indent', title: 'indent', buttonName: 'indent', callback: this.indent }); }, /** * Indents the currently selected content. * * @method indent */ indent: function() { // Save the current selection - we want to restore this. var selection = window.rangy.saveSelection(), blockquotes = this.editor.all('blockquote'), count = blockquotes.size(); // Remove display:none from rangy markers so browser doesn't delete them. this.editor.all('.rangySelectionBoundary').setStyle('display', null); // Mark all existing block quotes in case the user has actually added some. blockquotes.addClass('pre-existing'); // Run the indent command. document.execCommand('indent', false, null); // Fix indent list item. this.fixupListItemsAfterIndent(); // Get all blockquotes, both existing and new. blockquotes = this.editor.all('blockquote'); if (blockquotes.size() !== count) { // There are new block quotes, the indent exec has wrapped some content in block quotes in order // to indent the selected content. // We don't want blockquotes, we're going to convert them to divs. this.replaceBlockquote(this.editor); // Finally restore the seelction. The content has changed - sometimes this works - but not always :( window.rangy.restoreSelection(selection); } else if (blockquotes.size() > 0) { // There were no new blockquotes, this happens if the user is indenting/outdenting a list. blockquotes.removeClass('pre-existing'); } // Remove the selection markers - a clean up really. window.rangy.removeMarkers(selection); // Mark the text as having been updated. this.markUpdated(); }, /** * Outdents the currently selected content. * * @method outdent */ outdent: function() { // Save the selection we will want to restore it. var selection = window.rangy.saveSelection(), blockquotes = this.editor.all('blockquote'), count = blockquotes.size(); // Mark existing blockquotes so that we don't convert them later. blockquotes.addClass('pre-existing'); // Replace all div indents with blockquote indents so that we can rely on the browser functionality. this.replaceEditorIndents(this.editor); // Restore the users selection - otherwise the next outdent operation won't work! window.rangy.restoreSelection(selection); // And save it once more. selection = window.rangy.saveSelection(); // Outdent. document.execCommand('outdent', false, null); // Get all blockquotes so that we can work out what happened. blockquotes = this.editor.all('blockquote'); if (blockquotes.size() !== count) { // The number of blockquotes hasn't changed. // This occurs when the user has outdented a list item. this.replaceBlockquote(this.editor); window.rangy.restoreSelection(selection); } else if (blockquotes.size() > 0) { // The number of blockquotes is the same and is more than 0 we just need to clean up the class // we added to mark pre-existing blockquotes. blockquotes.removeClass('pre-existing'); } // Clean up any left over selection markers. window.rangy.removeMarkers(selection); // Mark the text as having been updated. this.markUpdated(); }, /** * Replaces all blockquotes within an editor with div indents. * @method replaceBlockquote * @param Editor editor */ replaceBlockquote: function(editor) { editor.all('blockquote').setAttribute('data-iterate', true); var blockquote = editor.one('blockquote'), margindir = (Y.one('body.dir-ltr')) ? 'marginLeft' : 'marginRight'; while (blockquote) { blockquote.removeAttribute('data-iterate'); if (blockquote.hasClass('pre-existing')) { blockquote.removeClass('pre-existing'); } else { var clone = Y.Node.create('<div></div>') .setAttrs(blockquote.getAttrs()) .setStyle(margindir, '30px') .addClass('editor-indent'); // We use childNodes here because we are interested in both type 1 and 3 child nodes. var children = blockquote.getDOMNode().childNodes; var child; child = children[0]; while (typeof child !== "undefined") { clone.append(child); child = children[0]; } blockquote.replace(clone); } blockquote = editor.one('blockquote[data-iterate]'); } }, /** * Replaces all div indents with blockquotes. * @method replaceEditorIndents * @param Editor editor */ replaceEditorIndents: function(editor) { // We use the editor-indent class because it is preserved between saves. var indent = editor.one('.editor-indent'); while (indent) { var clone = Y.Node.create('<blockquote></blockquote>') .setAttrs(indent .getAttrs()) .removeClass('editor-indent'); // We use childNodes here because we are interested in both type 1 and 3 child nodes. var children = indent.getDOMNode().childNodes; var child; child = children[0]; while (typeof child !== "undefined") { clone.append(child); child = children[0]; } indent.replace(clone); indent = editor.one('.editor-indent'); } }, /** * Fixup for list item after indent. * * @method fixupListItemsAfterIndent */ fixupListItemsAfterIndent: function() { var selection = window.rangy.getSelection(), rootelement = this.editor.getDOMNode(), listelement = selection.anchorNode.parentElement; listelement = listelement.closest('ol, ul'); if (!(listelement && rootelement.contains(listelement))) { return; } // We will move the child list into previous list item of the parent. var previous = listelement.previousElementSibling; if (previous && previous.tagName === 'LI') { previous.appendChild(listelement); selection.collapseToEnd(); } } }); }, '@VERSION@', {"requires": ["moodle-editor_atto-plugin"]}); yui/build/moodle-atto_indent-button/moodle-atto_indent-button-debug.js 0000644 00000020143 15152164371 0022274 0 ustar 00 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/>. /* * @package atto_indent * @copyright 2013 Damyon Wiese <damyon@moodle.com> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ /** * @module moodle-atto_indent-button */ /** * Atto text editor indent plugin. * * @namespace M.atto_indent * @class button * @extends M.editor_atto.EditorPlugin */ Y.namespace('M.atto_indent').Button = Y.Base.create('button', Y.M.editor_atto.EditorPlugin, [], { initializer: function() { this.addButton({ icon: 'e/decrease_indent', title: 'outdent', buttonName: 'outdent', callback: this.outdent }); this.addButton({ icon: 'e/increase_indent', title: 'indent', buttonName: 'indent', callback: this.indent }); }, /** * Indents the currently selected content. * * @method indent */ indent: function() { // Save the current selection - we want to restore this. var selection = window.rangy.saveSelection(), blockquotes = this.editor.all('blockquote'), count = blockquotes.size(); // Remove display:none from rangy markers so browser doesn't delete them. this.editor.all('.rangySelectionBoundary').setStyle('display', null); // Mark all existing block quotes in case the user has actually added some. blockquotes.addClass('pre-existing'); // Run the indent command. document.execCommand('indent', false, null); // Fix indent list item. this.fixupListItemsAfterIndent(); // Get all blockquotes, both existing and new. blockquotes = this.editor.all('blockquote'); if (blockquotes.size() !== count) { // There are new block quotes, the indent exec has wrapped some content in block quotes in order // to indent the selected content. // We don't want blockquotes, we're going to convert them to divs. this.replaceBlockquote(this.editor); // Finally restore the seelction. The content has changed - sometimes this works - but not always :( window.rangy.restoreSelection(selection); } else if (blockquotes.size() > 0) { // There were no new blockquotes, this happens if the user is indenting/outdenting a list. blockquotes.removeClass('pre-existing'); } // Remove the selection markers - a clean up really. window.rangy.removeMarkers(selection); // Mark the text as having been updated. this.markUpdated(); }, /** * Outdents the currently selected content. * * @method outdent */ outdent: function() { // Save the selection we will want to restore it. var selection = window.rangy.saveSelection(), blockquotes = this.editor.all('blockquote'), count = blockquotes.size(); // Mark existing blockquotes so that we don't convert them later. blockquotes.addClass('pre-existing'); // Replace all div indents with blockquote indents so that we can rely on the browser functionality. this.replaceEditorIndents(this.editor); // Restore the users selection - otherwise the next outdent operation won't work! window.rangy.restoreSelection(selection); // And save it once more. selection = window.rangy.saveSelection(); // Outdent. document.execCommand('outdent', false, null); // Get all blockquotes so that we can work out what happened. blockquotes = this.editor.all('blockquote'); if (blockquotes.size() !== count) { // The number of blockquotes hasn't changed. // This occurs when the user has outdented a list item. this.replaceBlockquote(this.editor); window.rangy.restoreSelection(selection); } else if (blockquotes.size() > 0) { // The number of blockquotes is the same and is more than 0 we just need to clean up the class // we added to mark pre-existing blockquotes. blockquotes.removeClass('pre-existing'); } // Clean up any left over selection markers. window.rangy.removeMarkers(selection); // Mark the text as having been updated. this.markUpdated(); }, /** * Replaces all blockquotes within an editor with div indents. * @method replaceBlockquote * @param Editor editor */ replaceBlockquote: function(editor) { editor.all('blockquote').setAttribute('data-iterate', true); var blockquote = editor.one('blockquote'), margindir = (Y.one('body.dir-ltr')) ? 'marginLeft' : 'marginRight'; while (blockquote) { blockquote.removeAttribute('data-iterate'); if (blockquote.hasClass('pre-existing')) { blockquote.removeClass('pre-existing'); } else { var clone = Y.Node.create('<div></div>') .setAttrs(blockquote.getAttrs()) .setStyle(margindir, '30px') .addClass('editor-indent'); // We use childNodes here because we are interested in both type 1 and 3 child nodes. var children = blockquote.getDOMNode().childNodes; var child; child = children[0]; while (typeof child !== "undefined") { clone.append(child); child = children[0]; } blockquote.replace(clone); } blockquote = editor.one('blockquote[data-iterate]'); } }, /** * Replaces all div indents with blockquotes. * @method replaceEditorIndents * @param Editor editor */ replaceEditorIndents: function(editor) { // We use the editor-indent class because it is preserved between saves. var indent = editor.one('.editor-indent'); while (indent) { var clone = Y.Node.create('<blockquote></blockquote>') .setAttrs(indent .getAttrs()) .removeClass('editor-indent'); // We use childNodes here because we are interested in both type 1 and 3 child nodes. var children = indent.getDOMNode().childNodes; var child; child = children[0]; while (typeof child !== "undefined") { clone.append(child); child = children[0]; } indent.replace(clone); indent = editor.one('.editor-indent'); } }, /** * Fixup for list item after indent. * * @method fixupListItemsAfterIndent */ fixupListItemsAfterIndent: function() { var selection = window.rangy.getSelection(), rootelement = this.editor.getDOMNode(), listelement = selection.anchorNode.parentElement; listelement = listelement.closest('ol, ul'); if (!(listelement && rootelement.contains(listelement))) { return; } // We will move the child list into previous list item of the parent. var previous = listelement.previousElementSibling; if (previous && previous.tagName === 'LI') { previous.appendChild(listelement); selection.collapseToEnd(); } } }); }, '@VERSION@', {"requires": ["moodle-editor_atto-plugin"]}); yui/build/moodle-atto_indent-button/moodle-atto_indent-button-min.js 0000644 00000004546 15152164371 0022002 0 ustar 00 YUI.add("moodle-atto_indent-button",function(r,e){r.namespace("M.atto_indent").Button=r.Base.create("button",r.M.editor_atto.EditorPlugin,[],{initializer:function(){this.addButton({icon:"e/decrease_indent",title:"outdent",buttonName:"outdent",callback:this.outdent}),this.addButton({icon:"e/increase_indent",title:"indent",buttonName:"indent",callback:this.indent})},indent:function(){var e=window.rangy.saveSelection(),t=this.editor.all("blockquote"),i=t.size();this.editor.all(".rangySelectionBoundary").setStyle("display",null),t.addClass("pre-existing"),document.execCommand("indent",!1,null),this.fixupListItemsAfterIndent(),(t=this.editor.all("blockquote")).size()!==i?(this.replaceBlockquote(this.editor),window.rangy.restoreSelection(e)):0<t.size()&&t.removeClass("pre-existing"),window.rangy.removeMarkers(e),this.markUpdated()},outdent:function(){var e=window.rangy.saveSelection(),t=this.editor.all("blockquote"),i=t.size();t.addClass("pre-existing"),this.replaceEditorIndents(this.editor),window.rangy.restoreSelection(e),e=window.rangy.saveSelection(),document.execCommand("outdent",!1,null),(t=this.editor.all("blockquote")).size()!==i?(this.replaceBlockquote(this.editor),window.rangy.restoreSelection(e)):0<t.size()&&t.removeClass("pre-existing"),window.rangy.removeMarkers(e),this.markUpdated()},replaceBlockquote:function(e){var t,i,o,n,d;for(e.all("blockquote").setAttribute("data-iterate",!0),t=e.one("blockquote"),i=r.one("body.dir-ltr")?"marginLeft":"marginRight";t;){if(t.removeAttribute("data-iterate"),t.hasClass("pre-existing"))t.removeClass("pre-existing");else{for(o=r.Node.create("<div></div>").setAttrs(t.getAttrs()).setStyle(i,"30px").addClass("editor-indent"),d=(n=t.getDOMNode().childNodes)[0];void 0!==d;)o.append(d),d=n[0];t.replace(o)}t=e.one("blockquote[data-iterate]")}},replaceEditorIndents:function(e){for(var t,i,o,n=e.one(".editor-indent");n;){for(t=r.Node.create("<blockquote></blockquote>").setAttrs(n.getAttrs()).removeClass("editor-indent"),o=(i=n.getDOMNode().childNodes)[0];void 0!==o;)t.append(o),o=i[0];n.replace(t),n=e.one(".editor-indent")}},fixupListItemsAfterIndent:function(){var e,t=window.rangy.getSelection(),i=this.editor.getDOMNode(),o=t.anchorNode.parentElement,o=o.closest("ol, ul");o&&i.contains(o)&&(e=o.previousElementSibling)&&"LI"===e.tagName&&(e.appendChild(o),t.collapseToEnd())}})},"@VERSION@",{requires:["moodle-editor_atto-plugin"]}); yui/src/button/meta/button.json 0000644 00000000165 15152164371 0012617 0 ustar 00 { "moodle-atto_indent-button": { "requires": [ "moodle-editor_atto-plugin" ] } } yui/src/button/build.json 0000644 00000000225 15152164371 0011452 0 ustar 00 { "name": "moodle-atto_indent-button", "builds": { "moodle-atto_indent-button": { "jsfiles": [ "button.js" ] } } } yui/src/button/js/button.js 0000644 00000017750 15152164371 0011760 0 ustar 00 // 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/>. /* * @package atto_indent * @copyright 2013 Damyon Wiese <damyon@moodle.com> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ /** * @module moodle-atto_indent-button */ /** * Atto text editor indent plugin. * * @namespace M.atto_indent * @class button * @extends M.editor_atto.EditorPlugin */ Y.namespace('M.atto_indent').Button = Y.Base.create('button', Y.M.editor_atto.EditorPlugin, [], { initializer: function() { this.addButton({ icon: 'e/decrease_indent', title: 'outdent', buttonName: 'outdent', callback: this.outdent }); this.addButton({ icon: 'e/increase_indent', title: 'indent', buttonName: 'indent', callback: this.indent }); }, /** * Indents the currently selected content. * * @method indent */ indent: function() { // Save the current selection - we want to restore this. var selection = window.rangy.saveSelection(), blockquotes = this.editor.all('blockquote'), count = blockquotes.size(); // Remove display:none from rangy markers so browser doesn't delete them. this.editor.all('.rangySelectionBoundary').setStyle('display', null); // Mark all existing block quotes in case the user has actually added some. blockquotes.addClass('pre-existing'); // Run the indent command. document.execCommand('indent', false, null); // Fix indent list item. this.fixupListItemsAfterIndent(); // Get all blockquotes, both existing and new. blockquotes = this.editor.all('blockquote'); if (blockquotes.size() !== count) { // There are new block quotes, the indent exec has wrapped some content in block quotes in order // to indent the selected content. // We don't want blockquotes, we're going to convert them to divs. this.replaceBlockquote(this.editor); // Finally restore the seelction. The content has changed - sometimes this works - but not always :( window.rangy.restoreSelection(selection); } else if (blockquotes.size() > 0) { // There were no new blockquotes, this happens if the user is indenting/outdenting a list. blockquotes.removeClass('pre-existing'); } // Remove the selection markers - a clean up really. window.rangy.removeMarkers(selection); // Mark the text as having been updated. this.markUpdated(); }, /** * Outdents the currently selected content. * * @method outdent */ outdent: function() { // Save the selection we will want to restore it. var selection = window.rangy.saveSelection(), blockquotes = this.editor.all('blockquote'), count = blockquotes.size(); // Mark existing blockquotes so that we don't convert them later. blockquotes.addClass('pre-existing'); // Replace all div indents with blockquote indents so that we can rely on the browser functionality. this.replaceEditorIndents(this.editor); // Restore the users selection - otherwise the next outdent operation won't work! window.rangy.restoreSelection(selection); // And save it once more. selection = window.rangy.saveSelection(); // Outdent. document.execCommand('outdent', false, null); // Get all blockquotes so that we can work out what happened. blockquotes = this.editor.all('blockquote'); if (blockquotes.size() !== count) { // The number of blockquotes hasn't changed. // This occurs when the user has outdented a list item. this.replaceBlockquote(this.editor); window.rangy.restoreSelection(selection); } else if (blockquotes.size() > 0) { // The number of blockquotes is the same and is more than 0 we just need to clean up the class // we added to mark pre-existing blockquotes. blockquotes.removeClass('pre-existing'); } // Clean up any left over selection markers. window.rangy.removeMarkers(selection); // Mark the text as having been updated. this.markUpdated(); }, /** * Replaces all blockquotes within an editor with div indents. * @method replaceBlockquote * @param Editor editor */ replaceBlockquote: function(editor) { editor.all('blockquote').setAttribute('data-iterate', true); var blockquote = editor.one('blockquote'), margindir = (Y.one('body.dir-ltr')) ? 'marginLeft' : 'marginRight'; while (blockquote) { blockquote.removeAttribute('data-iterate'); if (blockquote.hasClass('pre-existing')) { blockquote.removeClass('pre-existing'); } else { var clone = Y.Node.create('<div></div>') .setAttrs(blockquote.getAttrs()) .setStyle(margindir, '30px') .addClass('editor-indent'); // We use childNodes here because we are interested in both type 1 and 3 child nodes. var children = blockquote.getDOMNode().childNodes; var child; child = children[0]; while (typeof child !== "undefined") { clone.append(child); child = children[0]; } blockquote.replace(clone); } blockquote = editor.one('blockquote[data-iterate]'); } }, /** * Replaces all div indents with blockquotes. * @method replaceEditorIndents * @param Editor editor */ replaceEditorIndents: function(editor) { // We use the editor-indent class because it is preserved between saves. var indent = editor.one('.editor-indent'); while (indent) { var clone = Y.Node.create('<blockquote></blockquote>') .setAttrs(indent .getAttrs()) .removeClass('editor-indent'); // We use childNodes here because we are interested in both type 1 and 3 child nodes. var children = indent.getDOMNode().childNodes; var child; child = children[0]; while (typeof child !== "undefined") { clone.append(child); child = children[0]; } indent.replace(clone); indent = editor.one('.editor-indent'); } }, /** * Fixup for list item after indent. * * @method fixupListItemsAfterIndent */ fixupListItemsAfterIndent: function() { var selection = window.rangy.getSelection(), rootelement = this.editor.getDOMNode(), listelement = selection.anchorNode.parentElement; listelement = listelement.closest('ol, ul'); if (!(listelement && rootelement.contains(listelement))) { return; } // We will move the child list into previous list item of the parent. var previous = listelement.previousElementSibling; if (previous && previous.tagName === 'LI') { previous.appendChild(listelement); selection.collapseToEnd(); } } }); lang/en/atto_indent.php 0000644 00000002110 15152164371 0011107 0 ustar 00 <?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 <damyon@moodle.com> * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ $string['pluginname'] = 'Indent'; $string['indent'] = "Indent"; $string['outdent'] = "Outdent"; $string['privacy:metadata'] = 'The atto_indent plugin does not store any personal data.';
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | ���֧ߧ֧�ѧ�ڧ� ����ѧߧڧ��: 0 |
proxy
|
phpinfo
|
���ѧ����ۧܧ�