From c961fb9f6e3a7d7e880c29aadda40c4177780a33 Mon Sep 17 00:00:00 2001 From: brandonkelly Date: Wed, 10 May 2023 08:00:11 -0700 Subject: [PATCH] Finish 3.8.10.2 --- CHANGELOG.md | 2 +- src/config/app.php | 2 +- src/web/assets/matrix/dist/MatrixInput.js | 2 +- src/web/assets/matrix/dist/MatrixInput.js.map | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bef0c606c57..309c25cee6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Release Notes for Craft CMS 3.x -## 3.8.10.1 - 2023-05-09 +## 3.8.10.2 - 2023-05-09 - Fixed a bug where it wasn’t possible to add new Matrix blocks via the “Add a block” menu. ([#13177](https://github.com/craftcms/cms/issues/13177)) diff --git a/src/config/app.php b/src/config/app.php index f763bd409e0..68980245d7b 100644 --- a/src/config/app.php +++ b/src/config/app.php @@ -3,7 +3,7 @@ return [ 'id' => 'CraftCMS', 'name' => 'Craft CMS', - 'version' => '3.8.10.1', + 'version' => '3.8.10.2', 'schemaVersion' => '3.8.0.1', 'minVersionRequired' => '2.6.2788', 'basePath' => dirname(__DIR__), // Defines the @app alias diff --git a/src/web/assets/matrix/dist/MatrixInput.js b/src/web/assets/matrix/dist/MatrixInput.js index 6162be1b8a5..38b80989583 100644 --- a/src/web/assets/matrix/dist/MatrixInput.js +++ b/src/web/assets/matrix/dist/MatrixInput.js @@ -1,2 +1,2 @@ -!function(t){Craft.MatrixInput=Garnish.Base.extend({id:null,blockTypes:null,blockTypesByHandle:null,inputNamePrefix:null,inputIdPrefix:null,showingAddBlockMenu:!1,addBlockBtnGroupWidth:null,addBlockBtnContainerWidth:null,$container:null,$blockContainer:null,$addBlockBtnContainer:null,$addBlockBtnGroup:null,$addBlockBtnGroupBtns:null,$statusMessage:null,blockSort:null,blockSelect:null,totalNewBlocks:0,init:function(a,i,n,o){var s,l=this;for(this.id=a,this.blockTypes=i,this.inputNamePrefix=n,this.inputIdPrefix=Craft.formatInputId(this.inputNamePrefix),"number"==typeof o&&(o={maxBlocks:o}),this.setSettings(o,Craft.MatrixInput.defaults),this.$container=t("#"+this.id),this.$blockContainer=this.$container.children(".blocks"),this.$addBlockBtnContainer=this.$container.children(".buttons"),this.$addBlockBtnGroup=this.$addBlockBtnContainer.children(".btngroup"),this.$addBlockBtnGroupBtns=this.$addBlockBtnGroup.children(".btn"),this.$addBlockMenuBtn=this.$addBlockBtnContainer.children(".menubtn"),this.$statusMessage=this.$container.find("[data-status-message]"),this.$container.data("matrix",this),this.setNewBlockBtn(),this.blockTypesByHandle={},s=0;s .actions > .move",axis:"y",filter:function(){return l.blockSort.$targetItem.hasClass("sel")?l.blockSelect.getSelectedItems():l.blockSort.$targetItem},collapseDraggees:!0,magnetStrength:4,helperLagBase:1.5,helperOpacity:.9,onDragStop:function(){l.trigger("blockSortDragStop")},onSortChange:function(){l.blockSelect.resetItemOrder()}}),this.blockSelect=new Garnish.Select(this.$blockContainer,d,{multi:!0,vertical:!0,handle:"> .checkbox, > .titlebar",checkboxMode:!0}),s=0;sthis.totalNewBlocks&&(this.totalNewBlocks=parseInt(u[1]));var f=new e(this,h);f.id&&-1!==t.inArray(""+f.id,r)&&f.collapse()}this.addListener(this.$addBlockBtnGroupBtns,"click",(function(e){var a=t(e.target).data("type");this.addBlock(a)})),this.$addBlockMenuBtn.data("menubtn")&&this.$addBlockMenuBtn.data("menubtn").destroy(),new Garnish.MenuBtn(this.$addBlockMenuBtn,{onOptionSelect:function(e){l.addBlock(t(e).data("type"))}}),this.updateAddBlockBtn(),this.addListener(this.$container,"resize","setNewBlockBtn"),Garnish.$doc.ready(this.setNewBlockBtn.bind(this)),this.trigger("afterInit")},setNewBlockBtn:function(){var t=this;(this.addBlockBtnGroupWidth||(this.addBlockBtnGroupWidth=this.$addBlockBtnGroup.width(),this.addBlockBtnGroupWidth))&&this.addBlockBtnContainerWidth!==(this.addBlockBtnContainerWidth=this.$addBlockBtnContainer.width())&&(this.addBlockBtnGroupWidth>this.addBlockBtnContainerWidth?this.showingAddBlockMenu||(this.$addBlockBtnGroup.addClass("hidden"),this.$addBlockMenuBtn.removeClass("hidden"),this.showingAddBlockMenu=!0):this.showingAddBlockMenu&&(this.$addBlockMenuBtn.addClass("hidden"),this.$addBlockBtnGroup.removeClass("hidden"),this.showingAddBlockMenu=!1,-1!==navigator.userAgent.indexOf("Safari")&&Garnish.requestAnimationFrame((function(){t.$addBlockBtnGroup.css("opacity",.99),Garnish.requestAnimationFrame((function(){t.$addBlockBtnGroup.css("opacity","")}))}))))},canAddMoreBlocks:function(){return!this.maxBlocks||this.$blockContainer.children().length\n \n \n \n
\n
').concat(this.getBlockTypeByHandle(a).name,'
\n
\n
\n
\n \n ');var h=t(c);window.draftEditor&&window.draftEditor.pause(),i?h.insertBefore(i):h.appendTo(this.$blockContainer);var p=t('
').appendTo(h),u=this.getParsedBlockHtml(this.blockTypesByHandle[a].bodyHtml,s),f=this.getParsedBlockHtml(this.blockTypesByHandle[a].footHtml,s);t(u).appendTo(p),this.trigger("blockAdded",{$block:h}),h.css(this.getHiddenBlockCss(h)).velocity({opacity:1,"margin-bottom":10},"fast",(function(){h.css("margin-bottom",""),Garnish.$bod.append(f),Craft.initUiElements(p),new e(o,h),o.blockSort.addItems(h),o.blockSelect.addItems(h),o.updateAddBlockBtn(),Garnish.requestAnimationFrame((function(){(void 0===n||n)&&(Garnish.scrollContainerToElement(h),h.find(".text,[contenteditable]").first().trigger("focus")),window.draftEditor&&window.draftEditor.resume()}))}))}else this.updateStatusMessage()},getBlockTypeByHandle:function(t){for(var e=0;e .actions [data-disclosure-trigger]"),n=i.data("trigger")||new Garnish.DisclosureMenu(i);this.$actionMenu=n.$container,this.actionDisclosure=n,n.on("show",(function(){a.$container.addClass("active"),a.$container.prev(".matrixblock").length?a.$actionMenu.find("a[data-action=moveUp]:first").parent().removeClass("hidden"):a.$actionMenu.find("a[data-action=moveUp]:first").parent().addClass("hidden"),a.$container.next(".matrixblock").length?a.$actionMenu.find("a[data-action=moveDown]:first").parent().removeClass("hidden"):a.$actionMenu.find("a[data-action=moveDown]:first").parent().addClass("hidden")})),n.on("hide",(function(){a.$container.removeClass("active")})),this.$actionMenuOptions=this.$actionMenu.find("a[data-action]"),this.addListener(this.$actionMenuOptions,"click",this.handleActionClick),this.addListener(this.$actionMenuOptions,"keydown",this.handleActionKeydown),Garnish.hasAttr(this.$container,"data-collapsed")&&this.collapse(),this._handleTitleBarClick=function(t){t.preventDefault(),this.toggle()},this.addListener(this.$titlebar,"doubletap",this._handleTitleBarClick)},toggle:function(){this.collapsed?this.expand():this.collapse(!0)},collapse:function(e){var a=this;if(!this.collapsed){this.$container.addClass("collapsed");for(var i="",n=this.$fieldsContainer.children().children(),o=0;o| ":"")+l)}this.$previewContainer.html(i),this.$fieldsContainer.velocity("stop"),this.$container.velocity("stop"),e?(this.$fieldsContainer.velocity("fadeOut",{duration:"fast"}),this.$container.velocity({height:16},"fast")):(this.$previewContainer.show(),this.$fieldsContainer.hide(),this.$container.css({height:16})),setTimeout((function(){a.$actionMenu.find("a[data-action=collapse]:first").parent().addClass("hidden"),a.$actionMenu.find("a[data-action=expand]:first").parent().removeClass("hidden")}),200),this.isNew?this.$collapsedInput?this.$collapsedInput.val("1"):this.$collapsedInput=t('').appendTo(this.$container):Craft.MatrixInput.rememberCollapsedBlockId(this.id),this.collapsed=!0}},_inputPreviewText:function(e){if(e.is("select,multiselect")){for(var a=[],i=e.find("option:selected"),n=0;n1&&this.matrix.blockSelect.isSelected(this.$container),i=t(e);switch(i.data("action")){case"collapse":a?this.matrix.collapseSelectedBlocks():this.collapse(!0);break;case"expand":a?this.matrix.expandSelectedBlocks():this.expand();break;case"disable":a?this.matrix.disableSelectedBlocks():this.disable();break;case"enable":a?this.matrix.enableSelectedBlocks():(this.enable(),this.expand());break;case"moveUp":this.moveUp();break;case"moveDown":this.moveDown();break;case"add":var n=i.data("type");this.matrix.addBlock(n,this.$container);break;case"delete":a?confirm(Craft.t("app","Are you sure you want to delete the selected blocks?"))&&this.matrix.deleteSelectedBlocks():this.selfDestruct()}this.actionDisclosure.hide()},selfDestruct:function(){var e=this;t("[name]",this.$container).removeAttr("name"),this.$container.velocity(this.matrix.getHiddenBlockCss(this.$container),"fast",(function(){e.$container.remove(),e.matrix.updateAddBlockBtn(),e.matrix.trigger("blockDeleted",{$block:e.$container})}))}})}(jQuery); +!function(t){Craft.MatrixInput=Garnish.Base.extend({id:null,blockTypes:null,blockTypesByHandle:null,inputNamePrefix:null,inputIdPrefix:null,showingAddBlockMenu:!1,addBlockBtnGroupWidth:null,addBlockBtnContainerWidth:null,$container:null,$blockContainer:null,$addBlockBtnContainer:null,$addBlockBtnGroup:null,$addBlockBtnGroupBtns:null,$statusMessage:null,blockSort:null,blockSelect:null,totalNewBlocks:0,init:function(a,i,n,o){var s,l=this;for(this.id=a,this.blockTypes=i,this.inputNamePrefix=n,this.inputIdPrefix=Craft.formatInputId(this.inputNamePrefix),"number"==typeof o&&(o={maxBlocks:o}),this.setSettings(o,Craft.MatrixInput.defaults),this.$container=t("#"+this.id),this.$blockContainer=this.$container.children(".blocks"),this.$addBlockBtnContainer=this.$container.children(".buttons"),this.$addBlockBtnGroup=this.$addBlockBtnContainer.children(".btngroup"),this.$addBlockBtnGroupBtns=this.$addBlockBtnGroup.children(".btn"),this.$addBlockMenuBtn=this.$addBlockBtnContainer.children(".menubtn"),this.$statusMessage=this.$container.find("[data-status-message]"),this.$container.data("matrix",this),this.setNewBlockBtn(),this.blockTypesByHandle={},s=0;s .actions > .move",axis:"y",filter:function(){return l.blockSort.$targetItem.hasClass("sel")?l.blockSelect.getSelectedItems():l.blockSort.$targetItem},collapseDraggees:!0,magnetStrength:4,helperLagBase:1.5,helperOpacity:.9,onDragStop:function(){l.trigger("blockSortDragStop")},onSortChange:function(){l.blockSelect.resetItemOrder()}}),this.blockSelect=new Garnish.Select(this.$blockContainer,d,{multi:!0,vertical:!0,handle:"> .checkbox, > .titlebar",checkboxMode:!0}),s=0;sthis.totalNewBlocks&&(this.totalNewBlocks=parseInt(u[1]));var f=new e(this,h);f.id&&-1!==t.inArray(""+f.id,r)&&f.collapse()}this.addListener(this.$addBlockBtnGroupBtns,"click",(function(e){var a=t(e.target).data("type");this.addBlock(a)})),this.$addBlockMenuBtn.menubtn(),this.$addBlockMenuBtn.data("menubtn").on("optionSelect",(function(e){l.addBlock(t(e.option).data("type"))})),this.updateAddBlockBtn(),this.addListener(this.$container,"resize","setNewBlockBtn"),Garnish.$doc.ready(this.setNewBlockBtn.bind(this)),this.trigger("afterInit")},setNewBlockBtn:function(){var t=this;(this.addBlockBtnGroupWidth||(this.addBlockBtnGroupWidth=this.$addBlockBtnGroup.width(),this.addBlockBtnGroupWidth))&&this.addBlockBtnContainerWidth!==(this.addBlockBtnContainerWidth=this.$addBlockBtnContainer.width())&&(this.addBlockBtnGroupWidth>this.addBlockBtnContainerWidth?this.showingAddBlockMenu||(this.$addBlockBtnGroup.addClass("hidden"),this.$addBlockMenuBtn.removeClass("hidden"),this.showingAddBlockMenu=!0):this.showingAddBlockMenu&&(this.$addBlockMenuBtn.addClass("hidden"),this.$addBlockBtnGroup.removeClass("hidden"),this.showingAddBlockMenu=!1,-1!==navigator.userAgent.indexOf("Safari")&&Garnish.requestAnimationFrame((function(){t.$addBlockBtnGroup.css("opacity",.99),Garnish.requestAnimationFrame((function(){t.$addBlockBtnGroup.css("opacity","")}))}))))},canAddMoreBlocks:function(){return!this.maxBlocks||this.$blockContainer.children().length\n \n \n \n
\n
').concat(this.getBlockTypeByHandle(a).name,'
\n
\n
\n
\n \n
');var h=t(c);window.draftEditor&&window.draftEditor.pause(),i?h.insertBefore(i):h.appendTo(this.$blockContainer);var p=t('
').appendTo(h),u=this.getParsedBlockHtml(this.blockTypesByHandle[a].bodyHtml,s),f=this.getParsedBlockHtml(this.blockTypesByHandle[a].footHtml,s);t(u).appendTo(p),this.trigger("blockAdded",{$block:h}),h.css(this.getHiddenBlockCss(h)).velocity({opacity:1,"margin-bottom":10},"fast",(function(){h.css("margin-bottom",""),Garnish.$bod.append(f),Craft.initUiElements(p),new e(o,h),o.blockSort.addItems(h),o.blockSelect.addItems(h),o.updateAddBlockBtn(),Garnish.requestAnimationFrame((function(){(void 0===n||n)&&(Garnish.scrollContainerToElement(h),h.find(".text,[contenteditable]").first().trigger("focus")),window.draftEditor&&window.draftEditor.resume()}))}))}else this.updateStatusMessage()},getBlockTypeByHandle:function(t){for(var e=0;e .actions [data-disclosure-trigger]"),n=i.data("trigger")||new Garnish.DisclosureMenu(i);this.$actionMenu=n.$container,this.actionDisclosure=n,n.on("show",(function(){a.$container.addClass("active"),a.$container.prev(".matrixblock").length?a.$actionMenu.find("a[data-action=moveUp]:first").parent().removeClass("hidden"):a.$actionMenu.find("a[data-action=moveUp]:first").parent().addClass("hidden"),a.$container.next(".matrixblock").length?a.$actionMenu.find("a[data-action=moveDown]:first").parent().removeClass("hidden"):a.$actionMenu.find("a[data-action=moveDown]:first").parent().addClass("hidden")})),n.on("hide",(function(){a.$container.removeClass("active")})),this.$actionMenuOptions=this.$actionMenu.find("a[data-action]"),this.addListener(this.$actionMenuOptions,"click",this.handleActionClick),this.addListener(this.$actionMenuOptions,"keydown",this.handleActionKeydown),Garnish.hasAttr(this.$container,"data-collapsed")&&this.collapse(),this._handleTitleBarClick=function(t){t.preventDefault(),this.toggle()},this.addListener(this.$titlebar,"doubletap",this._handleTitleBarClick)},toggle:function(){this.collapsed?this.expand():this.collapse(!0)},collapse:function(e){var a=this;if(!this.collapsed){this.$container.addClass("collapsed");for(var i="",n=this.$fieldsContainer.children().children(),o=0;o| ":"")+l)}this.$previewContainer.html(i),this.$fieldsContainer.velocity("stop"),this.$container.velocity("stop"),e?(this.$fieldsContainer.velocity("fadeOut",{duration:"fast"}),this.$container.velocity({height:16},"fast")):(this.$previewContainer.show(),this.$fieldsContainer.hide(),this.$container.css({height:16})),setTimeout((function(){a.$actionMenu.find("a[data-action=collapse]:first").parent().addClass("hidden"),a.$actionMenu.find("a[data-action=expand]:first").parent().removeClass("hidden")}),200),this.isNew?this.$collapsedInput?this.$collapsedInput.val("1"):this.$collapsedInput=t('').appendTo(this.$container):Craft.MatrixInput.rememberCollapsedBlockId(this.id),this.collapsed=!0}},_inputPreviewText:function(e){if(e.is("select,multiselect")){for(var a=[],i=e.find("option:selected"),n=0;n1&&this.matrix.blockSelect.isSelected(this.$container),i=t(e);switch(i.data("action")){case"collapse":a?this.matrix.collapseSelectedBlocks():this.collapse(!0);break;case"expand":a?this.matrix.expandSelectedBlocks():this.expand();break;case"disable":a?this.matrix.disableSelectedBlocks():this.disable();break;case"enable":a?this.matrix.enableSelectedBlocks():(this.enable(),this.expand());break;case"moveUp":this.moveUp();break;case"moveDown":this.moveDown();break;case"add":var n=i.data("type");this.matrix.addBlock(n,this.$container);break;case"delete":a?confirm(Craft.t("app","Are you sure you want to delete the selected blocks?"))&&this.matrix.deleteSelectedBlocks():this.selfDestruct()}this.actionDisclosure.hide()},selfDestruct:function(){var e=this;t("[name]",this.$container).removeAttr("name"),this.$container.velocity(this.matrix.getHiddenBlockCss(this.$container),"fast",(function(){e.$container.remove(),e.matrix.updateAddBlockBtn(),e.matrix.trigger("blockDeleted",{$block:e.$container})}))}})}(jQuery); //# sourceMappingURL=MatrixInput.js.map \ No newline at end of file diff --git a/src/web/assets/matrix/dist/MatrixInput.js.map b/src/web/assets/matrix/dist/MatrixInput.js.map index c4b1d1eaeec..c107202f259 100644 --- a/src/web/assets/matrix/dist/MatrixInput.js.map +++ b/src/web/assets/matrix/dist/MatrixInput.js.map @@ -1 +1 @@ -{"version":3,"file":"MatrixInput.js","mappings":"CAAA,SAAWA,GAMTC,MAAMC,YAAcC,QAAQC,KAAKC,OAC/B,CACEC,GAAI,KACJC,WAAY,KACZC,mBAAoB,KACpBC,gBAAiB,KACjBC,cAAe,KAEfC,qBAAqB,EACrBC,sBAAuB,KACvBC,0BAA2B,KAE3BC,WAAY,KACZC,gBAAiB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AME,UAENrN,QAAQsN,YAExBH,EAAMvC,iBACNrJ,KAAK6L,eAAeD,EAAM9I,UAG5B+I,eAAgB,SAAU1I,GACxB,IAAM6I,EACFhM,KAAKmI,OAAOxI,YAAYsM,cAAgB,GACxCjM,KAAKmI,OAAOxI,YAAYuM,WAAWlM,KAAKZ,YAC1C+M,EAAU7N,EAAE6E,GAEd,OAAQgJ,EAAQ3L,KAAK,WACnB,IAAK,WACCwL,EACFhM,KAAKmI,OAAO3B,yBAEZxG,KAAK0C,UAAS,GAGhB,MAGF,IAAK,SACCsJ,EACFhM,KAAKmI,OAAOzB,uBAEZ1G,KAAKuJ,SAGP,MAGF,IAAK,UACCyC,EACFhM,KAAKmI,OAAOxB,wBAEZ3G,KAAKqL,UAGP,MAGF,IAAK,SACCW,EACFhM,KAAKmI,OAAOvB,wBAEZ5G,KAAKsL,SACLtL,KAAKuJ,UAGP,MAGF,IAAK,SACHvJ,KAAKuL,SACL,MAGF,IAAK,WACHvL,KAAKyL,WACL,MAGF,IAAK,MACH,IAAI5I,EAAOsJ,EAAQ3L,KAAK,QACxBR,KAAKmI,OAAOpF,SAASF,EAAM7C,KAAKZ,YAChC,MAGF,IAAK,SACC4M,EAEAI,QACE7N,MAAMoG,EACJ,MACA,0DAIJ3E,KAAKmI,OAAOtB,uBAGd7G,KAAKqM,eAOXrM,KAAKuI,iBAAiBkC,QAGxB4B,aAAc,WAAY,WAExB/N,EAAE,SAAU0B,KAAKZ,YAAY8E,WAAW,QAExClE,KAAKZ,WAAW2G,SACd/F,KAAKmI,OAAOrC,kBAAkB9F,KAAKZ,YACnC,QACA,WACE,EAAKA,WAAWkN,SAChB,EAAKnE,OAAO/E,oBAEZ,EAAK+E,OAAOxG,QAAQ,eAAgB,CAClCO,OAAQ,EAAK9C,mBA//BzB,CAqgCGmN","sources":["webpack:///./MatrixInput.js"],"sourcesContent":["(function ($) {\n /** global: Craft */\n /** global: Garnish */\n /**\n * Matrix input class\n */\n Craft.MatrixInput = Garnish.Base.extend(\n {\n id: null,\n blockTypes: null,\n blockTypesByHandle: null,\n inputNamePrefix: null,\n inputIdPrefix: null,\n\n showingAddBlockMenu: false,\n addBlockBtnGroupWidth: null,\n addBlockBtnContainerWidth: null,\n\n $container: null,\n $blockContainer: null,\n $addBlockBtnContainer: null,\n $addBlockBtnGroup: null,\n $addBlockBtnGroupBtns: null,\n $statusMessage: null,\n\n blockSort: null,\n blockSelect: null,\n totalNewBlocks: 0,\n\n init: function (id, blockTypes, inputNamePrefix, settings) {\n this.id = id;\n this.blockTypes = blockTypes;\n this.inputNamePrefix = inputNamePrefix;\n this.inputIdPrefix = Craft.formatInputId(this.inputNamePrefix);\n\n // see if settings was actually set to the maxBlocks value\n if (typeof settings === 'number') {\n settings = {maxBlocks: settings};\n }\n this.setSettings(settings, Craft.MatrixInput.defaults);\n\n this.$container = $('#' + this.id);\n this.$blockContainer = this.$container.children('.blocks');\n this.$addBlockBtnContainer = this.$container.children('.buttons');\n this.$addBlockBtnGroup =\n this.$addBlockBtnContainer.children('.btngroup');\n this.$addBlockBtnGroupBtns = this.$addBlockBtnGroup.children('.btn');\n this.$addBlockMenuBtn = this.$addBlockBtnContainer.children('.menubtn');\n this.$statusMessage = this.$container.find('[data-status-message]');\n\n this.$container.data('matrix', this);\n\n this.setNewBlockBtn();\n\n this.blockTypesByHandle = {};\n\n var i;\n\n for (i = 0; i < this.blockTypes.length; i++) {\n var blockType = this.blockTypes[i];\n this.blockTypesByHandle[blockType.handle] = blockType;\n }\n\n var $blocks = this.$blockContainer.children(),\n collapsedBlocks = Craft.MatrixInput.getCollapsedBlockIds();\n\n this.blockSort = new Garnish.DragSort($blocks, {\n handle: '> .actions > .move',\n axis: 'y',\n filter: () => {\n // Only return all the selected items if the target item is selected\n if (this.blockSort.$targetItem.hasClass('sel')) {\n return this.blockSelect.getSelectedItems();\n } else {\n return this.blockSort.$targetItem;\n }\n },\n collapseDraggees: true,\n magnetStrength: 4,\n helperLagBase: 1.5,\n helperOpacity: 0.9,\n onDragStop: () => {\n this.trigger('blockSortDragStop');\n },\n onSortChange: () => {\n this.blockSelect.resetItemOrder();\n },\n });\n\n this.blockSelect = new Garnish.Select(this.$blockContainer, $blocks, {\n multi: true,\n vertical: true,\n handle: '> .checkbox, > .titlebar',\n checkboxMode: true,\n });\n\n for (i = 0; i < $blocks.length; i++) {\n var $block = $($blocks[i]),\n blockId = $block.data('id');\n\n // Is this a new block?\n var newMatch =\n typeof blockId === 'string' && blockId.match(/new(\\d+)/);\n\n if (newMatch && newMatch[1] > this.totalNewBlocks) {\n this.totalNewBlocks = parseInt(newMatch[1]);\n }\n\n var block = new MatrixBlock(this, $block);\n\n if (block.id && $.inArray('' + block.id, collapsedBlocks) !== -1) {\n block.collapse();\n }\n }\n\n this.addListener(this.$addBlockBtnGroupBtns, 'click', function (ev) {\n var type = $(ev.target).data('type');\n this.addBlock(type);\n });\n\n if (this.$addBlockMenuBtn.data('menubtn')) {\n this.$addBlockMenuBtn.data('menubtn').destroy();\n }\n new Garnish.MenuBtn(this.$addBlockMenuBtn, {\n onOptionSelect: (option) => {\n this.addBlock($(option).data('type'));\n },\n });\n\n this.updateAddBlockBtn();\n\n this.addListener(this.$container, 'resize', 'setNewBlockBtn');\n Garnish.$doc.ready(this.setNewBlockBtn.bind(this));\n\n this.trigger('afterInit');\n },\n\n setNewBlockBtn: function () {\n // Do we know what the button group width is yet?\n if (!this.addBlockBtnGroupWidth) {\n this.addBlockBtnGroupWidth = this.$addBlockBtnGroup.width();\n\n if (!this.addBlockBtnGroupWidth) {\n return;\n }\n }\n\n // Only check if the container width has resized\n if (\n this.addBlockBtnContainerWidth !==\n (this.addBlockBtnContainerWidth = this.$addBlockBtnContainer.width())\n ) {\n if (this.addBlockBtnGroupWidth > this.addBlockBtnContainerWidth) {\n if (!this.showingAddBlockMenu) {\n this.$addBlockBtnGroup.addClass('hidden');\n this.$addBlockMenuBtn.removeClass('hidden');\n this.showingAddBlockMenu = true;\n }\n } else {\n if (this.showingAddBlockMenu) {\n this.$addBlockMenuBtn.addClass('hidden');\n this.$addBlockBtnGroup.removeClass('hidden');\n this.showingAddBlockMenu = false;\n\n // Because Safari is awesome\n if (navigator.userAgent.indexOf('Safari') !== -1) {\n Garnish.requestAnimationFrame(() => {\n this.$addBlockBtnGroup.css('opacity', 0.99);\n\n Garnish.requestAnimationFrame(() => {\n this.$addBlockBtnGroup.css('opacity', '');\n });\n });\n }\n }\n }\n }\n },\n\n canAddMoreBlocks: function () {\n return (\n !this.maxBlocks ||\n this.$blockContainer.children().length < this.maxBlocks\n );\n },\n\n updateAddBlockBtn: function () {\n var i, block;\n\n if (this.canAddMoreBlocks()) {\n this.$addBlockBtnGroup.removeClass('disabled');\n this.$addBlockMenuBtn.removeClass('disabled');\n\n this.$addBlockBtnGroupBtns.each(function () {\n $(this).removeAttr('aria-disabled');\n });\n\n for (i = 0; i < this.blockSelect.$items.length; i++) {\n block = this.blockSelect.$items.eq(i).data('block');\n\n if (block) {\n block.$actionMenu\n .find('a[data-action=add]')\n .parent()\n .removeClass('disabled');\n block.$actionMenu\n .find('a[data-action=add]')\n .removeAttr('aria-disabled');\n }\n }\n } else {\n this.$addBlockBtnGroup.addClass('disabled');\n this.$addBlockMenuBtn.addClass('disabled');\n\n this.$addBlockBtnGroupBtns.each(function () {\n $(this).attr('aria-disabled', 'true');\n });\n\n for (i = 0; i < this.blockSelect.$items.length; i++) {\n block = this.blockSelect.$items.eq(i).data('block');\n\n if (block) {\n block.$actionMenu\n .find('a[data-action=add]')\n .parent()\n .addClass('disabled');\n block.$actionMenu\n .find('a[data-action=add]')\n .attr('aria-disabled', 'true');\n }\n }\n }\n },\n\n updateStatusMessage: function () {\n this.$statusMessage.empty();\n let message;\n\n if (!this.canAddMoreBlocks()) {\n message = Craft.t(\n 'app',\n 'Matrix block could not be added. Maximum number of blocks reached.'\n );\n }\n\n setTimeout(() => {\n this.$statusMessage.text(message);\n }, 250);\n },\n\n addBlock: function (type, $insertBefore, autofocus) {\n if (!this.canAddMoreBlocks()) {\n this.updateStatusMessage();\n return;\n }\n\n this.totalNewBlocks++;\n\n var id = 'new' + this.totalNewBlocks;\n const actionMenuId = `matrixblock-action-menu-${id}`;\n\n var html = `\n
\n \n \n \n
\n
${\n this.getBlockTypeByHandle(type).name\n }
\n
\n
\n
\n
\n
\n
\n \n
\n `;\n\n if (!this.settings.staticBlocks) {\n html += `\n
\n \n
\n `;\n }\n\n html += `\n
\n
\n \n
\n
`;\n\n var $block = $(html);\n\n // Pause the draft editor\n if (window.draftEditor) {\n window.draftEditor.pause();\n }\n\n if ($insertBefore) {\n $block.insertBefore($insertBefore);\n } else {\n $block.appendTo(this.$blockContainer);\n }\n\n var $fieldsContainer = $('
').appendTo($block),\n bodyHtml = this.getParsedBlockHtml(\n this.blockTypesByHandle[type].bodyHtml,\n id\n ),\n footHtml = this.getParsedBlockHtml(\n this.blockTypesByHandle[type].footHtml,\n id\n );\n\n $(bodyHtml).appendTo($fieldsContainer);\n\n this.trigger('blockAdded', {\n $block: $block,\n });\n\n // Animate the block into position\n $block.css(this.getHiddenBlockCss($block)).velocity(\n {\n opacity: 1,\n 'margin-bottom': 10,\n },\n 'fast',\n () => {\n $block.css('margin-bottom', '');\n Garnish.$bod.append(footHtml);\n Craft.initUiElements($fieldsContainer);\n new MatrixBlock(this, $block);\n this.blockSort.addItems($block);\n this.blockSelect.addItems($block);\n this.updateAddBlockBtn();\n\n Garnish.requestAnimationFrame(function () {\n if (typeof autofocus === 'undefined' || autofocus) {\n // Scroll to the block\n Garnish.scrollContainerToElement($block);\n // Focus on the first text input\n $block.find('.text,[contenteditable]').first().trigger('focus');\n }\n\n // Resume the draft editor\n if (window.draftEditor) {\n window.draftEditor.resume();\n }\n });\n }\n );\n },\n\n getBlockTypeByHandle: function (handle) {\n for (var i = 0; i < this.blockTypes.length; i++) {\n if (this.blockTypes[i].handle === handle) {\n return this.blockTypes[i];\n }\n }\n },\n\n collapseSelectedBlocks: function () {\n this.callOnSelectedBlocks('collapse');\n },\n\n expandSelectedBlocks: function () {\n this.callOnSelectedBlocks('expand');\n },\n\n disableSelectedBlocks: function () {\n this.callOnSelectedBlocks('disable');\n },\n\n enableSelectedBlocks: function () {\n this.callOnSelectedBlocks('enable');\n },\n\n deleteSelectedBlocks: function () {\n this.callOnSelectedBlocks('selfDestruct');\n },\n\n callOnSelectedBlocks: function (fn) {\n for (var i = 0; i < this.blockSelect.$selectedItems.length; i++) {\n this.blockSelect.$selectedItems.eq(i).data('block')[fn]();\n }\n },\n\n getHiddenBlockCss: function ($block) {\n return {\n opacity: 0,\n marginBottom: -$block.outerHeight(),\n };\n },\n\n getParsedBlockHtml: function (html, id) {\n if (typeof html === 'string') {\n return html.replace(\n new RegExp(`__BLOCK_${this.settings.placeholderKey}__`, 'g'),\n id\n );\n } else {\n return '';\n }\n },\n\n get maxBlocks() {\n return this.settings.maxBlocks;\n },\n },\n {\n defaults: {\n placeholderKey: null,\n maxBlocks: null,\n staticBlocks: false,\n },\n\n collapsedBlockStorageKey:\n 'Craft-' + Craft.systemUid + '.MatrixInput.collapsedBlocks',\n\n getCollapsedBlockIds: function () {\n if (\n typeof localStorage[Craft.MatrixInput.collapsedBlockStorageKey] ===\n 'string'\n ) {\n return Craft.filterArray(\n localStorage[Craft.MatrixInput.collapsedBlockStorageKey].split(',')\n );\n } else {\n return [];\n }\n },\n\n setCollapsedBlockIds: function (ids) {\n localStorage[Craft.MatrixInput.collapsedBlockStorageKey] =\n ids.join(',');\n },\n\n rememberCollapsedBlockId: function (id) {\n if (typeof Storage !== 'undefined') {\n var collapsedBlocks = Craft.MatrixInput.getCollapsedBlockIds();\n\n if ($.inArray('' + id, collapsedBlocks) === -1) {\n collapsedBlocks.push(id);\n Craft.MatrixInput.setCollapsedBlockIds(collapsedBlocks);\n }\n }\n },\n\n forgetCollapsedBlockId: function (id) {\n if (typeof Storage !== 'undefined') {\n var collapsedBlocks = Craft.MatrixInput.getCollapsedBlockIds(),\n collapsedBlocksIndex = $.inArray('' + id, collapsedBlocks);\n\n if (collapsedBlocksIndex !== -1) {\n collapsedBlocks.splice(collapsedBlocksIndex, 1);\n Craft.MatrixInput.setCollapsedBlockIds(collapsedBlocks);\n }\n }\n },\n }\n );\n\n var MatrixBlock = Garnish.Base.extend({\n matrix: null,\n $container: null,\n $titlebar: null,\n $fieldsContainer: null,\n $previewContainer: null,\n $actionMenu: null,\n $collapsedInput: null,\n\n actionDisclosure: null,\n\n isNew: null,\n id: null,\n\n collapsed: false,\n\n init: function (matrix, $container) {\n this.matrix = matrix;\n this.$container = $container;\n this.$titlebar = $container.children('.titlebar');\n this.$previewContainer = this.$titlebar.children('.preview');\n this.$fieldsContainer = $container.children('.fields');\n\n this.$container.data('block', this);\n\n this.id = this.$container.data('id');\n this.isNew =\n !this.id ||\n (typeof this.id === 'string' && this.id.substr(0, 3) === 'new');\n\n const $actionMenuBtn = this.$container.find(\n '> .actions [data-disclosure-trigger]'\n );\n const actionDisclosure =\n $actionMenuBtn.data('trigger') ||\n new Garnish.DisclosureMenu($actionMenuBtn);\n\n this.$actionMenu = actionDisclosure.$container;\n this.actionDisclosure = actionDisclosure;\n\n actionDisclosure.on('show', () => {\n this.$container.addClass('active');\n if (this.$container.prev('.matrixblock').length) {\n this.$actionMenu\n .find('a[data-action=moveUp]:first')\n .parent()\n .removeClass('hidden');\n } else {\n this.$actionMenu\n .find('a[data-action=moveUp]:first')\n .parent()\n .addClass('hidden');\n }\n if (this.$container.next('.matrixblock').length) {\n this.$actionMenu\n .find('a[data-action=moveDown]:first')\n .parent()\n .removeClass('hidden');\n } else {\n this.$actionMenu\n .find('a[data-action=moveDown]:first')\n .parent()\n .addClass('hidden');\n }\n });\n\n actionDisclosure.on('hide', () => {\n this.$container.removeClass('active');\n });\n\n this.$actionMenuOptions = this.$actionMenu.find('a[data-action]');\n\n this.addListener(\n this.$actionMenuOptions,\n 'click',\n this.handleActionClick\n );\n this.addListener(\n this.$actionMenuOptions,\n 'keydown',\n this.handleActionKeydown\n );\n\n // Was this block already collapsed?\n if (Garnish.hasAttr(this.$container, 'data-collapsed')) {\n this.collapse();\n }\n\n this._handleTitleBarClick = function (ev) {\n ev.preventDefault();\n this.toggle();\n };\n\n this.addListener(this.$titlebar, 'doubletap', this._handleTitleBarClick);\n },\n\n toggle: function () {\n if (this.collapsed) {\n this.expand();\n } else {\n this.collapse(true);\n }\n },\n\n collapse: function (animate) {\n if (this.collapsed) {\n return;\n }\n\n this.$container.addClass('collapsed');\n\n var previewHtml = '',\n $fields = this.$fieldsContainer.children().children();\n\n for (var i = 0; i < $fields.length; i++) {\n var $field = $($fields[i]),\n $inputs = $field\n .children('.input')\n .find('select,input[type!=\"hidden\"],textarea,.label'),\n inputPreviewText = '';\n\n for (var j = 0; j < $inputs.length; j++) {\n var $input = $($inputs[j]),\n value;\n\n if ($input.hasClass('label')) {\n var $maybeLightswitchContainer = $input.parent().parent();\n\n if (\n $maybeLightswitchContainer.hasClass('lightswitch') &&\n (($maybeLightswitchContainer.hasClass('on') &&\n $input.hasClass('off')) ||\n (!$maybeLightswitchContainer.hasClass('on') &&\n $input.hasClass('on')))\n ) {\n continue;\n }\n\n value = $input.text();\n } else {\n value = Craft.getText(this._inputPreviewText($input));\n }\n\n if (value instanceof Array) {\n value = value.join(', ');\n }\n\n if (value) {\n value = Craft.trim(Craft.escapeHtml(value));\n\n if (value) {\n if (inputPreviewText) {\n inputPreviewText += ', ';\n }\n\n inputPreviewText += value;\n }\n }\n }\n\n if (inputPreviewText) {\n previewHtml +=\n (previewHtml ? ' | ' : '') + inputPreviewText;\n }\n }\n\n this.$previewContainer.html(previewHtml);\n\n this.$fieldsContainer.velocity('stop');\n this.$container.velocity('stop');\n\n if (animate) {\n this.$fieldsContainer.velocity('fadeOut', {duration: 'fast'});\n this.$container.velocity({height: 16}, 'fast');\n } else {\n this.$previewContainer.show();\n this.$fieldsContainer.hide();\n this.$container.css({height: 16});\n }\n\n setTimeout(() => {\n this.$actionMenu\n .find('a[data-action=collapse]:first')\n .parent()\n .addClass('hidden');\n this.$actionMenu\n .find('a[data-action=expand]:first')\n .parent()\n .removeClass('hidden');\n }, 200);\n\n // Remember that?\n if (!this.isNew) {\n Craft.MatrixInput.rememberCollapsedBlockId(this.id);\n } else {\n if (!this.$collapsedInput) {\n this.$collapsedInput = $(\n ''\n ).appendTo(this.$container);\n } else {\n this.$collapsedInput.val('1');\n }\n }\n\n this.collapsed = true;\n },\n\n _inputPreviewText: function ($input) {\n if ($input.is('select,multiselect')) {\n const labels = [];\n const $options = $input.find('option:selected');\n for (let k = 0; k < $options.length; k++) {\n labels.push($options.eq(k).text());\n }\n return labels;\n }\n\n if (\n $input.is('input[type=\"checkbox\"]:checked,input[type=\"radio\"]:checked')\n ) {\n const id = $input.attr('id');\n const $label = $(`label[for=\"${id}\"]`);\n if ($label.length) {\n return $label.text();\n }\n }\n\n return Garnish.getInputPostVal($input);\n },\n\n expand: function () {\n if (!this.collapsed) {\n return;\n }\n\n this.$container.removeClass('collapsed');\n\n this.$fieldsContainer.velocity('stop');\n this.$container.velocity('stop');\n\n var collapsedContainerHeight = this.$container.height();\n this.$container.height('auto');\n this.$fieldsContainer.show();\n var expandedContainerHeight = this.$container.height();\n var displayValue = this.$fieldsContainer.css('display') || 'block';\n this.$container.height(collapsedContainerHeight);\n this.$fieldsContainer\n .hide()\n .velocity('fadeIn', {duration: 'fast', display: displayValue});\n this.$container.velocity(\n {height: expandedContainerHeight},\n 'fast',\n () => {\n this.$previewContainer.html('');\n this.$container.height('auto');\n this.$container.trigger('scroll');\n }\n );\n\n setTimeout(() => {\n this.$actionMenu\n .find('a[data-action=collapse]:first')\n .parent()\n .removeClass('hidden');\n this.$actionMenu\n .find('a[data-action=expand]:first')\n .parent()\n .addClass('hidden');\n }, 200);\n\n // Remember that?\n if (!this.isNew && typeof Storage !== 'undefined') {\n var collapsedBlocks = Craft.MatrixInput.getCollapsedBlockIds(),\n collapsedBlocksIndex = $.inArray('' + this.id, collapsedBlocks);\n\n if (collapsedBlocksIndex !== -1) {\n collapsedBlocks.splice(collapsedBlocksIndex, 1);\n Craft.MatrixInput.setCollapsedBlockIds(collapsedBlocks);\n }\n }\n\n if (!this.isNew) {\n Craft.MatrixInput.forgetCollapsedBlockId(this.id);\n } else if (this.$collapsedInput) {\n this.$collapsedInput.val('');\n }\n\n this.collapsed = false;\n },\n\n disable: function () {\n this.$container.children('input[name$=\"[enabled]\"]:first').val('');\n this.$container.addClass('disabled');\n\n setTimeout(() => {\n this.$actionMenu\n .find('a[data-action=disable]:first')\n .parent()\n .addClass('hidden');\n this.$actionMenu\n .find('a[data-action=enable]:first')\n .parent()\n .removeClass('hidden');\n }, 200);\n\n this.collapse(true);\n },\n\n enable: function () {\n this.$container.children('input[name$=\"[enabled]\"]:first').val('1');\n this.$container.removeClass('disabled');\n\n setTimeout(() => {\n this.$actionMenu\n .find('a[data-action=disable]:first')\n .parent()\n .removeClass('hidden');\n this.$actionMenu\n .find('a[data-action=enable]:first')\n .parent()\n .addClass('hidden');\n }, 200);\n },\n\n moveUp: function () {\n this.matrix.trigger('beforeMoveBlockUp', {\n block: this,\n });\n let $prev = this.$container.prev('.matrixblock');\n if ($prev.length) {\n this.$container.insertBefore($prev);\n this.matrix.blockSelect.resetItemOrder();\n }\n this.matrix.trigger('moveBlockUp', {\n block: this,\n });\n },\n\n moveDown: function () {\n this.matrix.trigger('beforeMoveBlockDown', {\n block: this,\n });\n let $next = this.$container.next('.matrixblock');\n if ($next.length) {\n this.$container.insertAfter($next);\n this.matrix.blockSelect.resetItemOrder();\n }\n this.matrix.trigger('moveBlockDown', {\n block: this,\n });\n },\n\n handleActionClick: function (event) {\n event.preventDefault();\n this.onActionSelect(event.target);\n },\n\n handleActionKeydown: function (event) {\n const keyCode = event.keyCode;\n\n if (keyCode !== Garnish.SPACE_KEY) return;\n\n event.preventDefault();\n this.onActionSelect(event.target);\n },\n\n onActionSelect: function (option) {\n const batchAction =\n this.matrix.blockSelect.totalSelected > 1 &&\n this.matrix.blockSelect.isSelected(this.$container),\n $option = $(option);\n\n switch ($option.data('action')) {\n case 'collapse': {\n if (batchAction) {\n this.matrix.collapseSelectedBlocks();\n } else {\n this.collapse(true);\n }\n\n break;\n }\n\n case 'expand': {\n if (batchAction) {\n this.matrix.expandSelectedBlocks();\n } else {\n this.expand();\n }\n\n break;\n }\n\n case 'disable': {\n if (batchAction) {\n this.matrix.disableSelectedBlocks();\n } else {\n this.disable();\n }\n\n break;\n }\n\n case 'enable': {\n if (batchAction) {\n this.matrix.enableSelectedBlocks();\n } else {\n this.enable();\n this.expand();\n }\n\n break;\n }\n\n case 'moveUp': {\n this.moveUp();\n break;\n }\n\n case 'moveDown': {\n this.moveDown();\n break;\n }\n\n case 'add': {\n var type = $option.data('type');\n this.matrix.addBlock(type, this.$container);\n break;\n }\n\n case 'delete': {\n if (batchAction) {\n if (\n confirm(\n Craft.t(\n 'app',\n 'Are you sure you want to delete the selected blocks?'\n )\n )\n ) {\n this.matrix.deleteSelectedBlocks();\n }\n } else {\n this.selfDestruct();\n }\n\n break;\n }\n }\n\n this.actionDisclosure.hide();\n },\n\n selfDestruct: function () {\n // Remove any inputs from the form data\n $('[name]', this.$container).removeAttr('name');\n\n this.$container.velocity(\n this.matrix.getHiddenBlockCss(this.$container),\n 'fast',\n () => {\n this.$container.remove();\n this.matrix.updateAddBlockBtn();\n\n this.matrix.trigger('blockDeleted', {\n $block: this.$container,\n });\n }\n );\n },\n });\n})(jQuery);\n"],"names":["$","Craft","MatrixInput","Garnish","Base","extend","id","blockTypes","blockTypesByHandle","inputNamePrefix","inputIdPrefix","showingAddBlockMenu","addBlockBtnGroupWidth","addBlockBtnContainerWidth","$container","$blockContainer","$addBlockBtnContainer","$addBlockBtnGroup","$addBlockBtnGroupBtns","$statusMessage","blockSort","blockSelect","totalNewBlocks","init","settings","i","this","formatInputId","maxBlocks","setSettings","defaults","children","$addBlockMenuBtn","find","data","setNewBlockBtn","length","blockType","handle","$blocks","collapsedBlocks","getCollapsedBlockIds","DragSort","axis","filter","$targetItem","hasClass","getSelectedItems","collapseDraggees","magnetStrength","helperLagBase","helperOpacity","onDragStop","trigger","onSortChange","resetItemOrder","Select","multi","vertical","checkboxMode","$block","blockId","newMatch","match","parseInt","block","MatrixBlock","inArray","collapse","addListener","ev","type","target","addBlock","destroy","MenuBtn","onOptionSelect","option","updateAddBlockBtn","$doc","ready","bind","width","addClass","removeClass","navigator","userAgent","indexOf","requestAnimationFrame","css","canAddMoreBlocks","each","removeAttr","$items","eq","$actionMenu","parent","attr","updateStatusMessage","message","empty","t","setTimeout","text","$insertBefore","autofocus","actionMenuId","html","getBlockTypeByHandle","name","staticBlocks","window","draftEditor","pause","insertBefore","appendTo","$fieldsContainer","bodyHtml","getParsedBlockHtml","footHtml","getHiddenBlockCss","velocity","opacity","$bod","append","initUiElements","addItems","scrollContainerToElement","first","resume","collapseSelectedBlocks","callOnSelectedBlocks","expandSelectedBlocks","disableSelectedBlocks","enableSelectedBlocks","deleteSelectedBlocks","fn","$selectedItems","marginBottom","outerHeight","replace","RegExp","placeholderKey","collapsedBlockStorageKey","systemUid","localStorage","filterArray","split","setCollapsedBlockIds","ids","join","rememberCollapsedBlockId","Storage","push","forgetCollapsedBlockId","collapsedBlocksIndex","splice","matrix","$titlebar","$previewContainer","$collapsedInput","actionDisclosure","isNew","collapsed","substr","$actionMenuBtn","DisclosureMenu","on","prev","next","$actionMenuOptions","handleActionClick","handleActionKeydown","hasAttr","_handleTitleBarClick","preventDefault","toggle","expand","animate","previewHtml","$fields","$inputs","inputPreviewText","j","value","$input","$maybeLightswitchContainer","getText","_inputPreviewText","Array","trim","escapeHtml","duration","height","show","hide","val","is","labels","$options","k","$label","getInputPostVal","collapsedContainerHeight","expandedContainerHeight","displayValue","display","disable","enable","moveUp","$prev","moveDown","$next","insertAfter","event","onActionSelect","keyCode","SPACE_KEY","batchAction","totalSelected","isSelected","$option","confirm","selfDestruct","remove","jQuery"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"MatrixInput.js","mappings":"CAAA,SAA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,EAAK9C,mBA3/BzB,CAigCGiN","sources":["webpack:///./MatrixInput.js"],"sourcesContent":["(function ($) {\n /** global: Craft */\n /** global: Garnish */\n /**\n * Matrix input class\n */\n Craft.MatrixInput = Garnish.Base.extend(\n {\n id: null,\n blockTypes: null,\n blockTypesByHandle: null,\n inputNamePrefix: null,\n inputIdPrefix: null,\n\n showingAddBlockMenu: false,\n addBlockBtnGroupWidth: null,\n addBlockBtnContainerWidth: null,\n\n $container: null,\n $blockContainer: null,\n $addBlockBtnContainer: null,\n $addBlockBtnGroup: null,\n $addBlockBtnGroupBtns: null,\n $statusMessage: null,\n\n blockSort: null,\n blockSelect: null,\n totalNewBlocks: 0,\n\n init: function (id, blockTypes, inputNamePrefix, settings) {\n this.id = id;\n this.blockTypes = blockTypes;\n this.inputNamePrefix = inputNamePrefix;\n this.inputIdPrefix = Craft.formatInputId(this.inputNamePrefix);\n\n // see if settings was actually set to the maxBlocks value\n if (typeof settings === 'number') {\n settings = {maxBlocks: settings};\n }\n this.setSettings(settings, Craft.MatrixInput.defaults);\n\n this.$container = $('#' + this.id);\n this.$blockContainer = this.$container.children('.blocks');\n this.$addBlockBtnContainer = this.$container.children('.buttons');\n this.$addBlockBtnGroup =\n this.$addBlockBtnContainer.children('.btngroup');\n this.$addBlockBtnGroupBtns = this.$addBlockBtnGroup.children('.btn');\n this.$addBlockMenuBtn = this.$addBlockBtnContainer.children('.menubtn');\n this.$statusMessage = this.$container.find('[data-status-message]');\n\n this.$container.data('matrix', this);\n\n this.setNewBlockBtn();\n\n this.blockTypesByHandle = {};\n\n var i;\n\n for (i = 0; i < this.blockTypes.length; i++) {\n var blockType = this.blockTypes[i];\n this.blockTypesByHandle[blockType.handle] = blockType;\n }\n\n var $blocks = this.$blockContainer.children(),\n collapsedBlocks = Craft.MatrixInput.getCollapsedBlockIds();\n\n this.blockSort = new Garnish.DragSort($blocks, {\n handle: '> .actions > .move',\n axis: 'y',\n filter: () => {\n // Only return all the selected items if the target item is selected\n if (this.blockSort.$targetItem.hasClass('sel')) {\n return this.blockSelect.getSelectedItems();\n } else {\n return this.blockSort.$targetItem;\n }\n },\n collapseDraggees: true,\n magnetStrength: 4,\n helperLagBase: 1.5,\n helperOpacity: 0.9,\n onDragStop: () => {\n this.trigger('blockSortDragStop');\n },\n onSortChange: () => {\n this.blockSelect.resetItemOrder();\n },\n });\n\n this.blockSelect = new Garnish.Select(this.$blockContainer, $blocks, {\n multi: true,\n vertical: true,\n handle: '> .checkbox, > .titlebar',\n checkboxMode: true,\n });\n\n for (i = 0; i < $blocks.length; i++) {\n var $block = $($blocks[i]),\n blockId = $block.data('id');\n\n // Is this a new block?\n var newMatch =\n typeof blockId === 'string' && blockId.match(/new(\\d+)/);\n\n if (newMatch && newMatch[1] > this.totalNewBlocks) {\n this.totalNewBlocks = parseInt(newMatch[1]);\n }\n\n var block = new MatrixBlock(this, $block);\n\n if (block.id && $.inArray('' + block.id, collapsedBlocks) !== -1) {\n block.collapse();\n }\n }\n\n this.addListener(this.$addBlockBtnGroupBtns, 'click', function (ev) {\n var type = $(ev.target).data('type');\n this.addBlock(type);\n });\n\n this.$addBlockMenuBtn.menubtn();\n this.$addBlockMenuBtn.data('menubtn').on('optionSelect', (ev) => {\n this.addBlock($(ev.option).data('type'));\n });\n\n this.updateAddBlockBtn();\n\n this.addListener(this.$container, 'resize', 'setNewBlockBtn');\n Garnish.$doc.ready(this.setNewBlockBtn.bind(this));\n\n this.trigger('afterInit');\n },\n\n setNewBlockBtn: function () {\n // Do we know what the button group width is yet?\n if (!this.addBlockBtnGroupWidth) {\n this.addBlockBtnGroupWidth = this.$addBlockBtnGroup.width();\n\n if (!this.addBlockBtnGroupWidth) {\n return;\n }\n }\n\n // Only check if the container width has resized\n if (\n this.addBlockBtnContainerWidth !==\n (this.addBlockBtnContainerWidth = this.$addBlockBtnContainer.width())\n ) {\n if (this.addBlockBtnGroupWidth > this.addBlockBtnContainerWidth) {\n if (!this.showingAddBlockMenu) {\n this.$addBlockBtnGroup.addClass('hidden');\n this.$addBlockMenuBtn.removeClass('hidden');\n this.showingAddBlockMenu = true;\n }\n } else {\n if (this.showingAddBlockMenu) {\n this.$addBlockMenuBtn.addClass('hidden');\n this.$addBlockBtnGroup.removeClass('hidden');\n this.showingAddBlockMenu = false;\n\n // Because Safari is awesome\n if (navigator.userAgent.indexOf('Safari') !== -1) {\n Garnish.requestAnimationFrame(() => {\n this.$addBlockBtnGroup.css('opacity', 0.99);\n\n Garnish.requestAnimationFrame(() => {\n this.$addBlockBtnGroup.css('opacity', '');\n });\n });\n }\n }\n }\n }\n },\n\n canAddMoreBlocks: function () {\n return (\n !this.maxBlocks ||\n this.$blockContainer.children().length < this.maxBlocks\n );\n },\n\n updateAddBlockBtn: function () {\n var i, block;\n\n if (this.canAddMoreBlocks()) {\n this.$addBlockBtnGroup.removeClass('disabled');\n this.$addBlockMenuBtn.removeClass('disabled');\n\n this.$addBlockBtnGroupBtns.each(function () {\n $(this).removeAttr('aria-disabled');\n });\n\n for (i = 0; i < this.blockSelect.$items.length; i++) {\n block = this.blockSelect.$items.eq(i).data('block');\n\n if (block) {\n block.$actionMenu\n .find('a[data-action=add]')\n .parent()\n .removeClass('disabled');\n block.$actionMenu\n .find('a[data-action=add]')\n .removeAttr('aria-disabled');\n }\n }\n } else {\n this.$addBlockBtnGroup.addClass('disabled');\n this.$addBlockMenuBtn.addClass('disabled');\n\n this.$addBlockBtnGroupBtns.each(function () {\n $(this).attr('aria-disabled', 'true');\n });\n\n for (i = 0; i < this.blockSelect.$items.length; i++) {\n block = this.blockSelect.$items.eq(i).data('block');\n\n if (block) {\n block.$actionMenu\n .find('a[data-action=add]')\n .parent()\n .addClass('disabled');\n block.$actionMenu\n .find('a[data-action=add]')\n .attr('aria-disabled', 'true');\n }\n }\n }\n },\n\n updateStatusMessage: function () {\n this.$statusMessage.empty();\n let message;\n\n if (!this.canAddMoreBlocks()) {\n message = Craft.t(\n 'app',\n 'Matrix block could not be added. Maximum number of blocks reached.'\n );\n }\n\n setTimeout(() => {\n this.$statusMessage.text(message);\n }, 250);\n },\n\n addBlock: function (type, $insertBefore, autofocus) {\n if (!this.canAddMoreBlocks()) {\n this.updateStatusMessage();\n return;\n }\n\n this.totalNewBlocks++;\n\n var id = 'new' + this.totalNewBlocks;\n const actionMenuId = `matrixblock-action-menu-${id}`;\n\n var html = `\n
\n \n \n \n
\n
${\n this.getBlockTypeByHandle(type).name\n }
\n
\n
\n
\n
\n
\n
\n \n
\n `;\n\n if (!this.settings.staticBlocks) {\n html += `\n
\n \n
\n `;\n }\n\n html += `\n
\n
\n \n
\n
`;\n\n var $block = $(html);\n\n // Pause the draft editor\n if (window.draftEditor) {\n window.draftEditor.pause();\n }\n\n if ($insertBefore) {\n $block.insertBefore($insertBefore);\n } else {\n $block.appendTo(this.$blockContainer);\n }\n\n var $fieldsContainer = $('
').appendTo($block),\n bodyHtml = this.getParsedBlockHtml(\n this.blockTypesByHandle[type].bodyHtml,\n id\n ),\n footHtml = this.getParsedBlockHtml(\n this.blockTypesByHandle[type].footHtml,\n id\n );\n\n $(bodyHtml).appendTo($fieldsContainer);\n\n this.trigger('blockAdded', {\n $block: $block,\n });\n\n // Animate the block into position\n $block.css(this.getHiddenBlockCss($block)).velocity(\n {\n opacity: 1,\n 'margin-bottom': 10,\n },\n 'fast',\n () => {\n $block.css('margin-bottom', '');\n Garnish.$bod.append(footHtml);\n Craft.initUiElements($fieldsContainer);\n new MatrixBlock(this, $block);\n this.blockSort.addItems($block);\n this.blockSelect.addItems($block);\n this.updateAddBlockBtn();\n\n Garnish.requestAnimationFrame(function () {\n if (typeof autofocus === 'undefined' || autofocus) {\n // Scroll to the block\n Garnish.scrollContainerToElement($block);\n // Focus on the first text input\n $block.find('.text,[contenteditable]').first().trigger('focus');\n }\n\n // Resume the draft editor\n if (window.draftEditor) {\n window.draftEditor.resume();\n }\n });\n }\n );\n },\n\n getBlockTypeByHandle: function (handle) {\n for (var i = 0; i < this.blockTypes.length; i++) {\n if (this.blockTypes[i].handle === handle) {\n return this.blockTypes[i];\n }\n }\n },\n\n collapseSelectedBlocks: function () {\n this.callOnSelectedBlocks('collapse');\n },\n\n expandSelectedBlocks: function () {\n this.callOnSelectedBlocks('expand');\n },\n\n disableSelectedBlocks: function () {\n this.callOnSelectedBlocks('disable');\n },\n\n enableSelectedBlocks: function () {\n this.callOnSelectedBlocks('enable');\n },\n\n deleteSelectedBlocks: function () {\n this.callOnSelectedBlocks('selfDestruct');\n },\n\n callOnSelectedBlocks: function (fn) {\n for (var i = 0; i < this.blockSelect.$selectedItems.length; i++) {\n this.blockSelect.$selectedItems.eq(i).data('block')[fn]();\n }\n },\n\n getHiddenBlockCss: function ($block) {\n return {\n opacity: 0,\n marginBottom: -$block.outerHeight(),\n };\n },\n\n getParsedBlockHtml: function (html, id) {\n if (typeof html === 'string') {\n return html.replace(\n new RegExp(`__BLOCK_${this.settings.placeholderKey}__`, 'g'),\n id\n );\n } else {\n return '';\n }\n },\n\n get maxBlocks() {\n return this.settings.maxBlocks;\n },\n },\n {\n defaults: {\n placeholderKey: null,\n maxBlocks: null,\n staticBlocks: false,\n },\n\n collapsedBlockStorageKey:\n 'Craft-' + Craft.systemUid + '.MatrixInput.collapsedBlocks',\n\n getCollapsedBlockIds: function () {\n if (\n typeof localStorage[Craft.MatrixInput.collapsedBlockStorageKey] ===\n 'string'\n ) {\n return Craft.filterArray(\n localStorage[Craft.MatrixInput.collapsedBlockStorageKey].split(',')\n );\n } else {\n return [];\n }\n },\n\n setCollapsedBlockIds: function (ids) {\n localStorage[Craft.MatrixInput.collapsedBlockStorageKey] =\n ids.join(',');\n },\n\n rememberCollapsedBlockId: function (id) {\n if (typeof Storage !== 'undefined') {\n var collapsedBlocks = Craft.MatrixInput.getCollapsedBlockIds();\n\n if ($.inArray('' + id, collapsedBlocks) === -1) {\n collapsedBlocks.push(id);\n Craft.MatrixInput.setCollapsedBlockIds(collapsedBlocks);\n }\n }\n },\n\n forgetCollapsedBlockId: function (id) {\n if (typeof Storage !== 'undefined') {\n var collapsedBlocks = Craft.MatrixInput.getCollapsedBlockIds(),\n collapsedBlocksIndex = $.inArray('' + id, collapsedBlocks);\n\n if (collapsedBlocksIndex !== -1) {\n collapsedBlocks.splice(collapsedBlocksIndex, 1);\n Craft.MatrixInput.setCollapsedBlockIds(collapsedBlocks);\n }\n }\n },\n }\n );\n\n var MatrixBlock = Garnish.Base.extend({\n matrix: null,\n $container: null,\n $titlebar: null,\n $fieldsContainer: null,\n $previewContainer: null,\n $actionMenu: null,\n $collapsedInput: null,\n\n actionDisclosure: null,\n\n isNew: null,\n id: null,\n\n collapsed: false,\n\n init: function (matrix, $container) {\n this.matrix = matrix;\n this.$container = $container;\n this.$titlebar = $container.children('.titlebar');\n this.$previewContainer = this.$titlebar.children('.preview');\n this.$fieldsContainer = $container.children('.fields');\n\n this.$container.data('block', this);\n\n this.id = this.$container.data('id');\n this.isNew =\n !this.id ||\n (typeof this.id === 'string' && this.id.substr(0, 3) === 'new');\n\n const $actionMenuBtn = this.$container.find(\n '> .actions [data-disclosure-trigger]'\n );\n const actionDisclosure =\n $actionMenuBtn.data('trigger') ||\n new Garnish.DisclosureMenu($actionMenuBtn);\n\n this.$actionMenu = actionDisclosure.$container;\n this.actionDisclosure = actionDisclosure;\n\n actionDisclosure.on('show', () => {\n this.$container.addClass('active');\n if (this.$container.prev('.matrixblock').length) {\n this.$actionMenu\n .find('a[data-action=moveUp]:first')\n .parent()\n .removeClass('hidden');\n } else {\n this.$actionMenu\n .find('a[data-action=moveUp]:first')\n .parent()\n .addClass('hidden');\n }\n if (this.$container.next('.matrixblock').length) {\n this.$actionMenu\n .find('a[data-action=moveDown]:first')\n .parent()\n .removeClass('hidden');\n } else {\n this.$actionMenu\n .find('a[data-action=moveDown]:first')\n .parent()\n .addClass('hidden');\n }\n });\n\n actionDisclosure.on('hide', () => {\n this.$container.removeClass('active');\n });\n\n this.$actionMenuOptions = this.$actionMenu.find('a[data-action]');\n\n this.addListener(\n this.$actionMenuOptions,\n 'click',\n this.handleActionClick\n );\n this.addListener(\n this.$actionMenuOptions,\n 'keydown',\n this.handleActionKeydown\n );\n\n // Was this block already collapsed?\n if (Garnish.hasAttr(this.$container, 'data-collapsed')) {\n this.collapse();\n }\n\n this._handleTitleBarClick = function (ev) {\n ev.preventDefault();\n this.toggle();\n };\n\n this.addListener(this.$titlebar, 'doubletap', this._handleTitleBarClick);\n },\n\n toggle: function () {\n if (this.collapsed) {\n this.expand();\n } else {\n this.collapse(true);\n }\n },\n\n collapse: function (animate) {\n if (this.collapsed) {\n return;\n }\n\n this.$container.addClass('collapsed');\n\n var previewHtml = '',\n $fields = this.$fieldsContainer.children().children();\n\n for (var i = 0; i < $fields.length; i++) {\n var $field = $($fields[i]),\n $inputs = $field\n .children('.input')\n .find('select,input[type!=\"hidden\"],textarea,.label'),\n inputPreviewText = '';\n\n for (var j = 0; j < $inputs.length; j++) {\n var $input = $($inputs[j]),\n value;\n\n if ($input.hasClass('label')) {\n var $maybeLightswitchContainer = $input.parent().parent();\n\n if (\n $maybeLightswitchContainer.hasClass('lightswitch') &&\n (($maybeLightswitchContainer.hasClass('on') &&\n $input.hasClass('off')) ||\n (!$maybeLightswitchContainer.hasClass('on') &&\n $input.hasClass('on')))\n ) {\n continue;\n }\n\n value = $input.text();\n } else {\n value = Craft.getText(this._inputPreviewText($input));\n }\n\n if (value instanceof Array) {\n value = value.join(', ');\n }\n\n if (value) {\n value = Craft.trim(Craft.escapeHtml(value));\n\n if (value) {\n if (inputPreviewText) {\n inputPreviewText += ', ';\n }\n\n inputPreviewText += value;\n }\n }\n }\n\n if (inputPreviewText) {\n previewHtml +=\n (previewHtml ? ' | ' : '') + inputPreviewText;\n }\n }\n\n this.$previewContainer.html(previewHtml);\n\n this.$fieldsContainer.velocity('stop');\n this.$container.velocity('stop');\n\n if (animate) {\n this.$fieldsContainer.velocity('fadeOut', {duration: 'fast'});\n this.$container.velocity({height: 16}, 'fast');\n } else {\n this.$previewContainer.show();\n this.$fieldsContainer.hide();\n this.$container.css({height: 16});\n }\n\n setTimeout(() => {\n this.$actionMenu\n .find('a[data-action=collapse]:first')\n .parent()\n .addClass('hidden');\n this.$actionMenu\n .find('a[data-action=expand]:first')\n .parent()\n .removeClass('hidden');\n }, 200);\n\n // Remember that?\n if (!this.isNew) {\n Craft.MatrixInput.rememberCollapsedBlockId(this.id);\n } else {\n if (!this.$collapsedInput) {\n this.$collapsedInput = $(\n ''\n ).appendTo(this.$container);\n } else {\n this.$collapsedInput.val('1');\n }\n }\n\n this.collapsed = true;\n },\n\n _inputPreviewText: function ($input) {\n if ($input.is('select,multiselect')) {\n const labels = [];\n const $options = $input.find('option:selected');\n for (let k = 0; k < $options.length; k++) {\n labels.push($options.eq(k).text());\n }\n return labels;\n }\n\n if (\n $input.is('input[type=\"checkbox\"]:checked,input[type=\"radio\"]:checked')\n ) {\n const id = $input.attr('id');\n const $label = $(`label[for=\"${id}\"]`);\n if ($label.length) {\n return $label.text();\n }\n }\n\n return Garnish.getInputPostVal($input);\n },\n\n expand: function () {\n if (!this.collapsed) {\n return;\n }\n\n this.$container.removeClass('collapsed');\n\n this.$fieldsContainer.velocity('stop');\n this.$container.velocity('stop');\n\n var collapsedContainerHeight = this.$container.height();\n this.$container.height('auto');\n this.$fieldsContainer.show();\n var expandedContainerHeight = this.$container.height();\n var displayValue = this.$fieldsContainer.css('display') || 'block';\n this.$container.height(collapsedContainerHeight);\n this.$fieldsContainer\n .hide()\n .velocity('fadeIn', {duration: 'fast', display: displayValue});\n this.$container.velocity(\n {height: expandedContainerHeight},\n 'fast',\n () => {\n this.$previewContainer.html('');\n this.$container.height('auto');\n this.$container.trigger('scroll');\n }\n );\n\n setTimeout(() => {\n this.$actionMenu\n .find('a[data-action=collapse]:first')\n .parent()\n .removeClass('hidden');\n this.$actionMenu\n .find('a[data-action=expand]:first')\n .parent()\n .addClass('hidden');\n }, 200);\n\n // Remember that?\n if (!this.isNew && typeof Storage !== 'undefined') {\n var collapsedBlocks = Craft.MatrixInput.getCollapsedBlockIds(),\n collapsedBlocksIndex = $.inArray('' + this.id, collapsedBlocks);\n\n if (collapsedBlocksIndex !== -1) {\n collapsedBlocks.splice(collapsedBlocksIndex, 1);\n Craft.MatrixInput.setCollapsedBlockIds(collapsedBlocks);\n }\n }\n\n if (!this.isNew) {\n Craft.MatrixInput.forgetCollapsedBlockId(this.id);\n } else if (this.$collapsedInput) {\n this.$collapsedInput.val('');\n }\n\n this.collapsed = false;\n },\n\n disable: function () {\n this.$container.children('input[name$=\"[enabled]\"]:first').val('');\n this.$container.addClass('disabled');\n\n setTimeout(() => {\n this.$actionMenu\n .find('a[data-action=disable]:first')\n .parent()\n .addClass('hidden');\n this.$actionMenu\n .find('a[data-action=enable]:first')\n .parent()\n .removeClass('hidden');\n }, 200);\n\n this.collapse(true);\n },\n\n enable: function () {\n this.$container.children('input[name$=\"[enabled]\"]:first').val('1');\n this.$container.removeClass('disabled');\n\n setTimeout(() => {\n this.$actionMenu\n .find('a[data-action=disable]:first')\n .parent()\n .removeClass('hidden');\n this.$actionMenu\n .find('a[data-action=enable]:first')\n .parent()\n .addClass('hidden');\n }, 200);\n },\n\n moveUp: function () {\n this.matrix.trigger('beforeMoveBlockUp', {\n block: this,\n });\n let $prev = this.$container.prev('.matrixblock');\n if ($prev.length) {\n this.$container.insertBefore($prev);\n this.matrix.blockSelect.resetItemOrder();\n }\n this.matrix.trigger('moveBlockUp', {\n block: this,\n });\n },\n\n moveDown: function () {\n this.matrix.trigger('beforeMoveBlockDown', {\n block: this,\n });\n let $next = this.$container.next('.matrixblock');\n if ($next.length) {\n this.$container.insertAfter($next);\n this.matrix.blockSelect.resetItemOrder();\n }\n this.matrix.trigger('moveBlockDown', {\n block: this,\n });\n },\n\n handleActionClick: function (event) {\n event.preventDefault();\n this.onActionSelect(event.target);\n },\n\n handleActionKeydown: function (event) {\n const keyCode = event.keyCode;\n\n if (keyCode !== Garnish.SPACE_KEY) return;\n\n event.preventDefault();\n this.onActionSelect(event.target);\n },\n\n onActionSelect: function (option) {\n const batchAction =\n this.matrix.blockSelect.totalSelected > 1 &&\n this.matrix.blockSelect.isSelected(this.$container),\n $option = $(option);\n\n switch ($option.data('action')) {\n case 'collapse': {\n if (batchAction) {\n this.matrix.collapseSelectedBlocks();\n } else {\n this.collapse(true);\n }\n\n break;\n }\n\n case 'expand': {\n if (batchAction) {\n this.matrix.expandSelectedBlocks();\n } else {\n this.expand();\n }\n\n break;\n }\n\n case 'disable': {\n if (batchAction) {\n this.matrix.disableSelectedBlocks();\n } else {\n this.disable();\n }\n\n break;\n }\n\n case 'enable': {\n if (batchAction) {\n this.matrix.enableSelectedBlocks();\n } else {\n this.enable();\n this.expand();\n }\n\n break;\n }\n\n case 'moveUp': {\n this.moveUp();\n break;\n }\n\n case 'moveDown': {\n this.moveDown();\n break;\n }\n\n case 'add': {\n var type = $option.data('type');\n this.matrix.addBlock(type, this.$container);\n break;\n }\n\n case 'delete': {\n if (batchAction) {\n if (\n confirm(\n Craft.t(\n 'app',\n 'Are you sure you want to delete the selected blocks?'\n )\n )\n ) {\n this.matrix.deleteSelectedBlocks();\n }\n } else {\n this.selfDestruct();\n }\n\n break;\n }\n }\n\n this.actionDisclosure.hide();\n },\n\n selfDestruct: function () {\n // Remove any inputs from the form data\n $('[name]', this.$container).removeAttr('name');\n\n this.$container.velocity(\n this.matrix.getHiddenBlockCss(this.$container),\n 'fast',\n () => {\n this.$container.remove();\n this.matrix.updateAddBlockBtn();\n\n this.matrix.trigger('blockDeleted', {\n $block: this.$container,\n });\n }\n );\n },\n });\n})(jQuery);\n"],"names":["$","Craft","MatrixInput","Garnish","Base","extend","id","blockTypes","blockTypesByHandle","inputNamePrefix","inputIdPrefix","showingAddBlockMenu","addBlockBtnGroupWidth","addBlockBtnContainerWidth","$container","$blockContainer","$addBlockBtnContainer","$addBlockBtnGroup","$addBlockBtnGroupBtns","$statusMessage","blockSort","blockSelect","totalNewBlocks","init","settings","i","this","formatInputId","maxBlocks","setSettings","defaults","children","$addBlockMenuBtn","find","data","setNewBlockBtn","length","blockType","handle","$blocks","collapsedBlocks","getCollapsedBlockIds","DragSort","axis","filter","$targetItem","hasClass","getSelectedItems","collapseDraggees","magnetStrength","helperLagBase","helperOpacity","onDragStop","trigger","onSortChange","resetItemOrder","Select","multi","vertical","checkboxMode","$block","blockId","newMatch","match","parseInt","block","MatrixBlock","inArray","collapse","addListener","ev","type","target","addBlock","menubtn","on","option","updateAddBlockBtn","$doc","ready","bind","width","addClass","removeClass","navigator","userAgent","indexOf","requestAnimationFrame","css","canAddMoreBlocks","each","removeAttr","$items","eq","$actionMenu","parent","attr","updateStatusMessage","message","empty","t","setTimeout","text","$insertBefore","autofocus","actionMenuId","html","getBlockTypeByHandle","name","staticBlocks","window","draftEditor","pause","insertBefore","appendTo","$fieldsContainer","bodyHtml","getParsedBlockHtml","footHtml","getHiddenBlockCss","velocity","opacity","$bod","append","initUiElements","addItems","scrollContainerToElement","first","resume","collapseSelectedBlocks","callOnSelectedBlocks","expandSelectedBlocks","disableSelectedBlocks","enableSelectedBlocks","deleteSelectedBlocks","fn","$selectedItems","marginBottom","outerHeight","replace","RegExp","placeholderKey","collapsedBlockStorageKey","systemUid","localStorage","filterArray","split","setCollapsedBlockIds","ids","join","rememberCollapsedBlockId","Storage","push","forgetCollapsedBlockId","collapsedBlocksIndex","splice","matrix","$titlebar","$previewContainer","$collapsedInput","actionDisclosure","isNew","collapsed","substr","$actionMenuBtn","DisclosureMenu","prev","next","$actionMenuOptions","handleActionClick","handleActionKeydown","hasAttr","_handleTitleBarClick","preventDefault","toggle","expand","animate","previewHtml","$fields","$inputs","inputPreviewText","j","value","$input","$maybeLightswitchContainer","getText","_inputPreviewText","Array","trim","escapeHtml","duration","height","show","hide","val","is","labels","$options","k","$label","getInputPostVal","collapsedContainerHeight","expandedContainerHeight","displayValue","display","disable","enable","moveUp","$prev","moveDown","$next","insertAfter","event","onActionSelect","keyCode","SPACE_KEY","batchAction","totalSelected","isSelected","$option","confirm","selfDestruct","remove","jQuery"],"sourceRoot":""} \ No newline at end of file