mirror of
https://github.com/chinchang/web-maker.git
synced 2025-07-31 10:40:10 +02:00
remove ported code from old files
This commit is contained in:
@@ -1,76 +1,31 @@
|
|||||||
/**
|
// Console header drag resize logic
|
||||||
* Compiles directives on the given node
|
var consoleHeaderDragStartY;
|
||||||
* @param {Node} root The element on which compilation is required
|
var consoleInitialHeight;
|
||||||
*/
|
|
||||||
function compileNodes(root) {
|
|
||||||
if (!(root instanceof Node)) {
|
|
||||||
/* eslint-disable no-param-reassign */
|
|
||||||
root = document;
|
|
||||||
/* eslint-enable no-param-reassign */
|
|
||||||
}
|
|
||||||
// Create a querySelectorAll function bound to the passed `root` Node
|
|
||||||
const query = selector => [...root.querySelectorAll(selector)];
|
|
||||||
|
|
||||||
|
function onConsoleHeaderDrag(e) {
|
||||||
// Compile d-open-modal directive
|
consoleEl.style.height =
|
||||||
const modalTriggers = query(`[d-open-modal]`);
|
consoleInitialHeight + consoleHeaderDragStartY - e.pageY + 'px';
|
||||||
modalTriggers.forEach(function (el) {
|
|
||||||
utils.onButtonClick(el, function () {
|
|
||||||
scope.toggleModal(window[el.getAttribute('d-open-modal')]);
|
|
||||||
trackEvent(
|
|
||||||
el.getAttribute('data-event-category'),
|
|
||||||
el.getAttribute('data-event-action')
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
$('.js-console__header').addEventListener('mousedown', e => {
|
||||||
|
consoleHeaderDragStartY = e.pageY;
|
||||||
|
consoleInitialHeight = consoleEl.getBoundingClientRect().height;
|
||||||
|
$('#demo-frame').classList.add('pointer-none');
|
||||||
|
window.addEventListener('mousemove', onConsoleHeaderDrag);
|
||||||
|
});
|
||||||
|
$('.js-console__header').addEventListener('mouseup', () => {
|
||||||
|
window.removeEventListener('mousemove', onConsoleHeaderDrag);
|
||||||
|
$('#demo-frame').classList.remove('pointer-none');
|
||||||
|
});
|
||||||
|
|
||||||
function init() {
|
window.addEventListener('focusin', e => {
|
||||||
new TextareaAutoComplete(externalJsTextarea, {
|
if (document.body.classList.contains('overlay-visible')) {
|
||||||
filter: obj => obj.latest.match(/\.js$/)
|
const modal = $('.is-modal-visible');
|
||||||
});
|
if (!modal) {
|
||||||
new TextareaAutoComplete(externalCssTextarea, {
|
return;
|
||||||
filter: obj => obj.latest.match(/\.css$/)
|
}
|
||||||
});
|
if (!modal.contains(e.target)) {
|
||||||
new TextareaAutoComplete(externalLibrarySearchInput, {
|
e.preventDefault();
|
||||||
selectedCallback: value => {
|
modal.querySelector('.js-modal__close-btn').focus();
|
||||||
const textarea = value.match(/\.js$/) ?
|
|
||||||
externalJsTextarea :
|
|
||||||
externalCssTextarea;
|
|
||||||
textarea.value = `${textarea.value}\n${value}`;
|
|
||||||
externalLibrarySearchInput.value = '';
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
// Console header drag resize logic
|
|
||||||
var consoleHeaderDragStartY;
|
|
||||||
var consoleInitialHeight;
|
|
||||||
|
|
||||||
function onConsoleHeaderDrag(e) {
|
|
||||||
consoleEl.style.height =
|
|
||||||
consoleInitialHeight + consoleHeaderDragStartY - e.pageY + 'px';
|
|
||||||
}
|
}
|
||||||
$('.js-console__header').addEventListener('mousedown', e => {
|
});
|
||||||
consoleHeaderDragStartY = e.pageY;
|
|
||||||
consoleInitialHeight = consoleEl.getBoundingClientRect().height;
|
|
||||||
$('#demo-frame').classList.add('pointer-none');
|
|
||||||
window.addEventListener('mousemove', onConsoleHeaderDrag);
|
|
||||||
});
|
|
||||||
$('.js-console__header').addEventListener('mouseup', () => {
|
|
||||||
window.removeEventListener('mousemove', onConsoleHeaderDrag);
|
|
||||||
$('#demo-frame').classList.remove('pointer-none');
|
|
||||||
});
|
|
||||||
|
|
||||||
window.addEventListener('focusin', e => {
|
|
||||||
if (document.body.classList.contains('overlay-visible')) {
|
|
||||||
const modal = $('.is-modal-visible');
|
|
||||||
if (!modal) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!modal.contains(e.target)) {
|
|
||||||
e.preventDefault();
|
|
||||||
modal.querySelector('.js-modal__close-btn').focus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
Reference in New Issue
Block a user