mirror of
https://github.com/chinchang/web-maker.git
synced 2025-07-13 10:06:23 +02:00
create declarative directive for modal triggers.
This commit is contained in:
@ -1,8 +1,8 @@
|
||||
/* global trackEvent */
|
||||
/* global layoutBtn1, layoutBtn2, layoutBtn3, helpModal, notificationsModal, addLibraryModal,
|
||||
onboardModal, layoutBtn1, layoutBtn2, layoutBtn3, layoutBtn4, helpBtn, onboardModal, onboardModal,
|
||||
onboardModal, layoutBtn1, layoutBtn2, layoutBtn3, layoutBtn4, onboardModal, onboardModal,
|
||||
addLibraryModal, addLibraryModal, notificationsBtn, notificationsModal, notificationsModal,
|
||||
notificationsModal, notificationsBtn, codepenBtn, saveHtmlBtn, saveBtn, settingsBtn,
|
||||
notificationsModal, notificationsBtn, codepenBtn, saveHtmlBtn, saveBtn,
|
||||
onboardModal, settingsModal, notificationsBtn, onboardShowInTabOptionBtn, editorThemeLinkTag,
|
||||
onboardDontShowInTabOptionBtn, TextareaAutoComplete, savedItemCountEl, indentationSizeValueEl,
|
||||
runBtn, searchInput, consoleEl, consoleLogEl, logCountEl, fontStyleTag, fontStyleTemplate,
|
||||
@ -137,7 +137,6 @@ globalConsoleContainerEl
|
||||
jsModelLabel = $('#js-js-mode-label'),
|
||||
titleInput = $('#js-title-input'),
|
||||
addLibrarySelect = $('#js-add-library-select'),
|
||||
addLibraryBtn = $('#js-add-library-btn'),
|
||||
externalJsTextarea = $('#js-external-js'),
|
||||
externalCssTextarea = $('#js-external-css');
|
||||
|
||||
@ -1295,6 +1294,7 @@ globalConsoleContainerEl
|
||||
gutters: ['CodeMirror-foldgutter']
|
||||
});
|
||||
|
||||
// DEPRECATED
|
||||
function openSettings() {
|
||||
scope.toggleModal(settingsModal);
|
||||
|
||||
@ -1844,6 +1844,18 @@ globalConsoleContainerEl
|
||||
attachListenerForEvent('input');
|
||||
attachListenerForEvent('keyup');
|
||||
|
||||
// Compile d-open-modal directive
|
||||
const modalTriggers = $all(`[d-open-modal]`);
|
||||
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')
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
// Compile d-html directive
|
||||
const dHtmlNodes = $all(`[d-html]`);
|
||||
dHtmlNodes.forEach(function(el) {
|
||||
@ -1919,15 +1931,6 @@ globalConsoleContainerEl
|
||||
layoutBtn3.addEventListener('click', getToggleLayoutButtonListener(3));
|
||||
layoutBtn4.addEventListener('click', getToggleLayoutButtonListener(4));
|
||||
|
||||
utils.onButtonClick(helpBtn, function() {
|
||||
scope.toggleModal(helpModal);
|
||||
trackEvent('ui', 'helpButtonClick');
|
||||
});
|
||||
utils.onButtonClick(addLibraryBtn, function() {
|
||||
scope.toggleModal(addLibraryModal);
|
||||
trackEvent('ui', 'addLibraryButtonClick');
|
||||
});
|
||||
|
||||
notificationsBtn.addEventListener('click', function() {
|
||||
scope.toggleModal(notificationsModal);
|
||||
|
||||
@ -2157,11 +2160,6 @@ globalConsoleContainerEl
|
||||
}
|
||||
});
|
||||
|
||||
utils.onButtonClick(settingsBtn, function() {
|
||||
openSettings();
|
||||
trackEvent('ui', 'settingsBtnClick');
|
||||
});
|
||||
|
||||
// Initialize add library select box
|
||||
var libOptions = window.jsLibs.reduce(
|
||||
(html, lib) =>
|
||||
|
Reference in New Issue
Block a user