MDL-78428 tiny_media: Methods deprecation
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
define("tiny_media/imagehelpers",["exports","core/templates"],(function(_exports,_templates){var obj;
|
||||
define("tiny_media/imagehelpers",["exports","tiny_media/helpers"],(function(_exports,Helpers){function _getRequireWildcardCache(nodeInterop){if("function"!=typeof WeakMap)return null;var cacheBabelInterop=new WeakMap,cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.showElements=_exports.isPercentageValue=_exports.hideElements=_exports.footerImageInsert=_exports.footerImageDetails=_exports.bodyImageInsert=_exports.bodyImageDetails=_exports.MAX_LENGTH_ALT=void 0,Helpers=function(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule)return obj;if(null===obj||"object"!=typeof obj&&"function"!=typeof obj)return{default:obj};var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj))return cache.get(obj);var newObj={},hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj)if("default"!==key&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;desc&&(desc.get||desc.set)?Object.defineProperty(newObj,key,desc):newObj[key]=obj[key]}newObj.default=obj,cache&&cache.set(obj,newObj);return newObj}
|
||||
/**
|
||||
* Tiny media plugin image helpers.
|
||||
*
|
||||
* @module tiny_media/imagehelpers
|
||||
* @copyright 2024 Meirza <meirza.arson@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.showElements=_exports.isPercentageValue=_exports.hideElements=_exports.footerImageInsert=_exports.footerImageDetails=_exports.bodyImageInsert=_exports.bodyImageDetails=_exports.MAX_LENGTH_ALT=void 0,_templates=(obj=_templates)&&obj.__esModule?obj:{default:obj};_exports.MAX_LENGTH_ALT=750;_exports.bodyImageInsert=async(templateContext,root)=>_templates.default.renderForPromise("tiny_media/insert_image_modal_insert",{...templateContext}).then((_ref=>{let{html:html,js:js}=_ref;_templates.default.replaceNodeContents(root.querySelector(".tiny_image_body_template"),html,js)})).catch((error=>{window.console.log(error)}));_exports.footerImageInsert=async(templateContext,root)=>_templates.default.renderForPromise("tiny_media/insert_image_modal_insert_footer",{...templateContext}).then((_ref2=>{let{html:html,js:js}=_ref2;_templates.default.replaceNodeContents(root.querySelector(".tiny_image_footer_template"),html,js)})).catch((error=>{window.console.log(error)}));_exports.bodyImageDetails=async(templateContext,root)=>_templates.default.renderForPromise("tiny_media/insert_image_modal_details",{...templateContext}).then((_ref3=>{let{html:html,js:js}=_ref3;_templates.default.replaceNodeContents(root.querySelector(".tiny_image_body_template"),html,js)})).catch((error=>{window.console.log(error)}));_exports.footerImageDetails=async(templateContext,root)=>_templates.default.renderForPromise("tiny_media/insert_image_modal_details_footer",{...templateContext}).then((_ref4=>{let{html:html,js:js}=_ref4;_templates.default.replaceNodeContents(root.querySelector(".tiny_image_footer_template"),html,js)})).catch((error=>{window.console.log(error)}));_exports.showElements=(elements,root)=>{if(elements instanceof Array)elements.forEach((elementSelector=>{const element=root.querySelector(elementSelector);element&&element.classList.remove("d-none")}));else{const element=root.querySelector(elements);element&&element.classList.remove("d-none")}};_exports.hideElements=(elements,root)=>{if(elements instanceof Array)elements.forEach((elementSelector=>{const element=root.querySelector(elementSelector);element&&element.classList.add("d-none")}));else{const element=root.querySelector(elements);element&&element.classList.add("d-none")}};_exports.isPercentageValue=value=>value.match(/\d+%/)}));
|
||||
*/(Helpers);_exports.MAX_LENGTH_ALT=750;_exports.bodyImageInsert=async(templateContext,root)=>(window.console.warn("This function is deprecated. Please use core_editor/tiny/plugins/media/helpers.body instead."),templateContext.bodyTemplate="tiny_media/insert_image_modal_insert",templateContext.selector="IMAGE",Helpers.body(templateContext,root));_exports.footerImageInsert=async(templateContext,root)=>(window.console.warn("This function is deprecated.\n Please use core_editor/tiny/plugins/media/helpers.footer instead."),templateContext.footerTemplate="tiny_media/insert_image_modal_insert_footer",templateContext.selector="IMAGE",Helpers.footer(templateContext,root));_exports.bodyImageDetails=async(templateContext,root)=>(window.console.warn("This function is deprecated.\n Please use core_editor/tiny/plugins/media/helpers.body instead."),templateContext.bodyTemplate="tiny_media/insert_image_modal_details",templateContext.selector="IMAGE",Helpers.body(templateContext,root));_exports.footerImageDetails=async(templateContext,root)=>(window.console.warn("This function is deprecated.\n Please use core_editor/tiny/plugins/media/helpers.footer instead."),templateContext.footerTemplate="tiny_media/insert_image_modal_details_footer",templateContext.selector="IMAGE",Helpers.footer(templateContext,root));_exports.showElements=(elements,root)=>{window.console.warn("This function is deprecated.\n Please use core_editor/tiny/plugins/media/helpers.showElements instead."),Helpers.showElements(elements,root)};_exports.hideElements=(elements,root)=>{window.console.warn("This function is deprecated.\n Please use core_editor/tiny/plugins/media/helpers.hideElements instead."),Helpers.hideElements(elements,root)};_exports.isPercentageValue=value=>(window.console.warn("This function is deprecated.\n Please use core_editor/tiny/plugins/media/helpers.isPercentageValue instead."),Helpers.isPercentageValue(value))}));
|
||||
|
||||
//# sourceMappingURL=imagehelpers.min.js.map
|
||||
File diff suppressed because one or more lines are too long
@@ -21,7 +21,7 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
import Templates from 'core/templates';
|
||||
import * as Helpers from 'tiny_media/helpers';
|
||||
|
||||
/**
|
||||
* Maximum length allowed for the alt attribute.
|
||||
@@ -34,16 +34,14 @@ export const MAX_LENGTH_ALT = 750;
|
||||
* @param {object} templateContext - The context for rendering the template.
|
||||
* @param {HTMLElement} root - The root element where the template will be inserted.
|
||||
* @returns {Promise<void>}
|
||||
* @deprecated Since Moodle 4.5 See {@link module:core_editor/tiny/plugins/media/helpers.body}
|
||||
*/
|
||||
export const bodyImageInsert = async(templateContext, root) => {
|
||||
return Templates.renderForPromise('tiny_media/insert_image_modal_insert', {...templateContext})
|
||||
.then(({html, js}) => {
|
||||
Templates.replaceNodeContents(root.querySelector('.tiny_image_body_template'), html, js);
|
||||
return;
|
||||
})
|
||||
.catch(error => {
|
||||
window.console.log(error);
|
||||
});
|
||||
window.console.warn('This function is deprecated. Please use core_editor/tiny/plugins/media/helpers.body instead.');
|
||||
|
||||
templateContext.bodyTemplate = 'tiny_media/insert_image_modal_insert';
|
||||
templateContext.selector = 'IMAGE';
|
||||
return Helpers.body(templateContext, root);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -52,16 +50,15 @@ export const bodyImageInsert = async(templateContext, root) => {
|
||||
* @param {object} templateContext - The context for rendering the template.
|
||||
* @param {HTMLElement} root - The root element where the template will be inserted.
|
||||
* @returns {Promise<void>}
|
||||
* @deprecated Since Moodle 4.5 See {@link module:core_editor/tiny/plugins/media/helpers.footer}
|
||||
*/
|
||||
export const footerImageInsert = async(templateContext, root) => {
|
||||
return Templates.renderForPromise('tiny_media/insert_image_modal_insert_footer', {...templateContext})
|
||||
.then(({html, js}) => {
|
||||
Templates.replaceNodeContents(root.querySelector('.tiny_image_footer_template'), html, js);
|
||||
return;
|
||||
})
|
||||
.catch(error => {
|
||||
window.console.log(error);
|
||||
});
|
||||
window.console.warn(`This function is deprecated.
|
||||
Please use core_editor/tiny/plugins/media/helpers.footer instead.`);
|
||||
|
||||
templateContext.footerTemplate = 'tiny_media/insert_image_modal_insert_footer';
|
||||
templateContext.selector = 'IMAGE';
|
||||
return Helpers.footer(templateContext, root);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -70,16 +67,15 @@ export const footerImageInsert = async(templateContext, root) => {
|
||||
* @param {object} templateContext - The context for rendering the template.
|
||||
* @param {HTMLElement} root - The root element where the template will be inserted.
|
||||
* @returns {Promise<void>}
|
||||
* @deprecated Since Moodle 4.5 See {@link module:core_editor/tiny/plugins/media/helpers.body}
|
||||
*/
|
||||
export const bodyImageDetails = async(templateContext, root) => {
|
||||
return Templates.renderForPromise('tiny_media/insert_image_modal_details', {...templateContext})
|
||||
.then(({html, js}) => {
|
||||
Templates.replaceNodeContents(root.querySelector('.tiny_image_body_template'), html, js);
|
||||
return;
|
||||
})
|
||||
.catch(error => {
|
||||
window.console.log(error);
|
||||
});
|
||||
window.console.warn(`This function is deprecated.
|
||||
Please use core_editor/tiny/plugins/media/helpers.body instead.`);
|
||||
|
||||
templateContext.bodyTemplate = 'tiny_media/insert_image_modal_details';
|
||||
templateContext.selector = 'IMAGE';
|
||||
return Helpers.body(templateContext, root);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -87,16 +83,15 @@ export const bodyImageDetails = async(templateContext, root) => {
|
||||
* @param {object} templateContext - The context for rendering the template.
|
||||
* @param {HTMLElement} root - The root element where the template will be inserted.
|
||||
* @returns {Promise<void>}
|
||||
* @deprecated Since Moodle 4.5 See {@link module:core_editor/tiny/plugins/media/helpers.footer}
|
||||
*/
|
||||
export const footerImageDetails = async(templateContext, root) => {
|
||||
return Templates.renderForPromise('tiny_media/insert_image_modal_details_footer', {...templateContext})
|
||||
.then(({html, js}) => {
|
||||
Templates.replaceNodeContents(root.querySelector('.tiny_image_footer_template'), html, js);
|
||||
return;
|
||||
})
|
||||
.catch(error => {
|
||||
window.console.log(error);
|
||||
});
|
||||
window.console.warn(`This function is deprecated.
|
||||
Please use core_editor/tiny/plugins/media/helpers.footer instead.`);
|
||||
|
||||
templateContext.footerTemplate = 'tiny_media/insert_image_modal_details_footer';
|
||||
templateContext.selector = 'IMAGE';
|
||||
return Helpers.footer(templateContext, root);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -104,21 +99,12 @@ export const footerImageDetails = async(templateContext, root) => {
|
||||
*
|
||||
* @param {string|string[]} elements - The CSS selector for the elements to toggle.
|
||||
* @param {object} root - The CSS selector for the elements to toggle.
|
||||
* @deprecated Since Moodle 4.5 See {@link module:core_editor/tiny/plugins/media/helpers.showElements}
|
||||
*/
|
||||
export const showElements = (elements, root) => {
|
||||
if (elements instanceof Array) {
|
||||
elements.forEach((elementSelector) => {
|
||||
const element = root.querySelector(elementSelector);
|
||||
if (element) {
|
||||
element.classList.remove('d-none');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
const element = root.querySelector(elements);
|
||||
if (element) {
|
||||
element.classList.remove('d-none');
|
||||
}
|
||||
}
|
||||
window.console.warn(`This function is deprecated.
|
||||
Please use core_editor/tiny/plugins/media/helpers.showElements instead.`);
|
||||
Helpers.showElements(elements, root);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -126,21 +112,12 @@ export const showElements = (elements, root) => {
|
||||
*
|
||||
* @param {string|string[]} elements - The CSS selector for the elements to toggle.
|
||||
* @param {object} root - The CSS selector for the elements to toggle.
|
||||
* @deprecated Since Moodle 4.5 See {@link module:core_editor/tiny/plugins/media/helpers.hideElements}
|
||||
*/
|
||||
export const hideElements = (elements, root) => {
|
||||
if (elements instanceof Array) {
|
||||
elements.forEach((elementSelector) => {
|
||||
const element = root.querySelector(elementSelector);
|
||||
if (element) {
|
||||
element.classList.add('d-none');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
const element = root.querySelector(elements);
|
||||
if (element) {
|
||||
element.classList.add('d-none');
|
||||
}
|
||||
}
|
||||
window.console.warn(`This function is deprecated.
|
||||
Please use core_editor/tiny/plugins/media/helpers.hideElements instead.`);
|
||||
Helpers.hideElements(elements, root);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -148,7 +125,10 @@ export const hideElements = (elements, root) => {
|
||||
*
|
||||
* @param {string} value - The value to check.
|
||||
* @returns {boolean} True if the value is a percentage value, false otherwise.
|
||||
* @deprecated Since Moodle 4.5 See {@link module:core_editor/tiny/plugins/media/helpers.isPercentageValue}
|
||||
*/
|
||||
export const isPercentageValue = (value) => {
|
||||
return value.match(/\d+%/);
|
||||
window.console.warn(`This function is deprecated.
|
||||
Please use core_editor/tiny/plugins/media/helpers.isPercentageValue instead.`);
|
||||
return Helpers.isPercentageValue(value);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user