comparison src/sceditor.js @ 44:48c153a1a6cf

fix grip
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 30 Aug 2022 01:52:16 -0600
parents ab852c9f04c3
children bc1bce78276d
comparison
equal deleted inserted replaced
43:ab852c9f04c3 44:48c153a1a6cf
1684 /** 1684 /**
1685 * CSS that will be added to the to dropdown menu (eg. z-index) 1685 * CSS that will be added to the to dropdown menu (eg. z-index)
1686 * 1686 *
1687 * @type {Object} 1687 * @type {Object}
1688 */ 1688 */
1689 dropDownCss: { } 1689 dropDownCss: { },
1690
1691 //gripIcon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M14.656 5.156l-10 10 .688.688 10-10-.688-.688zm0 3l-7 7 .688.688 7-7-.688-.688zm0 3l-4 4 .688.688 4-4-.688-.688z"></svg>',
1692 //gripIcon: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M22,22H20V20H22V22M22,18H20V16H22V18M18,22H16V20H18V22M18,18H16V16H18V18M14,22H12V20H14V22M22,14H20V12H22V14Z"></svg>',
1693 gripIcon: '<img src="' + baseUrl + 'icons/material/resize-bottom-right.png">',
1690 }; 1694 };
1691 1695
1692 // Must start with a valid scheme 1696 // Must start with a valid scheme
1693 // ^ 1697 // ^
1694 // Schemes that are considered safe 1698 // Schemes that are considered safe
4760 return; 4764 return;
4761 } 4765 }
4762 4766
4763 let shortcut = command.shortcut; 4767 let shortcut = command.shortcut;
4764 let icon = command.icon; 4768 let icon = command.icon;
4765 let button = _tmpl('toolbarButton', { 4769 let button = _tmpl( 'toolbarButton', {
4766 name: commandName, 4770 name: commandName,
4767 icon: icon || '', 4771 icon: icon || '',
4768 }, true).firstChild; 4772 } );
4773 button = parseHTML(button).firstChild;
4769 button._sceTxtMode = !!command.txtExec; 4774 button._sceTxtMode = !!command.txtExec;
4770 button._sceWysiwygMode = !!command.exec; 4775 button._sceWysiwygMode = !!command.exec;
4771 toggleClass(button, 'disabled', !command.exec); 4776 toggleClass(button, 'disabled', !command.exec);
4772 onEvent2(button, 'click', function (e) { 4777 onEvent2(button, 'click', function (e) {
4773 if (!hasClass(button, 'disabled')) { 4778 if (!hasClass(button, 'disabled')) {
4826 * @private 4831 * @private
4827 */ 4832 */
4828 initResize = function () { 4833 initResize = function () {
4829 var minHeight, maxHeight, minWidth, maxWidth, 4834 var minHeight, maxHeight, minWidth, maxWidth,
4830 mouseMoveFunc, mouseUpFunc, 4835 mouseMoveFunc, mouseUpFunc,
4831 grip = createElement('div', {
4832 className: 'sceditor-grip'
4833 }),
4834 // Cover is used to cover the editor iframe so document 4836 // Cover is used to cover the editor iframe so document
4835 // still gets mouse move events 4837 // still gets mouse move events
4836 cover = createElement('div', { 4838 cover = createElement('div', {
4837 className: 'sceditor-resize-cover' 4839 className: 'sceditor-resize-cover'
4838 }), 4840 }),
4910 offEvent(globalDoc, endEvents, mouseUpFunc); 4912 offEvent(globalDoc, endEvents, mouseUpFunc);
4911 4913
4912 e.preventDefault(); 4914 e.preventDefault();
4913 }; 4915 };
4914 4916
4917 let grip = '<div class="sceditor-grip">' + options.gripIcon + '</div>';
4918 grip = parseHTML(grip).firstChild;
4919
4915 appendChild(editorContainer, grip); 4920 appendChild(editorContainer, grip);
4916 appendChild(editorContainer, cover); 4921 appendChild(editorContainer, cover);
4917 hide(cover); 4922 hide(cover);
4918 4923
4919 onEvent2(grip, 'touchstart mousedown', function (e) { 4924 onEvent2(grip, 'touchstart mousedown', function (e) {
5069 * @function 5074 * @function
5070 * @name rtl^2 5075 * @name rtl^2
5071 * @return {this} 5076 * @return {this}
5072 */ 5077 */
5073 base.rtl = function (rtl) { 5078 base.rtl = function (rtl) {
5074 var dir = rtl ? 'rtl' : 'ltr';
5075
5076 if (typeof rtl !== 'boolean') { 5079 if (typeof rtl !== 'boolean') {
5077 return attr(sourceEditor, 'dir') === 'rtl'; 5080 return attr(sourceEditor, 'dir') === 'rtl';
5078 } 5081 }
5079 5082 let dir = rtl ? 'rtl' : 'ltr';
5080 attr(wysiwygBody, 'dir', dir); 5083 attr(wysiwygBody, 'dir', dir);
5081 attr(sourceEditor, 'dir', dir); 5084 attr(sourceEditor, 'dir', dir);
5082 5085 attr(editorContainer, 'dir', dir);
5083 removeClass(editorContainer, 'rtl');
5084 removeClass(editorContainer, 'ltr');
5085 addClass(editorContainer, dir);
5086 }; 5086 };
5087 5087
5088 /** 5088 /**
5089 * Updates the toolbar to disable/enable the appropriate buttons 5089 * Updates the toolbar to disable/enable the appropriate buttons
5090 * @private 5090 * @private