Keine Beschreibung

edit-post.js 321KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492
  1. /******/ (function() { // webpackBootstrap
  2. /******/ var __webpack_modules__ = ({
  3. /***/ 4403:
  4. /***/ (function(module, exports) {
  5. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  6. Copyright (c) 2018 Jed Watson.
  7. Licensed under the MIT License (MIT), see
  8. http://jedwatson.github.io/classnames
  9. */
  10. /* global define */
  11. (function () {
  12. 'use strict';
  13. var hasOwn = {}.hasOwnProperty;
  14. function classNames() {
  15. var classes = [];
  16. for (var i = 0; i < arguments.length; i++) {
  17. var arg = arguments[i];
  18. if (!arg) continue;
  19. var argType = typeof arg;
  20. if (argType === 'string' || argType === 'number') {
  21. classes.push(arg);
  22. } else if (Array.isArray(arg)) {
  23. if (arg.length) {
  24. var inner = classNames.apply(null, arg);
  25. if (inner) {
  26. classes.push(inner);
  27. }
  28. }
  29. } else if (argType === 'object') {
  30. if (arg.toString === Object.prototype.toString) {
  31. for (var key in arg) {
  32. if (hasOwn.call(arg, key) && arg[key]) {
  33. classes.push(key);
  34. }
  35. }
  36. } else {
  37. classes.push(arg.toString());
  38. }
  39. }
  40. }
  41. return classes.join(' ');
  42. }
  43. if ( true && module.exports) {
  44. classNames.default = classNames;
  45. module.exports = classNames;
  46. } else if (true) {
  47. // register as 'classnames', consistent with npm package name
  48. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
  49. return classNames;
  50. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  51. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  52. } else {}
  53. }());
  54. /***/ })
  55. /******/ });
  56. /************************************************************************/
  57. /******/ // The module cache
  58. /******/ var __webpack_module_cache__ = {};
  59. /******/
  60. /******/ // The require function
  61. /******/ function __webpack_require__(moduleId) {
  62. /******/ // Check if module is in cache
  63. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  64. /******/ if (cachedModule !== undefined) {
  65. /******/ return cachedModule.exports;
  66. /******/ }
  67. /******/ // Create a new module (and put it into the cache)
  68. /******/ var module = __webpack_module_cache__[moduleId] = {
  69. /******/ // no module.id needed
  70. /******/ // no module.loaded needed
  71. /******/ exports: {}
  72. /******/ };
  73. /******/
  74. /******/ // Execute the module function
  75. /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
  76. /******/
  77. /******/ // Return the exports of the module
  78. /******/ return module.exports;
  79. /******/ }
  80. /******/
  81. /************************************************************************/
  82. /******/ /* webpack/runtime/compat get default export */
  83. /******/ !function() {
  84. /******/ // getDefaultExport function for compatibility with non-harmony modules
  85. /******/ __webpack_require__.n = function(module) {
  86. /******/ var getter = module && module.__esModule ?
  87. /******/ function() { return module['default']; } :
  88. /******/ function() { return module; };
  89. /******/ __webpack_require__.d(getter, { a: getter });
  90. /******/ return getter;
  91. /******/ };
  92. /******/ }();
  93. /******/
  94. /******/ /* webpack/runtime/define property getters */
  95. /******/ !function() {
  96. /******/ // define getter functions for harmony exports
  97. /******/ __webpack_require__.d = function(exports, definition) {
  98. /******/ for(var key in definition) {
  99. /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
  100. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  101. /******/ }
  102. /******/ }
  103. /******/ };
  104. /******/ }();
  105. /******/
  106. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  107. /******/ !function() {
  108. /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
  109. /******/ }();
  110. /******/
  111. /******/ /* webpack/runtime/make namespace object */
  112. /******/ !function() {
  113. /******/ // define __esModule on exports
  114. /******/ __webpack_require__.r = function(exports) {
  115. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  116. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  117. /******/ }
  118. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  119. /******/ };
  120. /******/ }();
  121. /******/
  122. /************************************************************************/
  123. var __webpack_exports__ = {};
  124. // This entry need to be wrapped in an IIFE because it need to be in strict mode.
  125. !function() {
  126. "use strict";
  127. // ESM COMPAT FLAG
  128. __webpack_require__.r(__webpack_exports__);
  129. // EXPORTS
  130. __webpack_require__.d(__webpack_exports__, {
  131. "PluginBlockSettingsMenuItem": function() { return /* reexport */ plugin_block_settings_menu_item; },
  132. "PluginDocumentSettingPanel": function() { return /* reexport */ plugin_document_setting_panel; },
  133. "PluginMoreMenuItem": function() { return /* reexport */ plugin_more_menu_item; },
  134. "PluginPostPublishPanel": function() { return /* reexport */ plugin_post_publish_panel; },
  135. "PluginPostStatusInfo": function() { return /* reexport */ plugin_post_status_info; },
  136. "PluginPrePublishPanel": function() { return /* reexport */ plugin_pre_publish_panel; },
  137. "PluginSidebar": function() { return /* reexport */ PluginSidebarEditPost; },
  138. "PluginSidebarMoreMenuItem": function() { return /* reexport */ PluginSidebarMoreMenuItem; },
  139. "__experimentalFullscreenModeClose": function() { return /* reexport */ fullscreen_mode_close; },
  140. "__experimentalMainDashboardButton": function() { return /* reexport */ main_dashboard_button; },
  141. "initializeEditor": function() { return /* binding */ initializeEditor; },
  142. "reinitializeEditor": function() { return /* binding */ reinitializeEditor; },
  143. "store": function() { return /* reexport */ store_store; }
  144. });
  145. // NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/store/actions.js
  146. var actions_namespaceObject = {};
  147. __webpack_require__.r(actions_namespaceObject);
  148. __webpack_require__.d(actions_namespaceObject, {
  149. "disableComplementaryArea": function() { return disableComplementaryArea; },
  150. "enableComplementaryArea": function() { return enableComplementaryArea; },
  151. "pinItem": function() { return pinItem; },
  152. "setFeatureDefaults": function() { return setFeatureDefaults; },
  153. "setFeatureValue": function() { return setFeatureValue; },
  154. "toggleFeature": function() { return toggleFeature; },
  155. "unpinItem": function() { return unpinItem; }
  156. });
  157. // NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/store/selectors.js
  158. var selectors_namespaceObject = {};
  159. __webpack_require__.r(selectors_namespaceObject);
  160. __webpack_require__.d(selectors_namespaceObject, {
  161. "getActiveComplementaryArea": function() { return getActiveComplementaryArea; },
  162. "isFeatureActive": function() { return isFeatureActive; },
  163. "isItemPinned": function() { return isItemPinned; }
  164. });
  165. // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-post/build-module/store/actions.js
  166. var store_actions_namespaceObject = {};
  167. __webpack_require__.r(store_actions_namespaceObject);
  168. __webpack_require__.d(store_actions_namespaceObject, {
  169. "__experimentalSetPreviewDeviceType": function() { return __experimentalSetPreviewDeviceType; },
  170. "__unstableCreateTemplate": function() { return __unstableCreateTemplate; },
  171. "__unstableSwitchToTemplateMode": function() { return __unstableSwitchToTemplateMode; },
  172. "closeGeneralSidebar": function() { return closeGeneralSidebar; },
  173. "closeModal": function() { return closeModal; },
  174. "closePublishSidebar": function() { return closePublishSidebar; },
  175. "hideBlockTypes": function() { return hideBlockTypes; },
  176. "initializeMetaBoxes": function() { return initializeMetaBoxes; },
  177. "metaBoxUpdatesFailure": function() { return metaBoxUpdatesFailure; },
  178. "metaBoxUpdatesSuccess": function() { return metaBoxUpdatesSuccess; },
  179. "openGeneralSidebar": function() { return openGeneralSidebar; },
  180. "openModal": function() { return openModal; },
  181. "openPublishSidebar": function() { return openPublishSidebar; },
  182. "removeEditorPanel": function() { return removeEditorPanel; },
  183. "requestMetaBoxUpdates": function() { return requestMetaBoxUpdates; },
  184. "setAvailableMetaBoxesPerLocation": function() { return setAvailableMetaBoxesPerLocation; },
  185. "setIsEditingTemplate": function() { return setIsEditingTemplate; },
  186. "setIsInserterOpened": function() { return setIsInserterOpened; },
  187. "setIsListViewOpened": function() { return setIsListViewOpened; },
  188. "showBlockTypes": function() { return showBlockTypes; },
  189. "switchEditorMode": function() { return switchEditorMode; },
  190. "toggleEditorPanelEnabled": function() { return toggleEditorPanelEnabled; },
  191. "toggleEditorPanelOpened": function() { return toggleEditorPanelOpened; },
  192. "toggleFeature": function() { return actions_toggleFeature; },
  193. "togglePinnedPluginItem": function() { return togglePinnedPluginItem; },
  194. "togglePublishSidebar": function() { return togglePublishSidebar; },
  195. "updatePreferredStyleVariations": function() { return updatePreferredStyleVariations; }
  196. });
  197. // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-post/build-module/store/selectors.js
  198. var store_selectors_namespaceObject = {};
  199. __webpack_require__.r(store_selectors_namespaceObject);
  200. __webpack_require__.d(store_selectors_namespaceObject, {
  201. "__experimentalGetInsertionPoint": function() { return __experimentalGetInsertionPoint; },
  202. "__experimentalGetPreviewDeviceType": function() { return __experimentalGetPreviewDeviceType; },
  203. "areMetaBoxesInitialized": function() { return areMetaBoxesInitialized; },
  204. "getActiveGeneralSidebarName": function() { return getActiveGeneralSidebarName; },
  205. "getActiveMetaBoxLocations": function() { return getActiveMetaBoxLocations; },
  206. "getAllMetaBoxes": function() { return getAllMetaBoxes; },
  207. "getEditedPostTemplate": function() { return getEditedPostTemplate; },
  208. "getEditorMode": function() { return getEditorMode; },
  209. "getHiddenBlockTypes": function() { return getHiddenBlockTypes; },
  210. "getMetaBoxesPerLocation": function() { return getMetaBoxesPerLocation; },
  211. "getPreference": function() { return getPreference; },
  212. "getPreferences": function() { return getPreferences; },
  213. "hasMetaBoxes": function() { return hasMetaBoxes; },
  214. "isEditingTemplate": function() { return selectors_isEditingTemplate; },
  215. "isEditorPanelEnabled": function() { return isEditorPanelEnabled; },
  216. "isEditorPanelOpened": function() { return isEditorPanelOpened; },
  217. "isEditorPanelRemoved": function() { return isEditorPanelRemoved; },
  218. "isEditorSidebarOpened": function() { return isEditorSidebarOpened; },
  219. "isFeatureActive": function() { return selectors_isFeatureActive; },
  220. "isInserterOpened": function() { return isInserterOpened; },
  221. "isListViewOpened": function() { return isListViewOpened; },
  222. "isMetaBoxLocationActive": function() { return isMetaBoxLocationActive; },
  223. "isMetaBoxLocationVisible": function() { return isMetaBoxLocationVisible; },
  224. "isModalActive": function() { return isModalActive; },
  225. "isPluginItemPinned": function() { return isPluginItemPinned; },
  226. "isPluginSidebarOpened": function() { return isPluginSidebarOpened; },
  227. "isPublishSidebarOpened": function() { return isPublishSidebarOpened; },
  228. "isSavingMetaBoxes": function() { return selectors_isSavingMetaBoxes; }
  229. });
  230. ;// CONCATENATED MODULE: external ["wp","element"]
  231. var external_wp_element_namespaceObject = window["wp"]["element"];
  232. ;// CONCATENATED MODULE: external ["wp","blocks"]
  233. var external_wp_blocks_namespaceObject = window["wp"]["blocks"];
  234. ;// CONCATENATED MODULE: external ["wp","blockLibrary"]
  235. var external_wp_blockLibrary_namespaceObject = window["wp"]["blockLibrary"];
  236. ;// CONCATENATED MODULE: external ["wp","data"]
  237. var external_wp_data_namespaceObject = window["wp"]["data"];
  238. ;// CONCATENATED MODULE: external ["wp","hooks"]
  239. var external_wp_hooks_namespaceObject = window["wp"]["hooks"];
  240. ;// CONCATENATED MODULE: external ["wp","preferences"]
  241. var external_wp_preferences_namespaceObject = window["wp"]["preferences"];
  242. ;// CONCATENATED MODULE: external ["wp","mediaUtils"]
  243. var external_wp_mediaUtils_namespaceObject = window["wp"]["mediaUtils"];
  244. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/hooks/components/index.js
  245. /**
  246. * WordPress dependencies
  247. */
  248. const replaceMediaUpload = () => external_wp_mediaUtils_namespaceObject.MediaUpload;
  249. (0,external_wp_hooks_namespaceObject.addFilter)('editor.MediaUpload', 'core/edit-post/replace-media-upload', replaceMediaUpload);
  250. ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
  251. function _extends() {
  252. _extends = Object.assign || function (target) {
  253. for (var i = 1; i < arguments.length; i++) {
  254. var source = arguments[i];
  255. for (var key in source) {
  256. if (Object.prototype.hasOwnProperty.call(source, key)) {
  257. target[key] = source[key];
  258. }
  259. }
  260. }
  261. return target;
  262. };
  263. return _extends.apply(this, arguments);
  264. }
  265. ;// CONCATENATED MODULE: external "lodash"
  266. var external_lodash_namespaceObject = window["lodash"];
  267. ;// CONCATENATED MODULE: external ["wp","components"]
  268. var external_wp_components_namespaceObject = window["wp"]["components"];
  269. ;// CONCATENATED MODULE: external ["wp","blockEditor"]
  270. var external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"];
  271. ;// CONCATENATED MODULE: external ["wp","i18n"]
  272. var external_wp_i18n_namespaceObject = window["wp"]["i18n"];
  273. ;// CONCATENATED MODULE: external ["wp","compose"]
  274. var external_wp_compose_namespaceObject = window["wp"]["compose"];
  275. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/hooks/validate-multiple-use/index.js
  276. /**
  277. * External dependencies
  278. */
  279. /**
  280. * WordPress dependencies
  281. */
  282. const enhance = (0,external_wp_compose_namespaceObject.compose)(
  283. /**
  284. * For blocks whose block type doesn't support `multiple`, provides the
  285. * wrapped component with `originalBlockClientId` -- a reference to the
  286. * first block of the same type in the content -- if and only if that
  287. * "original" block is not the current one. Thus, an inexisting
  288. * `originalBlockClientId` prop signals that the block is valid.
  289. *
  290. * @param {WPComponent} WrappedBlockEdit A filtered BlockEdit instance.
  291. *
  292. * @return {WPComponent} Enhanced component with merged state data props.
  293. */
  294. (0,external_wp_data_namespaceObject.withSelect)((select, block) => {
  295. const multiple = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(block.name, 'multiple', true); // For block types with `multiple` support, there is no "original
  296. // block" to be found in the content, as the block itself is valid.
  297. if (multiple) {
  298. return {};
  299. } // Otherwise, only pass `originalBlockClientId` if it refers to a different
  300. // block from the current one.
  301. const blocks = select(external_wp_blockEditor_namespaceObject.store).getBlocks();
  302. const firstOfSameType = (0,external_lodash_namespaceObject.find)(blocks, _ref => {
  303. let {
  304. name
  305. } = _ref;
  306. return block.name === name;
  307. });
  308. const isInvalid = firstOfSameType && firstOfSameType.clientId !== block.clientId;
  309. return {
  310. originalBlockClientId: isInvalid && firstOfSameType.clientId
  311. };
  312. }), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, _ref2) => {
  313. let {
  314. originalBlockClientId
  315. } = _ref2;
  316. return {
  317. selectFirst: () => dispatch(external_wp_blockEditor_namespaceObject.store).selectBlock(originalBlockClientId)
  318. };
  319. }));
  320. const withMultipleValidation = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => {
  321. return enhance(_ref3 => {
  322. let {
  323. originalBlockClientId,
  324. selectFirst,
  325. ...props
  326. } = _ref3;
  327. if (!originalBlockClientId) {
  328. return (0,external_wp_element_namespaceObject.createElement)(BlockEdit, props);
  329. }
  330. const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(props.name);
  331. const outboundType = getOutboundType(props.name);
  332. return [(0,external_wp_element_namespaceObject.createElement)("div", {
  333. key: "invalid-preview",
  334. style: {
  335. minHeight: '60px'
  336. }
  337. }, (0,external_wp_element_namespaceObject.createElement)(BlockEdit, _extends({
  338. key: "block-edit"
  339. }, props))), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, {
  340. key: "multiple-use-warning",
  341. actions: [(0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  342. key: "find-original",
  343. variant: "secondary",
  344. onClick: selectFirst
  345. }, (0,external_wp_i18n_namespaceObject.__)('Find original')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  346. key: "remove",
  347. variant: "secondary",
  348. onClick: () => props.onReplace([])
  349. }, (0,external_wp_i18n_namespaceObject.__)('Remove')), outboundType && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  350. key: "transform",
  351. variant: "secondary",
  352. onClick: () => props.onReplace((0,external_wp_blocks_namespaceObject.createBlock)(outboundType.name, props.attributes))
  353. }, (0,external_wp_i18n_namespaceObject.__)('Transform into:'), " ", outboundType.title)]
  354. }, (0,external_wp_element_namespaceObject.createElement)("strong", null, blockType === null || blockType === void 0 ? void 0 : blockType.title, ": "), (0,external_wp_i18n_namespaceObject.__)('This block can only be used once.'))];
  355. });
  356. }, 'withMultipleValidation');
  357. /**
  358. * Given a base block name, returns the default block type to which to offer
  359. * transforms.
  360. *
  361. * @param {string} blockName Base block name.
  362. *
  363. * @return {?Object} The chosen default block type.
  364. */
  365. function getOutboundType(blockName) {
  366. // Grab the first outbound transform.
  367. const transform = (0,external_wp_blocks_namespaceObject.findTransform)((0,external_wp_blocks_namespaceObject.getBlockTransforms)('to', blockName), _ref4 => {
  368. let {
  369. type,
  370. blocks
  371. } = _ref4;
  372. return type === 'block' && blocks.length === 1;
  373. } // What about when .length > 1?
  374. );
  375. if (!transform) {
  376. return null;
  377. }
  378. return (0,external_wp_blocks_namespaceObject.getBlockType)(transform.blocks[0]);
  379. }
  380. (0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockEdit', 'core/edit-post/validate-multiple-use/with-multiple-validation', withMultipleValidation);
  381. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/hooks/index.js
  382. /**
  383. * Internal dependencies
  384. */
  385. ;// CONCATENATED MODULE: external ["wp","primitives"]
  386. var external_wp_primitives_namespaceObject = window["wp"]["primitives"];
  387. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/external.js
  388. /**
  389. * WordPress dependencies
  390. */
  391. const external = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  392. xmlns: "http://www.w3.org/2000/svg",
  393. viewBox: "0 0 24 24"
  394. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  395. d: "M18.2 17c0 .7-.6 1.2-1.2 1.2H7c-.7 0-1.2-.6-1.2-1.2V7c0-.7.6-1.2 1.2-1.2h3.2V4.2H7C5.5 4.2 4.2 5.5 4.2 7v10c0 1.5 1.2 2.8 2.8 2.8h10c1.5 0 2.8-1.2 2.8-2.8v-3.6h-1.5V17zM14.9 3v1.5h3.7l-6.4 6.4 1.1 1.1 6.4-6.4v3.7h1.5V3h-6.3z"
  396. }));
  397. /* harmony default export */ var library_external = (external);
  398. ;// CONCATENATED MODULE: external ["wp","plugins"]
  399. var external_wp_plugins_namespaceObject = window["wp"]["plugins"];
  400. ;// CONCATENATED MODULE: external ["wp","url"]
  401. var external_wp_url_namespaceObject = window["wp"]["url"];
  402. ;// CONCATENATED MODULE: external ["wp","notices"]
  403. var external_wp_notices_namespaceObject = window["wp"]["notices"];
  404. ;// CONCATENATED MODULE: external ["wp","editor"]
  405. var external_wp_editor_namespaceObject = window["wp"]["editor"];
  406. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/plugins/copy-content-menu-item/index.js
  407. /**
  408. * WordPress dependencies
  409. */
  410. function CopyContentMenuItem() {
  411. const {
  412. createNotice
  413. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
  414. const getText = (0,external_wp_data_namespaceObject.useSelect)(select => () => select(external_wp_editor_namespaceObject.store).getEditedPostAttribute('content'), []);
  415. function onSuccess() {
  416. createNotice('info', (0,external_wp_i18n_namespaceObject.__)('All content copied.'), {
  417. isDismissible: true,
  418. type: 'snackbar'
  419. });
  420. }
  421. const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(getText, onSuccess);
  422. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
  423. ref: ref
  424. }, (0,external_wp_i18n_namespaceObject.__)('Copy all content'));
  425. }
  426. ;// CONCATENATED MODULE: external ["wp","keycodes"]
  427. var external_wp_keycodes_namespaceObject = window["wp"]["keycodes"];
  428. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/store/reducer.js
  429. /**
  430. * External dependencies
  431. */
  432. /**
  433. * WordPress dependencies
  434. */
  435. /**
  436. * Reducer storing the list of all programmatically removed panels.
  437. *
  438. * @param {Array} state Current state.
  439. * @param {Object} action Action object.
  440. *
  441. * @return {Array} Updated state.
  442. */
  443. function removedPanels() {
  444. let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  445. let action = arguments.length > 1 ? arguments[1] : undefined;
  446. switch (action.type) {
  447. case 'REMOVE_PANEL':
  448. if (!(0,external_lodash_namespaceObject.includes)(state, action.panelName)) {
  449. return [...state, action.panelName];
  450. }
  451. }
  452. return state;
  453. }
  454. /**
  455. * Reducer for storing the name of the open modal, or null if no modal is open.
  456. *
  457. * @param {Object} state Previous state.
  458. * @param {Object} action Action object containing the `name` of the modal
  459. *
  460. * @return {Object} Updated state
  461. */
  462. function activeModal() {
  463. let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  464. let action = arguments.length > 1 ? arguments[1] : undefined;
  465. switch (action.type) {
  466. case 'OPEN_MODAL':
  467. return action.name;
  468. case 'CLOSE_MODAL':
  469. return null;
  470. }
  471. return state;
  472. }
  473. function publishSidebarActive() {
  474. let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  475. let action = arguments.length > 1 ? arguments[1] : undefined;
  476. switch (action.type) {
  477. case 'OPEN_PUBLISH_SIDEBAR':
  478. return true;
  479. case 'CLOSE_PUBLISH_SIDEBAR':
  480. return false;
  481. case 'TOGGLE_PUBLISH_SIDEBAR':
  482. return !state;
  483. }
  484. return state;
  485. }
  486. /**
  487. * Reducer keeping track of the meta boxes isSaving state.
  488. * A "true" value means the meta boxes saving request is in-flight.
  489. *
  490. *
  491. * @param {boolean} state Previous state.
  492. * @param {Object} action Action Object.
  493. *
  494. * @return {Object} Updated state.
  495. */
  496. function isSavingMetaBoxes() {
  497. let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  498. let action = arguments.length > 1 ? arguments[1] : undefined;
  499. switch (action.type) {
  500. case 'REQUEST_META_BOX_UPDATES':
  501. return true;
  502. case 'META_BOX_UPDATES_SUCCESS':
  503. case 'META_BOX_UPDATES_FAILURE':
  504. return false;
  505. default:
  506. return state;
  507. }
  508. }
  509. /**
  510. * Reducer keeping track of the meta boxes per location.
  511. *
  512. * @param {boolean} state Previous state.
  513. * @param {Object} action Action Object.
  514. *
  515. * @return {Object} Updated state.
  516. */
  517. function metaBoxLocations() {
  518. let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  519. let action = arguments.length > 1 ? arguments[1] : undefined;
  520. switch (action.type) {
  521. case 'SET_META_BOXES_PER_LOCATIONS':
  522. return action.metaBoxesPerLocation;
  523. }
  524. return state;
  525. }
  526. /**
  527. * Reducer returning the editing canvas device type.
  528. *
  529. * @param {Object} state Current state.
  530. * @param {Object} action Dispatched action.
  531. *
  532. * @return {Object} Updated state.
  533. */
  534. function deviceType() {
  535. let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'Desktop';
  536. let action = arguments.length > 1 ? arguments[1] : undefined;
  537. switch (action.type) {
  538. case 'SET_PREVIEW_DEVICE_TYPE':
  539. return action.deviceType;
  540. }
  541. return state;
  542. }
  543. /**
  544. * Reducer to set the block inserter panel open or closed.
  545. *
  546. * Note: this reducer interacts with the list view panel reducer
  547. * to make sure that only one of the two panels is open at the same time.
  548. *
  549. * @param {Object} state Current state.
  550. * @param {Object} action Dispatched action.
  551. */
  552. function blockInserterPanel() {
  553. let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  554. let action = arguments.length > 1 ? arguments[1] : undefined;
  555. switch (action.type) {
  556. case 'SET_IS_LIST_VIEW_OPENED':
  557. return action.isOpen ? false : state;
  558. case 'SET_IS_INSERTER_OPENED':
  559. return action.value;
  560. }
  561. return state;
  562. }
  563. /**
  564. * Reducer to set the list view panel open or closed.
  565. *
  566. * Note: this reducer interacts with the inserter panel reducer
  567. * to make sure that only one of the two panels is open at the same time.
  568. *
  569. * @param {Object} state Current state.
  570. * @param {Object} action Dispatched action.
  571. */
  572. function listViewPanel() {
  573. let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  574. let action = arguments.length > 1 ? arguments[1] : undefined;
  575. switch (action.type) {
  576. case 'SET_IS_INSERTER_OPENED':
  577. return action.value ? false : state;
  578. case 'SET_IS_LIST_VIEW_OPENED':
  579. return action.isOpen;
  580. }
  581. return state;
  582. }
  583. /**
  584. * Reducer tracking whether the inserter is open.
  585. *
  586. * @param {boolean} state
  587. * @param {Object} action
  588. */
  589. function isEditingTemplate() {
  590. let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  591. let action = arguments.length > 1 ? arguments[1] : undefined;
  592. switch (action.type) {
  593. case 'SET_IS_EDITING_TEMPLATE':
  594. return action.value;
  595. }
  596. return state;
  597. }
  598. /**
  599. * Reducer tracking whether meta boxes are initialized.
  600. *
  601. * @param {boolean} state
  602. * @param {Object} action
  603. *
  604. * @return {boolean} Updated state.
  605. */
  606. function metaBoxesInitialized() {
  607. let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  608. let action = arguments.length > 1 ? arguments[1] : undefined;
  609. switch (action.type) {
  610. case 'META_BOXES_INITIALIZED':
  611. return true;
  612. }
  613. return state;
  614. }
  615. const metaBoxes = (0,external_wp_data_namespaceObject.combineReducers)({
  616. isSaving: isSavingMetaBoxes,
  617. locations: metaBoxLocations,
  618. initialized: metaBoxesInitialized
  619. });
  620. /* harmony default export */ var reducer = ((0,external_wp_data_namespaceObject.combineReducers)({
  621. activeModal,
  622. metaBoxes,
  623. publishSidebarActive,
  624. removedPanels,
  625. deviceType,
  626. blockInserterPanel,
  627. listViewPanel,
  628. isEditingTemplate
  629. }));
  630. ;// CONCATENATED MODULE: external ["wp","apiFetch"]
  631. var external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"];
  632. var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject);
  633. // EXTERNAL MODULE: ./node_modules/classnames/index.js
  634. var classnames = __webpack_require__(4403);
  635. var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
  636. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/check.js
  637. /**
  638. * WordPress dependencies
  639. */
  640. const check = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  641. xmlns: "http://www.w3.org/2000/svg",
  642. viewBox: "0 0 24 24"
  643. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  644. d: "M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"
  645. }));
  646. /* harmony default export */ var library_check = (check);
  647. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/star-filled.js
  648. /**
  649. * WordPress dependencies
  650. */
  651. const starFilled = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  652. xmlns: "http://www.w3.org/2000/svg",
  653. viewBox: "0 0 24 24"
  654. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  655. d: "M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z"
  656. }));
  657. /* harmony default export */ var star_filled = (starFilled);
  658. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/star-empty.js
  659. /**
  660. * WordPress dependencies
  661. */
  662. const starEmpty = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  663. xmlns: "http://www.w3.org/2000/svg",
  664. viewBox: "0 0 24 24"
  665. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  666. fillRule: "evenodd",
  667. d: "M9.706 8.646a.25.25 0 01-.188.137l-4.626.672a.25.25 0 00-.139.427l3.348 3.262a.25.25 0 01.072.222l-.79 4.607a.25.25 0 00.362.264l4.138-2.176a.25.25 0 01.233 0l4.137 2.175a.25.25 0 00.363-.263l-.79-4.607a.25.25 0 01.072-.222l3.347-3.262a.25.25 0 00-.139-.427l-4.626-.672a.25.25 0 01-.188-.137l-2.069-4.192a.25.25 0 00-.448 0L9.706 8.646zM12 7.39l-.948 1.921a1.75 1.75 0 01-1.317.957l-2.12.308 1.534 1.495c.412.402.6.982.503 1.55l-.362 2.11 1.896-.997a1.75 1.75 0 011.629 0l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39z",
  668. clipRule: "evenodd"
  669. }));
  670. /* harmony default export */ var star_empty = (starEmpty);
  671. ;// CONCATENATED MODULE: external ["wp","viewport"]
  672. var external_wp_viewport_namespaceObject = window["wp"]["viewport"];
  673. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close-small.js
  674. /**
  675. * WordPress dependencies
  676. */
  677. const closeSmall = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  678. xmlns: "http://www.w3.org/2000/svg",
  679. viewBox: "0 0 24 24"
  680. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  681. d: "M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"
  682. }));
  683. /* harmony default export */ var close_small = (closeSmall);
  684. ;// CONCATENATED MODULE: external ["wp","deprecated"]
  685. var external_wp_deprecated_namespaceObject = window["wp"]["deprecated"];
  686. var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject);
  687. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/actions.js
  688. /**
  689. * WordPress dependencies
  690. */
  691. /**
  692. * Enable the complementary area.
  693. *
  694. * @param {string} scope Complementary area scope.
  695. * @param {string} area Area identifier.
  696. */
  697. const enableComplementaryArea = (scope, area) => _ref => {
  698. let {
  699. registry
  700. } = _ref;
  701. // Return early if there's no area.
  702. if (!area) {
  703. return;
  704. }
  705. registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'complementaryArea', area);
  706. };
  707. /**
  708. * Disable the complementary area.
  709. *
  710. * @param {string} scope Complementary area scope.
  711. */
  712. const disableComplementaryArea = scope => _ref2 => {
  713. let {
  714. registry
  715. } = _ref2;
  716. registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'complementaryArea', null);
  717. };
  718. /**
  719. * Pins an item.
  720. *
  721. * @param {string} scope Item scope.
  722. * @param {string} item Item identifier.
  723. *
  724. * @return {Object} Action object.
  725. */
  726. const pinItem = (scope, item) => _ref3 => {
  727. let {
  728. registry
  729. } = _ref3;
  730. // Return early if there's no item.
  731. if (!item) {
  732. return;
  733. }
  734. const pinnedItems = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems'); // The item is already pinned, there's nothing to do.
  735. if ((pinnedItems === null || pinnedItems === void 0 ? void 0 : pinnedItems[item]) === true) {
  736. return;
  737. }
  738. registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'pinnedItems', { ...pinnedItems,
  739. [item]: true
  740. });
  741. };
  742. /**
  743. * Unpins an item.
  744. *
  745. * @param {string} scope Item scope.
  746. * @param {string} item Item identifier.
  747. */
  748. const unpinItem = (scope, item) => _ref4 => {
  749. let {
  750. registry
  751. } = _ref4;
  752. // Return early if there's no item.
  753. if (!item) {
  754. return;
  755. }
  756. const pinnedItems = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems');
  757. registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'pinnedItems', { ...pinnedItems,
  758. [item]: false
  759. });
  760. };
  761. /**
  762. * Returns an action object used in signalling that a feature should be toggled.
  763. *
  764. * @param {string} scope The feature scope (e.g. core/edit-post).
  765. * @param {string} featureName The feature name.
  766. */
  767. function toggleFeature(scope, featureName) {
  768. return function (_ref5) {
  769. let {
  770. registry
  771. } = _ref5;
  772. external_wp_deprecated_default()(`dispatch( 'core/interface' ).toggleFeature`, {
  773. since: '6.0',
  774. alternative: `dispatch( 'core/preferences' ).toggle`
  775. });
  776. registry.dispatch(external_wp_preferences_namespaceObject.store).toggle(scope, featureName);
  777. };
  778. }
  779. /**
  780. * Returns an action object used in signalling that a feature should be set to
  781. * a true or false value
  782. *
  783. * @param {string} scope The feature scope (e.g. core/edit-post).
  784. * @param {string} featureName The feature name.
  785. * @param {boolean} value The value to set.
  786. *
  787. * @return {Object} Action object.
  788. */
  789. function setFeatureValue(scope, featureName, value) {
  790. return function (_ref6) {
  791. let {
  792. registry
  793. } = _ref6;
  794. external_wp_deprecated_default()(`dispatch( 'core/interface' ).setFeatureValue`, {
  795. since: '6.0',
  796. alternative: `dispatch( 'core/preferences' ).set`
  797. });
  798. registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, featureName, !!value);
  799. };
  800. }
  801. /**
  802. * Returns an action object used in signalling that defaults should be set for features.
  803. *
  804. * @param {string} scope The feature scope (e.g. core/edit-post).
  805. * @param {Object<string, boolean>} defaults A key/value map of feature names to values.
  806. *
  807. * @return {Object} Action object.
  808. */
  809. function setFeatureDefaults(scope, defaults) {
  810. return function (_ref7) {
  811. let {
  812. registry
  813. } = _ref7;
  814. external_wp_deprecated_default()(`dispatch( 'core/interface' ).setFeatureDefaults`, {
  815. since: '6.0',
  816. alternative: `dispatch( 'core/preferences' ).setDefaults`
  817. });
  818. registry.dispatch(external_wp_preferences_namespaceObject.store).setDefaults(scope, defaults);
  819. };
  820. }
  821. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/selectors.js
  822. /**
  823. * WordPress dependencies
  824. */
  825. /**
  826. * Returns the complementary area that is active in a given scope.
  827. *
  828. * @param {Object} state Global application state.
  829. * @param {string} scope Item scope.
  830. *
  831. * @return {string} The complementary area that is active in the given scope.
  832. */
  833. const getActiveComplementaryArea = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope) => {
  834. return select(external_wp_preferences_namespaceObject.store).get(scope, 'complementaryArea');
  835. });
  836. /**
  837. * Returns a boolean indicating if an item is pinned or not.
  838. *
  839. * @param {Object} state Global application state.
  840. * @param {string} scope Scope.
  841. * @param {string} item Item to check.
  842. *
  843. * @return {boolean} True if the item is pinned and false otherwise.
  844. */
  845. const isItemPinned = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope, item) => {
  846. var _pinnedItems$item;
  847. const pinnedItems = select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems');
  848. return (_pinnedItems$item = pinnedItems === null || pinnedItems === void 0 ? void 0 : pinnedItems[item]) !== null && _pinnedItems$item !== void 0 ? _pinnedItems$item : true;
  849. });
  850. /**
  851. * Returns a boolean indicating whether a feature is active for a particular
  852. * scope.
  853. *
  854. * @param {Object} state The store state.
  855. * @param {string} scope The scope of the feature (e.g. core/edit-post).
  856. * @param {string} featureName The name of the feature.
  857. *
  858. * @return {boolean} Is the feature enabled?
  859. */
  860. const isFeatureActive = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope, featureName) => {
  861. external_wp_deprecated_default()(`select( 'core/interface' ).isFeatureActive( scope, featureName )`, {
  862. since: '6.0',
  863. alternative: `select( 'core/preferences' ).get( scope, featureName )`
  864. });
  865. return !!select(external_wp_preferences_namespaceObject.store).get(scope, featureName);
  866. });
  867. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/constants.js
  868. /**
  869. * The identifier for the data store.
  870. *
  871. * @type {string}
  872. */
  873. const STORE_NAME = 'core/interface';
  874. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/index.js
  875. /**
  876. * WordPress dependencies
  877. */
  878. /**
  879. * Internal dependencies
  880. */
  881. /**
  882. * Store definition for the interface namespace.
  883. *
  884. * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
  885. *
  886. * @type {Object}
  887. */
  888. const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, {
  889. reducer: () => {},
  890. actions: actions_namespaceObject,
  891. selectors: selectors_namespaceObject
  892. }); // Once we build a more generic persistence plugin that works across types of stores
  893. // we'd be able to replace this with a register call.
  894. (0,external_wp_data_namespaceObject.register)(store);
  895. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-context/index.js
  896. /**
  897. * WordPress dependencies
  898. */
  899. /* harmony default export */ var complementary_area_context = ((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => {
  900. return {
  901. icon: ownProps.icon || context.icon,
  902. identifier: ownProps.identifier || `${context.name}/${ownProps.name}`
  903. };
  904. }));
  905. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-toggle/index.js
  906. /**
  907. * External dependencies
  908. */
  909. /**
  910. * WordPress dependencies
  911. */
  912. /**
  913. * Internal dependencies
  914. */
  915. function ComplementaryAreaToggle(_ref) {
  916. let {
  917. as = external_wp_components_namespaceObject.Button,
  918. scope,
  919. identifier,
  920. icon,
  921. selectedIcon,
  922. ...props
  923. } = _ref;
  924. const ComponentToUse = as;
  925. const isSelected = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getActiveComplementaryArea(scope) === identifier, [identifier]);
  926. const {
  927. enableComplementaryArea,
  928. disableComplementaryArea
  929. } = (0,external_wp_data_namespaceObject.useDispatch)(store);
  930. return (0,external_wp_element_namespaceObject.createElement)(ComponentToUse, _extends({
  931. icon: selectedIcon && isSelected ? selectedIcon : icon,
  932. onClick: () => {
  933. if (isSelected) {
  934. disableComplementaryArea(scope);
  935. } else {
  936. enableComplementaryArea(scope, identifier);
  937. }
  938. }
  939. }, (0,external_lodash_namespaceObject.omit)(props, ['name'])));
  940. }
  941. /* harmony default export */ var complementary_area_toggle = (complementary_area_context(ComplementaryAreaToggle));
  942. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-header/index.js
  943. /**
  944. * External dependencies
  945. */
  946. /**
  947. * WordPress dependencies
  948. */
  949. /**
  950. * Internal dependencies
  951. */
  952. const ComplementaryAreaHeader = _ref => {
  953. let {
  954. smallScreenTitle,
  955. children,
  956. className,
  957. toggleButtonProps
  958. } = _ref;
  959. const toggleButton = (0,external_wp_element_namespaceObject.createElement)(complementary_area_toggle, _extends({
  960. icon: close_small
  961. }, toggleButtonProps));
  962. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", {
  963. className: "components-panel__header interface-complementary-area-header__small"
  964. }, smallScreenTitle && (0,external_wp_element_namespaceObject.createElement)("span", {
  965. className: "interface-complementary-area-header__small-title"
  966. }, smallScreenTitle), toggleButton), (0,external_wp_element_namespaceObject.createElement)("div", {
  967. className: classnames_default()('components-panel__header', 'interface-complementary-area-header', className),
  968. tabIndex: -1
  969. }, children, toggleButton));
  970. };
  971. /* harmony default export */ var complementary_area_header = (ComplementaryAreaHeader);
  972. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/action-item/index.js
  973. /**
  974. * External dependencies
  975. */
  976. /**
  977. * WordPress dependencies
  978. */
  979. function ActionItemSlot(_ref) {
  980. let {
  981. name,
  982. as: Component = external_wp_components_namespaceObject.ButtonGroup,
  983. fillProps = {},
  984. bubblesVirtually,
  985. ...props
  986. } = _ref;
  987. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Slot, {
  988. name: name,
  989. bubblesVirtually: bubblesVirtually,
  990. fillProps: fillProps
  991. }, fills => {
  992. if ((0,external_lodash_namespaceObject.isEmpty)(external_wp_element_namespaceObject.Children.toArray(fills))) {
  993. return null;
  994. } // Special handling exists for backward compatibility.
  995. // It ensures that menu items created by plugin authors aren't
  996. // duplicated with automatically injected menu items coming
  997. // from pinnable plugin sidebars.
  998. // @see https://github.com/WordPress/gutenberg/issues/14457
  999. const initializedByPlugins = [];
  1000. external_wp_element_namespaceObject.Children.forEach(fills, _ref2 => {
  1001. let {
  1002. props: {
  1003. __unstableExplicitMenuItem,
  1004. __unstableTarget
  1005. }
  1006. } = _ref2;
  1007. if (__unstableTarget && __unstableExplicitMenuItem) {
  1008. initializedByPlugins.push(__unstableTarget);
  1009. }
  1010. });
  1011. const children = external_wp_element_namespaceObject.Children.map(fills, child => {
  1012. if (!child.props.__unstableExplicitMenuItem && initializedByPlugins.includes(child.props.__unstableTarget)) {
  1013. return null;
  1014. }
  1015. return child;
  1016. });
  1017. return (0,external_wp_element_namespaceObject.createElement)(Component, props, children);
  1018. });
  1019. }
  1020. function ActionItem(_ref3) {
  1021. let {
  1022. name,
  1023. as: Component = external_wp_components_namespaceObject.Button,
  1024. onClick,
  1025. ...props
  1026. } = _ref3;
  1027. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Fill, {
  1028. name: name
  1029. }, _ref4 => {
  1030. let {
  1031. onClick: fpOnClick
  1032. } = _ref4;
  1033. return (0,external_wp_element_namespaceObject.createElement)(Component, _extends({
  1034. onClick: onClick || fpOnClick ? function () {
  1035. (onClick || external_lodash_namespaceObject.noop)(...arguments);
  1036. (fpOnClick || external_lodash_namespaceObject.noop)(...arguments);
  1037. } : undefined
  1038. }, props));
  1039. });
  1040. }
  1041. ActionItem.Slot = ActionItemSlot;
  1042. /* harmony default export */ var action_item = (ActionItem);
  1043. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-more-menu-item/index.js
  1044. /**
  1045. * External dependencies
  1046. */
  1047. /**
  1048. * WordPress dependencies
  1049. */
  1050. /**
  1051. * Internal dependencies
  1052. */
  1053. const PluginsMenuItem = props => // Menu item is marked with unstable prop for backward compatibility.
  1054. // They are removed so they don't leak to DOM elements.
  1055. // @see https://github.com/WordPress/gutenberg/issues/14457
  1056. (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, (0,external_lodash_namespaceObject.omit)(props, ['__unstableExplicitMenuItem', '__unstableTarget']));
  1057. function ComplementaryAreaMoreMenuItem(_ref) {
  1058. let {
  1059. scope,
  1060. target,
  1061. __unstableExplicitMenuItem,
  1062. ...props
  1063. } = _ref;
  1064. return (0,external_wp_element_namespaceObject.createElement)(complementary_area_toggle, _extends({
  1065. as: toggleProps => {
  1066. return (0,external_wp_element_namespaceObject.createElement)(action_item, _extends({
  1067. __unstableExplicitMenuItem: __unstableExplicitMenuItem,
  1068. __unstableTarget: `${scope}/${target}`,
  1069. as: PluginsMenuItem,
  1070. name: `${scope}/plugin-more-menu`
  1071. }, toggleProps));
  1072. },
  1073. role: "menuitemcheckbox",
  1074. selectedIcon: library_check,
  1075. name: target,
  1076. scope: scope
  1077. }, props));
  1078. }
  1079. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/pinned-items/index.js
  1080. /**
  1081. * External dependencies
  1082. */
  1083. /**
  1084. * WordPress dependencies
  1085. */
  1086. function PinnedItems(_ref) {
  1087. let {
  1088. scope,
  1089. ...props
  1090. } = _ref;
  1091. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Fill, _extends({
  1092. name: `PinnedItems/${scope}`
  1093. }, props));
  1094. }
  1095. function PinnedItemsSlot(_ref2) {
  1096. let {
  1097. scope,
  1098. className,
  1099. ...props
  1100. } = _ref2;
  1101. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Slot, _extends({
  1102. name: `PinnedItems/${scope}`
  1103. }, props), fills => !(0,external_lodash_namespaceObject.isEmpty)(fills) && (0,external_wp_element_namespaceObject.createElement)("div", {
  1104. className: classnames_default()(className, 'interface-pinned-items')
  1105. }, fills));
  1106. }
  1107. PinnedItems.Slot = PinnedItemsSlot;
  1108. /* harmony default export */ var pinned_items = (PinnedItems);
  1109. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area/index.js
  1110. /**
  1111. * External dependencies
  1112. */
  1113. /**
  1114. * WordPress dependencies
  1115. */
  1116. /**
  1117. * Internal dependencies
  1118. */
  1119. function ComplementaryAreaSlot(_ref) {
  1120. let {
  1121. scope,
  1122. ...props
  1123. } = _ref;
  1124. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Slot, _extends({
  1125. name: `ComplementaryArea/${scope}`
  1126. }, props));
  1127. }
  1128. function ComplementaryAreaFill(_ref2) {
  1129. let {
  1130. scope,
  1131. children,
  1132. className
  1133. } = _ref2;
  1134. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Fill, {
  1135. name: `ComplementaryArea/${scope}`
  1136. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  1137. className: className
  1138. }, children));
  1139. }
  1140. function useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall) {
  1141. const previousIsSmall = (0,external_wp_element_namespaceObject.useRef)(false);
  1142. const shouldOpenWhenNotSmall = (0,external_wp_element_namespaceObject.useRef)(false);
  1143. const {
  1144. enableComplementaryArea,
  1145. disableComplementaryArea
  1146. } = (0,external_wp_data_namespaceObject.useDispatch)(store);
  1147. (0,external_wp_element_namespaceObject.useEffect)(() => {
  1148. // If the complementary area is active and the editor is switching from a big to a small window size.
  1149. if (isActive && isSmall && !previousIsSmall.current) {
  1150. // Disable the complementary area.
  1151. disableComplementaryArea(scope); // Flag the complementary area to be reopened when the window size goes from small to big.
  1152. shouldOpenWhenNotSmall.current = true;
  1153. } else if ( // If there is a flag indicating the complementary area should be enabled when we go from small to big window size
  1154. // and we are going from a small to big window size.
  1155. shouldOpenWhenNotSmall.current && !isSmall && previousIsSmall.current) {
  1156. // Remove the flag indicating the complementary area should be enabled.
  1157. shouldOpenWhenNotSmall.current = false; // Enable the complementary area.
  1158. enableComplementaryArea(scope, identifier);
  1159. } else if ( // If the flag is indicating the current complementary should be reopened but another complementary area becomes active,
  1160. // remove the flag.
  1161. shouldOpenWhenNotSmall.current && activeArea && activeArea !== identifier) {
  1162. shouldOpenWhenNotSmall.current = false;
  1163. }
  1164. if (isSmall !== previousIsSmall.current) {
  1165. previousIsSmall.current = isSmall;
  1166. }
  1167. }, [isActive, isSmall, scope, identifier, activeArea]);
  1168. }
  1169. function ComplementaryArea(_ref3) {
  1170. let {
  1171. children,
  1172. className,
  1173. closeLabel = (0,external_wp_i18n_namespaceObject.__)('Close plugin'),
  1174. identifier,
  1175. header,
  1176. headerClassName,
  1177. icon,
  1178. isPinnable = true,
  1179. panelClassName,
  1180. scope,
  1181. name,
  1182. smallScreenTitle,
  1183. title,
  1184. toggleShortcut,
  1185. isActiveByDefault,
  1186. showIconLabels = false
  1187. } = _ref3;
  1188. const {
  1189. isActive,
  1190. isPinned,
  1191. activeArea,
  1192. isSmall,
  1193. isLarge
  1194. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  1195. const {
  1196. getActiveComplementaryArea,
  1197. isItemPinned
  1198. } = select(store);
  1199. const _activeArea = getActiveComplementaryArea(scope);
  1200. return {
  1201. isActive: _activeArea === identifier,
  1202. isPinned: isItemPinned(scope, identifier),
  1203. activeArea: _activeArea,
  1204. isSmall: select(external_wp_viewport_namespaceObject.store).isViewportMatch('< medium'),
  1205. isLarge: select(external_wp_viewport_namespaceObject.store).isViewportMatch('large')
  1206. };
  1207. }, [identifier, scope]);
  1208. useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall);
  1209. const {
  1210. enableComplementaryArea,
  1211. disableComplementaryArea,
  1212. pinItem,
  1213. unpinItem
  1214. } = (0,external_wp_data_namespaceObject.useDispatch)(store);
  1215. (0,external_wp_element_namespaceObject.useEffect)(() => {
  1216. if (isActiveByDefault && activeArea === undefined && !isSmall) {
  1217. enableComplementaryArea(scope, identifier);
  1218. }
  1219. }, [activeArea, isActiveByDefault, scope, identifier, isSmall]);
  1220. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, isPinnable && (0,external_wp_element_namespaceObject.createElement)(pinned_items, {
  1221. scope: scope
  1222. }, isPinned && (0,external_wp_element_namespaceObject.createElement)(complementary_area_toggle, {
  1223. scope: scope,
  1224. identifier: identifier,
  1225. isPressed: isActive && (!showIconLabels || isLarge),
  1226. "aria-expanded": isActive,
  1227. label: title,
  1228. icon: showIconLabels ? library_check : icon,
  1229. showTooltip: !showIconLabels,
  1230. variant: showIconLabels ? 'tertiary' : undefined
  1231. })), name && isPinnable && (0,external_wp_element_namespaceObject.createElement)(ComplementaryAreaMoreMenuItem, {
  1232. target: name,
  1233. scope: scope,
  1234. icon: icon
  1235. }, title), isActive && (0,external_wp_element_namespaceObject.createElement)(ComplementaryAreaFill, {
  1236. className: classnames_default()('interface-complementary-area', className),
  1237. scope: scope
  1238. }, (0,external_wp_element_namespaceObject.createElement)(complementary_area_header, {
  1239. className: headerClassName,
  1240. closeLabel: closeLabel,
  1241. onClose: () => disableComplementaryArea(scope),
  1242. smallScreenTitle: smallScreenTitle,
  1243. toggleButtonProps: {
  1244. label: closeLabel,
  1245. shortcut: toggleShortcut,
  1246. scope,
  1247. identifier
  1248. }
  1249. }, header || (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("strong", null, title), isPinnable && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  1250. className: "interface-complementary-area__pin-unpin-item",
  1251. icon: isPinned ? star_filled : star_empty,
  1252. label: isPinned ? (0,external_wp_i18n_namespaceObject.__)('Unpin from toolbar') : (0,external_wp_i18n_namespaceObject.__)('Pin to toolbar'),
  1253. onClick: () => (isPinned ? unpinItem : pinItem)(scope, identifier),
  1254. isPressed: isPinned,
  1255. "aria-expanded": isPinned
  1256. }))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Panel, {
  1257. className: panelClassName
  1258. }, children)));
  1259. }
  1260. const ComplementaryAreaWrapped = complementary_area_context(ComplementaryArea);
  1261. ComplementaryAreaWrapped.Slot = ComplementaryAreaSlot;
  1262. /* harmony default export */ var complementary_area = (ComplementaryAreaWrapped);
  1263. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/fullscreen-mode/index.js
  1264. /**
  1265. * WordPress dependencies
  1266. */
  1267. const FullscreenMode = _ref => {
  1268. let {
  1269. isActive
  1270. } = _ref;
  1271. (0,external_wp_element_namespaceObject.useEffect)(() => {
  1272. let isSticky = false; // `is-fullscreen-mode` is set in PHP as a body class by Gutenberg, and this causes
  1273. // `sticky-menu` to be applied by WordPress and prevents the admin menu being scrolled
  1274. // even if `is-fullscreen-mode` is then removed. Let's remove `sticky-menu` here as
  1275. // a consequence of the FullscreenMode setup.
  1276. if (document.body.classList.contains('sticky-menu')) {
  1277. isSticky = true;
  1278. document.body.classList.remove('sticky-menu');
  1279. }
  1280. return () => {
  1281. if (isSticky) {
  1282. document.body.classList.add('sticky-menu');
  1283. }
  1284. };
  1285. }, []);
  1286. (0,external_wp_element_namespaceObject.useEffect)(() => {
  1287. if (isActive) {
  1288. document.body.classList.add('is-fullscreen-mode');
  1289. } else {
  1290. document.body.classList.remove('is-fullscreen-mode');
  1291. }
  1292. return () => {
  1293. if (isActive) {
  1294. document.body.classList.remove('is-fullscreen-mode');
  1295. }
  1296. };
  1297. }, [isActive]);
  1298. return null;
  1299. };
  1300. /* harmony default export */ var fullscreen_mode = (FullscreenMode);
  1301. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/interface-skeleton/index.js
  1302. /**
  1303. * External dependencies
  1304. */
  1305. /**
  1306. * WordPress dependencies
  1307. */
  1308. /**
  1309. * WordPress dependencies
  1310. */
  1311. function useHTMLClass(className) {
  1312. (0,external_wp_element_namespaceObject.useEffect)(() => {
  1313. const element = document && document.querySelector(`html:not(.${className})`);
  1314. if (!element) {
  1315. return;
  1316. }
  1317. element.classList.toggle(className);
  1318. return () => {
  1319. element.classList.toggle(className);
  1320. };
  1321. }, [className]);
  1322. }
  1323. function InterfaceSkeleton(_ref, ref) {
  1324. let {
  1325. footer,
  1326. header,
  1327. sidebar,
  1328. secondarySidebar,
  1329. notices,
  1330. content,
  1331. drawer,
  1332. actions,
  1333. labels,
  1334. className,
  1335. shortcuts
  1336. } = _ref;
  1337. const navigateRegionsProps = (0,external_wp_components_namespaceObject.__unstableUseNavigateRegions)(shortcuts);
  1338. useHTMLClass('interface-interface-skeleton__html-container');
  1339. const defaultLabels = {
  1340. /* translators: accessibility text for the nav bar landmark region. */
  1341. drawer: (0,external_wp_i18n_namespaceObject.__)('Drawer'),
  1342. /* translators: accessibility text for the top bar landmark region. */
  1343. header: (0,external_wp_i18n_namespaceObject.__)('Header'),
  1344. /* translators: accessibility text for the content landmark region. */
  1345. body: (0,external_wp_i18n_namespaceObject.__)('Content'),
  1346. /* translators: accessibility text for the secondary sidebar landmark region. */
  1347. secondarySidebar: (0,external_wp_i18n_namespaceObject.__)('Block Library'),
  1348. /* translators: accessibility text for the settings landmark region. */
  1349. sidebar: (0,external_wp_i18n_namespaceObject.__)('Settings'),
  1350. /* translators: accessibility text for the publish landmark region. */
  1351. actions: (0,external_wp_i18n_namespaceObject.__)('Publish'),
  1352. /* translators: accessibility text for the footer landmark region. */
  1353. footer: (0,external_wp_i18n_namespaceObject.__)('Footer')
  1354. };
  1355. const mergedLabels = { ...defaultLabels,
  1356. ...labels
  1357. };
  1358. return (0,external_wp_element_namespaceObject.createElement)("div", _extends({}, navigateRegionsProps, {
  1359. ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, navigateRegionsProps.ref]),
  1360. className: classnames_default()(className, 'interface-interface-skeleton', navigateRegionsProps.className, !!footer && 'has-footer')
  1361. }), !!drawer && (0,external_wp_element_namespaceObject.createElement)("div", {
  1362. className: "interface-interface-skeleton__drawer",
  1363. role: "region",
  1364. "aria-label": mergedLabels.drawer,
  1365. tabIndex: "-1"
  1366. }, drawer), (0,external_wp_element_namespaceObject.createElement)("div", {
  1367. className: "interface-interface-skeleton__editor"
  1368. }, !!header && (0,external_wp_element_namespaceObject.createElement)("div", {
  1369. className: "interface-interface-skeleton__header",
  1370. role: "region",
  1371. "aria-label": mergedLabels.header,
  1372. tabIndex: "-1"
  1373. }, header), (0,external_wp_element_namespaceObject.createElement)("div", {
  1374. className: "interface-interface-skeleton__body"
  1375. }, !!secondarySidebar && (0,external_wp_element_namespaceObject.createElement)("div", {
  1376. className: "interface-interface-skeleton__secondary-sidebar",
  1377. role: "region",
  1378. "aria-label": mergedLabels.secondarySidebar,
  1379. tabIndex: "-1"
  1380. }, secondarySidebar), !!notices && (0,external_wp_element_namespaceObject.createElement)("div", {
  1381. className: "interface-interface-skeleton__notices"
  1382. }, notices), (0,external_wp_element_namespaceObject.createElement)("div", {
  1383. className: "interface-interface-skeleton__content",
  1384. role: "region",
  1385. "aria-label": mergedLabels.body,
  1386. tabIndex: "-1"
  1387. }, content), !!sidebar && (0,external_wp_element_namespaceObject.createElement)("div", {
  1388. className: "interface-interface-skeleton__sidebar",
  1389. role: "region",
  1390. "aria-label": mergedLabels.sidebar,
  1391. tabIndex: "-1"
  1392. }, sidebar), !!actions && (0,external_wp_element_namespaceObject.createElement)("div", {
  1393. className: "interface-interface-skeleton__actions",
  1394. role: "region",
  1395. "aria-label": mergedLabels.actions,
  1396. tabIndex: "-1"
  1397. }, actions))), !!footer && (0,external_wp_element_namespaceObject.createElement)("div", {
  1398. className: "interface-interface-skeleton__footer",
  1399. role: "region",
  1400. "aria-label": mergedLabels.footer,
  1401. tabIndex: "-1"
  1402. }, footer));
  1403. }
  1404. /* harmony default export */ var interface_skeleton = ((0,external_wp_element_namespaceObject.forwardRef)(InterfaceSkeleton));
  1405. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/more-vertical.js
  1406. /**
  1407. * WordPress dependencies
  1408. */
  1409. const moreVertical = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  1410. xmlns: "http://www.w3.org/2000/svg",
  1411. viewBox: "0 0 24 24"
  1412. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  1413. d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"
  1414. }));
  1415. /* harmony default export */ var more_vertical = (moreVertical);
  1416. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/more-menu-dropdown/index.js
  1417. /**
  1418. * External dependencies
  1419. */
  1420. /**
  1421. * WordPress dependencies
  1422. */
  1423. function MoreMenuDropdown(_ref) {
  1424. let {
  1425. as: DropdownComponent = external_wp_components_namespaceObject.DropdownMenu,
  1426. className,
  1427. /* translators: button label text should, if possible, be under 16 characters. */
  1428. label = (0,external_wp_i18n_namespaceObject.__)('Options'),
  1429. popoverProps,
  1430. toggleProps,
  1431. children
  1432. } = _ref;
  1433. return (0,external_wp_element_namespaceObject.createElement)(DropdownComponent, {
  1434. className: classnames_default()('interface-more-menu-dropdown', className),
  1435. icon: more_vertical,
  1436. label: label,
  1437. popoverProps: {
  1438. position: 'bottom left',
  1439. ...popoverProps,
  1440. className: classnames_default()('interface-more-menu-dropdown__content', popoverProps === null || popoverProps === void 0 ? void 0 : popoverProps.className)
  1441. },
  1442. toggleProps: {
  1443. tooltipPosition: 'bottom',
  1444. ...toggleProps
  1445. }
  1446. }, onClose => children(onClose));
  1447. }
  1448. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/preferences-modal/index.js
  1449. /**
  1450. * WordPress dependencies
  1451. */
  1452. function PreferencesModal(_ref) {
  1453. let {
  1454. closeModal,
  1455. children
  1456. } = _ref;
  1457. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
  1458. className: "interface-preferences-modal",
  1459. title: (0,external_wp_i18n_namespaceObject.__)('Preferences'),
  1460. closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close'),
  1461. onRequestClose: closeModal
  1462. }, children);
  1463. }
  1464. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/icon/index.js
  1465. /**
  1466. * WordPress dependencies
  1467. */
  1468. /** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */
  1469. /**
  1470. * Return an SVG icon.
  1471. *
  1472. * @param {IconProps} props icon is the SVG component to render
  1473. * size is a number specifiying the icon size in pixels
  1474. * Other props will be passed to wrapped SVG component
  1475. *
  1476. * @return {JSX.Element} Icon component
  1477. */
  1478. function Icon(_ref) {
  1479. let {
  1480. icon,
  1481. size = 24,
  1482. ...props
  1483. } = _ref;
  1484. return (0,external_wp_element_namespaceObject.cloneElement)(icon, {
  1485. width: size,
  1486. height: size,
  1487. ...props
  1488. });
  1489. }
  1490. /* harmony default export */ var icon = (Icon);
  1491. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-left.js
  1492. /**
  1493. * WordPress dependencies
  1494. */
  1495. const chevronLeft = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  1496. xmlns: "http://www.w3.org/2000/svg",
  1497. viewBox: "0 0 24 24"
  1498. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  1499. d: "M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z"
  1500. }));
  1501. /* harmony default export */ var chevron_left = (chevronLeft);
  1502. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-right.js
  1503. /**
  1504. * WordPress dependencies
  1505. */
  1506. const chevronRight = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  1507. xmlns: "http://www.w3.org/2000/svg",
  1508. viewBox: "0 0 24 24"
  1509. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  1510. d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z"
  1511. }));
  1512. /* harmony default export */ var chevron_right = (chevronRight);
  1513. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/preferences-modal-tabs/index.js
  1514. /**
  1515. * WordPress dependencies
  1516. */
  1517. const PREFERENCES_MENU = 'preferences-menu';
  1518. function PreferencesModalTabs(_ref) {
  1519. let {
  1520. sections
  1521. } = _ref;
  1522. const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium'); // This is also used to sync the two different rendered components
  1523. // between small and large viewports.
  1524. const [activeMenu, setActiveMenu] = (0,external_wp_element_namespaceObject.useState)(PREFERENCES_MENU);
  1525. /**
  1526. * Create helper objects from `sections` for easier data handling.
  1527. * `tabs` is used for creating the `TabPanel` and `sectionsContentMap`
  1528. * is used for easier access to active tab's content.
  1529. */
  1530. const {
  1531. tabs,
  1532. sectionsContentMap
  1533. } = (0,external_wp_element_namespaceObject.useMemo)(() => {
  1534. let mappedTabs = {
  1535. tabs: [],
  1536. sectionsContentMap: {}
  1537. };
  1538. if (sections.length) {
  1539. mappedTabs = sections.reduce((accumulator, _ref2) => {
  1540. let {
  1541. name,
  1542. tabLabel: title,
  1543. content
  1544. } = _ref2;
  1545. accumulator.tabs.push({
  1546. name,
  1547. title
  1548. });
  1549. accumulator.sectionsContentMap[name] = content;
  1550. return accumulator;
  1551. }, {
  1552. tabs: [],
  1553. sectionsContentMap: {}
  1554. });
  1555. }
  1556. return mappedTabs;
  1557. }, [sections]);
  1558. const getCurrentTab = (0,external_wp_element_namespaceObject.useCallback)(tab => sectionsContentMap[tab.name] || null, [sectionsContentMap]);
  1559. let modalContent; // We render different components based on the viewport size.
  1560. if (isLargeViewport) {
  1561. modalContent = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TabPanel, {
  1562. className: "interface-preferences__tabs",
  1563. tabs: tabs,
  1564. initialTabName: activeMenu !== PREFERENCES_MENU ? activeMenu : undefined,
  1565. onSelect: setActiveMenu,
  1566. orientation: "vertical"
  1567. }, getCurrentTab);
  1568. } else {
  1569. modalContent = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorProvider, {
  1570. initialPath: "/",
  1571. className: "interface-preferences__provider"
  1572. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, {
  1573. path: "/"
  1574. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Card, {
  1575. isBorderless: true,
  1576. size: "small"
  1577. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CardBody, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, null, tabs.map(tab => {
  1578. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorButton, {
  1579. key: tab.name,
  1580. path: tab.name,
  1581. as: external_wp_components_namespaceObject.__experimentalItem,
  1582. isAction: true
  1583. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
  1584. justify: "space-between"
  1585. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalTruncate, null, tab.title)), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(icon, {
  1586. icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right
  1587. }))));
  1588. }))))), sections.length && sections.map(section => {
  1589. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, {
  1590. key: `${section.name}-menu`,
  1591. path: section.name
  1592. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Card, {
  1593. isBorderless: true,
  1594. size: "large"
  1595. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CardHeader, {
  1596. isBorderless: false,
  1597. justify: "left",
  1598. size: "small",
  1599. gap: "6"
  1600. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorBackButton, {
  1601. icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left,
  1602. "aria-label": (0,external_wp_i18n_namespaceObject.__)('Navigate to the previous view')
  1603. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalText, {
  1604. size: "16"
  1605. }, section.tabLabel)), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CardBody, null, section.content)));
  1606. }));
  1607. }
  1608. return modalContent;
  1609. }
  1610. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/preferences-modal-section/index.js
  1611. const Section = _ref => {
  1612. let {
  1613. description,
  1614. title,
  1615. children
  1616. } = _ref;
  1617. return (0,external_wp_element_namespaceObject.createElement)("fieldset", {
  1618. className: "interface-preferences-modal__section"
  1619. }, (0,external_wp_element_namespaceObject.createElement)("legend", null, (0,external_wp_element_namespaceObject.createElement)("h2", {
  1620. className: "interface-preferences-modal__section-title"
  1621. }, title), description && (0,external_wp_element_namespaceObject.createElement)("p", {
  1622. className: "interface-preferences-modal__section-description"
  1623. }, description)), children);
  1624. };
  1625. /* harmony default export */ var preferences_modal_section = (Section);
  1626. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/preferences-modal-base-option/index.js
  1627. /**
  1628. * WordPress dependencies
  1629. */
  1630. function BaseOption(_ref) {
  1631. let {
  1632. help,
  1633. label,
  1634. isChecked,
  1635. onChange,
  1636. children
  1637. } = _ref;
  1638. return (0,external_wp_element_namespaceObject.createElement)("div", {
  1639. className: "interface-preferences-modal__option"
  1640. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
  1641. help: help,
  1642. label: label,
  1643. checked: isChecked,
  1644. onChange: onChange
  1645. }), children);
  1646. }
  1647. /* harmony default export */ var preferences_modal_base_option = (BaseOption);
  1648. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/index.js
  1649. ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/index.js
  1650. ;// CONCATENATED MODULE: external ["wp","a11y"]
  1651. var external_wp_a11y_namespaceObject = window["wp"]["a11y"];
  1652. ;// CONCATENATED MODULE: external ["wp","coreData"]
  1653. var external_wp_coreData_namespaceObject = window["wp"]["coreData"];
  1654. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/utils/meta-boxes.js
  1655. /**
  1656. * Function returning the current Meta Boxes DOM Node in the editor
  1657. * whether the meta box area is opened or not.
  1658. * If the MetaBox Area is visible returns it, and returns the original container instead.
  1659. *
  1660. * @param {string} location Meta Box location.
  1661. *
  1662. * @return {string} HTML content.
  1663. */
  1664. const getMetaBoxContainer = location => {
  1665. const area = document.querySelector(`.edit-post-meta-boxes-area.is-${location} .metabox-location-${location}`);
  1666. if (area) {
  1667. return area;
  1668. }
  1669. return document.querySelector('#metaboxes .metabox-location-' + location);
  1670. };
  1671. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/store/actions.js
  1672. /**
  1673. * External dependencies
  1674. */
  1675. /**
  1676. * WordPress dependencies
  1677. */
  1678. /**
  1679. * Internal dependencies
  1680. */
  1681. /**
  1682. * Returns an action object used in signalling that the user opened an editor sidebar.
  1683. *
  1684. * @param {?string} name Sidebar name to be opened.
  1685. */
  1686. const openGeneralSidebar = name => _ref => {
  1687. let {
  1688. registry
  1689. } = _ref;
  1690. return registry.dispatch(store).enableComplementaryArea(store_store.name, name);
  1691. };
  1692. /**
  1693. * Returns an action object signalling that the user closed the sidebar.
  1694. */
  1695. const closeGeneralSidebar = () => _ref2 => {
  1696. let {
  1697. registry
  1698. } = _ref2;
  1699. return registry.dispatch(store).disableComplementaryArea(store_store.name);
  1700. };
  1701. /**
  1702. * Returns an action object used in signalling that the user opened a modal.
  1703. *
  1704. * @param {string} name A string that uniquely identifies the modal.
  1705. *
  1706. * @return {Object} Action object.
  1707. */
  1708. function openModal(name) {
  1709. return {
  1710. type: 'OPEN_MODAL',
  1711. name
  1712. };
  1713. }
  1714. /**
  1715. * Returns an action object signalling that the user closed a modal.
  1716. *
  1717. * @return {Object} Action object.
  1718. */
  1719. function closeModal() {
  1720. return {
  1721. type: 'CLOSE_MODAL'
  1722. };
  1723. }
  1724. /**
  1725. * Returns an action object used in signalling that the user opened the publish
  1726. * sidebar.
  1727. *
  1728. * @return {Object} Action object
  1729. */
  1730. function openPublishSidebar() {
  1731. return {
  1732. type: 'OPEN_PUBLISH_SIDEBAR'
  1733. };
  1734. }
  1735. /**
  1736. * Returns an action object used in signalling that the user closed the
  1737. * publish sidebar.
  1738. *
  1739. * @return {Object} Action object.
  1740. */
  1741. function closePublishSidebar() {
  1742. return {
  1743. type: 'CLOSE_PUBLISH_SIDEBAR'
  1744. };
  1745. }
  1746. /**
  1747. * Returns an action object used in signalling that the user toggles the publish sidebar.
  1748. *
  1749. * @return {Object} Action object
  1750. */
  1751. function togglePublishSidebar() {
  1752. return {
  1753. type: 'TOGGLE_PUBLISH_SIDEBAR'
  1754. };
  1755. }
  1756. /**
  1757. * Returns an action object used to enable or disable a panel in the editor.
  1758. *
  1759. * @param {string} panelName A string that identifies the panel to enable or disable.
  1760. *
  1761. * @return {Object} Action object.
  1762. */
  1763. const toggleEditorPanelEnabled = panelName => _ref3 => {
  1764. var _registry$select$get;
  1765. let {
  1766. registry
  1767. } = _ref3;
  1768. const inactivePanels = (_registry$select$get = registry.select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'inactivePanels')) !== null && _registry$select$get !== void 0 ? _registry$select$get : [];
  1769. const isPanelInactive = !!(inactivePanels !== null && inactivePanels !== void 0 && inactivePanels.includes(panelName)); // If the panel is inactive, remove it to enable it, else add it to
  1770. // make it inactive.
  1771. let updatedInactivePanels;
  1772. if (isPanelInactive) {
  1773. updatedInactivePanels = inactivePanels.filter(invactivePanelName => invactivePanelName !== panelName);
  1774. } else {
  1775. updatedInactivePanels = [...inactivePanels, panelName];
  1776. }
  1777. registry.dispatch(external_wp_preferences_namespaceObject.store).set('core/edit-post', 'inactivePanels', updatedInactivePanels);
  1778. };
  1779. /**
  1780. * Opens a closed panel and closes an open panel.
  1781. *
  1782. * @param {string} panelName A string that identifies the panel to open or close.
  1783. */
  1784. const toggleEditorPanelOpened = panelName => _ref4 => {
  1785. var _registry$select$get2;
  1786. let {
  1787. registry
  1788. } = _ref4;
  1789. const openPanels = (_registry$select$get2 = registry.select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'openPanels')) !== null && _registry$select$get2 !== void 0 ? _registry$select$get2 : [];
  1790. const isPanelOpen = !!(openPanels !== null && openPanels !== void 0 && openPanels.includes(panelName)); // If the panel is open, remove it to close it, else add it to
  1791. // make it open.
  1792. let updatedOpenPanels;
  1793. if (isPanelOpen) {
  1794. updatedOpenPanels = openPanels.filter(openPanelName => openPanelName !== panelName);
  1795. } else {
  1796. updatedOpenPanels = [...openPanels, panelName];
  1797. }
  1798. registry.dispatch(external_wp_preferences_namespaceObject.store).set('core/edit-post', 'openPanels', updatedOpenPanels);
  1799. };
  1800. /**
  1801. * Returns an action object used to remove a panel from the editor.
  1802. *
  1803. * @param {string} panelName A string that identifies the panel to remove.
  1804. *
  1805. * @return {Object} Action object.
  1806. */
  1807. function removeEditorPanel(panelName) {
  1808. return {
  1809. type: 'REMOVE_PANEL',
  1810. panelName
  1811. };
  1812. }
  1813. /**
  1814. * Triggers an action used to toggle a feature flag.
  1815. *
  1816. * @param {string} feature Feature name.
  1817. */
  1818. const actions_toggleFeature = feature => _ref5 => {
  1819. let {
  1820. registry
  1821. } = _ref5;
  1822. return registry.dispatch(external_wp_preferences_namespaceObject.store).toggle('core/edit-post', feature);
  1823. };
  1824. /**
  1825. * Triggers an action used to switch editor mode.
  1826. *
  1827. * @param {string} mode The editor mode.
  1828. */
  1829. const switchEditorMode = mode => _ref6 => {
  1830. let {
  1831. registry
  1832. } = _ref6;
  1833. registry.dispatch(external_wp_preferences_namespaceObject.store).set('core/edit-post', 'editorMode', mode); // Unselect blocks when we switch to the code editor.
  1834. if (mode !== 'visual') {
  1835. registry.dispatch(external_wp_blockEditor_namespaceObject.store).clearSelectedBlock();
  1836. }
  1837. const message = mode === 'visual' ? (0,external_wp_i18n_namespaceObject.__)('Visual editor selected') : (0,external_wp_i18n_namespaceObject.__)('Code editor selected');
  1838. (0,external_wp_a11y_namespaceObject.speak)(message, 'assertive');
  1839. };
  1840. /**
  1841. * Triggers an action object used to toggle a plugin name flag.
  1842. *
  1843. * @param {string} pluginName Plugin name.
  1844. */
  1845. const togglePinnedPluginItem = pluginName => _ref7 => {
  1846. let {
  1847. registry
  1848. } = _ref7;
  1849. const isPinned = registry.select(store).isItemPinned('core/edit-post', pluginName);
  1850. registry.dispatch(store)[isPinned ? 'unpinItem' : 'pinItem']('core/edit-post', pluginName);
  1851. };
  1852. /**
  1853. * Returns an action object used in signaling that a style should be auto-applied when a block is created.
  1854. *
  1855. * @param {string} blockName Name of the block.
  1856. * @param {?string} blockStyle Name of the style that should be auto applied. If undefined, the "auto apply" setting of the block is removed.
  1857. */
  1858. const updatePreferredStyleVariations = (blockName, blockStyle) => _ref8 => {
  1859. var _registry$select$get3;
  1860. let {
  1861. registry
  1862. } = _ref8;
  1863. if (!blockName) {
  1864. return;
  1865. }
  1866. const existingVariations = (_registry$select$get3 = registry.select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'preferredStyleVariations')) !== null && _registry$select$get3 !== void 0 ? _registry$select$get3 : {}; // When the blockStyle is omitted, remove the block's preferred variation.
  1867. if (!blockStyle) {
  1868. const updatedVariations = { ...existingVariations
  1869. };
  1870. delete updatedVariations[blockName];
  1871. registry.dispatch(external_wp_preferences_namespaceObject.store).set('core/edit-post', 'preferredStyleVariations', updatedVariations);
  1872. } else {
  1873. // Else add the variation.
  1874. registry.dispatch(external_wp_preferences_namespaceObject.store).set('core/edit-post', 'preferredStyleVariations', { ...existingVariations,
  1875. [blockName]: blockStyle
  1876. });
  1877. }
  1878. };
  1879. /**
  1880. * Update the provided block types to be visible.
  1881. *
  1882. * @param {string[]} blockNames Names of block types to show.
  1883. */
  1884. const showBlockTypes = blockNames => _ref9 => {
  1885. var _registry$select$get4;
  1886. let {
  1887. registry
  1888. } = _ref9;
  1889. const existingBlockNames = (_registry$select$get4 = registry.select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'hiddenBlockTypes')) !== null && _registry$select$get4 !== void 0 ? _registry$select$get4 : [];
  1890. const newBlockNames = (0,external_lodash_namespaceObject.without)(existingBlockNames, ...(0,external_lodash_namespaceObject.castArray)(blockNames));
  1891. registry.dispatch(external_wp_preferences_namespaceObject.store).set('core/edit-post', 'hiddenBlockTypes', newBlockNames);
  1892. };
  1893. /**
  1894. * Update the provided block types to be hidden.
  1895. *
  1896. * @param {string[]} blockNames Names of block types to hide.
  1897. */
  1898. const hideBlockTypes = blockNames => _ref10 => {
  1899. var _registry$select$get5;
  1900. let {
  1901. registry
  1902. } = _ref10;
  1903. const existingBlockNames = (_registry$select$get5 = registry.select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'hiddenBlockTypes')) !== null && _registry$select$get5 !== void 0 ? _registry$select$get5 : [];
  1904. const mergedBlockNames = new Set([...existingBlockNames, ...(0,external_lodash_namespaceObject.castArray)(blockNames)]);
  1905. registry.dispatch(external_wp_preferences_namespaceObject.store).set('core/edit-post', 'hiddenBlockTypes', [...mergedBlockNames]);
  1906. };
  1907. /**
  1908. * Returns an action object used in signaling
  1909. * what Meta boxes are available in which location.
  1910. *
  1911. * @param {Object} metaBoxesPerLocation Meta boxes per location.
  1912. */
  1913. const setAvailableMetaBoxesPerLocation = metaBoxesPerLocation => _ref11 => {
  1914. let {
  1915. dispatch
  1916. } = _ref11;
  1917. return dispatch({
  1918. type: 'SET_META_BOXES_PER_LOCATIONS',
  1919. metaBoxesPerLocation
  1920. });
  1921. };
  1922. /**
  1923. * Update a metabox.
  1924. */
  1925. const requestMetaBoxUpdates = () => async _ref12 => {
  1926. let {
  1927. registry,
  1928. select,
  1929. dispatch
  1930. } = _ref12;
  1931. dispatch({
  1932. type: 'REQUEST_META_BOX_UPDATES'
  1933. }); // Saves the wp_editor fields.
  1934. if (window.tinyMCE) {
  1935. window.tinyMCE.triggerSave();
  1936. } // Additional data needed for backward compatibility.
  1937. // If we do not provide this data, the post will be overridden with the default values.
  1938. const post = registry.select(external_wp_editor_namespaceObject.store).getCurrentPost();
  1939. const additionalData = [post.comment_status ? ['comment_status', post.comment_status] : false, post.ping_status ? ['ping_status', post.ping_status] : false, post.sticky ? ['sticky', post.sticky] : false, post.author ? ['post_author', post.author] : false].filter(Boolean); // We gather all the metaboxes locations data and the base form data.
  1940. const baseFormData = new window.FormData(document.querySelector('.metabox-base-form'));
  1941. const activeMetaBoxLocations = select.getActiveMetaBoxLocations();
  1942. const formDataToMerge = [baseFormData, ...activeMetaBoxLocations.map(location => new window.FormData(getMetaBoxContainer(location)))]; // Merge all form data objects into a single one.
  1943. const formData = (0,external_lodash_namespaceObject.reduce)(formDataToMerge, (memo, currentFormData) => {
  1944. for (const [key, value] of currentFormData) {
  1945. memo.append(key, value);
  1946. }
  1947. return memo;
  1948. }, new window.FormData());
  1949. additionalData.forEach(_ref13 => {
  1950. let [key, value] = _ref13;
  1951. return formData.append(key, value);
  1952. });
  1953. try {
  1954. // Save the metaboxes.
  1955. await external_wp_apiFetch_default()({
  1956. url: window._wpMetaBoxUrl,
  1957. method: 'POST',
  1958. body: formData,
  1959. parse: false
  1960. });
  1961. dispatch.metaBoxUpdatesSuccess();
  1962. } catch {
  1963. dispatch.metaBoxUpdatesFailure();
  1964. }
  1965. };
  1966. /**
  1967. * Returns an action object used to signal a successful meta box update.
  1968. *
  1969. * @return {Object} Action object.
  1970. */
  1971. function metaBoxUpdatesSuccess() {
  1972. return {
  1973. type: 'META_BOX_UPDATES_SUCCESS'
  1974. };
  1975. }
  1976. /**
  1977. * Returns an action object used to signal a failed meta box update.
  1978. *
  1979. * @return {Object} Action object.
  1980. */
  1981. function metaBoxUpdatesFailure() {
  1982. return {
  1983. type: 'META_BOX_UPDATES_FAILURE'
  1984. };
  1985. }
  1986. /**
  1987. * Returns an action object used to toggle the width of the editing canvas.
  1988. *
  1989. * @param {string} deviceType
  1990. *
  1991. * @return {Object} Action object.
  1992. */
  1993. function __experimentalSetPreviewDeviceType(deviceType) {
  1994. return {
  1995. type: 'SET_PREVIEW_DEVICE_TYPE',
  1996. deviceType
  1997. };
  1998. }
  1999. /**
  2000. * Returns an action object used to open/close the inserter.
  2001. *
  2002. * @param {boolean|Object} value Whether the inserter should be
  2003. * opened (true) or closed (false).
  2004. * To specify an insertion point,
  2005. * use an object.
  2006. * @param {string} value.rootClientId The root client ID to insert at.
  2007. * @param {number} value.insertionIndex The index to insert at.
  2008. *
  2009. * @return {Object} Action object.
  2010. */
  2011. function setIsInserterOpened(value) {
  2012. return {
  2013. type: 'SET_IS_INSERTER_OPENED',
  2014. value
  2015. };
  2016. }
  2017. /**
  2018. * Returns an action object used to open/close the list view.
  2019. *
  2020. * @param {boolean} isOpen A boolean representing whether the list view should be opened or closed.
  2021. * @return {Object} Action object.
  2022. */
  2023. function setIsListViewOpened(isOpen) {
  2024. return {
  2025. type: 'SET_IS_LIST_VIEW_OPENED',
  2026. isOpen
  2027. };
  2028. }
  2029. /**
  2030. * Returns an action object used to switch to template editing.
  2031. *
  2032. * @param {boolean} value Is editing template.
  2033. * @return {Object} Action object.
  2034. */
  2035. function setIsEditingTemplate(value) {
  2036. return {
  2037. type: 'SET_IS_EDITING_TEMPLATE',
  2038. value
  2039. };
  2040. }
  2041. /**
  2042. * Switches to the template mode.
  2043. *
  2044. * @param {boolean} newTemplate Is new template.
  2045. */
  2046. const __unstableSwitchToTemplateMode = function () {
  2047. let newTemplate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  2048. return _ref14 => {
  2049. let {
  2050. registry,
  2051. select,
  2052. dispatch
  2053. } = _ref14;
  2054. dispatch(setIsEditingTemplate(true));
  2055. const isWelcomeGuideActive = select.isFeatureActive('welcomeGuideTemplate');
  2056. if (!isWelcomeGuideActive) {
  2057. const message = newTemplate ? (0,external_wp_i18n_namespaceObject.__)("Custom template created. You're in template mode now.") : (0,external_wp_i18n_namespaceObject.__)('Editing template. Changes made here affect all posts and pages that use the template.');
  2058. registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice(message, {
  2059. type: 'snackbar'
  2060. });
  2061. }
  2062. };
  2063. };
  2064. /**
  2065. * Create a block based template.
  2066. *
  2067. * @param {Object?} template Template to create and assign.
  2068. */
  2069. const __unstableCreateTemplate = template => async _ref15 => {
  2070. let {
  2071. registry
  2072. } = _ref15;
  2073. const savedTemplate = await registry.dispatch(external_wp_coreData_namespaceObject.store).saveEntityRecord('postType', 'wp_template', template);
  2074. const post = registry.select(external_wp_editor_namespaceObject.store).getCurrentPost();
  2075. registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', post.type, post.id, {
  2076. template: savedTemplate.slug
  2077. });
  2078. };
  2079. let actions_metaBoxesInitialized = false;
  2080. /**
  2081. * Initializes WordPress `postboxes` script and the logic for saving meta boxes.
  2082. */
  2083. const initializeMetaBoxes = () => _ref16 => {
  2084. let {
  2085. registry,
  2086. select,
  2087. dispatch
  2088. } = _ref16;
  2089. const isEditorReady = registry.select(external_wp_editor_namespaceObject.store).__unstableIsEditorReady();
  2090. if (!isEditorReady) {
  2091. return;
  2092. } // Only initialize once.
  2093. if (actions_metaBoxesInitialized) {
  2094. return;
  2095. }
  2096. const postType = registry.select(external_wp_editor_namespaceObject.store).getCurrentPostType();
  2097. if (window.postboxes.page !== postType) {
  2098. window.postboxes.add_postbox_toggles(postType);
  2099. }
  2100. actions_metaBoxesInitialized = true;
  2101. let wasSavingPost = registry.select(external_wp_editor_namespaceObject.store).isSavingPost();
  2102. let wasAutosavingPost = registry.select(external_wp_editor_namespaceObject.store).isAutosavingPost();
  2103. const hasMetaBoxes = select.hasMetaBoxes(); // Save metaboxes when performing a full save on the post.
  2104. registry.subscribe(async () => {
  2105. const isSavingPost = registry.select(external_wp_editor_namespaceObject.store).isSavingPost();
  2106. const isAutosavingPost = registry.select(external_wp_editor_namespaceObject.store).isAutosavingPost(); // Save metaboxes on save completion, except for autosaves that are not a post preview.
  2107. //
  2108. // Meta boxes are initialized once at page load. It is not necessary to
  2109. // account for updates on each state change.
  2110. //
  2111. // See: https://github.com/WordPress/WordPress/blob/5.1.1/wp-admin/includes/post.php#L2307-L2309.
  2112. const shouldTriggerMetaboxesSave = hasMetaBoxes && wasSavingPost && !isSavingPost && !wasAutosavingPost; // Save current state for next inspection.
  2113. wasSavingPost = isSavingPost;
  2114. wasAutosavingPost = isAutosavingPost;
  2115. if (shouldTriggerMetaboxesSave) {
  2116. await dispatch.requestMetaBoxUpdates();
  2117. }
  2118. });
  2119. dispatch({
  2120. type: 'META_BOXES_INITIALIZED'
  2121. });
  2122. };
  2123. ;// CONCATENATED MODULE: ./node_modules/rememo/es/rememo.js
  2124. var LEAF_KEY, hasWeakMap;
  2125. /**
  2126. * Arbitrary value used as key for referencing cache object in WeakMap tree.
  2127. *
  2128. * @type {Object}
  2129. */
  2130. LEAF_KEY = {};
  2131. /**
  2132. * Whether environment supports WeakMap.
  2133. *
  2134. * @type {boolean}
  2135. */
  2136. hasWeakMap = typeof WeakMap !== 'undefined';
  2137. /**
  2138. * Returns the first argument as the sole entry in an array.
  2139. *
  2140. * @param {*} value Value to return.
  2141. *
  2142. * @return {Array} Value returned as entry in array.
  2143. */
  2144. function arrayOf( value ) {
  2145. return [ value ];
  2146. }
  2147. /**
  2148. * Returns true if the value passed is object-like, or false otherwise. A value
  2149. * is object-like if it can support property assignment, e.g. object or array.
  2150. *
  2151. * @param {*} value Value to test.
  2152. *
  2153. * @return {boolean} Whether value is object-like.
  2154. */
  2155. function isObjectLike( value ) {
  2156. return !! value && 'object' === typeof value;
  2157. }
  2158. /**
  2159. * Creates and returns a new cache object.
  2160. *
  2161. * @return {Object} Cache object.
  2162. */
  2163. function createCache() {
  2164. var cache = {
  2165. clear: function() {
  2166. cache.head = null;
  2167. },
  2168. };
  2169. return cache;
  2170. }
  2171. /**
  2172. * Returns true if entries within the two arrays are strictly equal by
  2173. * reference from a starting index.
  2174. *
  2175. * @param {Array} a First array.
  2176. * @param {Array} b Second array.
  2177. * @param {number} fromIndex Index from which to start comparison.
  2178. *
  2179. * @return {boolean} Whether arrays are shallowly equal.
  2180. */
  2181. function isShallowEqual( a, b, fromIndex ) {
  2182. var i;
  2183. if ( a.length !== b.length ) {
  2184. return false;
  2185. }
  2186. for ( i = fromIndex; i < a.length; i++ ) {
  2187. if ( a[ i ] !== b[ i ] ) {
  2188. return false;
  2189. }
  2190. }
  2191. return true;
  2192. }
  2193. /**
  2194. * Returns a memoized selector function. The getDependants function argument is
  2195. * called before the memoized selector and is expected to return an immutable
  2196. * reference or array of references on which the selector depends for computing
  2197. * its own return value. The memoize cache is preserved only as long as those
  2198. * dependant references remain the same. If getDependants returns a different
  2199. * reference(s), the cache is cleared and the selector value regenerated.
  2200. *
  2201. * @param {Function} selector Selector function.
  2202. * @param {Function} getDependants Dependant getter returning an immutable
  2203. * reference or array of reference used in
  2204. * cache bust consideration.
  2205. *
  2206. * @return {Function} Memoized selector.
  2207. */
  2208. /* harmony default export */ function rememo(selector, getDependants ) {
  2209. var rootCache, getCache;
  2210. // Use object source as dependant if getter not provided
  2211. if ( ! getDependants ) {
  2212. getDependants = arrayOf;
  2213. }
  2214. /**
  2215. * Returns the root cache. If WeakMap is supported, this is assigned to the
  2216. * root WeakMap cache set, otherwise it is a shared instance of the default
  2217. * cache object.
  2218. *
  2219. * @return {(WeakMap|Object)} Root cache object.
  2220. */
  2221. function getRootCache() {
  2222. return rootCache;
  2223. }
  2224. /**
  2225. * Returns the cache for a given dependants array. When possible, a WeakMap
  2226. * will be used to create a unique cache for each set of dependants. This
  2227. * is feasible due to the nature of WeakMap in allowing garbage collection
  2228. * to occur on entries where the key object is no longer referenced. Since
  2229. * WeakMap requires the key to be an object, this is only possible when the
  2230. * dependant is object-like. The root cache is created as a hierarchy where
  2231. * each top-level key is the first entry in a dependants set, the value a
  2232. * WeakMap where each key is the next dependant, and so on. This continues
  2233. * so long as the dependants are object-like. If no dependants are object-
  2234. * like, then the cache is shared across all invocations.
  2235. *
  2236. * @see isObjectLike
  2237. *
  2238. * @param {Array} dependants Selector dependants.
  2239. *
  2240. * @return {Object} Cache object.
  2241. */
  2242. function getWeakMapCache( dependants ) {
  2243. var caches = rootCache,
  2244. isUniqueByDependants = true,
  2245. i, dependant, map, cache;
  2246. for ( i = 0; i < dependants.length; i++ ) {
  2247. dependant = dependants[ i ];
  2248. // Can only compose WeakMap from object-like key.
  2249. if ( ! isObjectLike( dependant ) ) {
  2250. isUniqueByDependants = false;
  2251. break;
  2252. }
  2253. // Does current segment of cache already have a WeakMap?
  2254. if ( caches.has( dependant ) ) {
  2255. // Traverse into nested WeakMap.
  2256. caches = caches.get( dependant );
  2257. } else {
  2258. // Create, set, and traverse into a new one.
  2259. map = new WeakMap();
  2260. caches.set( dependant, map );
  2261. caches = map;
  2262. }
  2263. }
  2264. // We use an arbitrary (but consistent) object as key for the last item
  2265. // in the WeakMap to serve as our running cache.
  2266. if ( ! caches.has( LEAF_KEY ) ) {
  2267. cache = createCache();
  2268. cache.isUniqueByDependants = isUniqueByDependants;
  2269. caches.set( LEAF_KEY, cache );
  2270. }
  2271. return caches.get( LEAF_KEY );
  2272. }
  2273. // Assign cache handler by availability of WeakMap
  2274. getCache = hasWeakMap ? getWeakMapCache : getRootCache;
  2275. /**
  2276. * Resets root memoization cache.
  2277. */
  2278. function clear() {
  2279. rootCache = hasWeakMap ? new WeakMap() : createCache();
  2280. }
  2281. // eslint-disable-next-line jsdoc/check-param-names
  2282. /**
  2283. * The augmented selector call, considering first whether dependants have
  2284. * changed before passing it to underlying memoize function.
  2285. *
  2286. * @param {Object} source Source object for derivation.
  2287. * @param {...*} extraArgs Additional arguments to pass to selector.
  2288. *
  2289. * @return {*} Selector result.
  2290. */
  2291. function callSelector( /* source, ...extraArgs */ ) {
  2292. var len = arguments.length,
  2293. cache, node, i, args, dependants;
  2294. // Create copy of arguments (avoid leaking deoptimization).
  2295. args = new Array( len );
  2296. for ( i = 0; i < len; i++ ) {
  2297. args[ i ] = arguments[ i ];
  2298. }
  2299. dependants = getDependants.apply( null, args );
  2300. cache = getCache( dependants );
  2301. // If not guaranteed uniqueness by dependants (primitive type or lack
  2302. // of WeakMap support), shallow compare against last dependants and, if
  2303. // references have changed, destroy cache to recalculate result.
  2304. if ( ! cache.isUniqueByDependants ) {
  2305. if ( cache.lastDependants && ! isShallowEqual( dependants, cache.lastDependants, 0 ) ) {
  2306. cache.clear();
  2307. }
  2308. cache.lastDependants = dependants;
  2309. }
  2310. node = cache.head;
  2311. while ( node ) {
  2312. // Check whether node arguments match arguments
  2313. if ( ! isShallowEqual( node.args, args, 1 ) ) {
  2314. node = node.next;
  2315. continue;
  2316. }
  2317. // At this point we can assume we've found a match
  2318. // Surface matched node to head if not already
  2319. if ( node !== cache.head ) {
  2320. // Adjust siblings to point to each other.
  2321. node.prev.next = node.next;
  2322. if ( node.next ) {
  2323. node.next.prev = node.prev;
  2324. }
  2325. node.next = cache.head;
  2326. node.prev = null;
  2327. cache.head.prev = node;
  2328. cache.head = node;
  2329. }
  2330. // Return immediately
  2331. return node.val;
  2332. }
  2333. // No cached value found. Continue to insertion phase:
  2334. node = {
  2335. // Generate the result from original function
  2336. val: selector.apply( null, args ),
  2337. };
  2338. // Avoid including the source object in the cache.
  2339. args[ 0 ] = null;
  2340. node.args = args;
  2341. // Don't need to check whether node is already head, since it would
  2342. // have been returned above already if it was
  2343. // Shift existing head down list
  2344. if ( cache.head ) {
  2345. cache.head.prev = node;
  2346. node.next = cache.head;
  2347. }
  2348. cache.head = node;
  2349. return node.val;
  2350. }
  2351. callSelector.getDependants = getDependants;
  2352. callSelector.clear = clear;
  2353. clear();
  2354. return callSelector;
  2355. }
  2356. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/store/selectors.js
  2357. /**
  2358. * External dependencies
  2359. */
  2360. /**
  2361. * WordPress dependencies
  2362. */
  2363. const EMPTY_ARRAY = [];
  2364. const EMPTY_OBJECT = {};
  2365. /**
  2366. * Returns the current editing mode.
  2367. *
  2368. * @param {Object} state Global application state.
  2369. *
  2370. * @return {string} Editing mode.
  2371. */
  2372. const getEditorMode = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => {
  2373. var _select$get;
  2374. return (_select$get = select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'editorMode')) !== null && _select$get !== void 0 ? _select$get : 'visual';
  2375. });
  2376. /**
  2377. * Returns true if the editor sidebar is opened.
  2378. *
  2379. * @param {Object} state Global application state
  2380. *
  2381. * @return {boolean} Whether the editor sidebar is opened.
  2382. */
  2383. const isEditorSidebarOpened = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => {
  2384. const activeGeneralSidebar = select(store).getActiveComplementaryArea('core/edit-post');
  2385. return (0,external_lodash_namespaceObject.includes)(['edit-post/document', 'edit-post/block'], activeGeneralSidebar);
  2386. });
  2387. /**
  2388. * Returns true if the plugin sidebar is opened.
  2389. *
  2390. * @param {Object} state Global application state.
  2391. *
  2392. * @return {boolean} Whether the plugin sidebar is opened.
  2393. */
  2394. const isPluginSidebarOpened = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => {
  2395. const activeGeneralSidebar = select(store).getActiveComplementaryArea('core/edit-post');
  2396. return !!activeGeneralSidebar && !(0,external_lodash_namespaceObject.includes)(['edit-post/document', 'edit-post/block'], activeGeneralSidebar);
  2397. });
  2398. /**
  2399. * Returns the current active general sidebar name, or null if there is no
  2400. * general sidebar active. The active general sidebar is a unique name to
  2401. * identify either an editor or plugin sidebar.
  2402. *
  2403. * Examples:
  2404. *
  2405. * - `edit-post/document`
  2406. * - `my-plugin/insert-image-sidebar`
  2407. *
  2408. * @param {Object} state Global application state.
  2409. *
  2410. * @return {?string} Active general sidebar name.
  2411. */
  2412. const getActiveGeneralSidebarName = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => {
  2413. return select(store).getActiveComplementaryArea('core/edit-post');
  2414. });
  2415. /**
  2416. * Converts panels from the new preferences store format to the old format
  2417. * that the post editor previously used.
  2418. *
  2419. * The resultant converted data should look like this:
  2420. * {
  2421. * panelName: {
  2422. * enabled: false,
  2423. * opened: true,
  2424. * },
  2425. * anotherPanelName: {
  2426. * opened: true
  2427. * },
  2428. * }
  2429. *
  2430. * @param {string[] | undefined} inactivePanels An array of inactive panel names.
  2431. * @param {string[] | undefined} openPanels An array of open panel names.
  2432. *
  2433. * @return {Object} The converted panel data.
  2434. */
  2435. function convertPanelsToOldFormat(inactivePanels, openPanels) {
  2436. var _ref;
  2437. // First reduce the inactive panels.
  2438. const panelsWithEnabledState = inactivePanels === null || inactivePanels === void 0 ? void 0 : inactivePanels.reduce((accumulatedPanels, panelName) => ({ ...accumulatedPanels,
  2439. [panelName]: {
  2440. enabled: false
  2441. }
  2442. }), {}); // Then reduce the open panels, passing in the result of the previous
  2443. // reduction as the initial value so that both open and inactive
  2444. // panel state is combined.
  2445. const panels = openPanels === null || openPanels === void 0 ? void 0 : openPanels.reduce((accumulatedPanels, panelName) => {
  2446. const currentPanelState = accumulatedPanels === null || accumulatedPanels === void 0 ? void 0 : accumulatedPanels[panelName];
  2447. return { ...accumulatedPanels,
  2448. [panelName]: { ...currentPanelState,
  2449. opened: true
  2450. }
  2451. };
  2452. }, panelsWithEnabledState !== null && panelsWithEnabledState !== void 0 ? panelsWithEnabledState : {}); // The panels variable will only be set if openPanels wasn't `undefined`.
  2453. // If it isn't set just return `panelsWithEnabledState`, and if that isn't
  2454. // set return an empty object.
  2455. return (_ref = panels !== null && panels !== void 0 ? panels : panelsWithEnabledState) !== null && _ref !== void 0 ? _ref : EMPTY_OBJECT;
  2456. }
  2457. /**
  2458. * Returns the preferences (these preferences are persisted locally).
  2459. *
  2460. * @param {Object} state Global application state.
  2461. *
  2462. * @return {Object} Preferences Object.
  2463. */
  2464. const getPreferences = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => {
  2465. external_wp_deprecated_default()(`select( 'core/edit-post' ).getPreferences`, {
  2466. since: '6.0',
  2467. alternative: `select( 'core/preferences' ).get`
  2468. }); // These preferences now exist in the preferences store.
  2469. // Fetch them so that they can be merged into the post
  2470. // editor preferences.
  2471. const preferences = ['hiddenBlockTypes', 'editorMode', 'preferredStyleVariations'].reduce((accumulatedPrefs, preferenceKey) => {
  2472. const value = select(external_wp_preferences_namespaceObject.store).get('core/edit-post', preferenceKey);
  2473. return { ...accumulatedPrefs,
  2474. [preferenceKey]: value
  2475. };
  2476. }, {}); // Panels were a preference, but the data structure changed when the state
  2477. // was migrated to the preferences store. They need to be converted from
  2478. // the new preferences store format to old format to ensure no breaking
  2479. // changes for plugins.
  2480. const inactivePanels = select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'inactivePanels');
  2481. const openPanels = select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'openPanels');
  2482. const panels = convertPanelsToOldFormat(inactivePanels, openPanels);
  2483. return { ...preferences,
  2484. panels
  2485. };
  2486. });
  2487. /**
  2488. *
  2489. * @param {Object} state Global application state.
  2490. * @param {string} preferenceKey Preference Key.
  2491. * @param {*} defaultValue Default Value.
  2492. *
  2493. * @return {*} Preference Value.
  2494. */
  2495. function getPreference(state, preferenceKey, defaultValue) {
  2496. external_wp_deprecated_default()(`select( 'core/edit-post' ).getPreference`, {
  2497. since: '6.0',
  2498. alternative: `select( 'core/preferences' ).get`
  2499. }); // Avoid using the `getPreferences` registry selector where possible.
  2500. const preferences = getPreferences(state);
  2501. const value = preferences[preferenceKey];
  2502. return value === undefined ? defaultValue : value;
  2503. }
  2504. /**
  2505. * Returns an array of blocks that are hidden.
  2506. *
  2507. * @return {Array} A list of the hidden block types
  2508. */
  2509. const getHiddenBlockTypes = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => {
  2510. var _select$get2;
  2511. return (_select$get2 = select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'hiddenBlockTypes')) !== null && _select$get2 !== void 0 ? _select$get2 : EMPTY_ARRAY;
  2512. });
  2513. /**
  2514. * Returns true if the publish sidebar is opened.
  2515. *
  2516. * @param {Object} state Global application state
  2517. *
  2518. * @return {boolean} Whether the publish sidebar is open.
  2519. */
  2520. function isPublishSidebarOpened(state) {
  2521. return state.publishSidebarActive;
  2522. }
  2523. /**
  2524. * Returns true if the given panel was programmatically removed, or false otherwise.
  2525. * All panels are not removed by default.
  2526. *
  2527. * @param {Object} state Global application state.
  2528. * @param {string} panelName A string that identifies the panel.
  2529. *
  2530. * @return {boolean} Whether or not the panel is removed.
  2531. */
  2532. function isEditorPanelRemoved(state, panelName) {
  2533. return (0,external_lodash_namespaceObject.includes)(state.removedPanels, panelName);
  2534. }
  2535. /**
  2536. * Returns true if the given panel is enabled, or false otherwise. Panels are
  2537. * enabled by default.
  2538. *
  2539. * @param {Object} state Global application state.
  2540. * @param {string} panelName A string that identifies the panel.
  2541. *
  2542. * @return {boolean} Whether or not the panel is enabled.
  2543. */
  2544. const isEditorPanelEnabled = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, panelName) => {
  2545. const inactivePanels = select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'inactivePanels');
  2546. return !isEditorPanelRemoved(state, panelName) && !(inactivePanels !== null && inactivePanels !== void 0 && inactivePanels.includes(panelName));
  2547. });
  2548. /**
  2549. * Returns true if the given panel is open, or false otherwise. Panels are
  2550. * closed by default.
  2551. *
  2552. * @param {Object} state Global application state.
  2553. * @param {string} panelName A string that identifies the panel.
  2554. *
  2555. * @return {boolean} Whether or not the panel is open.
  2556. */
  2557. const isEditorPanelOpened = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, panelName) => {
  2558. const openPanels = select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'openPanels');
  2559. return !!(openPanels !== null && openPanels !== void 0 && openPanels.includes(panelName));
  2560. });
  2561. /**
  2562. * Returns true if a modal is active, or false otherwise.
  2563. *
  2564. * @param {Object} state Global application state.
  2565. * @param {string} modalName A string that uniquely identifies the modal.
  2566. *
  2567. * @return {boolean} Whether the modal is active.
  2568. */
  2569. function isModalActive(state, modalName) {
  2570. return state.activeModal === modalName;
  2571. }
  2572. /**
  2573. * Returns whether the given feature is enabled or not.
  2574. *
  2575. * @param {Object} state Global application state.
  2576. * @param {string} feature Feature slug.
  2577. *
  2578. * @return {boolean} Is active.
  2579. */
  2580. const selectors_isFeatureActive = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, feature) => {
  2581. return !!select(external_wp_preferences_namespaceObject.store).get('core/edit-post', feature);
  2582. });
  2583. /**
  2584. * Returns true if the plugin item is pinned to the header.
  2585. * When the value is not set it defaults to true.
  2586. *
  2587. * @param {Object} state Global application state.
  2588. * @param {string} pluginName Plugin item name.
  2589. *
  2590. * @return {boolean} Whether the plugin item is pinned.
  2591. */
  2592. const isPluginItemPinned = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, pluginName) => {
  2593. return select(store).isItemPinned('core/edit-post', pluginName);
  2594. });
  2595. /**
  2596. * Returns an array of active meta box locations.
  2597. *
  2598. * @param {Object} state Post editor state.
  2599. *
  2600. * @return {string[]} Active meta box locations.
  2601. */
  2602. const getActiveMetaBoxLocations = rememo(state => {
  2603. return Object.keys(state.metaBoxes.locations).filter(location => isMetaBoxLocationActive(state, location));
  2604. }, state => [state.metaBoxes.locations]);
  2605. /**
  2606. * Returns true if a metabox location is active and visible
  2607. *
  2608. * @param {Object} state Post editor state.
  2609. * @param {string} location Meta box location to test.
  2610. *
  2611. * @return {boolean} Whether the meta box location is active and visible.
  2612. */
  2613. function isMetaBoxLocationVisible(state, location) {
  2614. return isMetaBoxLocationActive(state, location) && (0,external_lodash_namespaceObject.some)(getMetaBoxesPerLocation(state, location), _ref2 => {
  2615. let {
  2616. id
  2617. } = _ref2;
  2618. return isEditorPanelEnabled(state, `meta-box-${id}`);
  2619. });
  2620. }
  2621. /**
  2622. * Returns true if there is an active meta box in the given location, or false
  2623. * otherwise.
  2624. *
  2625. * @param {Object} state Post editor state.
  2626. * @param {string} location Meta box location to test.
  2627. *
  2628. * @return {boolean} Whether the meta box location is active.
  2629. */
  2630. function isMetaBoxLocationActive(state, location) {
  2631. const metaBoxes = getMetaBoxesPerLocation(state, location);
  2632. return !!metaBoxes && metaBoxes.length !== 0;
  2633. }
  2634. /**
  2635. * Returns the list of all the available meta boxes for a given location.
  2636. *
  2637. * @param {Object} state Global application state.
  2638. * @param {string} location Meta box location to test.
  2639. *
  2640. * @return {?Array} List of meta boxes.
  2641. */
  2642. function getMetaBoxesPerLocation(state, location) {
  2643. return state.metaBoxes.locations[location];
  2644. }
  2645. /**
  2646. * Returns the list of all the available meta boxes.
  2647. *
  2648. * @param {Object} state Global application state.
  2649. *
  2650. * @return {Array} List of meta boxes.
  2651. */
  2652. const getAllMetaBoxes = rememo(state => {
  2653. return (0,external_lodash_namespaceObject.flatten)((0,external_lodash_namespaceObject.values)(state.metaBoxes.locations));
  2654. }, state => [state.metaBoxes.locations]);
  2655. /**
  2656. * Returns true if the post is using Meta Boxes
  2657. *
  2658. * @param {Object} state Global application state
  2659. *
  2660. * @return {boolean} Whether there are metaboxes or not.
  2661. */
  2662. function hasMetaBoxes(state) {
  2663. return getActiveMetaBoxLocations(state).length > 0;
  2664. }
  2665. /**
  2666. * Returns true if the Meta Boxes are being saved.
  2667. *
  2668. * @param {Object} state Global application state.
  2669. *
  2670. * @return {boolean} Whether the metaboxes are being saved.
  2671. */
  2672. function selectors_isSavingMetaBoxes(state) {
  2673. return state.metaBoxes.isSaving;
  2674. }
  2675. /**
  2676. * Returns the current editing canvas device type.
  2677. *
  2678. * @param {Object} state Global application state.
  2679. *
  2680. * @return {string} Device type.
  2681. */
  2682. function __experimentalGetPreviewDeviceType(state) {
  2683. return state.deviceType;
  2684. }
  2685. /**
  2686. * Returns true if the inserter is opened.
  2687. *
  2688. * @param {Object} state Global application state.
  2689. *
  2690. * @return {boolean} Whether the inserter is opened.
  2691. */
  2692. function isInserterOpened(state) {
  2693. return !!state.blockInserterPanel;
  2694. }
  2695. /**
  2696. * Get the insertion point for the inserter.
  2697. *
  2698. * @param {Object} state Global application state.
  2699. *
  2700. * @return {Object} The root client ID, index to insert at and starting filter value.
  2701. */
  2702. function __experimentalGetInsertionPoint(state) {
  2703. const {
  2704. rootClientId,
  2705. insertionIndex,
  2706. filterValue
  2707. } = state.blockInserterPanel;
  2708. return {
  2709. rootClientId,
  2710. insertionIndex,
  2711. filterValue
  2712. };
  2713. }
  2714. /**
  2715. * Returns true if the list view is opened.
  2716. *
  2717. * @param {Object} state Global application state.
  2718. *
  2719. * @return {boolean} Whether the list view is opened.
  2720. */
  2721. function isListViewOpened(state) {
  2722. return state.listViewPanel;
  2723. }
  2724. /**
  2725. * Returns true if the template editing mode is enabled.
  2726. *
  2727. * @param {Object} state Global application state.
  2728. *
  2729. * @return {boolean} Whether we're editing the template.
  2730. */
  2731. function selectors_isEditingTemplate(state) {
  2732. return state.isEditingTemplate;
  2733. }
  2734. /**
  2735. * Returns true if meta boxes are initialized.
  2736. *
  2737. * @param {Object} state Global application state.
  2738. *
  2739. * @return {boolean} Whether meta boxes are initialized.
  2740. */
  2741. function areMetaBoxesInitialized(state) {
  2742. return state.metaBoxes.initialized;
  2743. }
  2744. /**
  2745. * Retrieves the template of the currently edited post.
  2746. *
  2747. * @return {Object?} Post Template.
  2748. */
  2749. const getEditedPostTemplate = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => {
  2750. const currentTemplate = select(external_wp_editor_namespaceObject.store).getEditedPostAttribute('template');
  2751. if (currentTemplate) {
  2752. var _select$getEntityReco;
  2753. const templateWithSameSlug = (_select$getEntityReco = select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', 'wp_template', {
  2754. per_page: -1
  2755. })) === null || _select$getEntityReco === void 0 ? void 0 : _select$getEntityReco.find(template => template.slug === currentTemplate);
  2756. if (!templateWithSameSlug) {
  2757. return templateWithSameSlug;
  2758. }
  2759. return select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', 'wp_template', templateWithSameSlug.id);
  2760. }
  2761. const post = select(external_wp_editor_namespaceObject.store).getCurrentPost();
  2762. if (post.link) {
  2763. return select(external_wp_coreData_namespaceObject.store).__experimentalGetTemplateForLink(post.link);
  2764. }
  2765. return null;
  2766. });
  2767. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/store/constants.js
  2768. /**
  2769. * The identifier for the data store.
  2770. *
  2771. * @type {string}
  2772. */
  2773. const constants_STORE_NAME = 'core/edit-post';
  2774. /**
  2775. * CSS selector string for the admin bar view post link anchor tag.
  2776. *
  2777. * @type {string}
  2778. */
  2779. const VIEW_AS_LINK_SELECTOR = '#wp-admin-bar-view a';
  2780. /**
  2781. * CSS selector string for the admin bar preview post link anchor tag.
  2782. *
  2783. * @type {string}
  2784. */
  2785. const VIEW_AS_PREVIEW_LINK_SELECTOR = '#wp-admin-bar-preview a';
  2786. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/store/index.js
  2787. /**
  2788. * WordPress dependencies
  2789. */
  2790. /**
  2791. * Internal dependencies
  2792. */
  2793. /**
  2794. * Store definition for the edit post namespace.
  2795. *
  2796. * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
  2797. *
  2798. * @type {Object}
  2799. */
  2800. const store_store = (0,external_wp_data_namespaceObject.createReduxStore)(constants_STORE_NAME, {
  2801. reducer: reducer,
  2802. actions: store_actions_namespaceObject,
  2803. selectors: store_selectors_namespaceObject
  2804. });
  2805. (0,external_wp_data_namespaceObject.register)(store_store);
  2806. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/plugins/keyboard-shortcuts-help-menu-item/index.js
  2807. /**
  2808. * WordPress dependencies
  2809. */
  2810. /**
  2811. * Internal dependencies
  2812. */
  2813. function KeyboardShortcutsHelpMenuItem(_ref) {
  2814. let {
  2815. openModal
  2816. } = _ref;
  2817. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
  2818. onClick: () => {
  2819. openModal('edit-post/keyboard-shortcut-help');
  2820. },
  2821. shortcut: external_wp_keycodes_namespaceObject.displayShortcut.access('h')
  2822. }, (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts'));
  2823. }
  2824. /* harmony default export */ var keyboard_shortcuts_help_menu_item = ((0,external_wp_data_namespaceObject.withDispatch)(dispatch => {
  2825. const {
  2826. openModal
  2827. } = dispatch(store_store);
  2828. return {
  2829. openModal
  2830. };
  2831. })(KeyboardShortcutsHelpMenuItem));
  2832. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/tools-more-menu-group/index.js
  2833. /**
  2834. * External dependencies
  2835. */
  2836. /**
  2837. * WordPress dependencies
  2838. */
  2839. const {
  2840. Fill: ToolsMoreMenuGroup,
  2841. Slot
  2842. } = (0,external_wp_components_namespaceObject.createSlotFill)('ToolsMoreMenuGroup');
  2843. ToolsMoreMenuGroup.Slot = _ref => {
  2844. let {
  2845. fillProps
  2846. } = _ref;
  2847. return (0,external_wp_element_namespaceObject.createElement)(Slot, {
  2848. fillProps: fillProps
  2849. }, fills => !(0,external_lodash_namespaceObject.isEmpty)(fills) && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
  2850. label: (0,external_wp_i18n_namespaceObject.__)('Tools')
  2851. }, fills));
  2852. };
  2853. /* harmony default export */ var tools_more_menu_group = (ToolsMoreMenuGroup);
  2854. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/plugins/welcome-guide-menu-item/index.js
  2855. /**
  2856. * WordPress dependencies
  2857. */
  2858. /**
  2859. * Internal dependencies
  2860. */
  2861. function WelcomeGuideMenuItem() {
  2862. const isTemplateMode = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).isEditingTemplate(), []);
  2863. return (0,external_wp_element_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, {
  2864. scope: "core/edit-post",
  2865. name: isTemplateMode ? 'welcomeGuideTemplate' : 'welcomeGuide',
  2866. label: (0,external_wp_i18n_namespaceObject.__)('Welcome Guide')
  2867. });
  2868. }
  2869. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/plugins/index.js
  2870. /**
  2871. * WordPress dependencies
  2872. */
  2873. /**
  2874. * Internal dependencies
  2875. */
  2876. (0,external_wp_plugins_namespaceObject.registerPlugin)('edit-post', {
  2877. render() {
  2878. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(tools_more_menu_group, null, _ref => {
  2879. let {
  2880. onClose
  2881. } = _ref;
  2882. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
  2883. role: "menuitem",
  2884. href: (0,external_wp_url_namespaceObject.addQueryArgs)('edit.php', {
  2885. post_type: 'wp_block'
  2886. })
  2887. }, (0,external_wp_i18n_namespaceObject.__)('Manage Reusable blocks')), (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcuts_help_menu_item, {
  2888. onSelect: onClose
  2889. }), (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideMenuItem, null), (0,external_wp_element_namespaceObject.createElement)(CopyContentMenuItem, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
  2890. role: "menuitem",
  2891. icon: library_external,
  2892. href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/support/article/wordpress-editor/'),
  2893. target: "_blank",
  2894. rel: "noopener noreferrer"
  2895. }, (0,external_wp_i18n_namespaceObject.__)('Help'), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
  2896. as: "span"
  2897. },
  2898. /* translators: accessibility text */
  2899. (0,external_wp_i18n_namespaceObject.__)('(opens in a new tab)'))));
  2900. }));
  2901. }
  2902. });
  2903. ;// CONCATENATED MODULE: external ["wp","keyboardShortcuts"]
  2904. var external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"];
  2905. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/text-editor/index.js
  2906. /**
  2907. * WordPress dependencies
  2908. */
  2909. /**
  2910. * Internal dependencies
  2911. */
  2912. function TextEditor(_ref) {
  2913. let {
  2914. onExit,
  2915. isRichEditingEnabled
  2916. } = _ref;
  2917. return (0,external_wp_element_namespaceObject.createElement)("div", {
  2918. className: "edit-post-text-editor"
  2919. }, isRichEditingEnabled && (0,external_wp_element_namespaceObject.createElement)("div", {
  2920. className: "edit-post-text-editor__toolbar"
  2921. }, (0,external_wp_element_namespaceObject.createElement)("h2", null, (0,external_wp_i18n_namespaceObject.__)('Editing code')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  2922. variant: "tertiary",
  2923. onClick: onExit,
  2924. shortcut: external_wp_keycodes_namespaceObject.displayShortcut.secondary('m')
  2925. }, (0,external_wp_i18n_namespaceObject.__)('Exit code editor')), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.TextEditorGlobalKeyboardShortcuts, null)), (0,external_wp_element_namespaceObject.createElement)("div", {
  2926. className: "edit-post-text-editor__body"
  2927. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTitle, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTextEditor, null)));
  2928. }
  2929. /* harmony default export */ var text_editor = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)(select => ({
  2930. isRichEditingEnabled: select(external_wp_editor_namespaceObject.store).getEditorSettings().richEditingEnabled
  2931. })), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => {
  2932. return {
  2933. onExit() {
  2934. dispatch(store_store).switchEditorMode('visual');
  2935. }
  2936. };
  2937. }))(TextEditor));
  2938. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/arrow-left.js
  2939. /**
  2940. * WordPress dependencies
  2941. */
  2942. const arrowLeft = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  2943. xmlns: "http://www.w3.org/2000/svg",
  2944. viewBox: "0 0 24 24"
  2945. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  2946. d: "M20 10.8H6.7l4.1-4.5-1.1-1.1-5.8 6.3 5.8 5.8 1.1-1.1-4-3.9H20z"
  2947. }));
  2948. /* harmony default export */ var arrow_left = (arrowLeft);
  2949. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/visual-editor/block-inspector-button.js
  2950. /**
  2951. * External dependencies
  2952. */
  2953. /**
  2954. * WordPress dependencies
  2955. */
  2956. /**
  2957. * Internal dependencies
  2958. */
  2959. function BlockInspectorButton(_ref) {
  2960. let {
  2961. onClick = external_lodash_namespaceObject.noop,
  2962. small = false
  2963. } = _ref;
  2964. const {
  2965. shortcut,
  2966. areAdvancedSettingsOpened
  2967. } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
  2968. shortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getShortcutRepresentation('core/edit-post/toggle-sidebar'),
  2969. areAdvancedSettingsOpened: select(store_store).getActiveGeneralSidebarName() === 'edit-post/block'
  2970. }), []);
  2971. const {
  2972. openGeneralSidebar,
  2973. closeGeneralSidebar
  2974. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  2975. const label = areAdvancedSettingsOpened ? (0,external_wp_i18n_namespaceObject.__)('Hide more settings') : (0,external_wp_i18n_namespaceObject.__)('Show more settings');
  2976. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
  2977. onClick: () => {
  2978. if (areAdvancedSettingsOpened) {
  2979. closeGeneralSidebar();
  2980. (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Block settings closed'));
  2981. } else {
  2982. openGeneralSidebar('edit-post/block');
  2983. (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Additional settings are now available in the Editor block settings sidebar'));
  2984. }
  2985. onClick();
  2986. },
  2987. shortcut: shortcut
  2988. }, !small && label);
  2989. }
  2990. /* harmony default export */ var block_inspector_button = (BlockInspectorButton);
  2991. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/visual-editor/index.js
  2992. /**
  2993. * External dependencies
  2994. */
  2995. /**
  2996. * WordPress dependencies
  2997. */
  2998. /**
  2999. * Internal dependencies
  3000. */
  3001. function MaybeIframe(_ref) {
  3002. let {
  3003. children,
  3004. contentRef,
  3005. shouldIframe,
  3006. styles,
  3007. assets,
  3008. style
  3009. } = _ref;
  3010. const ref = (0,external_wp_blockEditor_namespaceObject.__unstableUseMouseMoveTypingReset)();
  3011. if (!shouldIframe) {
  3012. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, {
  3013. styles: styles
  3014. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.WritingFlow, {
  3015. ref: contentRef,
  3016. className: "editor-styles-wrapper",
  3017. style: {
  3018. flex: '1',
  3019. ...style
  3020. },
  3021. tabIndex: -1
  3022. }, children));
  3023. }
  3024. return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableIframe, {
  3025. head: (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, {
  3026. styles: styles
  3027. }),
  3028. assets: assets,
  3029. ref: ref,
  3030. contentRef: contentRef,
  3031. style: {
  3032. width: '100%',
  3033. height: '100%',
  3034. display: 'block'
  3035. },
  3036. name: "editor-canvas"
  3037. }, children);
  3038. }
  3039. function VisualEditor(_ref2) {
  3040. let {
  3041. styles
  3042. } = _ref2;
  3043. const {
  3044. deviceType,
  3045. isTemplateMode,
  3046. wrapperBlockName,
  3047. wrapperUniqueId
  3048. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  3049. const {
  3050. isEditingTemplate,
  3051. __experimentalGetPreviewDeviceType
  3052. } = select(store_store);
  3053. const {
  3054. getCurrentPostId,
  3055. getCurrentPostType
  3056. } = select(external_wp_editor_namespaceObject.store);
  3057. const _isTemplateMode = isEditingTemplate();
  3058. let _wrapperBlockName;
  3059. if (getCurrentPostType() === 'wp_block') {
  3060. _wrapperBlockName = 'core/block';
  3061. } else if (!_isTemplateMode) {
  3062. _wrapperBlockName = 'core/post-content';
  3063. }
  3064. return {
  3065. deviceType: __experimentalGetPreviewDeviceType(),
  3066. isTemplateMode: _isTemplateMode,
  3067. wrapperBlockName: _wrapperBlockName,
  3068. wrapperUniqueId: getCurrentPostId()
  3069. };
  3070. }, []);
  3071. const hasMetaBoxes = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).hasMetaBoxes(), []);
  3072. const {
  3073. themeSupportsLayout,
  3074. assets
  3075. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  3076. const _settings = select(external_wp_blockEditor_namespaceObject.store).getSettings();
  3077. return {
  3078. themeSupportsLayout: _settings.supportsLayout,
  3079. assets: _settings.__unstableResolvedAssets
  3080. };
  3081. }, []);
  3082. const {
  3083. clearSelectedBlock
  3084. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
  3085. const {
  3086. setIsEditingTemplate
  3087. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  3088. const desktopCanvasStyles = {
  3089. height: '100%',
  3090. width: '100%',
  3091. margin: 0,
  3092. display: 'flex',
  3093. flexFlow: 'column',
  3094. // Default background color so that grey
  3095. // .edit-post-editor-regions__content color doesn't show through.
  3096. background: 'white'
  3097. };
  3098. const templateModeStyles = { ...desktopCanvasStyles,
  3099. borderRadius: '2px 2px 0 0',
  3100. border: '1px solid #ddd',
  3101. borderBottom: 0
  3102. };
  3103. const resizedCanvasStyles = (0,external_wp_blockEditor_namespaceObject.__experimentalUseResizeCanvas)(deviceType, isTemplateMode);
  3104. const defaultLayout = (0,external_wp_blockEditor_namespaceObject.useSetting)('layout');
  3105. const previewMode = 'is-' + deviceType.toLowerCase() + '-preview';
  3106. let animatedStyles = isTemplateMode ? templateModeStyles : desktopCanvasStyles;
  3107. if (resizedCanvasStyles) {
  3108. animatedStyles = resizedCanvasStyles;
  3109. }
  3110. let paddingBottom; // Add a constant padding for the typewritter effect. When typing at the
  3111. // bottom, there needs to be room to scroll up.
  3112. if (!hasMetaBoxes && !resizedCanvasStyles && !isTemplateMode) {
  3113. paddingBottom = '40vh';
  3114. }
  3115. const ref = (0,external_wp_element_namespaceObject.useRef)();
  3116. const contentRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, (0,external_wp_blockEditor_namespaceObject.__unstableUseClipboardHandler)(), (0,external_wp_blockEditor_namespaceObject.__unstableUseTypewriter)(), (0,external_wp_blockEditor_namespaceObject.__unstableUseTypingObserver)(), (0,external_wp_blockEditor_namespaceObject.__unstableUseBlockSelectionClearer)()]);
  3117. const blockSelectionClearerRef = (0,external_wp_blockEditor_namespaceObject.__unstableUseBlockSelectionClearer)();
  3118. const [, RecursionProvider] = (0,external_wp_blockEditor_namespaceObject.__experimentalUseNoRecursiveRenders)(wrapperUniqueId, wrapperBlockName);
  3119. const layout = (0,external_wp_element_namespaceObject.useMemo)(() => {
  3120. if (isTemplateMode) {
  3121. return {
  3122. type: 'default'
  3123. };
  3124. }
  3125. if (themeSupportsLayout) {
  3126. return defaultLayout;
  3127. }
  3128. return undefined;
  3129. }, [isTemplateMode, themeSupportsLayout, defaultLayout]);
  3130. return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockTools, {
  3131. __unstableContentRef: ref,
  3132. className: classnames_default()('edit-post-visual-editor', {
  3133. 'is-template-mode': isTemplateMode
  3134. })
  3135. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.VisualEditorGlobalKeyboardShortcuts, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, {
  3136. className: "edit-post-visual-editor__content-area",
  3137. animate: {
  3138. padding: isTemplateMode ? '48px 48px 0' : '0'
  3139. },
  3140. ref: blockSelectionClearerRef
  3141. }, isTemplateMode && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  3142. className: "edit-post-visual-editor__exit-template-mode",
  3143. icon: arrow_left,
  3144. onClick: () => {
  3145. clearSelectedBlock();
  3146. setIsEditingTemplate(false);
  3147. }
  3148. }, (0,external_wp_i18n_namespaceObject.__)('Back')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, {
  3149. animate: animatedStyles,
  3150. initial: desktopCanvasStyles,
  3151. className: previewMode
  3152. }, (0,external_wp_element_namespaceObject.createElement)(MaybeIframe, {
  3153. shouldIframe: isTemplateMode || deviceType === 'Tablet' || deviceType === 'Mobile',
  3154. contentRef: contentRef,
  3155. styles: styles,
  3156. assets: assets,
  3157. style: {
  3158. paddingBottom
  3159. }
  3160. }, themeSupportsLayout && !isTemplateMode && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalLayoutStyle, {
  3161. selector: ".edit-post-visual-editor__post-title-wrapper, .block-editor-block-list__layout.is-root-container",
  3162. layout: defaultLayout
  3163. }), !isTemplateMode && (0,external_wp_element_namespaceObject.createElement)("div", {
  3164. className: "edit-post-visual-editor__post-title-wrapper",
  3165. contentEditable: false
  3166. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTitle, null)), (0,external_wp_element_namespaceObject.createElement)(RecursionProvider, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockList, {
  3167. className: isTemplateMode ? 'wp-site-blocks' : undefined,
  3168. __experimentalLayout: layout
  3169. }))))), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableBlockSettingsMenuFirstItem, null, _ref3 => {
  3170. let {
  3171. onClose
  3172. } = _ref3;
  3173. return (0,external_wp_element_namespaceObject.createElement)(block_inspector_button, {
  3174. onClick: onClose
  3175. });
  3176. }));
  3177. }
  3178. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/keyboard-shortcuts/index.js
  3179. /**
  3180. * WordPress dependencies
  3181. */
  3182. /**
  3183. * Internal dependencies
  3184. */
  3185. function KeyboardShortcuts() {
  3186. const {
  3187. getBlockSelectionStart
  3188. } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store);
  3189. const {
  3190. getEditorMode,
  3191. isEditorSidebarOpened,
  3192. isListViewOpened
  3193. } = (0,external_wp_data_namespaceObject.useSelect)(store_store);
  3194. const isModeToggleDisabled = (0,external_wp_data_namespaceObject.useSelect)(select => {
  3195. const {
  3196. richEditingEnabled,
  3197. codeEditingEnabled
  3198. } = select(external_wp_editor_namespaceObject.store).getEditorSettings();
  3199. return !richEditingEnabled || !codeEditingEnabled;
  3200. }, []);
  3201. const {
  3202. switchEditorMode,
  3203. openGeneralSidebar,
  3204. closeGeneralSidebar,
  3205. toggleFeature,
  3206. setIsListViewOpened
  3207. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  3208. const {
  3209. registerShortcut
  3210. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store);
  3211. (0,external_wp_element_namespaceObject.useEffect)(() => {
  3212. registerShortcut({
  3213. name: 'core/edit-post/toggle-mode',
  3214. category: 'global',
  3215. description: (0,external_wp_i18n_namespaceObject.__)('Switch between visual editor and code editor.'),
  3216. keyCombination: {
  3217. modifier: 'secondary',
  3218. character: 'm'
  3219. }
  3220. });
  3221. registerShortcut({
  3222. name: 'core/edit-post/toggle-fullscreen',
  3223. category: 'global',
  3224. description: (0,external_wp_i18n_namespaceObject.__)('Toggle fullscreen mode.'),
  3225. keyCombination: {
  3226. modifier: 'secondary',
  3227. character: 'f'
  3228. }
  3229. });
  3230. registerShortcut({
  3231. name: 'core/edit-post/toggle-list-view',
  3232. category: 'global',
  3233. description: (0,external_wp_i18n_namespaceObject.__)('Open the block list view.'),
  3234. keyCombination: {
  3235. modifier: 'access',
  3236. character: 'o'
  3237. }
  3238. });
  3239. registerShortcut({
  3240. name: 'core/edit-post/toggle-sidebar',
  3241. category: 'global',
  3242. description: (0,external_wp_i18n_namespaceObject.__)('Show or hide the settings sidebar.'),
  3243. keyCombination: {
  3244. modifier: 'primaryShift',
  3245. character: ','
  3246. }
  3247. });
  3248. registerShortcut({
  3249. name: 'core/edit-post/next-region',
  3250. category: 'global',
  3251. description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the next part of the editor.'),
  3252. keyCombination: {
  3253. modifier: 'ctrl',
  3254. character: '`'
  3255. },
  3256. aliases: [{
  3257. modifier: 'access',
  3258. character: 'n'
  3259. }]
  3260. });
  3261. registerShortcut({
  3262. name: 'core/edit-post/previous-region',
  3263. category: 'global',
  3264. description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the previous part of the editor.'),
  3265. keyCombination: {
  3266. modifier: 'ctrlShift',
  3267. character: '`'
  3268. },
  3269. aliases: [{
  3270. modifier: 'access',
  3271. character: 'p'
  3272. }]
  3273. });
  3274. registerShortcut({
  3275. name: 'core/edit-post/keyboard-shortcuts',
  3276. category: 'main',
  3277. description: (0,external_wp_i18n_namespaceObject.__)('Display these keyboard shortcuts.'),
  3278. keyCombination: {
  3279. modifier: 'access',
  3280. character: 'h'
  3281. }
  3282. });
  3283. }, []);
  3284. (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-post/toggle-mode', () => {
  3285. switchEditorMode(getEditorMode() === 'visual' ? 'text' : 'visual');
  3286. }, {
  3287. isDisabled: isModeToggleDisabled
  3288. });
  3289. (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-post/toggle-fullscreen', () => {
  3290. toggleFeature('fullscreenMode');
  3291. });
  3292. (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-post/toggle-sidebar', event => {
  3293. // This shortcut has no known clashes, but use preventDefault to prevent any
  3294. // obscure shortcuts from triggering.
  3295. event.preventDefault();
  3296. if (isEditorSidebarOpened()) {
  3297. closeGeneralSidebar();
  3298. } else {
  3299. const sidebarToOpen = getBlockSelectionStart() ? 'edit-post/block' : 'edit-post/document';
  3300. openGeneralSidebar(sidebarToOpen);
  3301. }
  3302. });
  3303. (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-post/toggle-list-view', () => setIsListViewOpened(!isListViewOpened()));
  3304. return null;
  3305. }
  3306. /* harmony default export */ var keyboard_shortcuts = (KeyboardShortcuts);
  3307. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/keyboard-shortcut-help-modal/config.js
  3308. /**
  3309. * WordPress dependencies
  3310. */
  3311. const textFormattingShortcuts = [{
  3312. keyCombination: {
  3313. modifier: 'primary',
  3314. character: 'b'
  3315. },
  3316. description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text bold.')
  3317. }, {
  3318. keyCombination: {
  3319. modifier: 'primary',
  3320. character: 'i'
  3321. },
  3322. description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text italic.')
  3323. }, {
  3324. keyCombination: {
  3325. modifier: 'primary',
  3326. character: 'k'
  3327. },
  3328. description: (0,external_wp_i18n_namespaceObject.__)('Convert the selected text into a link.')
  3329. }, {
  3330. keyCombination: {
  3331. modifier: 'primaryShift',
  3332. character: 'k'
  3333. },
  3334. description: (0,external_wp_i18n_namespaceObject.__)('Remove a link.')
  3335. }, {
  3336. keyCombination: {
  3337. character: '[['
  3338. },
  3339. description: (0,external_wp_i18n_namespaceObject.__)('Insert a link to a post or page')
  3340. }, {
  3341. keyCombination: {
  3342. modifier: 'primary',
  3343. character: 'u'
  3344. },
  3345. description: (0,external_wp_i18n_namespaceObject.__)('Underline the selected text.')
  3346. }];
  3347. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/keyboard-shortcut-help-modal/shortcut.js
  3348. /**
  3349. * External dependencies
  3350. */
  3351. /**
  3352. * WordPress dependencies
  3353. */
  3354. function KeyCombination(_ref) {
  3355. let {
  3356. keyCombination,
  3357. forceAriaLabel
  3358. } = _ref;
  3359. const shortcut = keyCombination.modifier ? external_wp_keycodes_namespaceObject.displayShortcutList[keyCombination.modifier](keyCombination.character) : keyCombination.character;
  3360. const ariaLabel = keyCombination.modifier ? external_wp_keycodes_namespaceObject.shortcutAriaLabel[keyCombination.modifier](keyCombination.character) : keyCombination.character;
  3361. return (0,external_wp_element_namespaceObject.createElement)("kbd", {
  3362. className: "edit-post-keyboard-shortcut-help-modal__shortcut-key-combination",
  3363. "aria-label": forceAriaLabel || ariaLabel
  3364. }, (0,external_lodash_namespaceObject.castArray)(shortcut).map((character, index) => {
  3365. if (character === '+') {
  3366. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, {
  3367. key: index
  3368. }, character);
  3369. }
  3370. return (0,external_wp_element_namespaceObject.createElement)("kbd", {
  3371. key: index,
  3372. className: "edit-post-keyboard-shortcut-help-modal__shortcut-key"
  3373. }, character);
  3374. }));
  3375. }
  3376. function Shortcut(_ref2) {
  3377. let {
  3378. description,
  3379. keyCombination,
  3380. aliases = [],
  3381. ariaLabel
  3382. } = _ref2;
  3383. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", {
  3384. className: "edit-post-keyboard-shortcut-help-modal__shortcut-description"
  3385. }, description), (0,external_wp_element_namespaceObject.createElement)("div", {
  3386. className: "edit-post-keyboard-shortcut-help-modal__shortcut-term"
  3387. }, (0,external_wp_element_namespaceObject.createElement)(KeyCombination, {
  3388. keyCombination: keyCombination,
  3389. forceAriaLabel: ariaLabel
  3390. }), aliases.map((alias, index) => (0,external_wp_element_namespaceObject.createElement)(KeyCombination, {
  3391. keyCombination: alias,
  3392. forceAriaLabel: ariaLabel,
  3393. key: index
  3394. }))));
  3395. }
  3396. /* harmony default export */ var keyboard_shortcut_help_modal_shortcut = (Shortcut);
  3397. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js
  3398. /**
  3399. * WordPress dependencies
  3400. */
  3401. /**
  3402. * Internal dependencies
  3403. */
  3404. function DynamicShortcut(_ref) {
  3405. let {
  3406. name
  3407. } = _ref;
  3408. const {
  3409. keyCombination,
  3410. description,
  3411. aliases
  3412. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  3413. const {
  3414. getShortcutKeyCombination,
  3415. getShortcutDescription,
  3416. getShortcutAliases
  3417. } = select(external_wp_keyboardShortcuts_namespaceObject.store);
  3418. return {
  3419. keyCombination: getShortcutKeyCombination(name),
  3420. aliases: getShortcutAliases(name),
  3421. description: getShortcutDescription(name)
  3422. };
  3423. }, [name]);
  3424. if (!keyCombination) {
  3425. return null;
  3426. }
  3427. return (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcut_help_modal_shortcut, {
  3428. keyCombination: keyCombination,
  3429. description: description,
  3430. aliases: aliases
  3431. });
  3432. }
  3433. /* harmony default export */ var dynamic_shortcut = (DynamicShortcut);
  3434. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/keyboard-shortcut-help-modal/index.js
  3435. /**
  3436. * External dependencies
  3437. */
  3438. /**
  3439. * WordPress dependencies
  3440. */
  3441. /**
  3442. * Internal dependencies
  3443. */
  3444. const MODAL_NAME = 'edit-post/keyboard-shortcut-help';
  3445. const ShortcutList = _ref => {
  3446. let {
  3447. shortcuts
  3448. } = _ref;
  3449. return (
  3450. /*
  3451. * Disable reason: The `list` ARIA role is redundant but
  3452. * Safari+VoiceOver won't announce the list otherwise.
  3453. */
  3454. /* eslint-disable jsx-a11y/no-redundant-roles */
  3455. (0,external_wp_element_namespaceObject.createElement)("ul", {
  3456. className: "edit-post-keyboard-shortcut-help-modal__shortcut-list",
  3457. role: "list"
  3458. }, shortcuts.map((shortcut, index) => (0,external_wp_element_namespaceObject.createElement)("li", {
  3459. className: "edit-post-keyboard-shortcut-help-modal__shortcut",
  3460. key: index
  3461. }, (0,external_lodash_namespaceObject.isString)(shortcut) ? (0,external_wp_element_namespaceObject.createElement)(dynamic_shortcut, {
  3462. name: shortcut
  3463. }) : (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcut_help_modal_shortcut, shortcut))))
  3464. /* eslint-enable jsx-a11y/no-redundant-roles */
  3465. );
  3466. };
  3467. const ShortcutSection = _ref2 => {
  3468. let {
  3469. title,
  3470. shortcuts,
  3471. className
  3472. } = _ref2;
  3473. return (0,external_wp_element_namespaceObject.createElement)("section", {
  3474. className: classnames_default()('edit-post-keyboard-shortcut-help-modal__section', className)
  3475. }, !!title && (0,external_wp_element_namespaceObject.createElement)("h2", {
  3476. className: "edit-post-keyboard-shortcut-help-modal__section-title"
  3477. }, title), (0,external_wp_element_namespaceObject.createElement)(ShortcutList, {
  3478. shortcuts: shortcuts
  3479. }));
  3480. };
  3481. const ShortcutCategorySection = _ref3 => {
  3482. let {
  3483. title,
  3484. categoryName,
  3485. additionalShortcuts = []
  3486. } = _ref3;
  3487. const categoryShortcuts = (0,external_wp_data_namespaceObject.useSelect)(select => {
  3488. return select(external_wp_keyboardShortcuts_namespaceObject.store).getCategoryShortcuts(categoryName);
  3489. }, [categoryName]);
  3490. return (0,external_wp_element_namespaceObject.createElement)(ShortcutSection, {
  3491. title: title,
  3492. shortcuts: categoryShortcuts.concat(additionalShortcuts)
  3493. });
  3494. };
  3495. function KeyboardShortcutHelpModal(_ref4) {
  3496. let {
  3497. isModalActive,
  3498. toggleModal
  3499. } = _ref4;
  3500. (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-post/keyboard-shortcuts', toggleModal);
  3501. if (!isModalActive) {
  3502. return null;
  3503. }
  3504. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
  3505. className: "edit-post-keyboard-shortcut-help-modal",
  3506. title: (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts'),
  3507. closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close'),
  3508. onRequestClose: toggleModal
  3509. }, (0,external_wp_element_namespaceObject.createElement)(ShortcutSection, {
  3510. className: "edit-post-keyboard-shortcut-help-modal__main-shortcuts",
  3511. shortcuts: ['core/edit-post/keyboard-shortcuts']
  3512. }), (0,external_wp_element_namespaceObject.createElement)(ShortcutCategorySection, {
  3513. title: (0,external_wp_i18n_namespaceObject.__)('Global shortcuts'),
  3514. categoryName: "global"
  3515. }), (0,external_wp_element_namespaceObject.createElement)(ShortcutCategorySection, {
  3516. title: (0,external_wp_i18n_namespaceObject.__)('Selection shortcuts'),
  3517. categoryName: "selection"
  3518. }), (0,external_wp_element_namespaceObject.createElement)(ShortcutCategorySection, {
  3519. title: (0,external_wp_i18n_namespaceObject.__)('Block shortcuts'),
  3520. categoryName: "block",
  3521. additionalShortcuts: [{
  3522. keyCombination: {
  3523. character: '/'
  3524. },
  3525. description: (0,external_wp_i18n_namespaceObject.__)('Change the block type after adding a new paragraph.'),
  3526. /* translators: The forward-slash character. e.g. '/'. */
  3527. ariaLabel: (0,external_wp_i18n_namespaceObject.__)('Forward-slash')
  3528. }]
  3529. }), (0,external_wp_element_namespaceObject.createElement)(ShortcutSection, {
  3530. title: (0,external_wp_i18n_namespaceObject.__)('Text formatting'),
  3531. shortcuts: textFormattingShortcuts
  3532. }));
  3533. }
  3534. /* harmony default export */ var keyboard_shortcut_help_modal = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => ({
  3535. isModalActive: select(store_store).isModalActive(MODAL_NAME)
  3536. })), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, _ref5) => {
  3537. let {
  3538. isModalActive
  3539. } = _ref5;
  3540. const {
  3541. openModal,
  3542. closeModal
  3543. } = dispatch(store_store);
  3544. return {
  3545. toggleModal: () => isModalActive ? closeModal() : openModal(MODAL_NAME)
  3546. };
  3547. })])(KeyboardShortcutHelpModal));
  3548. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/options/enable-custom-fields.js
  3549. /**
  3550. * WordPress dependencies
  3551. */
  3552. function CustomFieldsConfirmation(_ref) {
  3553. let {
  3554. willEnable
  3555. } = _ref;
  3556. const [isReloading, setIsReloading] = (0,external_wp_element_namespaceObject.useState)(false);
  3557. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("p", {
  3558. className: "edit-post-preferences-modal__custom-fields-confirmation-message"
  3559. }, (0,external_wp_i18n_namespaceObject.__)('A page reload is required for this change. Make sure your content is saved before reloading.')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  3560. className: "edit-post-preferences-modal__custom-fields-confirmation-button",
  3561. variant: "secondary",
  3562. isBusy: isReloading,
  3563. disabled: isReloading,
  3564. onClick: () => {
  3565. setIsReloading(true);
  3566. document.getElementById('toggle-custom-fields-form').submit();
  3567. }
  3568. }, willEnable ? (0,external_wp_i18n_namespaceObject.__)('Enable & Reload') : (0,external_wp_i18n_namespaceObject.__)('Disable & Reload')));
  3569. }
  3570. function EnableCustomFieldsOption(_ref2) {
  3571. let {
  3572. label,
  3573. areCustomFieldsEnabled
  3574. } = _ref2;
  3575. const [isChecked, setIsChecked] = (0,external_wp_element_namespaceObject.useState)(areCustomFieldsEnabled);
  3576. return (0,external_wp_element_namespaceObject.createElement)(preferences_modal_base_option, {
  3577. label: label,
  3578. isChecked: isChecked,
  3579. onChange: setIsChecked
  3580. }, isChecked !== areCustomFieldsEnabled && (0,external_wp_element_namespaceObject.createElement)(CustomFieldsConfirmation, {
  3581. willEnable: isChecked
  3582. }));
  3583. }
  3584. /* harmony default export */ var enable_custom_fields = ((0,external_wp_data_namespaceObject.withSelect)(select => ({
  3585. areCustomFieldsEnabled: !!select(external_wp_editor_namespaceObject.store).getEditorSettings().enableCustomFields
  3586. }))(EnableCustomFieldsOption));
  3587. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/options/enable-panel.js
  3588. /**
  3589. * WordPress dependencies
  3590. */
  3591. /**
  3592. * Internal dependencies
  3593. */
  3594. /* harmony default export */ var enable_panel = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)((select, _ref) => {
  3595. let {
  3596. panelName
  3597. } = _ref;
  3598. const {
  3599. isEditorPanelEnabled,
  3600. isEditorPanelRemoved
  3601. } = select(store_store);
  3602. return {
  3603. isRemoved: isEditorPanelRemoved(panelName),
  3604. isChecked: isEditorPanelEnabled(panelName)
  3605. };
  3606. }), (0,external_wp_compose_namespaceObject.ifCondition)(_ref2 => {
  3607. let {
  3608. isRemoved
  3609. } = _ref2;
  3610. return !isRemoved;
  3611. }), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, _ref3) => {
  3612. let {
  3613. panelName
  3614. } = _ref3;
  3615. return {
  3616. onChange: () => dispatch(store_store).toggleEditorPanelEnabled(panelName)
  3617. };
  3618. }))(preferences_modal_base_option));
  3619. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/options/enable-plugin-document-setting-panel.js
  3620. /**
  3621. * WordPress dependencies
  3622. */
  3623. /**
  3624. * Internal dependencies
  3625. */
  3626. const {
  3627. Fill,
  3628. Slot: enable_plugin_document_setting_panel_Slot
  3629. } = (0,external_wp_components_namespaceObject.createSlotFill)('EnablePluginDocumentSettingPanelOption');
  3630. const EnablePluginDocumentSettingPanelOption = _ref => {
  3631. let {
  3632. label,
  3633. panelName
  3634. } = _ref;
  3635. return (0,external_wp_element_namespaceObject.createElement)(Fill, null, (0,external_wp_element_namespaceObject.createElement)(enable_panel, {
  3636. label: label,
  3637. panelName: panelName
  3638. }));
  3639. };
  3640. EnablePluginDocumentSettingPanelOption.Slot = enable_plugin_document_setting_panel_Slot;
  3641. /* harmony default export */ var enable_plugin_document_setting_panel = (EnablePluginDocumentSettingPanelOption);
  3642. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/options/enable-publish-sidebar.js
  3643. /**
  3644. * WordPress dependencies
  3645. */
  3646. /* harmony default export */ var enable_publish_sidebar = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)(select => ({
  3647. isChecked: select(external_wp_editor_namespaceObject.store).isPublishSidebarEnabled()
  3648. })), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => {
  3649. const {
  3650. enablePublishSidebar,
  3651. disablePublishSidebar
  3652. } = dispatch(external_wp_editor_namespaceObject.store);
  3653. return {
  3654. onChange: isEnabled => isEnabled ? enablePublishSidebar() : disablePublishSidebar()
  3655. };
  3656. }), // In < medium viewports we override this option and always show the publish sidebar.
  3657. // See the edit-post's header component for the specific logic.
  3658. (0,external_wp_viewport_namespaceObject.ifViewportMatches)('medium'))(preferences_modal_base_option));
  3659. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/options/enable-feature.js
  3660. /**
  3661. * WordPress dependencies
  3662. */
  3663. /**
  3664. * Internal dependencies
  3665. */
  3666. /* harmony default export */ var enable_feature = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)((select, _ref) => {
  3667. let {
  3668. featureName
  3669. } = _ref;
  3670. const {
  3671. isFeatureActive
  3672. } = select(store_store);
  3673. return {
  3674. isChecked: isFeatureActive(featureName)
  3675. };
  3676. }), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, _ref2) => {
  3677. let {
  3678. featureName
  3679. } = _ref2;
  3680. return {
  3681. onChange: () => dispatch(store_store).toggleFeature(featureName)
  3682. };
  3683. }))(preferences_modal_base_option));
  3684. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/options/index.js
  3685. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/meta-boxes-section.js
  3686. /**
  3687. * External dependencies
  3688. */
  3689. /**
  3690. * WordPress dependencies
  3691. */
  3692. /**
  3693. * Internal dependencies
  3694. */
  3695. function MetaBoxesSection(_ref) {
  3696. let {
  3697. areCustomFieldsRegistered,
  3698. metaBoxes,
  3699. ...sectionProps
  3700. } = _ref;
  3701. // The 'Custom Fields' meta box is a special case that we handle separately.
  3702. const thirdPartyMetaBoxes = (0,external_lodash_namespaceObject.filter)(metaBoxes, _ref2 => {
  3703. let {
  3704. id
  3705. } = _ref2;
  3706. return id !== 'postcustom';
  3707. });
  3708. if (!areCustomFieldsRegistered && thirdPartyMetaBoxes.length === 0) {
  3709. return null;
  3710. }
  3711. return (0,external_wp_element_namespaceObject.createElement)(preferences_modal_section, sectionProps, areCustomFieldsRegistered && (0,external_wp_element_namespaceObject.createElement)(enable_custom_fields, {
  3712. label: (0,external_wp_i18n_namespaceObject.__)('Custom fields')
  3713. }), (0,external_lodash_namespaceObject.map)(thirdPartyMetaBoxes, _ref3 => {
  3714. let {
  3715. id,
  3716. title
  3717. } = _ref3;
  3718. return (0,external_wp_element_namespaceObject.createElement)(enable_panel, {
  3719. key: id,
  3720. label: title,
  3721. panelName: `meta-box-${id}`
  3722. });
  3723. }));
  3724. }
  3725. /* harmony default export */ var meta_boxes_section = ((0,external_wp_data_namespaceObject.withSelect)(select => {
  3726. const {
  3727. getEditorSettings
  3728. } = select(external_wp_editor_namespaceObject.store);
  3729. const {
  3730. getAllMetaBoxes
  3731. } = select(store_store);
  3732. return {
  3733. // This setting should not live in the block editor's store.
  3734. areCustomFieldsRegistered: getEditorSettings().enableCustomFields !== undefined,
  3735. metaBoxes: getAllMetaBoxes()
  3736. };
  3737. })(MetaBoxesSection));
  3738. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/block-manager/checklist.js
  3739. /**
  3740. * External dependencies
  3741. */
  3742. /**
  3743. * WordPress dependencies
  3744. */
  3745. function BlockTypesChecklist(_ref) {
  3746. let {
  3747. blockTypes,
  3748. value,
  3749. onItemChange
  3750. } = _ref;
  3751. return (0,external_wp_element_namespaceObject.createElement)("ul", {
  3752. className: "edit-post-block-manager__checklist"
  3753. }, blockTypes.map(blockType => (0,external_wp_element_namespaceObject.createElement)("li", {
  3754. key: blockType.name,
  3755. className: "edit-post-block-manager__checklist-item"
  3756. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CheckboxControl, {
  3757. label: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, blockType.title, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockIcon, {
  3758. icon: blockType.icon
  3759. })),
  3760. checked: value.includes(blockType.name),
  3761. onChange: (0,external_lodash_namespaceObject.partial)(onItemChange, blockType.name)
  3762. }))));
  3763. }
  3764. /* harmony default export */ var checklist = (BlockTypesChecklist);
  3765. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/block-manager/category.js
  3766. /**
  3767. * External dependencies
  3768. */
  3769. /**
  3770. * WordPress dependencies
  3771. */
  3772. /**
  3773. * Internal dependencies
  3774. */
  3775. function BlockManagerCategory(_ref) {
  3776. let {
  3777. title,
  3778. blockTypes
  3779. } = _ref;
  3780. const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(BlockManagerCategory);
  3781. const {
  3782. defaultAllowedBlockTypes,
  3783. hiddenBlockTypes
  3784. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  3785. const {
  3786. getEditorSettings
  3787. } = select(external_wp_editor_namespaceObject.store);
  3788. const {
  3789. getHiddenBlockTypes
  3790. } = select(store_store);
  3791. return {
  3792. defaultAllowedBlockTypes: getEditorSettings().defaultAllowedBlockTypes,
  3793. hiddenBlockTypes: getHiddenBlockTypes()
  3794. };
  3795. }, []);
  3796. const filteredBlockTypes = (0,external_wp_element_namespaceObject.useMemo)(() => {
  3797. if (defaultAllowedBlockTypes === true) {
  3798. return blockTypes;
  3799. }
  3800. return blockTypes.filter(_ref2 => {
  3801. let {
  3802. name
  3803. } = _ref2;
  3804. return (0,external_lodash_namespaceObject.includes)(defaultAllowedBlockTypes || [], name);
  3805. });
  3806. }, [defaultAllowedBlockTypes, blockTypes]);
  3807. const {
  3808. showBlockTypes,
  3809. hideBlockTypes
  3810. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  3811. const toggleVisible = (0,external_wp_element_namespaceObject.useCallback)((blockName, nextIsChecked) => {
  3812. if (nextIsChecked) {
  3813. showBlockTypes(blockName);
  3814. } else {
  3815. hideBlockTypes(blockName);
  3816. }
  3817. }, []);
  3818. const toggleAllVisible = (0,external_wp_element_namespaceObject.useCallback)(nextIsChecked => {
  3819. const blockNames = (0,external_lodash_namespaceObject.map)(blockTypes, 'name');
  3820. if (nextIsChecked) {
  3821. showBlockTypes(blockNames);
  3822. } else {
  3823. hideBlockTypes(blockNames);
  3824. }
  3825. }, [blockTypes]);
  3826. if (!filteredBlockTypes.length) {
  3827. return null;
  3828. }
  3829. const checkedBlockNames = (0,external_lodash_namespaceObject.without)((0,external_lodash_namespaceObject.map)(filteredBlockTypes, 'name'), ...hiddenBlockTypes);
  3830. const titleId = 'edit-post-block-manager__category-title-' + instanceId;
  3831. const isAllChecked = checkedBlockNames.length === filteredBlockTypes.length;
  3832. let ariaChecked;
  3833. if (isAllChecked) {
  3834. ariaChecked = 'true';
  3835. } else if (checkedBlockNames.length > 0) {
  3836. ariaChecked = 'mixed';
  3837. } else {
  3838. ariaChecked = 'false';
  3839. }
  3840. return (0,external_wp_element_namespaceObject.createElement)("div", {
  3841. role: "group",
  3842. "aria-labelledby": titleId,
  3843. className: "edit-post-block-manager__category"
  3844. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CheckboxControl, {
  3845. checked: isAllChecked,
  3846. onChange: toggleAllVisible,
  3847. className: "edit-post-block-manager__category-title",
  3848. "aria-checked": ariaChecked,
  3849. label: (0,external_wp_element_namespaceObject.createElement)("span", {
  3850. id: titleId
  3851. }, title)
  3852. }), (0,external_wp_element_namespaceObject.createElement)(checklist, {
  3853. blockTypes: filteredBlockTypes,
  3854. value: checkedBlockNames,
  3855. onItemChange: toggleVisible
  3856. }));
  3857. }
  3858. /* harmony default export */ var block_manager_category = (BlockManagerCategory);
  3859. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/block-manager/index.js
  3860. /**
  3861. * External dependencies
  3862. */
  3863. /**
  3864. * WordPress dependencies
  3865. */
  3866. /**
  3867. * Internal dependencies
  3868. */
  3869. function BlockManager(_ref) {
  3870. let {
  3871. blockTypes,
  3872. categories,
  3873. hasBlockSupport,
  3874. isMatchingSearchTerm,
  3875. numberOfHiddenBlocks
  3876. } = _ref;
  3877. const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500);
  3878. const [search, setSearch] = (0,external_wp_element_namespaceObject.useState)(''); // Filtering occurs here (as opposed to `withSelect`) to avoid
  3879. // wasted renders by consequence of `Array#filter` producing
  3880. // a new value reference on each call.
  3881. blockTypes = blockTypes.filter(blockType => hasBlockSupport(blockType, 'inserter', true) && (!search || isMatchingSearchTerm(blockType, search)) && (!blockType.parent || (0,external_lodash_namespaceObject.includes)(blockType.parent, 'core/post-content'))); // Announce search results on change
  3882. (0,external_wp_element_namespaceObject.useEffect)(() => {
  3883. if (!search) {
  3884. return;
  3885. }
  3886. const count = blockTypes.length;
  3887. const resultsFoundMessage = (0,external_wp_i18n_namespaceObject.sprintf)(
  3888. /* translators: %d: number of results. */
  3889. (0,external_wp_i18n_namespaceObject._n)('%d result found.', '%d results found.', count), count);
  3890. debouncedSpeak(resultsFoundMessage);
  3891. }, [blockTypes.length, search, debouncedSpeak]);
  3892. return (0,external_wp_element_namespaceObject.createElement)("div", {
  3893. className: "edit-post-block-manager__content"
  3894. }, !!numberOfHiddenBlocks && (0,external_wp_element_namespaceObject.createElement)("div", {
  3895. className: "edit-post-block-manager__disabled-blocks-count"
  3896. }, (0,external_wp_i18n_namespaceObject.sprintf)(
  3897. /* translators: %d: number of blocks. */
  3898. (0,external_wp_i18n_namespaceObject._n)('%d block is hidden.', '%d blocks are hidden.', numberOfHiddenBlocks), numberOfHiddenBlocks)), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SearchControl, {
  3899. label: (0,external_wp_i18n_namespaceObject.__)('Search for a block'),
  3900. placeholder: (0,external_wp_i18n_namespaceObject.__)('Search for a block'),
  3901. value: search,
  3902. onChange: nextSearch => setSearch(nextSearch),
  3903. className: "edit-post-block-manager__search"
  3904. }), (0,external_wp_element_namespaceObject.createElement)("div", {
  3905. tabIndex: "0",
  3906. role: "region",
  3907. "aria-label": (0,external_wp_i18n_namespaceObject.__)('Available block types'),
  3908. className: "edit-post-block-manager__results"
  3909. }, blockTypes.length === 0 && (0,external_wp_element_namespaceObject.createElement)("p", {
  3910. className: "edit-post-block-manager__no-results"
  3911. }, (0,external_wp_i18n_namespaceObject.__)('No blocks found.')), categories.map(category => (0,external_wp_element_namespaceObject.createElement)(block_manager_category, {
  3912. key: category.slug,
  3913. title: category.title,
  3914. blockTypes: (0,external_lodash_namespaceObject.filter)(blockTypes, {
  3915. category: category.slug
  3916. })
  3917. })), (0,external_wp_element_namespaceObject.createElement)(block_manager_category, {
  3918. title: (0,external_wp_i18n_namespaceObject.__)('Uncategorized'),
  3919. blockTypes: (0,external_lodash_namespaceObject.filter)(blockTypes, _ref2 => {
  3920. let {
  3921. category
  3922. } = _ref2;
  3923. return !category;
  3924. })
  3925. })));
  3926. }
  3927. /* harmony default export */ var block_manager = ((0,external_wp_data_namespaceObject.withSelect)(select => {
  3928. const {
  3929. getBlockTypes,
  3930. getCategories,
  3931. hasBlockSupport,
  3932. isMatchingSearchTerm
  3933. } = select(external_wp_blocks_namespaceObject.store);
  3934. const {
  3935. getHiddenBlockTypes
  3936. } = select(store_store);
  3937. const hiddenBlockTypes = getHiddenBlockTypes();
  3938. const numberOfHiddenBlocks = (0,external_lodash_namespaceObject.isArray)(hiddenBlockTypes) && hiddenBlockTypes.length;
  3939. return {
  3940. blockTypes: getBlockTypes(),
  3941. categories: getCategories(),
  3942. hasBlockSupport,
  3943. isMatchingSearchTerm,
  3944. numberOfHiddenBlocks
  3945. };
  3946. })(BlockManager));
  3947. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/index.js
  3948. /**
  3949. * External dependencies
  3950. */
  3951. /**
  3952. * WordPress dependencies
  3953. */
  3954. /**
  3955. * Internal dependencies
  3956. */
  3957. const preferences_modal_MODAL_NAME = 'edit-post/preferences';
  3958. function EditPostPreferencesModal() {
  3959. const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium');
  3960. const {
  3961. closeModal
  3962. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  3963. const {
  3964. isModalActive,
  3965. isViewable
  3966. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  3967. const {
  3968. getEditedPostAttribute
  3969. } = select(external_wp_editor_namespaceObject.store);
  3970. const {
  3971. getPostType
  3972. } = select(external_wp_coreData_namespaceObject.store);
  3973. const postType = getPostType(getEditedPostAttribute('type'));
  3974. return {
  3975. isModalActive: select(store_store).isModalActive(preferences_modal_MODAL_NAME),
  3976. isViewable: (0,external_lodash_namespaceObject.get)(postType, ['viewable'], false)
  3977. };
  3978. }, []);
  3979. const showBlockBreadcrumbsOption = (0,external_wp_data_namespaceObject.useSelect)(select => {
  3980. const {
  3981. getEditorSettings
  3982. } = select(external_wp_editor_namespaceObject.store);
  3983. const {
  3984. getEditorMode,
  3985. isFeatureActive
  3986. } = select(store_store);
  3987. const mode = getEditorMode();
  3988. const isRichEditingEnabled = getEditorSettings().richEditingEnabled;
  3989. const hasReducedUI = isFeatureActive('reducedUI');
  3990. return !hasReducedUI && isLargeViewport && isRichEditingEnabled && mode === 'visual';
  3991. }, [isLargeViewport]);
  3992. const sections = (0,external_wp_element_namespaceObject.useMemo)(() => [{
  3993. name: 'general',
  3994. tabLabel: (0,external_wp_i18n_namespaceObject.__)('General'),
  3995. content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, isLargeViewport && (0,external_wp_element_namespaceObject.createElement)(preferences_modal_section, {
  3996. title: (0,external_wp_i18n_namespaceObject.__)('Publishing'),
  3997. description: (0,external_wp_i18n_namespaceObject.__)('Change options related to publishing.')
  3998. }, (0,external_wp_element_namespaceObject.createElement)(enable_publish_sidebar, {
  3999. help: (0,external_wp_i18n_namespaceObject.__)('Review settings, such as visibility and tags.'),
  4000. label: (0,external_wp_i18n_namespaceObject.__)('Include pre-publish checklist')
  4001. })), (0,external_wp_element_namespaceObject.createElement)(preferences_modal_section, {
  4002. title: (0,external_wp_i18n_namespaceObject.__)('Appearance'),
  4003. description: (0,external_wp_i18n_namespaceObject.__)('Customize options related to the block editor interface and editing flow.')
  4004. }, (0,external_wp_element_namespaceObject.createElement)(enable_feature, {
  4005. featureName: "reducedUI",
  4006. help: (0,external_wp_i18n_namespaceObject.__)('Compacts options and outlines in the toolbar.'),
  4007. label: (0,external_wp_i18n_namespaceObject.__)('Reduce the interface')
  4008. }), (0,external_wp_element_namespaceObject.createElement)(enable_feature, {
  4009. featureName: "focusMode",
  4010. help: (0,external_wp_i18n_namespaceObject.__)('Highlights the current block and fades other content.'),
  4011. label: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode')
  4012. }), (0,external_wp_element_namespaceObject.createElement)(enable_feature, {
  4013. featureName: "showIconLabels",
  4014. help: (0,external_wp_i18n_namespaceObject.__)('Shows text instead of icons.'),
  4015. label: (0,external_wp_i18n_namespaceObject.__)('Display button labels')
  4016. }), (0,external_wp_element_namespaceObject.createElement)(enable_feature, {
  4017. featureName: "themeStyles",
  4018. help: (0,external_wp_i18n_namespaceObject.__)('Make the editor look like your theme.'),
  4019. label: (0,external_wp_i18n_namespaceObject.__)('Use theme styles')
  4020. }), showBlockBreadcrumbsOption && (0,external_wp_element_namespaceObject.createElement)(enable_feature, {
  4021. featureName: "showBlockBreadcrumbs",
  4022. help: (0,external_wp_i18n_namespaceObject.__)('Shows block breadcrumbs at the bottom of the editor.'),
  4023. label: (0,external_wp_i18n_namespaceObject.__)('Display block breadcrumbs')
  4024. })))
  4025. }, {
  4026. name: 'blocks',
  4027. tabLabel: (0,external_wp_i18n_namespaceObject.__)('Blocks'),
  4028. content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(preferences_modal_section, {
  4029. title: (0,external_wp_i18n_namespaceObject.__)('Block interactions'),
  4030. description: (0,external_wp_i18n_namespaceObject.__)('Customize how you interact with blocks in the block library and editing canvas.')
  4031. }, (0,external_wp_element_namespaceObject.createElement)(enable_feature, {
  4032. featureName: "mostUsedBlocks",
  4033. help: (0,external_wp_i18n_namespaceObject.__)('Places the most frequent blocks in the block library.'),
  4034. label: (0,external_wp_i18n_namespaceObject.__)('Show most used blocks')
  4035. }), (0,external_wp_element_namespaceObject.createElement)(enable_feature, {
  4036. featureName: "keepCaretInsideBlock",
  4037. help: (0,external_wp_i18n_namespaceObject.__)('Aids screen readers by stopping text caret from leaving blocks.'),
  4038. label: (0,external_wp_i18n_namespaceObject.__)('Contain text cursor inside block')
  4039. })), (0,external_wp_element_namespaceObject.createElement)(preferences_modal_section, {
  4040. title: (0,external_wp_i18n_namespaceObject.__)('Visible blocks'),
  4041. description: (0,external_wp_i18n_namespaceObject.__)("Disable blocks that you don't want to appear in the inserter. They can always be toggled back on later.")
  4042. }, (0,external_wp_element_namespaceObject.createElement)(block_manager, null)))
  4043. }, {
  4044. name: 'panels',
  4045. tabLabel: (0,external_wp_i18n_namespaceObject.__)('Panels'),
  4046. content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(preferences_modal_section, {
  4047. title: (0,external_wp_i18n_namespaceObject.__)('Document settings'),
  4048. description: (0,external_wp_i18n_namespaceObject.__)('Choose what displays in the panel.')
  4049. }, (0,external_wp_element_namespaceObject.createElement)(enable_plugin_document_setting_panel.Slot, null), isViewable && (0,external_wp_element_namespaceObject.createElement)(enable_panel, {
  4050. label: (0,external_wp_i18n_namespaceObject.__)('Permalink'),
  4051. panelName: "post-link"
  4052. }), isViewable && (0,external_wp_element_namespaceObject.createElement)(enable_panel, {
  4053. label: (0,external_wp_i18n_namespaceObject.__)('Template'),
  4054. panelName: "template"
  4055. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTaxonomies, {
  4056. taxonomyWrapper: (content, taxonomy) => (0,external_wp_element_namespaceObject.createElement)(enable_panel, {
  4057. label: (0,external_lodash_namespaceObject.get)(taxonomy, ['labels', 'menu_name']),
  4058. panelName: `taxonomy-panel-${taxonomy.slug}`
  4059. })
  4060. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostFeaturedImageCheck, null, (0,external_wp_element_namespaceObject.createElement)(enable_panel, {
  4061. label: (0,external_wp_i18n_namespaceObject.__)('Featured image'),
  4062. panelName: "featured-image"
  4063. })), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostExcerptCheck, null, (0,external_wp_element_namespaceObject.createElement)(enable_panel, {
  4064. label: (0,external_wp_i18n_namespaceObject.__)('Excerpt'),
  4065. panelName: "post-excerpt"
  4066. })), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTypeSupportCheck, {
  4067. supportKeys: ['comments', 'trackbacks']
  4068. }, (0,external_wp_element_namespaceObject.createElement)(enable_panel, {
  4069. label: (0,external_wp_i18n_namespaceObject.__)('Discussion'),
  4070. panelName: "discussion-panel"
  4071. })), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PageAttributesCheck, null, (0,external_wp_element_namespaceObject.createElement)(enable_panel, {
  4072. label: (0,external_wp_i18n_namespaceObject.__)('Page attributes'),
  4073. panelName: "page-attributes"
  4074. }))), (0,external_wp_element_namespaceObject.createElement)(meta_boxes_section, {
  4075. title: (0,external_wp_i18n_namespaceObject.__)('Additional'),
  4076. description: (0,external_wp_i18n_namespaceObject.__)('Add extra areas to the editor.')
  4077. }))
  4078. }], [isViewable, isLargeViewport, showBlockBreadcrumbsOption]);
  4079. if (!isModalActive) {
  4080. return null;
  4081. }
  4082. return (0,external_wp_element_namespaceObject.createElement)(PreferencesModal, {
  4083. closeModal: closeModal
  4084. }, (0,external_wp_element_namespaceObject.createElement)(PreferencesModalTabs, {
  4085. sections: sections
  4086. }));
  4087. }
  4088. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/browser-url/index.js
  4089. /**
  4090. * WordPress dependencies
  4091. */
  4092. /**
  4093. * Returns the Post's Edit URL.
  4094. *
  4095. * @param {number} postId Post ID.
  4096. *
  4097. * @return {string} Post edit URL.
  4098. */
  4099. function getPostEditURL(postId) {
  4100. return (0,external_wp_url_namespaceObject.addQueryArgs)('post.php', {
  4101. post: postId,
  4102. action: 'edit'
  4103. });
  4104. }
  4105. /**
  4106. * Returns the Post's Trashed URL.
  4107. *
  4108. * @param {number} postId Post ID.
  4109. * @param {string} postType Post Type.
  4110. *
  4111. * @return {string} Post trashed URL.
  4112. */
  4113. function getPostTrashedURL(postId, postType) {
  4114. return (0,external_wp_url_namespaceObject.addQueryArgs)('edit.php', {
  4115. trashed: 1,
  4116. post_type: postType,
  4117. ids: postId
  4118. });
  4119. }
  4120. class BrowserURL extends external_wp_element_namespaceObject.Component {
  4121. constructor() {
  4122. super(...arguments);
  4123. this.state = {
  4124. historyId: null
  4125. };
  4126. }
  4127. componentDidUpdate(prevProps) {
  4128. const {
  4129. postId,
  4130. postStatus,
  4131. postType,
  4132. isSavingPost
  4133. } = this.props;
  4134. const {
  4135. historyId
  4136. } = this.state; // Posts are still dirty while saving so wait for saving to finish
  4137. // to avoid the unsaved changes warning when trashing posts.
  4138. if (postStatus === 'trash' && !isSavingPost) {
  4139. this.setTrashURL(postId, postType);
  4140. return;
  4141. }
  4142. if ((postId !== prevProps.postId || postId !== historyId) && postStatus !== 'auto-draft' && postId) {
  4143. this.setBrowserURL(postId);
  4144. }
  4145. }
  4146. /**
  4147. * Navigates the browser to the post trashed URL to show a notice about the trashed post.
  4148. *
  4149. * @param {number} postId Post ID.
  4150. * @param {string} postType Post Type.
  4151. */
  4152. setTrashURL(postId, postType) {
  4153. window.location.href = getPostTrashedURL(postId, postType);
  4154. }
  4155. /**
  4156. * Replaces the browser URL with a post editor link for the given post ID.
  4157. *
  4158. * Note it is important that, since this function may be called when the
  4159. * editor first loads, the result generated `getPostEditURL` matches that
  4160. * produced by the server. Otherwise, the URL will change unexpectedly.
  4161. *
  4162. * @param {number} postId Post ID for which to generate post editor URL.
  4163. */
  4164. setBrowserURL(postId) {
  4165. window.history.replaceState({
  4166. id: postId
  4167. }, 'Post ' + postId, getPostEditURL(postId));
  4168. this.setState(() => ({
  4169. historyId: postId
  4170. }));
  4171. }
  4172. render() {
  4173. return null;
  4174. }
  4175. }
  4176. /* harmony default export */ var browser_url = ((0,external_wp_data_namespaceObject.withSelect)(select => {
  4177. const {
  4178. getCurrentPost,
  4179. isSavingPost
  4180. } = select(external_wp_editor_namespaceObject.store);
  4181. const post = getCurrentPost();
  4182. let {
  4183. id,
  4184. status,
  4185. type
  4186. } = post;
  4187. const isTemplate = ['wp_template', 'wp_template_part'].includes(type);
  4188. if (isTemplate) {
  4189. id = post.wp_id;
  4190. }
  4191. return {
  4192. postId: id,
  4193. postStatus: status,
  4194. postType: type,
  4195. isSavingPost: isSavingPost()
  4196. };
  4197. })(BrowserURL));
  4198. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/wordpress.js
  4199. /**
  4200. * WordPress dependencies
  4201. */
  4202. const wordpress = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  4203. xmlns: "http://www.w3.org/2000/svg",
  4204. viewBox: "-2 -2 24 24"
  4205. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  4206. d: "M20 10c0-5.51-4.49-10-10-10C4.48 0 0 4.49 0 10c0 5.52 4.48 10 10 10 5.51 0 10-4.48 10-10zM7.78 15.37L4.37 6.22c.55-.02 1.17-.08 1.17-.08.5-.06.44-1.13-.06-1.11 0 0-1.45.11-2.37.11-.18 0-.37 0-.58-.01C4.12 2.69 6.87 1.11 10 1.11c2.33 0 4.45.87 6.05 2.34-.68-.11-1.65.39-1.65 1.58 0 .74.45 1.36.9 2.1.35.61.55 1.36.55 2.46 0 1.49-1.4 5-1.4 5l-3.03-8.37c.54-.02.82-.17.82-.17.5-.05.44-1.25-.06-1.22 0 0-1.44.12-2.38.12-.87 0-2.33-.12-2.33-.12-.5-.03-.56 1.2-.06 1.22l.92.08 1.26 3.41zM17.41 10c.24-.64.74-1.87.43-4.25.7 1.29 1.05 2.71 1.05 4.25 0 3.29-1.73 6.24-4.4 7.78.97-2.59 1.94-5.2 2.92-7.78zM6.1 18.09C3.12 16.65 1.11 13.53 1.11 10c0-1.3.23-2.48.72-3.59C3.25 10.3 4.67 14.2 6.1 18.09zm4.03-6.63l2.58 6.98c-.86.29-1.76.45-2.71.45-.79 0-1.57-.11-2.29-.33.81-2.38 1.62-4.74 2.42-7.1z"
  4207. }));
  4208. /* harmony default export */ var library_wordpress = (wordpress);
  4209. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/fullscreen-mode-close/index.js
  4210. /**
  4211. * External dependencies
  4212. */
  4213. /**
  4214. * WordPress dependencies
  4215. */
  4216. /**
  4217. * Internal dependencies
  4218. */
  4219. function FullscreenModeClose(_ref) {
  4220. let {
  4221. showTooltip,
  4222. icon,
  4223. href
  4224. } = _ref;
  4225. const {
  4226. isActive,
  4227. isRequestingSiteIcon,
  4228. postType,
  4229. siteIconUrl
  4230. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  4231. const {
  4232. getCurrentPostType
  4233. } = select(external_wp_editor_namespaceObject.store);
  4234. const {
  4235. isFeatureActive
  4236. } = select(store_store);
  4237. const {
  4238. getEntityRecord,
  4239. getPostType,
  4240. isResolving
  4241. } = select(external_wp_coreData_namespaceObject.store);
  4242. const siteData = getEntityRecord('root', '__unstableBase', undefined) || {};
  4243. return {
  4244. isActive: isFeatureActive('fullscreenMode'),
  4245. isRequestingSiteIcon: isResolving('getEntityRecord', ['root', '__unstableBase', undefined]),
  4246. postType: getPostType(getCurrentPostType()),
  4247. siteIconUrl: siteData.site_icon_url
  4248. };
  4249. }, []);
  4250. const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)();
  4251. if (!isActive || !postType) {
  4252. return null;
  4253. }
  4254. let buttonIcon = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, {
  4255. size: "36px",
  4256. icon: library_wordpress
  4257. });
  4258. const effect = {
  4259. expand: {
  4260. scale: 1.25,
  4261. transition: {
  4262. type: 'tween',
  4263. duration: '0.3'
  4264. }
  4265. }
  4266. };
  4267. if (siteIconUrl) {
  4268. buttonIcon = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.img, {
  4269. variants: !disableMotion && effect,
  4270. alt: (0,external_wp_i18n_namespaceObject.__)('Site Icon'),
  4271. className: "edit-post-fullscreen-mode-close_site-icon",
  4272. src: siteIconUrl
  4273. });
  4274. }
  4275. if (isRequestingSiteIcon) {
  4276. buttonIcon = null;
  4277. } // Override default icon if custom icon is provided via props.
  4278. if (icon) {
  4279. buttonIcon = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, {
  4280. size: "36px",
  4281. icon: icon
  4282. });
  4283. }
  4284. const classes = classnames_default()({
  4285. 'edit-post-fullscreen-mode-close': true,
  4286. 'has-icon': siteIconUrl
  4287. });
  4288. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, {
  4289. whileHover: "expand"
  4290. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  4291. className: classes,
  4292. href: href !== null && href !== void 0 ? href : (0,external_wp_url_namespaceObject.addQueryArgs)('edit.php', {
  4293. post_type: postType.slug
  4294. }),
  4295. label: (0,external_lodash_namespaceObject.get)(postType, ['labels', 'view_items'], (0,external_wp_i18n_namespaceObject.__)('Back')),
  4296. showTooltip: showTooltip
  4297. }, buttonIcon));
  4298. }
  4299. /* harmony default export */ var fullscreen_mode_close = (FullscreenModeClose);
  4300. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/list-view.js
  4301. /**
  4302. * WordPress dependencies
  4303. */
  4304. const listView = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  4305. viewBox: "0 0 24 24",
  4306. xmlns: "http://www.w3.org/2000/svg"
  4307. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  4308. d: "M13.8 5.2H3v1.5h10.8V5.2zm-3.6 12v1.5H21v-1.5H10.2zm7.2-6H6.6v1.5h10.8v-1.5z"
  4309. }));
  4310. /* harmony default export */ var list_view = (listView);
  4311. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/plus.js
  4312. /**
  4313. * WordPress dependencies
  4314. */
  4315. const plus = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  4316. xmlns: "http://www.w3.org/2000/svg",
  4317. viewBox: "0 0 24 24"
  4318. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  4319. d: "M18 11.2h-5.2V6h-1.6v5.2H6v1.6h5.2V18h1.6v-5.2H18z"
  4320. }));
  4321. /* harmony default export */ var library_plus = (plus);
  4322. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/header-toolbar/index.js
  4323. /**
  4324. * WordPress dependencies
  4325. */
  4326. /**
  4327. * Internal dependencies
  4328. */
  4329. const preventDefault = event => {
  4330. event.preventDefault();
  4331. };
  4332. function HeaderToolbar() {
  4333. const inserterButton = (0,external_wp_element_namespaceObject.useRef)();
  4334. const {
  4335. setIsInserterOpened,
  4336. setIsListViewOpened
  4337. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  4338. const {
  4339. isInserterEnabled,
  4340. isInserterOpened,
  4341. isTextModeEnabled,
  4342. showIconLabels,
  4343. isListViewOpen,
  4344. listViewShortcut
  4345. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  4346. const {
  4347. hasInserterItems,
  4348. getBlockRootClientId,
  4349. getBlockSelectionEnd
  4350. } = select(external_wp_blockEditor_namespaceObject.store);
  4351. const {
  4352. getEditorSettings
  4353. } = select(external_wp_editor_namespaceObject.store);
  4354. const {
  4355. getEditorMode,
  4356. isFeatureActive,
  4357. isListViewOpened
  4358. } = select(store_store);
  4359. const {
  4360. getShortcutRepresentation
  4361. } = select(external_wp_keyboardShortcuts_namespaceObject.store);
  4362. return {
  4363. // This setting (richEditingEnabled) should not live in the block editor's setting.
  4364. isInserterEnabled: getEditorMode() === 'visual' && getEditorSettings().richEditingEnabled && hasInserterItems(getBlockRootClientId(getBlockSelectionEnd())),
  4365. isInserterOpened: select(store_store).isInserterOpened(),
  4366. isTextModeEnabled: getEditorMode() === 'text',
  4367. showIconLabels: isFeatureActive('showIconLabels'),
  4368. isListViewOpen: isListViewOpened(),
  4369. listViewShortcut: getShortcutRepresentation('core/edit-post/toggle-list-view')
  4370. };
  4371. }, []);
  4372. const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium');
  4373. const isWideViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('wide');
  4374. /* translators: accessibility text for the editor toolbar */
  4375. const toolbarAriaLabel = (0,external_wp_i18n_namespaceObject.__)('Document tools');
  4376. const toggleListView = (0,external_wp_element_namespaceObject.useCallback)(() => setIsListViewOpened(!isListViewOpen), [setIsListViewOpened, isListViewOpen]);
  4377. const overflowItems = (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, {
  4378. as: external_wp_editor_namespaceObject.TableOfContents,
  4379. hasOutlineItemsDisabled: isTextModeEnabled,
  4380. repositionDropdown: showIconLabels && !isWideViewport,
  4381. showTooltip: !showIconLabels,
  4382. variant: showIconLabels ? 'tertiary' : undefined
  4383. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, {
  4384. as: external_wp_components_namespaceObject.Button,
  4385. className: "edit-post-header-toolbar__list-view-toggle",
  4386. icon: list_view,
  4387. disabled: isTextModeEnabled,
  4388. isPressed: isListViewOpen
  4389. /* translators: button label text should, if possible, be under 16 characters. */
  4390. ,
  4391. label: (0,external_wp_i18n_namespaceObject.__)('List View'),
  4392. onClick: toggleListView,
  4393. shortcut: listViewShortcut,
  4394. showTooltip: !showIconLabels
  4395. }));
  4396. const openInserter = (0,external_wp_element_namespaceObject.useCallback)(() => {
  4397. if (isInserterOpened) {
  4398. // Focusing the inserter button closes the inserter popover.
  4399. inserterButton.current.focus();
  4400. } else {
  4401. setIsInserterOpened(true);
  4402. }
  4403. }, [isInserterOpened, setIsInserterOpened]);
  4404. return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.NavigableToolbar, {
  4405. className: "edit-post-header-toolbar",
  4406. "aria-label": toolbarAriaLabel
  4407. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  4408. className: "edit-post-header-toolbar__left"
  4409. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, {
  4410. ref: inserterButton,
  4411. as: external_wp_components_namespaceObject.Button,
  4412. className: "edit-post-header-toolbar__inserter-toggle",
  4413. variant: "primary",
  4414. isPressed: isInserterOpened,
  4415. onMouseDown: preventDefault,
  4416. onClick: openInserter,
  4417. disabled: !isInserterEnabled,
  4418. icon: library_plus
  4419. /* translators: button label text should, if possible, be under 16
  4420. characters. */
  4421. ,
  4422. label: (0,external_wp_i18n_namespaceObject._x)('Toggle block inserter', 'Generic label for block inserter button'),
  4423. showTooltip: !showIconLabels
  4424. }, showIconLabels && (!isInserterOpened ? (0,external_wp_i18n_namespaceObject.__)('Add') : (0,external_wp_i18n_namespaceObject.__)('Close'))), (isWideViewport || !showIconLabels) && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, isLargeViewport && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, {
  4425. as: external_wp_blockEditor_namespaceObject.ToolSelector,
  4426. showTooltip: !showIconLabels,
  4427. variant: showIconLabels ? 'tertiary' : undefined,
  4428. disabled: isTextModeEnabled
  4429. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, {
  4430. as: external_wp_editor_namespaceObject.EditorHistoryUndo,
  4431. showTooltip: !showIconLabels,
  4432. variant: showIconLabels ? 'tertiary' : undefined
  4433. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, {
  4434. as: external_wp_editor_namespaceObject.EditorHistoryRedo,
  4435. showTooltip: !showIconLabels,
  4436. variant: showIconLabels ? 'tertiary' : undefined
  4437. }), overflowItems)));
  4438. }
  4439. /* harmony default export */ var header_toolbar = (HeaderToolbar);
  4440. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/mode-switcher/index.js
  4441. /**
  4442. * WordPress dependencies
  4443. */
  4444. /**
  4445. * Internal dependencies
  4446. */
  4447. /**
  4448. * Set of available mode options.
  4449. *
  4450. * @type {Array}
  4451. */
  4452. const MODES = [{
  4453. value: 'visual',
  4454. label: (0,external_wp_i18n_namespaceObject.__)('Visual editor')
  4455. }, {
  4456. value: 'text',
  4457. label: (0,external_wp_i18n_namespaceObject.__)('Code editor')
  4458. }];
  4459. function ModeSwitcher() {
  4460. const {
  4461. shortcut,
  4462. isRichEditingEnabled,
  4463. isCodeEditingEnabled,
  4464. isEditingTemplate,
  4465. mode
  4466. } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
  4467. shortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getShortcutRepresentation('core/edit-post/toggle-mode'),
  4468. isRichEditingEnabled: select(external_wp_editor_namespaceObject.store).getEditorSettings().richEditingEnabled,
  4469. isCodeEditingEnabled: select(external_wp_editor_namespaceObject.store).getEditorSettings().codeEditingEnabled,
  4470. isEditingTemplate: select(store_store).isEditingTemplate(),
  4471. mode: select(store_store).getEditorMode()
  4472. }), []);
  4473. const {
  4474. switchEditorMode
  4475. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  4476. if (isEditingTemplate) {
  4477. return null;
  4478. }
  4479. if (!isRichEditingEnabled || !isCodeEditingEnabled) {
  4480. return null;
  4481. }
  4482. const choices = MODES.map(choice => {
  4483. if (choice.value !== mode) {
  4484. return { ...choice,
  4485. shortcut
  4486. };
  4487. }
  4488. return choice;
  4489. });
  4490. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
  4491. label: (0,external_wp_i18n_namespaceObject.__)('Editor')
  4492. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItemsChoice, {
  4493. choices: choices,
  4494. value: mode,
  4495. onSelect: switchEditorMode
  4496. }));
  4497. }
  4498. /* harmony default export */ var mode_switcher = (ModeSwitcher);
  4499. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/preferences-menu-item/index.js
  4500. /**
  4501. * WordPress dependencies
  4502. */
  4503. /**
  4504. * Internal dependencies
  4505. */
  4506. function PreferencesMenuItem() {
  4507. const {
  4508. openModal
  4509. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  4510. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
  4511. onClick: () => {
  4512. openModal('edit-post/preferences');
  4513. }
  4514. }, (0,external_wp_i18n_namespaceObject.__)('Preferences'));
  4515. }
  4516. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/writing-menu/index.js
  4517. /**
  4518. * WordPress dependencies
  4519. */
  4520. function WritingMenu() {
  4521. const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium');
  4522. if (!isLargeViewport) {
  4523. return null;
  4524. }
  4525. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
  4526. label: (0,external_wp_i18n_namespaceObject._x)('View', 'noun')
  4527. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, {
  4528. scope: "core/edit-post",
  4529. name: "fixedToolbar",
  4530. label: (0,external_wp_i18n_namespaceObject.__)('Top toolbar'),
  4531. info: (0,external_wp_i18n_namespaceObject.__)('Access all block and document tools in a single place'),
  4532. messageActivated: (0,external_wp_i18n_namespaceObject.__)('Top toolbar activated'),
  4533. messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Top toolbar deactivated')
  4534. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, {
  4535. scope: "core/edit-post",
  4536. name: "focusMode",
  4537. label: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode'),
  4538. info: (0,external_wp_i18n_namespaceObject.__)('Focus on one block at a time'),
  4539. messageActivated: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode activated'),
  4540. messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode deactivated')
  4541. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, {
  4542. scope: "core/edit-post",
  4543. name: "fullscreenMode",
  4544. label: (0,external_wp_i18n_namespaceObject.__)('Fullscreen mode'),
  4545. info: (0,external_wp_i18n_namespaceObject.__)('Work without distraction'),
  4546. messageActivated: (0,external_wp_i18n_namespaceObject.__)('Fullscreen mode activated'),
  4547. messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Fullscreen mode deactivated'),
  4548. shortcut: external_wp_keycodes_namespaceObject.displayShortcut.secondary('f')
  4549. }));
  4550. }
  4551. /* harmony default export */ var writing_menu = (WritingMenu);
  4552. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/more-menu/index.js
  4553. /**
  4554. * WordPress dependencies
  4555. */
  4556. /**
  4557. * Internal dependencies
  4558. */
  4559. const MoreMenu = _ref => {
  4560. let {
  4561. showIconLabels
  4562. } = _ref;
  4563. const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('large');
  4564. return (0,external_wp_element_namespaceObject.createElement)(MoreMenuDropdown, {
  4565. toggleProps: {
  4566. showTooltip: !showIconLabels,
  4567. ...(showIconLabels && {
  4568. variant: 'tertiary'
  4569. })
  4570. }
  4571. }, _ref2 => {
  4572. let {
  4573. onClose
  4574. } = _ref2;
  4575. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, showIconLabels && !isLargeViewport && (0,external_wp_element_namespaceObject.createElement)(pinned_items.Slot, {
  4576. className: showIconLabels && 'show-icon-labels',
  4577. scope: "core/edit-post"
  4578. }), (0,external_wp_element_namespaceObject.createElement)(writing_menu, null), (0,external_wp_element_namespaceObject.createElement)(mode_switcher, null), (0,external_wp_element_namespaceObject.createElement)(action_item.Slot, {
  4579. name: "core/edit-post/plugin-more-menu",
  4580. label: (0,external_wp_i18n_namespaceObject.__)('Plugins'),
  4581. as: external_wp_components_namespaceObject.MenuGroup,
  4582. fillProps: {
  4583. onClick: onClose
  4584. }
  4585. }), (0,external_wp_element_namespaceObject.createElement)(tools_more_menu_group.Slot, {
  4586. fillProps: {
  4587. onClose
  4588. }
  4589. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_wp_element_namespaceObject.createElement)(PreferencesMenuItem, null)));
  4590. });
  4591. };
  4592. /* harmony default export */ var more_menu = (MoreMenu);
  4593. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/post-publish-button-or-toggle.js
  4594. /**
  4595. * External dependencies
  4596. */
  4597. /**
  4598. * WordPress dependencies
  4599. */
  4600. /**
  4601. * Internal dependencies
  4602. */
  4603. function PostPublishButtonOrToggle(_ref) {
  4604. let {
  4605. forceIsDirty,
  4606. forceIsSaving,
  4607. hasPublishAction,
  4608. isBeingScheduled,
  4609. isPending,
  4610. isPublished,
  4611. isPublishSidebarEnabled,
  4612. isPublishSidebarOpened,
  4613. isScheduled,
  4614. togglePublishSidebar,
  4615. setEntitiesSavedStatesCallback
  4616. } = _ref;
  4617. const IS_TOGGLE = 'toggle';
  4618. const IS_BUTTON = 'button';
  4619. const isSmallerThanMediumViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
  4620. let component;
  4621. /**
  4622. * Conditions to show a BUTTON (publish directly) or a TOGGLE (open publish sidebar):
  4623. *
  4624. * 1) We want to show a BUTTON when the post status is at the _final stage_
  4625. * for a particular role (see https://wordpress.org/support/article/post-status/):
  4626. *
  4627. * - is published
  4628. * - is scheduled to be published
  4629. * - is pending and can't be published (but only for viewports >= medium).
  4630. * Originally, we considered showing a button for pending posts that couldn't be published
  4631. * (for example, for an author with the contributor role). Some languages can have
  4632. * long translations for "Submit for review", so given the lack of UI real estate available
  4633. * we decided to take into account the viewport in that case.
  4634. * See: https://github.com/WordPress/gutenberg/issues/10475
  4635. *
  4636. * 2) Then, in small viewports, we'll show a TOGGLE.
  4637. *
  4638. * 3) Finally, we'll use the publish sidebar status to decide:
  4639. *
  4640. * - if it is enabled, we show a TOGGLE
  4641. * - if it is disabled, we show a BUTTON
  4642. */
  4643. if (isPublished || isScheduled && isBeingScheduled || isPending && !hasPublishAction && !isSmallerThanMediumViewport) {
  4644. component = IS_BUTTON;
  4645. } else if (isSmallerThanMediumViewport) {
  4646. component = IS_TOGGLE;
  4647. } else if (isPublishSidebarEnabled) {
  4648. component = IS_TOGGLE;
  4649. } else {
  4650. component = IS_BUTTON;
  4651. }
  4652. return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostPublishButton, {
  4653. forceIsDirty: forceIsDirty,
  4654. forceIsSaving: forceIsSaving,
  4655. isOpen: isPublishSidebarOpened,
  4656. isToggle: component === IS_TOGGLE,
  4657. onToggle: togglePublishSidebar,
  4658. setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback
  4659. });
  4660. }
  4661. /* harmony default export */ var post_publish_button_or_toggle = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)(select => ({
  4662. hasPublishAction: (0,external_lodash_namespaceObject.get)(select(external_wp_editor_namespaceObject.store).getCurrentPost(), ['_links', 'wp:action-publish'], false),
  4663. isBeingScheduled: select(external_wp_editor_namespaceObject.store).isEditedPostBeingScheduled(),
  4664. isPending: select(external_wp_editor_namespaceObject.store).isCurrentPostPending(),
  4665. isPublished: select(external_wp_editor_namespaceObject.store).isCurrentPostPublished(),
  4666. isPublishSidebarEnabled: select(external_wp_editor_namespaceObject.store).isPublishSidebarEnabled(),
  4667. isPublishSidebarOpened: select(store_store).isPublishSidebarOpened(),
  4668. isScheduled: select(external_wp_editor_namespaceObject.store).isCurrentPostScheduled()
  4669. })), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => {
  4670. const {
  4671. togglePublishSidebar
  4672. } = dispatch(store_store);
  4673. return {
  4674. togglePublishSidebar
  4675. };
  4676. }))(PostPublishButtonOrToggle));
  4677. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/device-preview/index.js
  4678. /**
  4679. * WordPress dependencies
  4680. */
  4681. /**
  4682. * Internal dependencies
  4683. */
  4684. function DevicePreview() {
  4685. const {
  4686. hasActiveMetaboxes,
  4687. isPostSaveable,
  4688. isSaving,
  4689. deviceType
  4690. } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
  4691. hasActiveMetaboxes: select(store_store).hasMetaBoxes(),
  4692. isSaving: select(store_store).isSavingMetaBoxes(),
  4693. isPostSaveable: select(external_wp_editor_namespaceObject.store).isEditedPostSaveable(),
  4694. deviceType: select(store_store).__experimentalGetPreviewDeviceType()
  4695. }), []);
  4696. const {
  4697. __experimentalSetPreviewDeviceType: setPreviewDeviceType
  4698. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  4699. return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalPreviewOptions, {
  4700. isEnabled: isPostSaveable,
  4701. className: "edit-post-post-preview-dropdown",
  4702. deviceType: deviceType,
  4703. setDeviceType: setPreviewDeviceType
  4704. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_wp_element_namespaceObject.createElement)("div", {
  4705. className: "edit-post-header-preview__grouping-external"
  4706. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostPreviewButton, {
  4707. className: 'edit-post-header-preview__button-external',
  4708. role: "menuitem",
  4709. forceIsAutosaveable: hasActiveMetaboxes,
  4710. forcePreviewLink: isSaving ? null : undefined,
  4711. textContent: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_i18n_namespaceObject.__)('Preview in new tab'), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, {
  4712. icon: library_external
  4713. }))
  4714. }))));
  4715. }
  4716. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/main-dashboard-button/index.js
  4717. /**
  4718. * WordPress dependencies
  4719. */
  4720. const slotName = '__experimentalMainDashboardButton';
  4721. const {
  4722. Fill: main_dashboard_button_Fill,
  4723. Slot: MainDashboardButtonSlot
  4724. } = (0,external_wp_components_namespaceObject.createSlotFill)(slotName);
  4725. const MainDashboardButton = main_dashboard_button_Fill;
  4726. const main_dashboard_button_Slot = _ref => {
  4727. let {
  4728. children
  4729. } = _ref;
  4730. const slot = (0,external_wp_components_namespaceObject.__experimentalUseSlot)(slotName);
  4731. const hasFills = Boolean(slot.fills && slot.fills.length);
  4732. if (!hasFills) {
  4733. return children;
  4734. }
  4735. return (0,external_wp_element_namespaceObject.createElement)(MainDashboardButtonSlot, {
  4736. bubblesVirtually: true
  4737. });
  4738. };
  4739. MainDashboardButton.Slot = main_dashboard_button_Slot;
  4740. /* harmony default export */ var main_dashboard_button = (MainDashboardButton);
  4741. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-down.js
  4742. /**
  4743. * WordPress dependencies
  4744. */
  4745. const chevronDown = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  4746. viewBox: "0 0 24 24",
  4747. xmlns: "http://www.w3.org/2000/svg"
  4748. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  4749. d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"
  4750. }));
  4751. /* harmony default export */ var chevron_down = (chevronDown);
  4752. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/template-title/delete-template.js
  4753. /**
  4754. * External dependencies
  4755. */
  4756. /**
  4757. * WordPress dependencies
  4758. */
  4759. /**
  4760. * Internal dependencies
  4761. */
  4762. function DeleteTemplate() {
  4763. const {
  4764. clearSelectedBlock
  4765. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
  4766. const {
  4767. setIsEditingTemplate
  4768. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  4769. const {
  4770. getEditorSettings
  4771. } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_editor_namespaceObject.store);
  4772. const {
  4773. updateEditorSettings,
  4774. editPost
  4775. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store);
  4776. const {
  4777. deleteEntityRecord
  4778. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
  4779. const {
  4780. template
  4781. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  4782. const {
  4783. isEditingTemplate,
  4784. getEditedPostTemplate
  4785. } = select(store_store);
  4786. const _isEditing = isEditingTemplate();
  4787. return {
  4788. template: _isEditing ? getEditedPostTemplate() : null
  4789. };
  4790. }, []);
  4791. const [showConfirmDialog, setShowConfirmDialog] = (0,external_wp_element_namespaceObject.useState)(false);
  4792. if (!template || !template.wp_id) {
  4793. return null;
  4794. }
  4795. let templateTitle = template.slug;
  4796. if (template !== null && template !== void 0 && template.title) {
  4797. templateTitle = template.title;
  4798. }
  4799. const onDelete = () => {
  4800. clearSelectedBlock();
  4801. setIsEditingTemplate(false);
  4802. setShowConfirmDialog(false);
  4803. editPost({
  4804. template: ''
  4805. });
  4806. const settings = getEditorSettings();
  4807. const newAvailableTemplates = (0,external_lodash_namespaceObject.pickBy)(settings.availableTemplates, (_title, id) => {
  4808. return id !== template.slug;
  4809. });
  4810. updateEditorSettings({ ...settings,
  4811. availableTemplates: newAvailableTemplates
  4812. });
  4813. deleteEntityRecord('postType', 'wp_template', template.id, {
  4814. throwOnError: true
  4815. });
  4816. };
  4817. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
  4818. className: "edit-post-template-top-area__second-menu-group"
  4819. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
  4820. className: "edit-post-template-top-area__delete-template-button",
  4821. isDestructive: true,
  4822. variant: "secondary",
  4823. "aria-label": (0,external_wp_i18n_namespaceObject.__)('Delete template'),
  4824. onClick: () => {
  4825. setShowConfirmDialog(true);
  4826. }
  4827. }, (0,external_wp_i18n_namespaceObject.__)('Delete template')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalConfirmDialog, {
  4828. isOpen: showConfirmDialog,
  4829. onConfirm: onDelete,
  4830. onCancel: () => {
  4831. setShowConfirmDialog(false);
  4832. }
  4833. }, (0,external_wp_i18n_namespaceObject.sprintf)(
  4834. /* translators: %s: template name */
  4835. (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to delete the %s template? It may be used by other pages or posts.'), templateTitle))));
  4836. }
  4837. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/template-title/edit-template-title.js
  4838. /**
  4839. * External dependencies
  4840. */
  4841. /**
  4842. * WordPress dependencies
  4843. */
  4844. /**
  4845. * Internal dependencies
  4846. */
  4847. function EditTemplateTitle() {
  4848. const {
  4849. template
  4850. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  4851. const {
  4852. getEditedPostTemplate
  4853. } = select(store_store);
  4854. return {
  4855. template: getEditedPostTemplate()
  4856. };
  4857. }, []);
  4858. const {
  4859. editEntityRecord
  4860. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
  4861. const {
  4862. getEditorSettings
  4863. } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_editor_namespaceObject.store);
  4864. const {
  4865. updateEditorSettings
  4866. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store); // Only user-created and non-default templates can change the name.
  4867. if (!template.is_custom || template.has_theme_file) {
  4868. return null;
  4869. }
  4870. let templateTitle = (0,external_wp_i18n_namespaceObject.__)('Default');
  4871. if (template !== null && template !== void 0 && template.title) {
  4872. templateTitle = template.title;
  4873. } else if (!!template) {
  4874. templateTitle = template.slug;
  4875. }
  4876. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
  4877. label: (0,external_wp_i18n_namespaceObject.__)('Title'),
  4878. value: templateTitle,
  4879. help: (0,external_wp_i18n_namespaceObject.__)('Give the template a title that indicates its purpose, e.g. "Full Width".'),
  4880. onChange: newTitle => {
  4881. const settings = getEditorSettings();
  4882. const newAvailableTemplates = (0,external_lodash_namespaceObject.mapValues)(settings.availableTemplates, (existingTitle, id) => {
  4883. if (id !== template.slug) {
  4884. return existingTitle;
  4885. }
  4886. return newTitle;
  4887. });
  4888. updateEditorSettings({ ...settings,
  4889. availableTemplates: newAvailableTemplates
  4890. });
  4891. editEntityRecord('postType', 'wp_template', template.id, {
  4892. title: newTitle
  4893. });
  4894. }
  4895. });
  4896. }
  4897. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/template-title/template-description.js
  4898. /**
  4899. * WordPress dependencies
  4900. */
  4901. /**
  4902. * Internal dependencies
  4903. */
  4904. function TemplateDescription() {
  4905. const {
  4906. description,
  4907. title
  4908. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  4909. const {
  4910. getEditedPostTemplate
  4911. } = select(store_store);
  4912. return {
  4913. title: getEditedPostTemplate().title,
  4914. description: getEditedPostTemplate().description
  4915. };
  4916. }, []);
  4917. if (!description) {
  4918. return null;
  4919. }
  4920. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHeading, {
  4921. level: 4,
  4922. weight: 600
  4923. }, title), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalText, {
  4924. className: "edit-post-template-details__description",
  4925. size: "body",
  4926. as: "p",
  4927. style: {
  4928. marginTop: '12px'
  4929. }
  4930. }, description));
  4931. }
  4932. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/template-title/index.js
  4933. /**
  4934. * WordPress dependencies
  4935. */
  4936. /**
  4937. * Internal dependencies
  4938. */
  4939. function TemplateTitle() {
  4940. const {
  4941. template,
  4942. isEditing,
  4943. title
  4944. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  4945. const {
  4946. isEditingTemplate,
  4947. getEditedPostTemplate
  4948. } = select(store_store);
  4949. const {
  4950. getEditedPostAttribute
  4951. } = select(external_wp_editor_namespaceObject.store);
  4952. const _isEditing = isEditingTemplate();
  4953. return {
  4954. template: _isEditing ? getEditedPostTemplate() : null,
  4955. isEditing: _isEditing,
  4956. title: getEditedPostAttribute('title') ? getEditedPostAttribute('title') : (0,external_wp_i18n_namespaceObject.__)('Untitled')
  4957. };
  4958. }, []);
  4959. const {
  4960. clearSelectedBlock
  4961. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
  4962. const {
  4963. setIsEditingTemplate
  4964. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  4965. if (!isEditing || !template) {
  4966. return null;
  4967. }
  4968. let templateTitle = (0,external_wp_i18n_namespaceObject.__)('Default');
  4969. if (template !== null && template !== void 0 && template.title) {
  4970. templateTitle = template.title;
  4971. } else if (!!template) {
  4972. templateTitle = template.slug;
  4973. }
  4974. const hasOptions = !!(template.custom || template.wp_id || template.description);
  4975. return (0,external_wp_element_namespaceObject.createElement)("div", {
  4976. className: "edit-post-template-top-area"
  4977. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  4978. className: "edit-post-template-post-title",
  4979. isLink: true,
  4980. showTooltip: true,
  4981. label: (0,external_wp_i18n_namespaceObject.sprintf)(
  4982. /* translators: %s: Title of the referring post, e.g: "Hello World!" */
  4983. (0,external_wp_i18n_namespaceObject.__)('Edit %s'), title),
  4984. onClick: () => {
  4985. clearSelectedBlock();
  4986. setIsEditingTemplate(false);
  4987. }
  4988. }, title), hasOptions ? (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, {
  4989. position: "bottom center",
  4990. contentClassName: "edit-post-template-top-area__popover",
  4991. renderToggle: _ref => {
  4992. let {
  4993. onToggle
  4994. } = _ref;
  4995. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  4996. className: "edit-post-template-title",
  4997. isLink: true,
  4998. icon: chevron_down,
  4999. showTooltip: true,
  5000. onClick: onToggle,
  5001. label: (0,external_wp_i18n_namespaceObject.__)('Template Options')
  5002. }, templateTitle);
  5003. },
  5004. renderContent: () => (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(EditTemplateTitle, null), (0,external_wp_element_namespaceObject.createElement)(TemplateDescription, null), (0,external_wp_element_namespaceObject.createElement)(DeleteTemplate, null))
  5005. }) : (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalText, {
  5006. className: "edit-post-template-title",
  5007. size: "body",
  5008. style: {
  5009. lineHeight: '24px'
  5010. }
  5011. }, templateTitle));
  5012. }
  5013. /* harmony default export */ var template_title = (TemplateTitle);
  5014. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/index.js
  5015. /**
  5016. * External dependencies
  5017. */
  5018. /**
  5019. * WordPress dependencies
  5020. */
  5021. /**
  5022. * Internal dependencies
  5023. */
  5024. function Header(_ref) {
  5025. let {
  5026. setEntitiesSavedStatesCallback
  5027. } = _ref;
  5028. const {
  5029. hasActiveMetaboxes,
  5030. isPublishSidebarOpened,
  5031. isSaving,
  5032. showIconLabels,
  5033. hasReducedUI
  5034. } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
  5035. hasActiveMetaboxes: select(store_store).hasMetaBoxes(),
  5036. isPublishSidebarOpened: select(store_store).isPublishSidebarOpened(),
  5037. isSaving: select(store_store).isSavingMetaBoxes(),
  5038. showIconLabels: select(store_store).isFeatureActive('showIconLabels'),
  5039. hasReducedUI: select(store_store).isFeatureActive('reducedUI')
  5040. }), []);
  5041. const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('large');
  5042. const classes = classnames_default()('edit-post-header', {
  5043. 'has-reduced-ui': hasReducedUI
  5044. });
  5045. return (0,external_wp_element_namespaceObject.createElement)("div", {
  5046. className: classes
  5047. }, (0,external_wp_element_namespaceObject.createElement)(main_dashboard_button.Slot, null, (0,external_wp_element_namespaceObject.createElement)(fullscreen_mode_close, {
  5048. showTooltip: true
  5049. })), (0,external_wp_element_namespaceObject.createElement)("div", {
  5050. className: "edit-post-header__toolbar"
  5051. }, (0,external_wp_element_namespaceObject.createElement)(header_toolbar, null), (0,external_wp_element_namespaceObject.createElement)(template_title, null)), (0,external_wp_element_namespaceObject.createElement)("div", {
  5052. className: "edit-post-header__settings"
  5053. }, !isPublishSidebarOpened && // This button isn't completely hidden by the publish sidebar.
  5054. // We can't hide the whole toolbar when the publish sidebar is open because
  5055. // we want to prevent mounting/unmounting the PostPublishButtonOrToggle DOM node.
  5056. // We track that DOM node to return focus to the PostPublishButtonOrToggle
  5057. // when the publish sidebar has been closed.
  5058. (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostSavedState, {
  5059. forceIsDirty: hasActiveMetaboxes,
  5060. forceIsSaving: isSaving,
  5061. showIconLabels: showIconLabels
  5062. }), (0,external_wp_element_namespaceObject.createElement)(DevicePreview, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostPreviewButton, {
  5063. forceIsAutosaveable: hasActiveMetaboxes,
  5064. forcePreviewLink: isSaving ? null : undefined
  5065. }), (0,external_wp_element_namespaceObject.createElement)(post_publish_button_or_toggle, {
  5066. forceIsDirty: hasActiveMetaboxes,
  5067. forceIsSaving: isSaving,
  5068. setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback
  5069. }), (isLargeViewport || !showIconLabels) && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(pinned_items.Slot, {
  5070. scope: "core/edit-post"
  5071. }), (0,external_wp_element_namespaceObject.createElement)(more_menu, {
  5072. showIconLabels: showIconLabels
  5073. })), showIconLabels && !isLargeViewport && (0,external_wp_element_namespaceObject.createElement)(more_menu, {
  5074. showIconLabels: showIconLabels
  5075. })));
  5076. }
  5077. /* harmony default export */ var header = (Header);
  5078. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close.js
  5079. /**
  5080. * WordPress dependencies
  5081. */
  5082. const close_close = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  5083. xmlns: "http://www.w3.org/2000/svg",
  5084. viewBox: "0 0 24 24"
  5085. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  5086. d: "M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"
  5087. }));
  5088. /* harmony default export */ var library_close = (close_close);
  5089. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/secondary-sidebar/inserter-sidebar.js
  5090. /**
  5091. * WordPress dependencies
  5092. */
  5093. /**
  5094. * Internal dependencies
  5095. */
  5096. function InserterSidebar() {
  5097. const {
  5098. insertionPoint,
  5099. showMostUsedBlocks
  5100. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  5101. const {
  5102. isFeatureActive,
  5103. __experimentalGetInsertionPoint
  5104. } = select(store_store);
  5105. return {
  5106. insertionPoint: __experimentalGetInsertionPoint(),
  5107. showMostUsedBlocks: isFeatureActive('mostUsedBlocks')
  5108. };
  5109. }, []);
  5110. const {
  5111. setIsInserterOpened
  5112. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  5113. const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
  5114. const TagName = !isMobileViewport ? external_wp_components_namespaceObject.VisuallyHidden : 'div';
  5115. const [inserterDialogRef, inserterDialogProps] = (0,external_wp_compose_namespaceObject.__experimentalUseDialog)({
  5116. onClose: () => setIsInserterOpened(false),
  5117. focusOnMount: null
  5118. });
  5119. const libraryRef = (0,external_wp_element_namespaceObject.useRef)();
  5120. (0,external_wp_element_namespaceObject.useEffect)(() => {
  5121. libraryRef.current.focusSearch();
  5122. }, []);
  5123. return (0,external_wp_element_namespaceObject.createElement)("div", _extends({
  5124. ref: inserterDialogRef
  5125. }, inserterDialogProps, {
  5126. className: "edit-post-editor__inserter-panel"
  5127. }), (0,external_wp_element_namespaceObject.createElement)(TagName, {
  5128. className: "edit-post-editor__inserter-panel-header"
  5129. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  5130. icon: library_close,
  5131. label: (0,external_wp_i18n_namespaceObject.__)('Close block inserter'),
  5132. onClick: () => setIsInserterOpened(false)
  5133. })), (0,external_wp_element_namespaceObject.createElement)("div", {
  5134. className: "edit-post-editor__inserter-panel-content"
  5135. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalLibrary, {
  5136. showMostUsedBlocks: showMostUsedBlocks,
  5137. showInserterHelpPanel: true,
  5138. shouldFocusBlock: isMobileViewport,
  5139. rootClientId: insertionPoint.rootClientId,
  5140. __experimentalInsertionIndex: insertionPoint.insertionIndex,
  5141. __experimentalFilterValue: insertionPoint.filterValue,
  5142. ref: libraryRef
  5143. })));
  5144. }
  5145. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/secondary-sidebar/list-view-sidebar.js
  5146. /**
  5147. * WordPress dependencies
  5148. */
  5149. /**
  5150. * Internal dependencies
  5151. */
  5152. function ListViewSidebar() {
  5153. const {
  5154. setIsListViewOpened
  5155. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  5156. const focusOnMountRef = (0,external_wp_compose_namespaceObject.useFocusOnMount)('firstElement');
  5157. const headerFocusReturnRef = (0,external_wp_compose_namespaceObject.useFocusReturn)();
  5158. const contentFocusReturnRef = (0,external_wp_compose_namespaceObject.useFocusReturn)();
  5159. function closeOnEscape(event) {
  5160. if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !event.defaultPrevented) {
  5161. event.preventDefault();
  5162. setIsListViewOpened(false);
  5163. }
  5164. }
  5165. const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(ListViewSidebar);
  5166. const labelId = `edit-post-editor__list-view-panel-label-${instanceId}`;
  5167. return (// eslint-disable-next-line jsx-a11y/no-static-element-interactions
  5168. (0,external_wp_element_namespaceObject.createElement)("div", {
  5169. "aria-labelledby": labelId,
  5170. className: "edit-post-editor__list-view-panel",
  5171. onKeyDown: closeOnEscape
  5172. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  5173. className: "edit-post-editor__list-view-panel-header",
  5174. ref: headerFocusReturnRef
  5175. }, (0,external_wp_element_namespaceObject.createElement)("strong", {
  5176. id: labelId
  5177. }, (0,external_wp_i18n_namespaceObject.__)('List View')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  5178. icon: close_small,
  5179. label: (0,external_wp_i18n_namespaceObject.__)('Close List View Sidebar'),
  5180. onClick: () => setIsListViewOpened(false)
  5181. })), (0,external_wp_element_namespaceObject.createElement)("div", {
  5182. className: "edit-post-editor__list-view-panel-content",
  5183. ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([contentFocusReturnRef, focusOnMountRef])
  5184. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalListView, {
  5185. showNestedBlocks: true,
  5186. __experimentalFeatures: true,
  5187. __experimentalPersistentListViewFeatures: true
  5188. })))
  5189. );
  5190. }
  5191. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/cog.js
  5192. /**
  5193. * WordPress dependencies
  5194. */
  5195. const cog = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  5196. xmlns: "http://www.w3.org/2000/svg",
  5197. viewBox: "0 0 24 24"
  5198. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  5199. fillRule: "evenodd",
  5200. d: "M10.289 4.836A1 1 0 0111.275 4h1.306a1 1 0 01.987.836l.244 1.466c.787.26 1.503.679 2.108 1.218l1.393-.522a1 1 0 011.216.437l.653 1.13a1 1 0 01-.23 1.273l-1.148.944a6.025 6.025 0 010 2.435l1.149.946a1 1 0 01.23 1.272l-.653 1.13a1 1 0 01-1.216.437l-1.394-.522c-.605.54-1.32.958-2.108 1.218l-.244 1.466a1 1 0 01-.987.836h-1.306a1 1 0 01-.986-.836l-.244-1.466a5.995 5.995 0 01-2.108-1.218l-1.394.522a1 1 0 01-1.217-.436l-.653-1.131a1 1 0 01.23-1.272l1.149-.946a6.026 6.026 0 010-2.435l-1.148-.944a1 1 0 01-.23-1.272l.653-1.131a1 1 0 011.217-.437l1.393.522a5.994 5.994 0 012.108-1.218l.244-1.466zM14.929 12a3 3 0 11-6 0 3 3 0 016 0z",
  5201. clipRule: "evenodd"
  5202. }));
  5203. /* harmony default export */ var library_cog = (cog);
  5204. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/settings-header/index.js
  5205. /**
  5206. * WordPress dependencies
  5207. */
  5208. /**
  5209. * Internal dependencies
  5210. */
  5211. const SettingsHeader = _ref => {
  5212. let {
  5213. sidebarName
  5214. } = _ref;
  5215. const {
  5216. openGeneralSidebar
  5217. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  5218. const openDocumentSettings = () => openGeneralSidebar('edit-post/document');
  5219. const openBlockSettings = () => openGeneralSidebar('edit-post/block');
  5220. const {
  5221. documentLabel,
  5222. isTemplateMode
  5223. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  5224. const postTypeLabel = select(external_wp_editor_namespaceObject.store).getPostTypeLabel();
  5225. return {
  5226. // translators: Default label for the Document sidebar tab, not selected.
  5227. documentLabel: postTypeLabel || (0,external_wp_i18n_namespaceObject._x)('Document', 'noun'),
  5228. isTemplateMode: select(store_store).isEditingTemplate()
  5229. };
  5230. }, []);
  5231. const [documentAriaLabel, documentActiveClass] = sidebarName === 'edit-post/document' ? // translators: ARIA label for the Document sidebar tab, selected. %s: Document label.
  5232. [(0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('%s (selected)'), documentLabel), 'is-active'] : [documentLabel, ''];
  5233. const [blockAriaLabel, blockActiveClass] = sidebarName === 'edit-post/block' ? // translators: ARIA label for the Block Settings Sidebar tab, selected.
  5234. [(0,external_wp_i18n_namespaceObject.__)('Block (selected)'), 'is-active'] : // translators: ARIA label for the Block Settings Sidebar tab, not selected.
  5235. [(0,external_wp_i18n_namespaceObject.__)('Block'), ''];
  5236. const [templateAriaLabel, templateActiveClass] = sidebarName === 'edit-post/document' ? [(0,external_wp_i18n_namespaceObject.__)('Template (selected)'), 'is-active'] : [(0,external_wp_i18n_namespaceObject.__)('Template'), ''];
  5237. /* Use a list so screen readers will announce how many tabs there are. */
  5238. return (0,external_wp_element_namespaceObject.createElement)("ul", null, !isTemplateMode && (0,external_wp_element_namespaceObject.createElement)("li", null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  5239. onClick: openDocumentSettings,
  5240. className: `edit-post-sidebar__panel-tab ${documentActiveClass}`,
  5241. "aria-label": documentAriaLabel,
  5242. "data-label": documentLabel
  5243. }, documentLabel)), isTemplateMode && (0,external_wp_element_namespaceObject.createElement)("li", null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  5244. onClick: openDocumentSettings,
  5245. className: `edit-post-sidebar__panel-tab ${templateActiveClass}`,
  5246. "aria-label": templateAriaLabel,
  5247. "data-label": (0,external_wp_i18n_namespaceObject.__)('Template')
  5248. }, (0,external_wp_i18n_namespaceObject.__)('Template'))), (0,external_wp_element_namespaceObject.createElement)("li", null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  5249. onClick: openBlockSettings,
  5250. className: `edit-post-sidebar__panel-tab ${blockActiveClass}`,
  5251. "aria-label": blockAriaLabel // translators: Data label for the Block Settings Sidebar tab.
  5252. ,
  5253. "data-label": (0,external_wp_i18n_namespaceObject.__)('Block')
  5254. }, // translators: Text label for the Block Settings Sidebar tab.
  5255. (0,external_wp_i18n_namespaceObject.__)('Block'))));
  5256. };
  5257. /* harmony default export */ var settings_header = (SettingsHeader);
  5258. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-visibility/index.js
  5259. /**
  5260. * WordPress dependencies
  5261. */
  5262. function PostVisibility() {
  5263. return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostVisibilityCheck, {
  5264. render: _ref => {
  5265. let {
  5266. canEdit
  5267. } = _ref;
  5268. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, {
  5269. className: "edit-post-post-visibility"
  5270. }, (0,external_wp_element_namespaceObject.createElement)("span", null, (0,external_wp_i18n_namespaceObject.__)('Visibility')), !canEdit && (0,external_wp_element_namespaceObject.createElement)("span", null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostVisibilityLabel, null)), canEdit && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, {
  5271. position: "bottom left",
  5272. contentClassName: "edit-post-post-visibility__dialog",
  5273. renderToggle: _ref2 => {
  5274. let {
  5275. isOpen,
  5276. onToggle
  5277. } = _ref2;
  5278. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  5279. "aria-expanded": isOpen,
  5280. className: "edit-post-post-visibility__toggle",
  5281. onClick: onToggle,
  5282. variant: "tertiary"
  5283. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostVisibilityLabel, null));
  5284. },
  5285. renderContent: () => (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostVisibility, null)
  5286. }));
  5287. }
  5288. });
  5289. }
  5290. /* harmony default export */ var post_visibility = (PostVisibility);
  5291. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-trash/index.js
  5292. /**
  5293. * WordPress dependencies
  5294. */
  5295. function PostTrash() {
  5296. return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTrashCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTrash, null)));
  5297. }
  5298. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-schedule/index.js
  5299. /**
  5300. * WordPress dependencies
  5301. */
  5302. function PostSchedule() {
  5303. const anchorRef = (0,external_wp_element_namespaceObject.useRef)();
  5304. return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostScheduleCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, {
  5305. className: "edit-post-post-schedule",
  5306. ref: anchorRef
  5307. }, (0,external_wp_element_namespaceObject.createElement)("span", null, (0,external_wp_i18n_namespaceObject.__)('Publish')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, {
  5308. popoverProps: {
  5309. anchorRef: anchorRef.current
  5310. },
  5311. position: "bottom left",
  5312. contentClassName: "edit-post-post-schedule__dialog",
  5313. renderToggle: _ref => {
  5314. let {
  5315. onToggle,
  5316. isOpen
  5317. } = _ref;
  5318. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  5319. className: "edit-post-post-schedule__toggle",
  5320. onClick: onToggle,
  5321. "aria-expanded": isOpen,
  5322. variant: "tertiary"
  5323. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostScheduleLabel, null)));
  5324. },
  5325. renderContent: () => (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostSchedule, null)
  5326. })));
  5327. }
  5328. /* harmony default export */ var post_schedule = (PostSchedule);
  5329. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-sticky/index.js
  5330. /**
  5331. * WordPress dependencies
  5332. */
  5333. function PostSticky() {
  5334. return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostStickyCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostSticky, null)));
  5335. }
  5336. /* harmony default export */ var post_sticky = (PostSticky);
  5337. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-author/index.js
  5338. /**
  5339. * WordPress dependencies
  5340. */
  5341. function PostAuthor() {
  5342. return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostAuthorCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, {
  5343. className: "edit-post-post-author"
  5344. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostAuthor, null)));
  5345. }
  5346. /* harmony default export */ var post_author = (PostAuthor);
  5347. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-slug/index.js
  5348. /**
  5349. * WordPress dependencies
  5350. */
  5351. function PostSlug() {
  5352. return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostSlugCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostSlug, null)));
  5353. }
  5354. /* harmony default export */ var post_slug = (PostSlug);
  5355. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-format/index.js
  5356. /**
  5357. * WordPress dependencies
  5358. */
  5359. function PostFormat() {
  5360. return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostFormatCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostFormat, null)));
  5361. }
  5362. /* harmony default export */ var post_format = (PostFormat);
  5363. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-pending-status/index.js
  5364. /**
  5365. * WordPress dependencies
  5366. */
  5367. function PostPendingStatus() {
  5368. return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostPendingStatusCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostPendingStatus, null)));
  5369. }
  5370. /* harmony default export */ var post_pending_status = (PostPendingStatus);
  5371. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/plugin-post-status-info/index.js
  5372. /**
  5373. * Defines as extensibility slot for the Status & visibility panel.
  5374. */
  5375. /**
  5376. * WordPress dependencies
  5377. */
  5378. const {
  5379. Fill: plugin_post_status_info_Fill,
  5380. Slot: plugin_post_status_info_Slot
  5381. } = (0,external_wp_components_namespaceObject.createSlotFill)('PluginPostStatusInfo');
  5382. /**
  5383. * Renders a row in the Status & visibility panel of the Document sidebar.
  5384. * It should be noted that this is named and implemented around the function it serves
  5385. * and not its location, which may change in future iterations.
  5386. *
  5387. * @param {Object} props Component properties.
  5388. * @param {string} [props.className] An optional class name added to the row.
  5389. * @param {WPElement} props.children Children to be rendered.
  5390. *
  5391. * @example
  5392. * ```js
  5393. * // Using ES5 syntax
  5394. * var __ = wp.i18n.__;
  5395. * var PluginPostStatusInfo = wp.editPost.PluginPostStatusInfo;
  5396. *
  5397. * function MyPluginPostStatusInfo() {
  5398. * return wp.element.createElement(
  5399. * PluginPostStatusInfo,
  5400. * {
  5401. * className: 'my-plugin-post-status-info',
  5402. * },
  5403. * __( 'My post status info' )
  5404. * )
  5405. * }
  5406. * ```
  5407. *
  5408. * @example
  5409. * ```jsx
  5410. * // Using ESNext syntax
  5411. * import { __ } from '@wordpress/i18n';
  5412. * import { PluginPostStatusInfo } from '@wordpress/edit-post';
  5413. *
  5414. * const MyPluginPostStatusInfo = () => (
  5415. * <PluginPostStatusInfo
  5416. * className="my-plugin-post-status-info"
  5417. * >
  5418. * { __( 'My post status info' ) }
  5419. * </PluginPostStatusInfo>
  5420. * );
  5421. * ```
  5422. *
  5423. * @return {WPComponent} The component to be rendered.
  5424. */
  5425. const PluginPostStatusInfo = _ref => {
  5426. let {
  5427. children,
  5428. className
  5429. } = _ref;
  5430. return (0,external_wp_element_namespaceObject.createElement)(plugin_post_status_info_Fill, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, {
  5431. className: className
  5432. }, children));
  5433. };
  5434. PluginPostStatusInfo.Slot = plugin_post_status_info_Slot;
  5435. /* harmony default export */ var plugin_post_status_info = (PluginPostStatusInfo);
  5436. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-status/index.js
  5437. /**
  5438. * WordPress dependencies
  5439. */
  5440. /**
  5441. * Internal dependencies
  5442. */
  5443. /**
  5444. * Module Constants
  5445. */
  5446. const PANEL_NAME = 'post-status';
  5447. function PostStatus(_ref) {
  5448. let {
  5449. isOpened,
  5450. onTogglePanel
  5451. } = _ref;
  5452. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
  5453. className: "edit-post-post-status",
  5454. title: (0,external_wp_i18n_namespaceObject.__)('Status & visibility'),
  5455. opened: isOpened,
  5456. onToggle: onTogglePanel
  5457. }, (0,external_wp_element_namespaceObject.createElement)(plugin_post_status_info.Slot, null, fills => (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(post_visibility, null), (0,external_wp_element_namespaceObject.createElement)(post_schedule, null), (0,external_wp_element_namespaceObject.createElement)(post_format, null), (0,external_wp_element_namespaceObject.createElement)(post_sticky, null), (0,external_wp_element_namespaceObject.createElement)(post_pending_status, null), (0,external_wp_element_namespaceObject.createElement)(post_slug, null), (0,external_wp_element_namespaceObject.createElement)(post_author, null), fills, (0,external_wp_element_namespaceObject.createElement)(PostTrash, null))));
  5458. }
  5459. /* harmony default export */ var post_status = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
  5460. // We use isEditorPanelRemoved to hide the panel if it was programatically removed. We do
  5461. // not use isEditorPanelEnabled since this panel should not be disabled through the UI.
  5462. const {
  5463. isEditorPanelRemoved,
  5464. isEditorPanelOpened
  5465. } = select(store_store);
  5466. return {
  5467. isRemoved: isEditorPanelRemoved(PANEL_NAME),
  5468. isOpened: isEditorPanelOpened(PANEL_NAME)
  5469. };
  5470. }), (0,external_wp_compose_namespaceObject.ifCondition)(_ref2 => {
  5471. let {
  5472. isRemoved
  5473. } = _ref2;
  5474. return !isRemoved;
  5475. }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => ({
  5476. onTogglePanel() {
  5477. return dispatch(store_store).toggleEditorPanelOpened(PANEL_NAME);
  5478. }
  5479. }))])(PostStatus));
  5480. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/last-revision/index.js
  5481. /**
  5482. * WordPress dependencies
  5483. */
  5484. function LastRevision() {
  5485. return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostLastRevisionCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
  5486. className: "edit-post-last-revision__panel"
  5487. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostLastRevision, null)));
  5488. }
  5489. /* harmony default export */ var last_revision = (LastRevision);
  5490. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-taxonomies/taxonomy-panel.js
  5491. /**
  5492. * External dependencies
  5493. */
  5494. /**
  5495. * WordPress dependencies
  5496. */
  5497. /**
  5498. * Internal dependencies
  5499. */
  5500. function TaxonomyPanel(_ref) {
  5501. let {
  5502. isEnabled,
  5503. taxonomy,
  5504. isOpened,
  5505. onTogglePanel,
  5506. children
  5507. } = _ref;
  5508. if (!isEnabled) {
  5509. return null;
  5510. }
  5511. const taxonomyMenuName = (0,external_lodash_namespaceObject.get)(taxonomy, ['labels', 'menu_name']);
  5512. if (!taxonomyMenuName) {
  5513. return null;
  5514. }
  5515. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
  5516. title: taxonomyMenuName,
  5517. opened: isOpened,
  5518. onToggle: onTogglePanel
  5519. }, children);
  5520. }
  5521. /* harmony default export */ var taxonomy_panel = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)((select, ownProps) => {
  5522. const slug = (0,external_lodash_namespaceObject.get)(ownProps.taxonomy, ['slug']);
  5523. const panelName = slug ? `taxonomy-panel-${slug}` : '';
  5524. return {
  5525. panelName,
  5526. isEnabled: slug ? select(store_store).isEditorPanelEnabled(panelName) : false,
  5527. isOpened: slug ? select(store_store).isEditorPanelOpened(panelName) : false
  5528. };
  5529. }), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, ownProps) => ({
  5530. onTogglePanel: () => {
  5531. dispatch(store_store).toggleEditorPanelOpened(ownProps.panelName);
  5532. }
  5533. })))(TaxonomyPanel));
  5534. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-taxonomies/index.js
  5535. /**
  5536. * WordPress dependencies
  5537. */
  5538. /**
  5539. * Internal dependencies
  5540. */
  5541. function PostTaxonomies() {
  5542. return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTaxonomiesCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTaxonomies, {
  5543. taxonomyWrapper: (content, taxonomy) => {
  5544. return (0,external_wp_element_namespaceObject.createElement)(taxonomy_panel, {
  5545. taxonomy: taxonomy
  5546. }, content);
  5547. }
  5548. }));
  5549. }
  5550. /* harmony default export */ var post_taxonomies = (PostTaxonomies);
  5551. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/featured-image/index.js
  5552. /**
  5553. * External dependencies
  5554. */
  5555. /**
  5556. * WordPress dependencies
  5557. */
  5558. /**
  5559. * Internal dependencies
  5560. */
  5561. /**
  5562. * Module Constants
  5563. */
  5564. const featured_image_PANEL_NAME = 'featured-image';
  5565. function FeaturedImage(_ref) {
  5566. let {
  5567. isEnabled,
  5568. isOpened,
  5569. postType,
  5570. onTogglePanel
  5571. } = _ref;
  5572. if (!isEnabled) {
  5573. return null;
  5574. }
  5575. return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostFeaturedImageCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
  5576. title: (0,external_lodash_namespaceObject.get)(postType, ['labels', 'featured_image'], (0,external_wp_i18n_namespaceObject.__)('Featured image')),
  5577. opened: isOpened,
  5578. onToggle: onTogglePanel
  5579. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostFeaturedImage, null)));
  5580. }
  5581. const applyWithSelect = (0,external_wp_data_namespaceObject.withSelect)(select => {
  5582. const {
  5583. getEditedPostAttribute
  5584. } = select(external_wp_editor_namespaceObject.store);
  5585. const {
  5586. getPostType
  5587. } = select(external_wp_coreData_namespaceObject.store);
  5588. const {
  5589. isEditorPanelEnabled,
  5590. isEditorPanelOpened
  5591. } = select(store_store);
  5592. return {
  5593. postType: getPostType(getEditedPostAttribute('type')),
  5594. isEnabled: isEditorPanelEnabled(featured_image_PANEL_NAME),
  5595. isOpened: isEditorPanelOpened(featured_image_PANEL_NAME)
  5596. };
  5597. });
  5598. const applyWithDispatch = (0,external_wp_data_namespaceObject.withDispatch)(dispatch => {
  5599. const {
  5600. toggleEditorPanelOpened
  5601. } = dispatch(store_store);
  5602. return {
  5603. onTogglePanel: (0,external_lodash_namespaceObject.partial)(toggleEditorPanelOpened, featured_image_PANEL_NAME)
  5604. };
  5605. });
  5606. /* harmony default export */ var featured_image = ((0,external_wp_compose_namespaceObject.compose)(applyWithSelect, applyWithDispatch)(FeaturedImage));
  5607. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-excerpt/index.js
  5608. /**
  5609. * WordPress dependencies
  5610. */
  5611. /**
  5612. * Internal dependencies
  5613. */
  5614. /**
  5615. * Module Constants
  5616. */
  5617. const post_excerpt_PANEL_NAME = 'post-excerpt';
  5618. function PostExcerpt(_ref) {
  5619. let {
  5620. isEnabled,
  5621. isOpened,
  5622. onTogglePanel
  5623. } = _ref;
  5624. if (!isEnabled) {
  5625. return null;
  5626. }
  5627. return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostExcerptCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
  5628. title: (0,external_wp_i18n_namespaceObject.__)('Excerpt'),
  5629. opened: isOpened,
  5630. onToggle: onTogglePanel
  5631. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostExcerpt, null)));
  5632. }
  5633. /* harmony default export */ var post_excerpt = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
  5634. return {
  5635. isEnabled: select(store_store).isEditorPanelEnabled(post_excerpt_PANEL_NAME),
  5636. isOpened: select(store_store).isEditorPanelOpened(post_excerpt_PANEL_NAME)
  5637. };
  5638. }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => ({
  5639. onTogglePanel() {
  5640. return dispatch(store_store).toggleEditorPanelOpened(post_excerpt_PANEL_NAME);
  5641. }
  5642. }))])(PostExcerpt));
  5643. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-link/index.js
  5644. /**
  5645. * External dependencies
  5646. */
  5647. /**
  5648. * WordPress dependencies
  5649. */
  5650. /**
  5651. * Internal dependencies
  5652. */
  5653. /**
  5654. * Module Constants
  5655. */
  5656. const post_link_PANEL_NAME = 'post-link';
  5657. function PostLink(_ref) {
  5658. let {
  5659. isOpened,
  5660. onTogglePanel,
  5661. isEditable,
  5662. postLink,
  5663. permalinkPrefix,
  5664. permalinkSuffix,
  5665. editPermalink,
  5666. postSlug,
  5667. postTypeLabel
  5668. } = _ref;
  5669. const [forceEmptyField, setForceEmptyField] = (0,external_wp_element_namespaceObject.useState)(false);
  5670. let prefixElement, postNameElement, suffixElement;
  5671. if (isEditable) {
  5672. prefixElement = permalinkPrefix && (0,external_wp_element_namespaceObject.createElement)("span", {
  5673. className: "edit-post-post-link__link-prefix"
  5674. }, permalinkPrefix);
  5675. postNameElement = postSlug && (0,external_wp_element_namespaceObject.createElement)("span", {
  5676. className: "edit-post-post-link__link-post-name"
  5677. }, postSlug);
  5678. suffixElement = permalinkSuffix && (0,external_wp_element_namespaceObject.createElement)("span", {
  5679. className: "edit-post-post-link__link-suffix"
  5680. }, permalinkSuffix);
  5681. }
  5682. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
  5683. title: (0,external_wp_i18n_namespaceObject.__)('Permalink'),
  5684. opened: isOpened,
  5685. onToggle: onTogglePanel
  5686. }, isEditable && (0,external_wp_element_namespaceObject.createElement)("div", {
  5687. className: "editor-post-link"
  5688. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
  5689. label: (0,external_wp_i18n_namespaceObject.__)('URL Slug'),
  5690. value: forceEmptyField ? '' : postSlug,
  5691. autoComplete: "off",
  5692. spellCheck: "false",
  5693. onChange: newValue => {
  5694. editPermalink(newValue); // When we delete the field the permalink gets
  5695. // reverted to the original value.
  5696. // The forceEmptyField logic allows the user to have
  5697. // the field temporarily empty while typing.
  5698. if (!newValue) {
  5699. if (!forceEmptyField) {
  5700. setForceEmptyField(true);
  5701. }
  5702. return;
  5703. }
  5704. if (forceEmptyField) {
  5705. setForceEmptyField(false);
  5706. }
  5707. },
  5708. onBlur: event => {
  5709. editPermalink((0,external_wp_url_namespaceObject.cleanForSlug)(event.target.value));
  5710. if (forceEmptyField) {
  5711. setForceEmptyField(false);
  5712. }
  5713. }
  5714. }), (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('The last part of the URL.'), ' ', (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, {
  5715. href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/support/article/settings-sidebar/#permalink')
  5716. }, (0,external_wp_i18n_namespaceObject.__)('Read about permalinks')))), (0,external_wp_element_namespaceObject.createElement)("h3", {
  5717. className: "edit-post-post-link__preview-label"
  5718. }, postTypeLabel || (0,external_wp_i18n_namespaceObject.__)('View post')), (0,external_wp_element_namespaceObject.createElement)("div", {
  5719. className: "edit-post-post-link__preview-link-container"
  5720. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, {
  5721. className: "edit-post-post-link__link",
  5722. href: postLink,
  5723. target: "_blank"
  5724. }, isEditable ? (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, prefixElement, postNameElement, suffixElement) : postLink)));
  5725. }
  5726. /* harmony default export */ var post_link = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
  5727. const {
  5728. isPermalinkEditable,
  5729. getCurrentPost,
  5730. isCurrentPostPublished,
  5731. getPermalinkParts,
  5732. getEditedPostAttribute,
  5733. getEditedPostSlug
  5734. } = select(external_wp_editor_namespaceObject.store);
  5735. const {
  5736. isEditorPanelEnabled,
  5737. isEditorPanelOpened
  5738. } = select(store_store);
  5739. const {
  5740. getPostType
  5741. } = select(external_wp_coreData_namespaceObject.store);
  5742. const {
  5743. link
  5744. } = getCurrentPost();
  5745. const postTypeName = getEditedPostAttribute('type');
  5746. const postType = getPostType(postTypeName);
  5747. const permalinkParts = getPermalinkParts();
  5748. return {
  5749. postLink: link,
  5750. isEditable: isPermalinkEditable(),
  5751. isPublished: isCurrentPostPublished(),
  5752. isOpened: isEditorPanelOpened(post_link_PANEL_NAME),
  5753. isEnabled: isEditorPanelEnabled(post_link_PANEL_NAME),
  5754. isViewable: (0,external_lodash_namespaceObject.get)(postType, ['viewable'], false),
  5755. postSlug: (0,external_wp_url_namespaceObject.safeDecodeURIComponent)(getEditedPostSlug()),
  5756. postTypeLabel: (0,external_lodash_namespaceObject.get)(postType, ['labels', 'view_item']),
  5757. hasPermalinkParts: !!permalinkParts,
  5758. permalinkPrefix: permalinkParts === null || permalinkParts === void 0 ? void 0 : permalinkParts.prefix,
  5759. permalinkSuffix: permalinkParts === null || permalinkParts === void 0 ? void 0 : permalinkParts.suffix
  5760. };
  5761. }), (0,external_wp_compose_namespaceObject.ifCondition)(_ref2 => {
  5762. let {
  5763. isEnabled,
  5764. postLink,
  5765. isViewable,
  5766. hasPermalinkParts
  5767. } = _ref2;
  5768. return isEnabled && postLink && isViewable && hasPermalinkParts;
  5769. }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => {
  5770. const {
  5771. toggleEditorPanelOpened
  5772. } = dispatch(store_store);
  5773. const {
  5774. editPost
  5775. } = dispatch(external_wp_editor_namespaceObject.store);
  5776. return {
  5777. onTogglePanel: () => toggleEditorPanelOpened(post_link_PANEL_NAME),
  5778. editPermalink: newSlug => {
  5779. editPost({
  5780. slug: newSlug
  5781. });
  5782. }
  5783. };
  5784. })])(PostLink));
  5785. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/discussion-panel/index.js
  5786. /**
  5787. * WordPress dependencies
  5788. */
  5789. /**
  5790. * Internal dependencies
  5791. */
  5792. /**
  5793. * Module Constants
  5794. */
  5795. const discussion_panel_PANEL_NAME = 'discussion-panel';
  5796. function DiscussionPanel(_ref) {
  5797. let {
  5798. isEnabled,
  5799. isOpened,
  5800. onTogglePanel
  5801. } = _ref;
  5802. if (!isEnabled) {
  5803. return null;
  5804. }
  5805. return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTypeSupportCheck, {
  5806. supportKeys: ['comments', 'trackbacks']
  5807. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
  5808. title: (0,external_wp_i18n_namespaceObject.__)('Discussion'),
  5809. opened: isOpened,
  5810. onToggle: onTogglePanel
  5811. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTypeSupportCheck, {
  5812. supportKeys: "comments"
  5813. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostComments, null))), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTypeSupportCheck, {
  5814. supportKeys: "trackbacks"
  5815. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostPingbacks, null)))));
  5816. }
  5817. /* harmony default export */ var discussion_panel = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
  5818. return {
  5819. isEnabled: select(store_store).isEditorPanelEnabled(discussion_panel_PANEL_NAME),
  5820. isOpened: select(store_store).isEditorPanelOpened(discussion_panel_PANEL_NAME)
  5821. };
  5822. }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => ({
  5823. onTogglePanel() {
  5824. return dispatch(store_store).toggleEditorPanelOpened(discussion_panel_PANEL_NAME);
  5825. }
  5826. }))])(DiscussionPanel));
  5827. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/page-attributes/index.js
  5828. /**
  5829. * External dependencies
  5830. */
  5831. /**
  5832. * WordPress dependencies
  5833. */
  5834. /**
  5835. * Internal dependencies
  5836. */
  5837. /**
  5838. * Module Constants
  5839. */
  5840. const page_attributes_PANEL_NAME = 'page-attributes';
  5841. function PageAttributes() {
  5842. const {
  5843. isEnabled,
  5844. isOpened,
  5845. postType
  5846. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  5847. const {
  5848. getEditedPostAttribute
  5849. } = select(external_wp_editor_namespaceObject.store);
  5850. const {
  5851. isEditorPanelEnabled,
  5852. isEditorPanelOpened
  5853. } = select(store_store);
  5854. const {
  5855. getPostType
  5856. } = select(external_wp_coreData_namespaceObject.store);
  5857. return {
  5858. isEnabled: isEditorPanelEnabled(page_attributes_PANEL_NAME),
  5859. isOpened: isEditorPanelOpened(page_attributes_PANEL_NAME),
  5860. postType: getPostType(getEditedPostAttribute('type'))
  5861. };
  5862. }, []);
  5863. const {
  5864. toggleEditorPanelOpened
  5865. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  5866. if (!isEnabled || !postType) {
  5867. return null;
  5868. }
  5869. const onTogglePanel = (0,external_lodash_namespaceObject.partial)(toggleEditorPanelOpened, page_attributes_PANEL_NAME);
  5870. return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PageAttributesCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
  5871. title: (0,external_lodash_namespaceObject.get)(postType, ['labels', 'attributes'], (0,external_wp_i18n_namespaceObject.__)('Page attributes')),
  5872. opened: isOpened,
  5873. onToggle: onTogglePanel
  5874. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PageAttributesParent, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PageAttributesOrder, null))));
  5875. }
  5876. /* harmony default export */ var page_attributes = (PageAttributes);
  5877. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/meta-boxes/meta-boxes-area/index.js
  5878. /**
  5879. * External dependencies
  5880. */
  5881. /**
  5882. * WordPress dependencies
  5883. */
  5884. /**
  5885. * Internal dependencies
  5886. */
  5887. /**
  5888. * Render metabox area.
  5889. *
  5890. * @param {Object} props Component props.
  5891. * @param {string} props.location metabox location.
  5892. * @return {WPComponent} The component to be rendered.
  5893. */
  5894. function MetaBoxesArea(_ref) {
  5895. let {
  5896. location
  5897. } = _ref;
  5898. const container = (0,external_wp_element_namespaceObject.useRef)(null);
  5899. const formRef = (0,external_wp_element_namespaceObject.useRef)(null);
  5900. (0,external_wp_element_namespaceObject.useEffect)(() => {
  5901. formRef.current = document.querySelector('.metabox-location-' + location);
  5902. if (formRef.current) {
  5903. container.current.appendChild(formRef.current);
  5904. }
  5905. return () => {
  5906. if (formRef.current) {
  5907. document.querySelector('#metaboxes').appendChild(formRef.current);
  5908. }
  5909. };
  5910. }, [location]);
  5911. const isSaving = (0,external_wp_data_namespaceObject.useSelect)(select => {
  5912. return select(store_store).isSavingMetaBoxes();
  5913. }, []);
  5914. const classes = classnames_default()('edit-post-meta-boxes-area', `is-${location}`, {
  5915. 'is-loading': isSaving
  5916. });
  5917. return (0,external_wp_element_namespaceObject.createElement)("div", {
  5918. className: classes
  5919. }, isSaving && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null), (0,external_wp_element_namespaceObject.createElement)("div", {
  5920. className: "edit-post-meta-boxes-area__container",
  5921. ref: container
  5922. }), (0,external_wp_element_namespaceObject.createElement)("div", {
  5923. className: "edit-post-meta-boxes-area__clear"
  5924. }));
  5925. }
  5926. /* harmony default export */ var meta_boxes_area = (MetaBoxesArea);
  5927. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/meta-boxes/meta-box-visibility.js
  5928. /**
  5929. * WordPress dependencies
  5930. */
  5931. /**
  5932. * Internal dependencies
  5933. */
  5934. class MetaBoxVisibility extends external_wp_element_namespaceObject.Component {
  5935. componentDidMount() {
  5936. this.updateDOM();
  5937. }
  5938. componentDidUpdate(prevProps) {
  5939. if (this.props.isVisible !== prevProps.isVisible) {
  5940. this.updateDOM();
  5941. }
  5942. }
  5943. updateDOM() {
  5944. const {
  5945. id,
  5946. isVisible
  5947. } = this.props;
  5948. const element = document.getElementById(id);
  5949. if (!element) {
  5950. return;
  5951. }
  5952. if (isVisible) {
  5953. element.classList.remove('is-hidden');
  5954. } else {
  5955. element.classList.add('is-hidden');
  5956. }
  5957. }
  5958. render() {
  5959. return null;
  5960. }
  5961. }
  5962. /* harmony default export */ var meta_box_visibility = ((0,external_wp_data_namespaceObject.withSelect)((select, _ref) => {
  5963. let {
  5964. id
  5965. } = _ref;
  5966. return {
  5967. isVisible: select(store_store).isEditorPanelEnabled(`meta-box-${id}`)
  5968. };
  5969. })(MetaBoxVisibility));
  5970. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/meta-boxes/index.js
  5971. /**
  5972. * External dependencies
  5973. */
  5974. /**
  5975. * WordPress dependencies
  5976. */
  5977. /**
  5978. * Internal dependencies
  5979. */
  5980. function MetaBoxes(_ref) {
  5981. let {
  5982. location
  5983. } = _ref;
  5984. const registry = (0,external_wp_data_namespaceObject.useRegistry)();
  5985. const {
  5986. metaBoxes,
  5987. areMetaBoxesInitialized,
  5988. isEditorReady
  5989. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  5990. const {
  5991. __unstableIsEditorReady
  5992. } = select(external_wp_editor_namespaceObject.store);
  5993. const {
  5994. getMetaBoxesPerLocation,
  5995. areMetaBoxesInitialized: _areMetaBoxesInitialized
  5996. } = select(store_store);
  5997. return {
  5998. metaBoxes: getMetaBoxesPerLocation(location),
  5999. areMetaBoxesInitialized: _areMetaBoxesInitialized(),
  6000. isEditorReady: __unstableIsEditorReady()
  6001. };
  6002. }, [location]); // When editor is ready, initialize postboxes (wp core script) and metabox
  6003. // saving. This initializes all meta box locations, not just this specific
  6004. // one.
  6005. (0,external_wp_element_namespaceObject.useEffect)(() => {
  6006. if (isEditorReady && !areMetaBoxesInitialized) {
  6007. registry.dispatch(store_store).initializeMetaBoxes();
  6008. }
  6009. }, [isEditorReady, areMetaBoxesInitialized]);
  6010. if (!areMetaBoxesInitialized) {
  6011. return null;
  6012. }
  6013. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_lodash_namespaceObject.map)(metaBoxes, _ref2 => {
  6014. let {
  6015. id
  6016. } = _ref2;
  6017. return (0,external_wp_element_namespaceObject.createElement)(meta_box_visibility, {
  6018. key: id,
  6019. id: id
  6020. });
  6021. }), (0,external_wp_element_namespaceObject.createElement)(meta_boxes_area, {
  6022. location: location
  6023. }));
  6024. }
  6025. ;// CONCATENATED MODULE: external ["wp","warning"]
  6026. var external_wp_warning_namespaceObject = window["wp"]["warning"];
  6027. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/plugin-document-setting-panel/index.js
  6028. /**
  6029. * Defines as extensibility slot for the Settings sidebar
  6030. */
  6031. /**
  6032. * WordPress dependencies
  6033. */
  6034. /**
  6035. * Internal dependencies
  6036. */
  6037. const {
  6038. Fill: plugin_document_setting_panel_Fill,
  6039. Slot: plugin_document_setting_panel_Slot
  6040. } = (0,external_wp_components_namespaceObject.createSlotFill)('PluginDocumentSettingPanel');
  6041. const PluginDocumentSettingFill = _ref => {
  6042. let {
  6043. isEnabled,
  6044. panelName,
  6045. opened,
  6046. onToggle,
  6047. className,
  6048. title,
  6049. icon,
  6050. children
  6051. } = _ref;
  6052. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(enable_plugin_document_setting_panel, {
  6053. label: title,
  6054. panelName: panelName
  6055. }), (0,external_wp_element_namespaceObject.createElement)(plugin_document_setting_panel_Fill, null, isEnabled && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
  6056. className: className,
  6057. title: title,
  6058. icon: icon,
  6059. opened: opened,
  6060. onToggle: onToggle
  6061. }, children)));
  6062. };
  6063. /**
  6064. * Renders items below the Status & Availability panel in the Document Sidebar.
  6065. *
  6066. * @param {Object} props Component properties.
  6067. * @param {string} [props.name] The machine-friendly name for the panel.
  6068. * @param {string} [props.className] An optional class name added to the row.
  6069. * @param {string} [props.title] The title of the panel
  6070. * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.
  6071. *
  6072. * @example
  6073. * ```js
  6074. * // Using ES5 syntax
  6075. * var el = wp.element.createElement;
  6076. * var __ = wp.i18n.__;
  6077. * var registerPlugin = wp.plugins.registerPlugin;
  6078. * var PluginDocumentSettingPanel = wp.editPost.PluginDocumentSettingPanel;
  6079. *
  6080. * function MyDocumentSettingPlugin() {
  6081. * return el(
  6082. * PluginDocumentSettingPanel,
  6083. * {
  6084. * className: 'my-document-setting-plugin',
  6085. * title: 'My Panel',
  6086. * },
  6087. * __( 'My Document Setting Panel' )
  6088. * );
  6089. * }
  6090. *
  6091. * registerPlugin( 'my-document-setting-plugin', {
  6092. * render: MyDocumentSettingPlugin
  6093. * } );
  6094. * ```
  6095. *
  6096. * @example
  6097. * ```jsx
  6098. * // Using ESNext syntax
  6099. * import { registerPlugin } from '@wordpress/plugins';
  6100. * import { PluginDocumentSettingPanel } from '@wordpress/edit-post';
  6101. *
  6102. * const MyDocumentSettingTest = () => (
  6103. * <PluginDocumentSettingPanel className="my-document-setting-plugin" title="My Panel">
  6104. * <p>My Document Setting Panel</p>
  6105. * </PluginDocumentSettingPanel>
  6106. * );
  6107. *
  6108. * registerPlugin( 'document-setting-test', { render: MyDocumentSettingTest } );
  6109. * ```
  6110. *
  6111. * @return {WPComponent} The component to be rendered.
  6112. */
  6113. const PluginDocumentSettingPanel = (0,external_wp_compose_namespaceObject.compose)((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => {
  6114. if (undefined === ownProps.name) {
  6115. typeof process !== "undefined" && process.env && "production" !== "production" ? 0 : void 0;
  6116. }
  6117. return {
  6118. icon: ownProps.icon || context.icon,
  6119. panelName: `${context.name}/${ownProps.name}`
  6120. };
  6121. }), (0,external_wp_data_namespaceObject.withSelect)((select, _ref2) => {
  6122. let {
  6123. panelName
  6124. } = _ref2;
  6125. return {
  6126. opened: select(store_store).isEditorPanelOpened(panelName),
  6127. isEnabled: select(store_store).isEditorPanelEnabled(panelName)
  6128. };
  6129. }), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, _ref3) => {
  6130. let {
  6131. panelName
  6132. } = _ref3;
  6133. return {
  6134. onToggle() {
  6135. return dispatch(store_store).toggleEditorPanelOpened(panelName);
  6136. }
  6137. };
  6138. }))(PluginDocumentSettingFill);
  6139. PluginDocumentSettingPanel.Slot = plugin_document_setting_panel_Slot;
  6140. /* harmony default export */ var plugin_document_setting_panel = (PluginDocumentSettingPanel);
  6141. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/plugin-sidebar/index.js
  6142. /**
  6143. * WordPress dependencies
  6144. */
  6145. /**
  6146. * Internal dependencies
  6147. */
  6148. /**
  6149. * Renders a sidebar when activated. The contents within the `PluginSidebar` will appear as content within the sidebar.
  6150. * It also automatically renders a corresponding `PluginSidebarMenuItem` component when `isPinnable` flag is set to `true`.
  6151. * If you wish to display the sidebar, you can with use the `PluginSidebarMoreMenuItem` component or the `wp.data.dispatch` API:
  6152. *
  6153. * ```js
  6154. * wp.data.dispatch( 'core/edit-post' ).openGeneralSidebar( 'plugin-name/sidebar-name' );
  6155. * ```
  6156. *
  6157. * @see PluginSidebarMoreMenuItem
  6158. *
  6159. * @param {Object} props Element props.
  6160. * @param {string} props.name A string identifying the sidebar. Must be unique for every sidebar registered within the scope of your plugin.
  6161. * @param {string} [props.className] An optional class name added to the sidebar body.
  6162. * @param {string} props.title Title displayed at the top of the sidebar.
  6163. * @param {boolean} [props.isPinnable=true] Whether to allow to pin sidebar to the toolbar. When set to `true` it also automatically renders a corresponding menu item.
  6164. * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.
  6165. *
  6166. * @example
  6167. * ```js
  6168. * // Using ES5 syntax
  6169. * var __ = wp.i18n.__;
  6170. * var el = wp.element.createElement;
  6171. * var PanelBody = wp.components.PanelBody;
  6172. * var PluginSidebar = wp.editPost.PluginSidebar;
  6173. * var moreIcon = wp.element.createElement( 'svg' ); //... svg element.
  6174. *
  6175. * function MyPluginSidebar() {
  6176. * return el(
  6177. * PluginSidebar,
  6178. * {
  6179. * name: 'my-sidebar',
  6180. * title: 'My sidebar title',
  6181. * icon: moreIcon,
  6182. * },
  6183. * el(
  6184. * PanelBody,
  6185. * {},
  6186. * __( 'My sidebar content' )
  6187. * )
  6188. * );
  6189. * }
  6190. * ```
  6191. *
  6192. * @example
  6193. * ```jsx
  6194. * // Using ESNext syntax
  6195. * import { __ } from '@wordpress/i18n';
  6196. * import { PanelBody } from '@wordpress/components';
  6197. * import { PluginSidebar } from '@wordpress/edit-post';
  6198. * import { more } from '@wordpress/icons';
  6199. *
  6200. * const MyPluginSidebar = () => (
  6201. * <PluginSidebar
  6202. * name="my-sidebar"
  6203. * title="My sidebar title"
  6204. * icon={ more }
  6205. * >
  6206. * <PanelBody>
  6207. * { __( 'My sidebar content' ) }
  6208. * </PanelBody>
  6209. * </PluginSidebar>
  6210. * );
  6211. * ```
  6212. */
  6213. function PluginSidebarEditPost(_ref) {
  6214. let {
  6215. className,
  6216. ...props
  6217. } = _ref;
  6218. const {
  6219. postTitle,
  6220. shortcut,
  6221. showIconLabels
  6222. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  6223. return {
  6224. postTitle: select(external_wp_editor_namespaceObject.store).getEditedPostAttribute('title'),
  6225. shortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getShortcutRepresentation('core/edit-post/toggle-sidebar'),
  6226. showIconLabels: select(store_store).isFeatureActive('showIconLabels')
  6227. };
  6228. }, []);
  6229. return (0,external_wp_element_namespaceObject.createElement)(complementary_area, _extends({
  6230. panelClassName: className,
  6231. className: "edit-post-sidebar",
  6232. smallScreenTitle: postTitle || (0,external_wp_i18n_namespaceObject.__)('(no title)'),
  6233. scope: "core/edit-post",
  6234. toggleShortcut: shortcut,
  6235. showIconLabels: showIconLabels
  6236. }, props));
  6237. }
  6238. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/template/actions.js
  6239. /**
  6240. * External dependencies
  6241. */
  6242. /**
  6243. * WordPress dependencies
  6244. */
  6245. /**
  6246. * Internal dependencies
  6247. */
  6248. function PostTemplateActions(_ref) {
  6249. let {
  6250. isPostsPage
  6251. } = _ref;
  6252. const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false);
  6253. const [isBusy, setIsBusy] = (0,external_wp_element_namespaceObject.useState)(false);
  6254. const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)('');
  6255. const {
  6256. template,
  6257. supportsTemplateMode,
  6258. defaultTemplate
  6259. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  6260. var _getPostType$viewable, _getPostType;
  6261. const {
  6262. getCurrentPostType,
  6263. getEditorSettings
  6264. } = select(external_wp_editor_namespaceObject.store);
  6265. const {
  6266. getPostType
  6267. } = select(external_wp_coreData_namespaceObject.store);
  6268. const {
  6269. getEditedPostTemplate
  6270. } = select(store_store);
  6271. const isViewable = (_getPostType$viewable = (_getPostType = getPostType(getCurrentPostType())) === null || _getPostType === void 0 ? void 0 : _getPostType.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false;
  6272. const _supportsTemplateMode = getEditorSettings().supportsTemplateMode && isViewable;
  6273. return {
  6274. template: _supportsTemplateMode && getEditedPostTemplate(),
  6275. supportsTemplateMode: _supportsTemplateMode,
  6276. defaultTemplate: getEditorSettings().defaultBlockTemplate
  6277. };
  6278. }, []);
  6279. const {
  6280. __unstableCreateTemplate,
  6281. __unstableSwitchToTemplateMode
  6282. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  6283. if (!supportsTemplateMode) {
  6284. return null;
  6285. }
  6286. const defaultTitle = (0,external_wp_i18n_namespaceObject.__)('Custom Template');
  6287. async function onCreateTemplate(event) {
  6288. event.preventDefault();
  6289. if (isBusy) {
  6290. return;
  6291. }
  6292. setIsBusy(true);
  6293. const newTemplateContent = defaultTemplate !== null && defaultTemplate !== void 0 ? defaultTemplate : (0,external_wp_blocks_namespaceObject.serialize)([(0,external_wp_blocks_namespaceObject.createBlock)('core/group', {
  6294. tagName: 'header',
  6295. layout: {
  6296. inherit: true
  6297. }
  6298. }, [(0,external_wp_blocks_namespaceObject.createBlock)('core/site-title'), (0,external_wp_blocks_namespaceObject.createBlock)('core/site-tagline')]), (0,external_wp_blocks_namespaceObject.createBlock)('core/separator'), (0,external_wp_blocks_namespaceObject.createBlock)('core/group', {
  6299. tagName: 'main'
  6300. }, [(0,external_wp_blocks_namespaceObject.createBlock)('core/group', {
  6301. layout: {
  6302. inherit: true
  6303. }
  6304. }, [(0,external_wp_blocks_namespaceObject.createBlock)('core/post-title')]), (0,external_wp_blocks_namespaceObject.createBlock)('core/post-content', {
  6305. layout: {
  6306. inherit: true
  6307. }
  6308. })])]);
  6309. await __unstableCreateTemplate({
  6310. slug: 'wp-custom-template-' + (0,external_lodash_namespaceObject.kebabCase)(title || defaultTitle),
  6311. content: newTemplateContent,
  6312. title: title || defaultTitle
  6313. });
  6314. setIsBusy(false);
  6315. setIsModalOpen(false);
  6316. __unstableSwitchToTemplateMode(true);
  6317. }
  6318. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", {
  6319. className: "edit-post-template__actions"
  6320. }, !!template && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  6321. variant: "link",
  6322. onClick: () => __unstableSwitchToTemplateMode()
  6323. }, (0,external_wp_i18n_namespaceObject.__)('Edit')), !isPostsPage && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  6324. variant: "link",
  6325. onClick: () => setIsModalOpen(true)
  6326. },
  6327. /* translators: button to create a new template */
  6328. (0,external_wp_i18n_namespaceObject._x)('New', 'action'))), isModalOpen && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
  6329. title: (0,external_wp_i18n_namespaceObject.__)('Create custom template'),
  6330. closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close'),
  6331. onRequestClose: () => {
  6332. setIsModalOpen(false);
  6333. setTitle('');
  6334. },
  6335. overlayClassName: "edit-post-template__modal"
  6336. }, (0,external_wp_element_namespaceObject.createElement)("form", {
  6337. onSubmit: onCreateTemplate
  6338. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, {
  6339. align: "flex-start",
  6340. gap: 8
  6341. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
  6342. label: (0,external_wp_i18n_namespaceObject.__)('Name'),
  6343. value: title,
  6344. onChange: setTitle,
  6345. placeholder: defaultTitle,
  6346. disabled: isBusy,
  6347. help: (0,external_wp_i18n_namespaceObject.__)('Describe the purpose of the template, e.g. "Full Width". Custom templates can be applied to any post or page.')
  6348. }))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, {
  6349. className: "edit-post-template__modal-actions",
  6350. justify: "flex-end",
  6351. expanded: false
  6352. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  6353. variant: "tertiary",
  6354. onClick: () => {
  6355. setIsModalOpen(false);
  6356. setTitle('');
  6357. }
  6358. }, (0,external_wp_i18n_namespaceObject.__)('Cancel'))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  6359. variant: "primary",
  6360. type: "submit",
  6361. isBusy: isBusy,
  6362. "aria-disabled": isBusy
  6363. }, (0,external_wp_i18n_namespaceObject.__)('Create')))))));
  6364. }
  6365. /* harmony default export */ var actions = (PostTemplateActions);
  6366. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/template/index.js
  6367. /**
  6368. * External dependencies
  6369. */
  6370. /**
  6371. * WordPress dependencies
  6372. */
  6373. /**
  6374. * Internal dependencies
  6375. */
  6376. /**
  6377. * Module Constants
  6378. */
  6379. const template_PANEL_NAME = 'template';
  6380. function TemplatePanel() {
  6381. const {
  6382. isEnabled,
  6383. isOpened,
  6384. isPostsPage,
  6385. selectedTemplate,
  6386. availableTemplates,
  6387. fetchedTemplates,
  6388. isViewable,
  6389. template,
  6390. supportsTemplateMode,
  6391. canUserCreate
  6392. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  6393. var _getPostType$viewable, _getPostType;
  6394. const {
  6395. isEditorPanelEnabled,
  6396. isEditorPanelOpened,
  6397. getEditedPostTemplate
  6398. } = select(store_store);
  6399. const {
  6400. getEditedPostAttribute,
  6401. getEditorSettings,
  6402. getCurrentPostId,
  6403. getCurrentPostType
  6404. } = select(external_wp_editor_namespaceObject.store);
  6405. const {
  6406. getPostType,
  6407. getEntityRecord,
  6408. getEntityRecords,
  6409. canUser
  6410. } = select(external_wp_coreData_namespaceObject.store);
  6411. const currentPostId = getCurrentPostId();
  6412. const currentPostType = getCurrentPostType();
  6413. const settings = getEntityRecord('root', 'site');
  6414. const _isViewable = (_getPostType$viewable = (_getPostType = getPostType(currentPostType)) === null || _getPostType === void 0 ? void 0 : _getPostType.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false;
  6415. const _supportsTemplateMode = select(external_wp_editor_namespaceObject.store).getEditorSettings().supportsTemplateMode && _isViewable;
  6416. const templateRecords = getEntityRecords('postType', 'wp_template', {
  6417. post_type: currentPostType,
  6418. per_page: -1
  6419. });
  6420. return {
  6421. isEnabled: isEditorPanelEnabled(template_PANEL_NAME),
  6422. isOpened: isEditorPanelOpened(template_PANEL_NAME),
  6423. isPostsPage: currentPostId === (settings === null || settings === void 0 ? void 0 : settings.page_for_posts),
  6424. selectedTemplate: getEditedPostAttribute('template'),
  6425. availableTemplates: getEditorSettings().availableTemplates,
  6426. fetchedTemplates: templateRecords,
  6427. template: _supportsTemplateMode && getEditedPostTemplate(),
  6428. isViewable: _isViewable,
  6429. supportsTemplateMode: _supportsTemplateMode,
  6430. canUserCreate: canUser('create', 'templates')
  6431. };
  6432. }, []);
  6433. const templates = (0,external_wp_element_namespaceObject.useMemo)(() => {
  6434. return { ...availableTemplates,
  6435. ...(0,external_lodash_namespaceObject.fromPairs)((fetchedTemplates !== null && fetchedTemplates !== void 0 ? fetchedTemplates : []).map(_ref => {
  6436. let {
  6437. slug,
  6438. title
  6439. } = _ref;
  6440. return [slug, title.rendered];
  6441. }))
  6442. };
  6443. }, [availableTemplates, fetchedTemplates]);
  6444. const {
  6445. toggleEditorPanelOpened
  6446. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  6447. const {
  6448. editPost
  6449. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store);
  6450. if (!isEnabled || !isViewable || (0,external_lodash_namespaceObject.isEmpty)(availableTemplates) && (!supportsTemplateMode || !canUserCreate)) {
  6451. return null;
  6452. }
  6453. const onTogglePanel = (0,external_lodash_namespaceObject.partial)(toggleEditorPanelOpened, template_PANEL_NAME);
  6454. let panelTitle = (0,external_wp_i18n_namespaceObject.__)('Template');
  6455. if (!!template) {
  6456. var _template$title;
  6457. panelTitle = (0,external_wp_i18n_namespaceObject.sprintf)(
  6458. /* translators: %s: template title */
  6459. (0,external_wp_i18n_namespaceObject.__)('Template: %s'), (_template$title = template === null || template === void 0 ? void 0 : template.title) !== null && _template$title !== void 0 ? _template$title : template.slug);
  6460. }
  6461. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
  6462. title: panelTitle,
  6463. opened: isOpened,
  6464. onToggle: onTogglePanel
  6465. }, isPostsPage ? (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Notice, {
  6466. className: "edit-post-template__notice",
  6467. status: "warning",
  6468. isDismissible: false
  6469. }, (0,external_wp_i18n_namespaceObject.__)('The posts page template cannot be changed.')) : (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
  6470. hideLabelFromVision: true,
  6471. label: (0,external_wp_i18n_namespaceObject.__)('Template:'),
  6472. value: Object.keys(templates).includes(selectedTemplate) ? selectedTemplate : '',
  6473. onChange: templateSlug => {
  6474. editPost({
  6475. template: templateSlug || ''
  6476. });
  6477. },
  6478. options: (0,external_lodash_namespaceObject.map)(templates, (templateName, templateSlug) => ({
  6479. value: templateSlug,
  6480. label: templateName
  6481. }))
  6482. }), canUserCreate && (0,external_wp_element_namespaceObject.createElement)(actions, {
  6483. isPostsPage: isPostsPage
  6484. }));
  6485. }
  6486. /* harmony default export */ var template = (TemplatePanel);
  6487. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/layout.js
  6488. /**
  6489. * WordPress dependencies
  6490. */
  6491. const layout = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  6492. xmlns: "http://www.w3.org/2000/svg",
  6493. viewBox: "0 0 24 24"
  6494. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  6495. d: "M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"
  6496. }));
  6497. /* harmony default export */ var library_layout = (layout);
  6498. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/template-summary/index.js
  6499. /**
  6500. * WordPress dependencies
  6501. */
  6502. /**
  6503. * Internal dependencies
  6504. */
  6505. function TemplateSummary() {
  6506. const template = (0,external_wp_data_namespaceObject.useSelect)(select => {
  6507. const {
  6508. getEditedPostTemplate
  6509. } = select(store_store);
  6510. return getEditedPostTemplate();
  6511. }, []);
  6512. if (!template) {
  6513. return null;
  6514. }
  6515. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, {
  6516. align: "flex-start",
  6517. gap: "3"
  6518. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(icon, {
  6519. icon: library_layout
  6520. })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexBlock, null, (0,external_wp_element_namespaceObject.createElement)("h2", {
  6521. className: "edit-post-template-summary__title"
  6522. }, (template === null || template === void 0 ? void 0 : template.title) || (template === null || template === void 0 ? void 0 : template.slug)), (0,external_wp_element_namespaceObject.createElement)("p", null, template === null || template === void 0 ? void 0 : template.description))));
  6523. }
  6524. /* harmony default export */ var template_summary = (TemplateSummary);
  6525. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/settings-sidebar/index.js
  6526. /**
  6527. * WordPress dependencies
  6528. */
  6529. /**
  6530. * Internal dependencies
  6531. */
  6532. const SIDEBAR_ACTIVE_BY_DEFAULT = external_wp_element_namespaceObject.Platform.select({
  6533. web: true,
  6534. native: false
  6535. });
  6536. const SettingsSidebar = () => {
  6537. const {
  6538. sidebarName,
  6539. keyboardShortcut,
  6540. isTemplateMode
  6541. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  6542. // The settings sidebar is used by the edit-post/document and edit-post/block sidebars.
  6543. // sidebarName represents the sidebar that is active or that should be active when the SettingsSidebar toggle button is pressed.
  6544. // If one of the two sidebars is active the component will contain the content of that sidebar.
  6545. // When neither of the the two sidebars is active we can not simply return null, because the PluginSidebarEditPost
  6546. // component, besides being used to render the sidebar, also renders the toggle button. In that case sidebarName
  6547. // should contain the sidebar that will be active when the toggle button is pressed. If a block
  6548. // is selected, that should be edit-post/block otherwise it's edit-post/document.
  6549. let sidebar = select(store).getActiveComplementaryArea(store_store.name);
  6550. if (!['edit-post/document', 'edit-post/block'].includes(sidebar)) {
  6551. if (select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart()) {
  6552. sidebar = 'edit-post/block';
  6553. }
  6554. sidebar = 'edit-post/document';
  6555. }
  6556. const shortcut = select(external_wp_keyboardShortcuts_namespaceObject.store).getShortcutRepresentation('core/edit-post/toggle-sidebar');
  6557. return {
  6558. sidebarName: sidebar,
  6559. keyboardShortcut: shortcut,
  6560. isTemplateMode: select(store_store).isEditingTemplate()
  6561. };
  6562. }, []);
  6563. return (0,external_wp_element_namespaceObject.createElement)(PluginSidebarEditPost, {
  6564. identifier: sidebarName,
  6565. header: (0,external_wp_element_namespaceObject.createElement)(settings_header, {
  6566. sidebarName: sidebarName
  6567. }),
  6568. closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close settings'),
  6569. headerClassName: "edit-post-sidebar__panel-tabs"
  6570. /* translators: button label text should, if possible, be under 16 characters. */
  6571. ,
  6572. title: (0,external_wp_i18n_namespaceObject.__)('Settings'),
  6573. toggleShortcut: keyboardShortcut,
  6574. icon: library_cog,
  6575. isActiveByDefault: SIDEBAR_ACTIVE_BY_DEFAULT
  6576. }, !isTemplateMode && sidebarName === 'edit-post/document' && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(post_status, null), (0,external_wp_element_namespaceObject.createElement)(template, null), (0,external_wp_element_namespaceObject.createElement)(plugin_document_setting_panel.Slot, null), (0,external_wp_element_namespaceObject.createElement)(last_revision, null), (0,external_wp_element_namespaceObject.createElement)(post_link, null), (0,external_wp_element_namespaceObject.createElement)(post_taxonomies, null), (0,external_wp_element_namespaceObject.createElement)(featured_image, null), (0,external_wp_element_namespaceObject.createElement)(post_excerpt, null), (0,external_wp_element_namespaceObject.createElement)(discussion_panel, null), (0,external_wp_element_namespaceObject.createElement)(page_attributes, null), (0,external_wp_element_namespaceObject.createElement)(MetaBoxes, {
  6577. location: "side"
  6578. })), isTemplateMode && sidebarName === 'edit-post/document' && (0,external_wp_element_namespaceObject.createElement)(template_summary, null), sidebarName === 'edit-post/block' && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockInspector, null));
  6579. };
  6580. /* harmony default export */ var settings_sidebar = (SettingsSidebar);
  6581. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/welcome-guide/image.js
  6582. function WelcomeGuideImage(_ref) {
  6583. let {
  6584. nonAnimatedSrc,
  6585. animatedSrc
  6586. } = _ref;
  6587. return (0,external_wp_element_namespaceObject.createElement)("picture", {
  6588. className: "edit-post-welcome-guide__image"
  6589. }, (0,external_wp_element_namespaceObject.createElement)("source", {
  6590. srcSet: nonAnimatedSrc,
  6591. media: "(prefers-reduced-motion: reduce)"
  6592. }), (0,external_wp_element_namespaceObject.createElement)("img", {
  6593. src: animatedSrc,
  6594. width: "312",
  6595. height: "240",
  6596. alt: ""
  6597. }));
  6598. }
  6599. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/welcome-guide/default.js
  6600. /**
  6601. * WordPress dependencies
  6602. */
  6603. /**
  6604. * Internal dependencies
  6605. */
  6606. function WelcomeGuideDefault() {
  6607. const {
  6608. toggleFeature
  6609. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  6610. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Guide, {
  6611. className: "edit-post-welcome-guide",
  6612. contentLabel: (0,external_wp_i18n_namespaceObject.__)('Welcome to the block editor'),
  6613. finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Get started'),
  6614. onFinish: () => toggleFeature('welcomeGuide'),
  6615. pages: [{
  6616. image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, {
  6617. nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-canvas.svg",
  6618. animatedSrc: "https://s.w.org/images/block-editor/welcome-canvas.gif"
  6619. }),
  6620. content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", {
  6621. className: "edit-post-welcome-guide__heading"
  6622. }, (0,external_wp_i18n_namespaceObject.__)('Welcome to the block editor')), (0,external_wp_element_namespaceObject.createElement)("p", {
  6623. className: "edit-post-welcome-guide__text"
  6624. }, (0,external_wp_i18n_namespaceObject.__)('In the WordPress editor, each paragraph, image, or video is presented as a distinct “block” of content.')))
  6625. }, {
  6626. image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, {
  6627. nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-editor.svg",
  6628. animatedSrc: "https://s.w.org/images/block-editor/welcome-editor.gif"
  6629. }),
  6630. content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", {
  6631. className: "edit-post-welcome-guide__heading"
  6632. }, (0,external_wp_i18n_namespaceObject.__)('Make each block your own')), (0,external_wp_element_namespaceObject.createElement)("p", {
  6633. className: "edit-post-welcome-guide__text"
  6634. }, (0,external_wp_i18n_namespaceObject.__)('Each block comes with its own set of controls for changing things like color, width, and alignment. These will show and hide automatically when you have a block selected.')))
  6635. }, {
  6636. image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, {
  6637. nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-library.svg",
  6638. animatedSrc: "https://s.w.org/images/block-editor/welcome-library.gif"
  6639. }),
  6640. content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", {
  6641. className: "edit-post-welcome-guide__heading"
  6642. }, (0,external_wp_i18n_namespaceObject.__)('Get to know the block library')), (0,external_wp_element_namespaceObject.createElement)("p", {
  6643. className: "edit-post-welcome-guide__text"
  6644. }, (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)('All of the blocks available to you live in the block library. You’ll find it wherever you see the <InserterIconImage /> icon.'), {
  6645. InserterIconImage: (0,external_wp_element_namespaceObject.createElement)("img", {
  6646. alt: (0,external_wp_i18n_namespaceObject.__)('inserter'),
  6647. src: "data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='18' height='18' rx='2' fill='%231E1E1E'/%3E%3Cpath d='M9.22727 4V14M4 8.77273H14' stroke='white' stroke-width='1.5'/%3E%3C/svg%3E%0A"
  6648. })
  6649. })))
  6650. }, {
  6651. image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, {
  6652. nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.svg",
  6653. animatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.gif"
  6654. }),
  6655. content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", {
  6656. className: "edit-post-welcome-guide__heading"
  6657. }, (0,external_wp_i18n_namespaceObject.__)('Learn how to use the block editor')), (0,external_wp_element_namespaceObject.createElement)("p", {
  6658. className: "edit-post-welcome-guide__text"
  6659. }, (0,external_wp_i18n_namespaceObject.__)('New to the block editor? Want to learn more about using it? '), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, {
  6660. href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/support/article/wordpress-editor/')
  6661. }, (0,external_wp_i18n_namespaceObject.__)("Here's a detailed guide."))))
  6662. }]
  6663. });
  6664. }
  6665. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/welcome-guide/template.js
  6666. /**
  6667. * WordPress dependencies
  6668. */
  6669. /**
  6670. * Internal dependencies
  6671. */
  6672. function WelcomeGuideTemplate() {
  6673. const {
  6674. toggleFeature
  6675. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  6676. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Guide, {
  6677. className: "edit-template-welcome-guide",
  6678. contentLabel: (0,external_wp_i18n_namespaceObject.__)('Welcome to the template editor'),
  6679. finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Get started'),
  6680. onFinish: () => toggleFeature('welcomeGuideTemplate'),
  6681. pages: [{
  6682. image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, {
  6683. nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-template-editor.svg",
  6684. animatedSrc: "https://s.w.org/images/block-editor/welcome-template-editor.gif"
  6685. }),
  6686. content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", {
  6687. className: "edit-post-welcome-guide__heading"
  6688. }, (0,external_wp_i18n_namespaceObject.__)('Welcome to the template editor')), (0,external_wp_element_namespaceObject.createElement)("p", {
  6689. className: "edit-post-welcome-guide__text"
  6690. }, (0,external_wp_i18n_namespaceObject.__)('Templates help define the layout of the site. You can customize all aspects of your posts and pages using blocks and patterns in this editor.')))
  6691. }]
  6692. });
  6693. }
  6694. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/welcome-guide/index.js
  6695. /**
  6696. * WordPress dependencies
  6697. */
  6698. /**
  6699. * Internal dependencies
  6700. */
  6701. function WelcomeGuide() {
  6702. const {
  6703. isActive,
  6704. isTemplateMode
  6705. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  6706. const {
  6707. isFeatureActive,
  6708. isEditingTemplate
  6709. } = select(store_store);
  6710. const _isTemplateMode = isEditingTemplate();
  6711. const feature = _isTemplateMode ? 'welcomeGuideTemplate' : 'welcomeGuide';
  6712. return {
  6713. isActive: isFeatureActive(feature),
  6714. isTemplateMode: _isTemplateMode
  6715. };
  6716. }, []);
  6717. if (!isActive) {
  6718. return null;
  6719. }
  6720. return isTemplateMode ? (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideTemplate, null) : (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideDefault, null);
  6721. }
  6722. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/plugin-post-publish-panel/index.js
  6723. /**
  6724. * WordPress dependencies
  6725. */
  6726. const {
  6727. Fill: plugin_post_publish_panel_Fill,
  6728. Slot: plugin_post_publish_panel_Slot
  6729. } = (0,external_wp_components_namespaceObject.createSlotFill)('PluginPostPublishPanel');
  6730. const PluginPostPublishPanelFill = _ref => {
  6731. let {
  6732. children,
  6733. className,
  6734. title,
  6735. initialOpen = false,
  6736. icon
  6737. } = _ref;
  6738. return (0,external_wp_element_namespaceObject.createElement)(plugin_post_publish_panel_Fill, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
  6739. className: className,
  6740. initialOpen: initialOpen || !title,
  6741. title: title,
  6742. icon: icon
  6743. }, children));
  6744. };
  6745. /**
  6746. * Renders provided content to the post-publish panel in the publish flow
  6747. * (side panel that opens after a user publishes the post).
  6748. *
  6749. * @param {Object} props Component properties.
  6750. * @param {string} [props.className] An optional class name added to the panel.
  6751. * @param {string} [props.title] Title displayed at the top of the panel.
  6752. * @param {boolean} [props.initialOpen=false] Whether to have the panel initially opened. When no title is provided it is always opened.
  6753. * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.
  6754. *
  6755. * @example
  6756. * ```js
  6757. * // Using ES5 syntax
  6758. * var __ = wp.i18n.__;
  6759. * var PluginPostPublishPanel = wp.editPost.PluginPostPublishPanel;
  6760. *
  6761. * function MyPluginPostPublishPanel() {
  6762. * return wp.element.createElement(
  6763. * PluginPostPublishPanel,
  6764. * {
  6765. * className: 'my-plugin-post-publish-panel',
  6766. * title: __( 'My panel title' ),
  6767. * initialOpen: true,
  6768. * },
  6769. * __( 'My panel content' )
  6770. * );
  6771. * }
  6772. * ```
  6773. *
  6774. * @example
  6775. * ```jsx
  6776. * // Using ESNext syntax
  6777. * import { __ } from '@wordpress/i18n';
  6778. * import { PluginPostPublishPanel } from '@wordpress/edit-post';
  6779. *
  6780. * const MyPluginPostPublishPanel = () => (
  6781. * <PluginPostPublishPanel
  6782. * className="my-plugin-post-publish-panel"
  6783. * title={ __( 'My panel title' ) }
  6784. * initialOpen={ true }
  6785. * >
  6786. * { __( 'My panel content' ) }
  6787. * </PluginPostPublishPanel>
  6788. * );
  6789. * ```
  6790. *
  6791. * @return {WPComponent} The component to be rendered.
  6792. */
  6793. const PluginPostPublishPanel = (0,external_wp_compose_namespaceObject.compose)((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => {
  6794. return {
  6795. icon: ownProps.icon || context.icon
  6796. };
  6797. }))(PluginPostPublishPanelFill);
  6798. PluginPostPublishPanel.Slot = plugin_post_publish_panel_Slot;
  6799. /* harmony default export */ var plugin_post_publish_panel = (PluginPostPublishPanel);
  6800. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/plugin-pre-publish-panel/index.js
  6801. /**
  6802. * WordPress dependencies
  6803. */
  6804. const {
  6805. Fill: plugin_pre_publish_panel_Fill,
  6806. Slot: plugin_pre_publish_panel_Slot
  6807. } = (0,external_wp_components_namespaceObject.createSlotFill)('PluginPrePublishPanel');
  6808. const PluginPrePublishPanelFill = _ref => {
  6809. let {
  6810. children,
  6811. className,
  6812. title,
  6813. initialOpen = false,
  6814. icon
  6815. } = _ref;
  6816. return (0,external_wp_element_namespaceObject.createElement)(plugin_pre_publish_panel_Fill, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
  6817. className: className,
  6818. initialOpen: initialOpen || !title,
  6819. title: title,
  6820. icon: icon
  6821. }, children));
  6822. };
  6823. /**
  6824. * Renders provided content to the pre-publish side panel in the publish flow
  6825. * (side panel that opens when a user first pushes "Publish" from the main editor).
  6826. *
  6827. * @param {Object} props Component props.
  6828. * @param {string} [props.className] An optional class name added to the panel.
  6829. * @param {string} [props.title] Title displayed at the top of the panel.
  6830. * @param {boolean} [props.initialOpen=false] Whether to have the panel initially opened.
  6831. * When no title is provided it is always opened.
  6832. * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/)
  6833. * icon slug string, or an SVG WP element, to be rendered when
  6834. * the sidebar is pinned to toolbar.
  6835. *
  6836. * @example
  6837. * ```js
  6838. * // Using ES5 syntax
  6839. * var __ = wp.i18n.__;
  6840. * var PluginPrePublishPanel = wp.editPost.PluginPrePublishPanel;
  6841. *
  6842. * function MyPluginPrePublishPanel() {
  6843. * return wp.element.createElement(
  6844. * PluginPrePublishPanel,
  6845. * {
  6846. * className: 'my-plugin-pre-publish-panel',
  6847. * title: __( 'My panel title' ),
  6848. * initialOpen: true,
  6849. * },
  6850. * __( 'My panel content' )
  6851. * );
  6852. * }
  6853. * ```
  6854. *
  6855. * @example
  6856. * ```jsx
  6857. * // Using ESNext syntax
  6858. * import { __ } from '@wordpress/i18n';
  6859. * import { PluginPrePublishPanel } from '@wordpress/edit-post';
  6860. *
  6861. * const MyPluginPrePublishPanel = () => (
  6862. * <PluginPrePublishPanel
  6863. * className="my-plugin-pre-publish-panel"
  6864. * title={ __( 'My panel title' ) }
  6865. * initialOpen={ true }
  6866. * >
  6867. * { __( 'My panel content' ) }
  6868. * </PluginPrePublishPanel>
  6869. * );
  6870. * ```
  6871. *
  6872. * @return {WPComponent} The component to be rendered.
  6873. */
  6874. const PluginPrePublishPanel = (0,external_wp_compose_namespaceObject.compose)((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => {
  6875. return {
  6876. icon: ownProps.icon || context.icon
  6877. };
  6878. }))(PluginPrePublishPanelFill);
  6879. PluginPrePublishPanel.Slot = plugin_pre_publish_panel_Slot;
  6880. /* harmony default export */ var plugin_pre_publish_panel = (PluginPrePublishPanel);
  6881. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/layout/actions-panel.js
  6882. /**
  6883. * WordPress dependencies
  6884. */
  6885. /**
  6886. * Internal dependencies
  6887. */
  6888. const {
  6889. Fill: actions_panel_Fill,
  6890. Slot: actions_panel_Slot
  6891. } = (0,external_wp_components_namespaceObject.createSlotFill)('ActionsPanel');
  6892. const ActionsPanelFill = (/* unused pure expression or super */ null && (actions_panel_Fill));
  6893. function ActionsPanel(_ref) {
  6894. let {
  6895. setEntitiesSavedStatesCallback,
  6896. closeEntitiesSavedStates,
  6897. isEntitiesSavedStatesOpen
  6898. } = _ref;
  6899. const {
  6900. closePublishSidebar,
  6901. togglePublishSidebar
  6902. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  6903. const {
  6904. publishSidebarOpened,
  6905. hasActiveMetaboxes,
  6906. isSavingMetaBoxes,
  6907. hasNonPostEntityChanges
  6908. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  6909. return {
  6910. publishSidebarOpened: select(store_store).isPublishSidebarOpened(),
  6911. hasActiveMetaboxes: select(store_store).hasMetaBoxes(),
  6912. isSavingMetaBoxes: select(store_store).isSavingMetaBoxes(),
  6913. hasNonPostEntityChanges: select(external_wp_editor_namespaceObject.store).hasNonPostEntityChanges()
  6914. };
  6915. }, []);
  6916. const openEntitiesSavedStates = (0,external_wp_element_namespaceObject.useCallback)(() => setEntitiesSavedStatesCallback(true), []); // It is ok for these components to be unmounted when not in visual use.
  6917. // We don't want more than one present at a time, decide which to render.
  6918. let unmountableContent;
  6919. if (publishSidebarOpened) {
  6920. unmountableContent = (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostPublishPanel, {
  6921. onClose: closePublishSidebar,
  6922. forceIsDirty: hasActiveMetaboxes,
  6923. forceIsSaving: isSavingMetaBoxes,
  6924. PrePublishExtension: plugin_pre_publish_panel.Slot,
  6925. PostPublishExtension: plugin_post_publish_panel.Slot
  6926. });
  6927. } else if (hasNonPostEntityChanges) {
  6928. unmountableContent = (0,external_wp_element_namespaceObject.createElement)("div", {
  6929. className: "edit-post-layout__toggle-entities-saved-states-panel"
  6930. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  6931. variant: "secondary",
  6932. className: "edit-post-layout__toggle-entities-saved-states-panel-button",
  6933. onClick: openEntitiesSavedStates,
  6934. "aria-expanded": false
  6935. }, (0,external_wp_i18n_namespaceObject.__)('Open save panel')));
  6936. } else {
  6937. unmountableContent = (0,external_wp_element_namespaceObject.createElement)("div", {
  6938. className: "edit-post-layout__toggle-publish-panel"
  6939. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  6940. variant: "secondary",
  6941. className: "edit-post-layout__toggle-publish-panel-button",
  6942. onClick: togglePublishSidebar,
  6943. "aria-expanded": false
  6944. }, (0,external_wp_i18n_namespaceObject.__)('Open publish panel')));
  6945. } // Since EntitiesSavedStates controls its own panel, we can keep it
  6946. // always mounted to retain its own component state (such as checkboxes).
  6947. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, isEntitiesSavedStatesOpen && (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.EntitiesSavedStates, {
  6948. close: closeEntitiesSavedStates
  6949. }), (0,external_wp_element_namespaceObject.createElement)(actions_panel_Slot, {
  6950. bubblesVirtually: true
  6951. }), !isEntitiesSavedStatesOpen && unmountableContent);
  6952. }
  6953. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/start-page-options/index.js
  6954. /**
  6955. * WordPress dependencies
  6956. */
  6957. /**
  6958. * Internal dependencies
  6959. */
  6960. function PatternSelection(_ref) {
  6961. let {
  6962. onChoosePattern
  6963. } = _ref;
  6964. const {
  6965. blockPatterns
  6966. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  6967. const {
  6968. __experimentalGetPatternsByBlockTypes
  6969. } = select(external_wp_blockEditor_namespaceObject.store);
  6970. return {
  6971. blockPatterns: __experimentalGetPatternsByBlockTypes('core/post-content')
  6972. };
  6973. }, []);
  6974. const shownBlockPatterns = (0,external_wp_compose_namespaceObject.useAsyncList)(blockPatterns);
  6975. const {
  6976. resetEditorBlocks
  6977. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store);
  6978. return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalBlockPatternsList, {
  6979. blockPatterns: blockPatterns,
  6980. shownPatterns: shownBlockPatterns,
  6981. onClickPattern: (_pattern, blocks) => {
  6982. resetEditorBlocks(blocks);
  6983. onChoosePattern();
  6984. }
  6985. });
  6986. }
  6987. const START_PAGE_MODAL_STATES = {
  6988. INITIAL: 'INITIAL',
  6989. PATTERN: 'PATTERN',
  6990. CLOSED: 'CLOSED'
  6991. };
  6992. function StartPageOptions() {
  6993. const [modalState, setModalState] = (0,external_wp_element_namespaceObject.useState)(START_PAGE_MODAL_STATES.INITIAL);
  6994. const shouldOpenModel = (0,external_wp_data_namespaceObject.useSelect)(select => {
  6995. if (modalState !== START_PAGE_MODAL_STATES.INITIAL) {
  6996. return false;
  6997. }
  6998. const {
  6999. __experimentalGetPatternsByBlockTypes
  7000. } = select(external_wp_blockEditor_namespaceObject.store);
  7001. const {
  7002. getCurrentPostType,
  7003. getEditedPostContent,
  7004. isEditedPostSaveable
  7005. } = select(external_wp_editor_namespaceObject.store);
  7006. const {
  7007. isEditingTemplate,
  7008. isFeatureActive
  7009. } = select(store_store);
  7010. return getCurrentPostType() === 'page' && !isEditedPostSaveable() && '' === getEditedPostContent() && !isEditingTemplate() && !isFeatureActive('welcomeGuide') && __experimentalGetPatternsByBlockTypes('core/post-content').length >= 1;
  7011. }, [modalState]);
  7012. (0,external_wp_element_namespaceObject.useEffect)(() => {
  7013. if (shouldOpenModel) {
  7014. setModalState(START_PAGE_MODAL_STATES.PATTERN);
  7015. }
  7016. }, [shouldOpenModel]);
  7017. if (modalState === START_PAGE_MODAL_STATES.INITIAL || modalState === START_PAGE_MODAL_STATES.CLOSED) {
  7018. return null;
  7019. }
  7020. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
  7021. className: "edit-post-start-page-options__modal",
  7022. title: (0,external_wp_i18n_namespaceObject.__)('Choose a pattern'),
  7023. closeLabel: (0,external_wp_i18n_namespaceObject.__)('Cancel'),
  7024. onRequestClose: () => {
  7025. setModalState(START_PAGE_MODAL_STATES.CLOSED);
  7026. }
  7027. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  7028. className: "edit-post-start-page-options__modal-content"
  7029. }, modalState === START_PAGE_MODAL_STATES.PATTERN && (0,external_wp_element_namespaceObject.createElement)(PatternSelection, {
  7030. onChoosePattern: () => {
  7031. setModalState(START_PAGE_MODAL_STATES.CLOSED);
  7032. }
  7033. })));
  7034. }
  7035. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/layout/index.js
  7036. /**
  7037. * External dependencies
  7038. */
  7039. /**
  7040. * WordPress dependencies
  7041. */
  7042. /**
  7043. * Internal dependencies
  7044. */
  7045. const interfaceLabels = {
  7046. /* translators: accessibility text for the editor top bar landmark region. */
  7047. header: (0,external_wp_i18n_namespaceObject.__)('Editor top bar'),
  7048. /* translators: accessibility text for the editor content landmark region. */
  7049. body: (0,external_wp_i18n_namespaceObject.__)('Editor content'),
  7050. /* translators: accessibility text for the editor settings landmark region. */
  7051. sidebar: (0,external_wp_i18n_namespaceObject.__)('Editor settings'),
  7052. /* translators: accessibility text for the editor publish landmark region. */
  7053. actions: (0,external_wp_i18n_namespaceObject.__)('Editor publish'),
  7054. /* translators: accessibility text for the editor footer landmark region. */
  7055. footer: (0,external_wp_i18n_namespaceObject.__)('Editor footer')
  7056. };
  7057. function Layout(_ref) {
  7058. let {
  7059. styles
  7060. } = _ref;
  7061. const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
  7062. const isHugeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('huge', '>=');
  7063. const {
  7064. openGeneralSidebar,
  7065. closeGeneralSidebar,
  7066. setIsInserterOpened
  7067. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  7068. const {
  7069. createErrorNotice
  7070. } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
  7071. const {
  7072. mode,
  7073. isFullscreenActive,
  7074. isRichEditingEnabled,
  7075. sidebarIsOpened,
  7076. hasActiveMetaboxes,
  7077. hasFixedToolbar,
  7078. previousShortcut,
  7079. nextShortcut,
  7080. hasBlockSelected,
  7081. isInserterOpened,
  7082. isListViewOpened,
  7083. showIconLabels,
  7084. hasReducedUI,
  7085. showBlockBreadcrumbs,
  7086. isTemplateMode,
  7087. documentLabel
  7088. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  7089. const {
  7090. getEditorSettings,
  7091. getPostTypeLabel
  7092. } = select(external_wp_editor_namespaceObject.store);
  7093. const editorSettings = getEditorSettings();
  7094. const postTypeLabel = getPostTypeLabel();
  7095. return {
  7096. isTemplateMode: select(store_store).isEditingTemplate(),
  7097. hasFixedToolbar: select(store_store).isFeatureActive('fixedToolbar'),
  7098. sidebarIsOpened: !!(select(store).getActiveComplementaryArea(store_store.name) || select(store_store).isPublishSidebarOpened()),
  7099. isFullscreenActive: select(store_store).isFeatureActive('fullscreenMode'),
  7100. isInserterOpened: select(store_store).isInserterOpened(),
  7101. isListViewOpened: select(store_store).isListViewOpened(),
  7102. mode: select(store_store).getEditorMode(),
  7103. isRichEditingEnabled: editorSettings.richEditingEnabled,
  7104. hasActiveMetaboxes: select(store_store).hasMetaBoxes(),
  7105. previousShortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getAllShortcutKeyCombinations('core/edit-post/previous-region'),
  7106. nextShortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getAllShortcutKeyCombinations('core/edit-post/next-region'),
  7107. showIconLabels: select(store_store).isFeatureActive('showIconLabels'),
  7108. hasReducedUI: select(store_store).isFeatureActive('reducedUI'),
  7109. showBlockBreadcrumbs: select(store_store).isFeatureActive('showBlockBreadcrumbs'),
  7110. // translators: Default label for the Document in the Block Breadcrumb.
  7111. documentLabel: postTypeLabel || (0,external_wp_i18n_namespaceObject._x)('Document', 'noun')
  7112. };
  7113. }, []);
  7114. const className = classnames_default()('edit-post-layout', 'is-mode-' + mode, {
  7115. 'is-sidebar-opened': sidebarIsOpened,
  7116. 'has-fixed-toolbar': hasFixedToolbar,
  7117. 'has-metaboxes': hasActiveMetaboxes,
  7118. 'show-icon-labels': showIconLabels
  7119. });
  7120. const openSidebarPanel = () => openGeneralSidebar(hasBlockSelected ? 'edit-post/block' : 'edit-post/document'); // Inserter and Sidebars are mutually exclusive
  7121. (0,external_wp_element_namespaceObject.useEffect)(() => {
  7122. if (sidebarIsOpened && !isHugeViewport) {
  7123. setIsInserterOpened(false);
  7124. }
  7125. }, [sidebarIsOpened, isHugeViewport]);
  7126. (0,external_wp_element_namespaceObject.useEffect)(() => {
  7127. if (isInserterOpened && !isHugeViewport) {
  7128. closeGeneralSidebar();
  7129. }
  7130. }, [isInserterOpened, isHugeViewport]); // Local state for save panel.
  7131. // Note 'truthy' callback implies an open panel.
  7132. const [entitiesSavedStatesCallback, setEntitiesSavedStatesCallback] = (0,external_wp_element_namespaceObject.useState)(false);
  7133. const closeEntitiesSavedStates = (0,external_wp_element_namespaceObject.useCallback)(arg => {
  7134. if (typeof entitiesSavedStatesCallback === 'function') {
  7135. entitiesSavedStatesCallback(arg);
  7136. }
  7137. setEntitiesSavedStatesCallback(false);
  7138. }, [entitiesSavedStatesCallback]);
  7139. const secondarySidebarLabel = isListViewOpened ? (0,external_wp_i18n_namespaceObject.__)('List View') : (0,external_wp_i18n_namespaceObject.__)('Block Library');
  7140. const secondarySidebar = () => {
  7141. if (mode === 'visual' && isInserterOpened) {
  7142. return (0,external_wp_element_namespaceObject.createElement)(InserterSidebar, null);
  7143. }
  7144. if (mode === 'visual' && isListViewOpened) {
  7145. return (0,external_wp_element_namespaceObject.createElement)(ListViewSidebar, null);
  7146. }
  7147. return null;
  7148. };
  7149. function onPluginAreaError(name) {
  7150. createErrorNotice((0,external_wp_i18n_namespaceObject.sprintf)(
  7151. /* translators: %s: plugin name */
  7152. (0,external_wp_i18n_namespaceObject.__)('The "%s" plugin has encountered an error and cannot be rendered.'), name));
  7153. }
  7154. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(fullscreen_mode, {
  7155. isActive: isFullscreenActive
  7156. }), (0,external_wp_element_namespaceObject.createElement)(browser_url, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.UnsavedChangesWarning, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.AutosaveMonitor, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.LocalAutosaveMonitor, null), (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcuts, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.EditorKeyboardShortcutsRegister, null), (0,external_wp_element_namespaceObject.createElement)(settings_sidebar, null), (0,external_wp_element_namespaceObject.createElement)(interface_skeleton, {
  7157. className: className,
  7158. labels: { ...interfaceLabels,
  7159. secondarySidebar: secondarySidebarLabel
  7160. },
  7161. header: (0,external_wp_element_namespaceObject.createElement)(header, {
  7162. setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback
  7163. }),
  7164. secondarySidebar: secondarySidebar(),
  7165. sidebar: (!isMobileViewport || sidebarIsOpened) && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, !isMobileViewport && !sidebarIsOpened && (0,external_wp_element_namespaceObject.createElement)("div", {
  7166. className: "edit-post-layout__toggle-sidebar-panel"
  7167. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
  7168. variant: "secondary",
  7169. className: "edit-post-layout__toggle-sidebar-panel-button",
  7170. onClick: openSidebarPanel,
  7171. "aria-expanded": false
  7172. }, hasBlockSelected ? (0,external_wp_i18n_namespaceObject.__)('Open block settings') : (0,external_wp_i18n_namespaceObject.__)('Open document settings'))), (0,external_wp_element_namespaceObject.createElement)(complementary_area.Slot, {
  7173. scope: "core/edit-post"
  7174. })),
  7175. notices: (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.EditorSnackbars, null),
  7176. content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.EditorNotices, null), (mode === 'text' || !isRichEditingEnabled) && (0,external_wp_element_namespaceObject.createElement)(text_editor, null), isRichEditingEnabled && mode === 'visual' && (0,external_wp_element_namespaceObject.createElement)(VisualEditor, {
  7177. styles: styles
  7178. }), !isTemplateMode && (0,external_wp_element_namespaceObject.createElement)("div", {
  7179. className: "edit-post-layout__metaboxes"
  7180. }, (0,external_wp_element_namespaceObject.createElement)(MetaBoxes, {
  7181. location: "normal"
  7182. }), (0,external_wp_element_namespaceObject.createElement)(MetaBoxes, {
  7183. location: "advanced"
  7184. })), isMobileViewport && sidebarIsOpened && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ScrollLock, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockStyles.Slot, {
  7185. scope: "core/block-inspector"
  7186. })),
  7187. footer: !hasReducedUI && showBlockBreadcrumbs && !isMobileViewport && isRichEditingEnabled && mode === 'visual' && (0,external_wp_element_namespaceObject.createElement)("div", {
  7188. className: "edit-post-layout__footer"
  7189. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockBreadcrumb, {
  7190. rootLabelText: documentLabel
  7191. })),
  7192. actions: (0,external_wp_element_namespaceObject.createElement)(ActionsPanel, {
  7193. closeEntitiesSavedStates: closeEntitiesSavedStates,
  7194. isEntitiesSavedStatesOpen: entitiesSavedStatesCallback,
  7195. setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback
  7196. }),
  7197. shortcuts: {
  7198. previous: previousShortcut,
  7199. next: nextShortcut
  7200. }
  7201. }), (0,external_wp_element_namespaceObject.createElement)(EditPostPreferencesModal, null), (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcut_help_modal, null), (0,external_wp_element_namespaceObject.createElement)(WelcomeGuide, null), (0,external_wp_element_namespaceObject.createElement)(StartPageOptions, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover.Slot, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_plugins_namespaceObject.PluginArea, {
  7202. onError: onPluginAreaError
  7203. }));
  7204. }
  7205. /* harmony default export */ var components_layout = (Layout);
  7206. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/editor-initialization/listener-hooks.js
  7207. /**
  7208. * WordPress dependencies
  7209. */
  7210. /**
  7211. * Internal dependencies
  7212. */
  7213. /**
  7214. * This listener hook monitors for block selection and triggers the appropriate
  7215. * sidebar state.
  7216. *
  7217. * @param {number} postId The current post id.
  7218. */
  7219. const useBlockSelectionListener = postId => {
  7220. const {
  7221. hasBlockSelection,
  7222. isEditorSidebarOpened
  7223. } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
  7224. hasBlockSelection: !!select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart(),
  7225. isEditorSidebarOpened: select(constants_STORE_NAME).isEditorSidebarOpened()
  7226. }), [postId]);
  7227. const {
  7228. openGeneralSidebar
  7229. } = (0,external_wp_data_namespaceObject.useDispatch)(constants_STORE_NAME);
  7230. (0,external_wp_element_namespaceObject.useEffect)(() => {
  7231. if (!isEditorSidebarOpened) {
  7232. return;
  7233. }
  7234. if (hasBlockSelection) {
  7235. openGeneralSidebar('edit-post/block');
  7236. } else {
  7237. openGeneralSidebar('edit-post/document');
  7238. }
  7239. }, [hasBlockSelection, isEditorSidebarOpened]);
  7240. };
  7241. /**
  7242. * This listener hook monitors any change in permalink and updates the view
  7243. * post link in the admin bar.
  7244. *
  7245. * @param {number} postId
  7246. */
  7247. const useUpdatePostLinkListener = postId => {
  7248. const {
  7249. newPermalink
  7250. } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
  7251. newPermalink: select(external_wp_editor_namespaceObject.store).getCurrentPost().link
  7252. }), [postId]);
  7253. const nodeToUpdate = (0,external_wp_element_namespaceObject.useRef)();
  7254. (0,external_wp_element_namespaceObject.useEffect)(() => {
  7255. nodeToUpdate.current = document.querySelector(VIEW_AS_PREVIEW_LINK_SELECTOR) || document.querySelector(VIEW_AS_LINK_SELECTOR);
  7256. }, [postId]);
  7257. (0,external_wp_element_namespaceObject.useEffect)(() => {
  7258. if (!newPermalink || !nodeToUpdate.current) {
  7259. return;
  7260. }
  7261. nodeToUpdate.current.setAttribute('href', newPermalink);
  7262. }, [newPermalink]);
  7263. };
  7264. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/editor-initialization/index.js
  7265. /**
  7266. * Internal dependencies
  7267. */
  7268. /**
  7269. * Data component used for initializing the editor and re-initializes
  7270. * when postId changes or on unmount.
  7271. *
  7272. * @param {number} postId The id of the post.
  7273. * @return {null} This is a data component so does not render any ui.
  7274. */
  7275. function EditorInitialization(_ref) {
  7276. let {
  7277. postId
  7278. } = _ref;
  7279. useBlockSelectionListener(postId);
  7280. useUpdatePostLinkListener(postId);
  7281. return null;
  7282. }
  7283. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/editor.js
  7284. /**
  7285. * External dependencies
  7286. */
  7287. /**
  7288. * WordPress dependencies
  7289. */
  7290. /**
  7291. * Internal dependencies
  7292. */
  7293. function Editor(_ref) {
  7294. let {
  7295. postId,
  7296. postType,
  7297. settings,
  7298. initialEdits,
  7299. onError,
  7300. ...props
  7301. } = _ref;
  7302. const {
  7303. hasFixedToolbar,
  7304. focusMode,
  7305. hasReducedUI,
  7306. hasThemeStyles,
  7307. post,
  7308. preferredStyleVariations,
  7309. hiddenBlockTypes,
  7310. blockTypes,
  7311. keepCaretInsideBlock,
  7312. isTemplateMode,
  7313. template
  7314. } = (0,external_wp_data_namespaceObject.useSelect)(select => {
  7315. var _getPostType$viewable, _getPostType;
  7316. const {
  7317. isFeatureActive,
  7318. __experimentalGetPreviewDeviceType,
  7319. isEditingTemplate,
  7320. getEditedPostTemplate,
  7321. getHiddenBlockTypes
  7322. } = select(store_store);
  7323. const {
  7324. getEntityRecord,
  7325. getPostType,
  7326. getEntityRecords
  7327. } = select(external_wp_coreData_namespaceObject.store);
  7328. const {
  7329. getEditorSettings
  7330. } = select(external_wp_editor_namespaceObject.store);
  7331. const {
  7332. getBlockTypes
  7333. } = select(external_wp_blocks_namespaceObject.store);
  7334. const isTemplate = ['wp_template', 'wp_template_part'].includes(postType); // Ideally the initializeEditor function should be called using the ID of the REST endpoint.
  7335. // to avoid the special case.
  7336. let postObject;
  7337. if (isTemplate) {
  7338. const posts = getEntityRecords('postType', postType, {
  7339. wp_id: postId
  7340. });
  7341. postObject = posts === null || posts === void 0 ? void 0 : posts[0];
  7342. } else {
  7343. postObject = getEntityRecord('postType', postType, postId);
  7344. }
  7345. const supportsTemplateMode = getEditorSettings().supportsTemplateMode;
  7346. const isViewable = (_getPostType$viewable = (_getPostType = getPostType(postType)) === null || _getPostType === void 0 ? void 0 : _getPostType.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false;
  7347. return {
  7348. hasFixedToolbar: isFeatureActive('fixedToolbar') || __experimentalGetPreviewDeviceType() !== 'Desktop',
  7349. focusMode: isFeatureActive('focusMode'),
  7350. hasReducedUI: isFeatureActive('reducedUI'),
  7351. hasThemeStyles: isFeatureActive('themeStyles'),
  7352. preferredStyleVariations: select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'preferredStyleVariations'),
  7353. hiddenBlockTypes: getHiddenBlockTypes(),
  7354. blockTypes: getBlockTypes(),
  7355. keepCaretInsideBlock: isFeatureActive('keepCaretInsideBlock'),
  7356. isTemplateMode: isEditingTemplate(),
  7357. template: supportsTemplateMode && isViewable ? getEditedPostTemplate() : null,
  7358. post: postObject
  7359. };
  7360. }, [postType, postId]);
  7361. const {
  7362. updatePreferredStyleVariations,
  7363. setIsInserterOpened
  7364. } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
  7365. const editorSettings = (0,external_wp_element_namespaceObject.useMemo)(() => {
  7366. const result = { ...settings,
  7367. __experimentalPreferredStyleVariations: {
  7368. value: preferredStyleVariations,
  7369. onChange: updatePreferredStyleVariations
  7370. },
  7371. hasFixedToolbar,
  7372. focusMode,
  7373. hasReducedUI,
  7374. // This is marked as experimental to give time for the quick inserter to mature.
  7375. __experimentalSetIsInserterOpened: setIsInserterOpened,
  7376. keepCaretInsideBlock,
  7377. // Keep a reference of the `allowedBlockTypes` from the server to handle use cases
  7378. // where we need to differentiate if a block is disabled by the user or some plugin.
  7379. defaultAllowedBlockTypes: settings.allowedBlockTypes
  7380. }; // Omit hidden block types if exists and non-empty.
  7381. if ((0,external_lodash_namespaceObject.size)(hiddenBlockTypes) > 0) {
  7382. // Defer to passed setting for `allowedBlockTypes` if provided as
  7383. // anything other than `true` (where `true` is equivalent to allow
  7384. // all block types).
  7385. const defaultAllowedBlockTypes = true === settings.allowedBlockTypes ? (0,external_lodash_namespaceObject.map)(blockTypes, 'name') : settings.allowedBlockTypes || [];
  7386. result.allowedBlockTypes = (0,external_lodash_namespaceObject.without)(defaultAllowedBlockTypes, ...hiddenBlockTypes);
  7387. }
  7388. return result;
  7389. }, [settings, hasFixedToolbar, focusMode, hasReducedUI, hiddenBlockTypes, blockTypes, preferredStyleVariations, setIsInserterOpened, updatePreferredStyleVariations, keepCaretInsideBlock]);
  7390. const styles = (0,external_wp_element_namespaceObject.useMemo)(() => {
  7391. const themeStyles = [];
  7392. const presetStyles = [];
  7393. (0,external_lodash_namespaceObject.forEach)(settings.styles, style => {
  7394. if (!style.__unstableType || style.__unstableType === 'theme') {
  7395. themeStyles.push(style);
  7396. } else {
  7397. presetStyles.push(style);
  7398. }
  7399. });
  7400. const defaultEditorStyles = [...settings.defaultEditorStyles, ...presetStyles];
  7401. return hasThemeStyles && themeStyles.length ? settings.styles : defaultEditorStyles;
  7402. }, [settings, hasThemeStyles]);
  7403. if (!post) {
  7404. return null;
  7405. }
  7406. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.StrictMode, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_keyboardShortcuts_namespaceObject.ShortcutProvider, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SlotFillProvider, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.EditorProvider, _extends({
  7407. settings: editorSettings,
  7408. post: post,
  7409. initialEdits: initialEdits,
  7410. useSubRegistry: false,
  7411. __unstableTemplate: isTemplateMode ? template : undefined
  7412. }, props), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.ErrorBoundary, {
  7413. onError: onError
  7414. }, (0,external_wp_element_namespaceObject.createElement)(EditorInitialization, {
  7415. postId: postId
  7416. }), (0,external_wp_element_namespaceObject.createElement)(components_layout, {
  7417. styles: styles
  7418. })), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostLockedModal, null)))));
  7419. }
  7420. /* harmony default export */ var editor = (Editor);
  7421. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js
  7422. /**
  7423. * External dependencies
  7424. */
  7425. /**
  7426. * WordPress dependencies
  7427. */
  7428. const isEverySelectedBlockAllowed = (selected, allowed) => (0,external_lodash_namespaceObject.difference)(selected, allowed).length === 0;
  7429. /**
  7430. * Plugins may want to add an item to the menu either for every block
  7431. * or only for the specific ones provided in the `allowedBlocks` component property.
  7432. *
  7433. * If there are multiple blocks selected the item will be rendered if every block
  7434. * is of one allowed type (not necessarily the same).
  7435. *
  7436. * @param {string[]} selectedBlocks Array containing the names of the blocks selected
  7437. * @param {string[]} allowedBlocks Array containing the names of the blocks allowed
  7438. * @return {boolean} Whether the item will be rendered or not.
  7439. */
  7440. const shouldRenderItem = (selectedBlocks, allowedBlocks) => !Array.isArray(allowedBlocks) || isEverySelectedBlockAllowed(selectedBlocks, allowedBlocks);
  7441. /**
  7442. * Renders a new item in the block settings menu.
  7443. *
  7444. * @param {Object} props Component props.
  7445. * @param {Array} [props.allowedBlocks] An array containing a list of block names for which the item should be shown. If not present, it'll be rendered for any block. If multiple blocks are selected, it'll be shown if and only if all of them are in the allowed list.
  7446. * @param {WPBlockTypeIconRender} [props.icon] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element.
  7447. * @param {string} props.label The menu item text.
  7448. * @param {Function} props.onClick Callback function to be executed when the user click the menu item.
  7449. * @param {boolean} [props.small] Whether to render the label or not.
  7450. * @param {string} [props.role] The ARIA role for the menu item.
  7451. *
  7452. * @example
  7453. * ```js
  7454. * // Using ES5 syntax
  7455. * var __ = wp.i18n.__;
  7456. * var PluginBlockSettingsMenuItem = wp.editPost.PluginBlockSettingsMenuItem;
  7457. *
  7458. * function doOnClick(){
  7459. * // To be called when the user clicks the menu item.
  7460. * }
  7461. *
  7462. * function MyPluginBlockSettingsMenuItem() {
  7463. * return wp.element.createElement(
  7464. * PluginBlockSettingsMenuItem,
  7465. * {
  7466. * allowedBlocks: [ 'core/paragraph' ],
  7467. * icon: 'dashicon-name',
  7468. * label: __( 'Menu item text' ),
  7469. * onClick: doOnClick,
  7470. * }
  7471. * );
  7472. * }
  7473. * ```
  7474. *
  7475. * @example
  7476. * ```jsx
  7477. * // Using ESNext syntax
  7478. * import { __ } from '@wordpress/i18n';
  7479. * import { PluginBlockSettingsMenuItem } from '@wordpress/edit-post';
  7480. *
  7481. * const doOnClick = ( ) => {
  7482. * // To be called when the user clicks the menu item.
  7483. * };
  7484. *
  7485. * const MyPluginBlockSettingsMenuItem = () => (
  7486. * <PluginBlockSettingsMenuItem
  7487. * allowedBlocks={ [ 'core/paragraph' ] }
  7488. * icon='dashicon-name'
  7489. * label={ __( 'Menu item text' ) }
  7490. * onClick={ doOnClick } />
  7491. * );
  7492. * ```
  7493. *
  7494. * @return {WPComponent} The component to be rendered.
  7495. */
  7496. const PluginBlockSettingsMenuItem = _ref => {
  7497. let {
  7498. allowedBlocks,
  7499. icon,
  7500. label,
  7501. onClick,
  7502. small,
  7503. role
  7504. } = _ref;
  7505. return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockSettingsMenuControls, null, _ref2 => {
  7506. let {
  7507. selectedBlocks,
  7508. onClose
  7509. } = _ref2;
  7510. if (!shouldRenderItem(selectedBlocks, allowedBlocks)) {
  7511. return null;
  7512. }
  7513. return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
  7514. onClick: (0,external_wp_compose_namespaceObject.compose)(onClick, onClose),
  7515. icon: icon,
  7516. label: small ? label : undefined,
  7517. role: role
  7518. }, !small && label);
  7519. });
  7520. };
  7521. /* harmony default export */ var plugin_block_settings_menu_item = (PluginBlockSettingsMenuItem);
  7522. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/plugin-more-menu-item/index.js
  7523. /**
  7524. * WordPress dependencies
  7525. */
  7526. /**
  7527. * Renders a menu item in `Plugins` group in `More Menu` drop down, and can be used to as a button or link depending on the props provided.
  7528. * The text within the component appears as the menu item label.
  7529. *
  7530. * @param {Object} props Component properties.
  7531. * @param {string} [props.href] When `href` is provided then the menu item is represented as an anchor rather than button. It corresponds to the `href` attribute of the anchor.
  7532. * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered to the left of the menu item label.
  7533. * @param {Function} [props.onClick=noop] The callback function to be executed when the user clicks the menu item.
  7534. * @param {...*} [props.other] Any additional props are passed through to the underlying [MenuItem](https://github.com/WordPress/gutenberg/tree/HEAD/packages/components/src/menu-item/README.md) component.
  7535. *
  7536. * @example
  7537. * ```js
  7538. * // Using ES5 syntax
  7539. * var __ = wp.i18n.__;
  7540. * var PluginMoreMenuItem = wp.editPost.PluginMoreMenuItem;
  7541. * var moreIcon = wp.element.createElement( 'svg' ); //... svg element.
  7542. *
  7543. * function onButtonClick() {
  7544. * alert( 'Button clicked.' );
  7545. * }
  7546. *
  7547. * function MyButtonMoreMenuItem() {
  7548. * return wp.element.createElement(
  7549. * PluginMoreMenuItem,
  7550. * {
  7551. * icon: moreIcon,
  7552. * onClick: onButtonClick,
  7553. * },
  7554. * __( 'My button title' )
  7555. * );
  7556. * }
  7557. * ```
  7558. *
  7559. * @example
  7560. * ```jsx
  7561. * // Using ESNext syntax
  7562. * import { __ } from '@wordpress/i18n';
  7563. * import { PluginMoreMenuItem } from '@wordpress/edit-post';
  7564. * import { more } from '@wordpress/icons';
  7565. *
  7566. * function onButtonClick() {
  7567. * alert( 'Button clicked.' );
  7568. * }
  7569. *
  7570. * const MyButtonMoreMenuItem = () => (
  7571. * <PluginMoreMenuItem
  7572. * icon={ more }
  7573. * onClick={ onButtonClick }
  7574. * >
  7575. * { __( 'My button title' ) }
  7576. * </PluginMoreMenuItem>
  7577. * );
  7578. * ```
  7579. *
  7580. * @return {WPComponent} The component to be rendered.
  7581. */
  7582. /* harmony default export */ var plugin_more_menu_item = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => {
  7583. var _ownProps$as;
  7584. return {
  7585. as: (_ownProps$as = ownProps.as) !== null && _ownProps$as !== void 0 ? _ownProps$as : external_wp_components_namespaceObject.MenuItem,
  7586. icon: ownProps.icon || context.icon,
  7587. name: 'core/edit-post/plugin-more-menu'
  7588. };
  7589. }))(action_item));
  7590. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/plugin-sidebar-more-menu-item/index.js
  7591. /**
  7592. * WordPress dependencies
  7593. */
  7594. /**
  7595. * Renders a menu item in `Plugins` group in `More Menu` drop down,
  7596. * and can be used to activate the corresponding `PluginSidebar` component.
  7597. * The text within the component appears as the menu item label.
  7598. *
  7599. * @param {Object} props Component props.
  7600. * @param {string} props.target A string identifying the target sidebar you wish to be activated by this menu item. Must be the same as the `name` prop you have given to that sidebar.
  7601. * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered to the left of the menu item label.
  7602. *
  7603. * @example
  7604. * ```js
  7605. * // Using ES5 syntax
  7606. * var __ = wp.i18n.__;
  7607. * var PluginSidebarMoreMenuItem = wp.editPost.PluginSidebarMoreMenuItem;
  7608. * var moreIcon = wp.element.createElement( 'svg' ); //... svg element.
  7609. *
  7610. * function MySidebarMoreMenuItem() {
  7611. * return wp.element.createElement(
  7612. * PluginSidebarMoreMenuItem,
  7613. * {
  7614. * target: 'my-sidebar',
  7615. * icon: moreIcon,
  7616. * },
  7617. * __( 'My sidebar title' )
  7618. * )
  7619. * }
  7620. * ```
  7621. *
  7622. * @example
  7623. * ```jsx
  7624. * // Using ESNext syntax
  7625. * import { __ } from '@wordpress/i18n';
  7626. * import { PluginSidebarMoreMenuItem } from '@wordpress/edit-post';
  7627. * import { more } from '@wordpress/icons';
  7628. *
  7629. * const MySidebarMoreMenuItem = () => (
  7630. * <PluginSidebarMoreMenuItem
  7631. * target="my-sidebar"
  7632. * icon={ more }
  7633. * >
  7634. * { __( 'My sidebar title' ) }
  7635. * </PluginSidebarMoreMenuItem>
  7636. * );
  7637. * ```
  7638. *
  7639. * @return {WPComponent} The component to be rendered.
  7640. */
  7641. function PluginSidebarMoreMenuItem(props) {
  7642. return (0,external_wp_element_namespaceObject.createElement)(ComplementaryAreaMoreMenuItem // Menu item is marked with unstable prop for backward compatibility.
  7643. // @see https://github.com/WordPress/gutenberg/issues/14457
  7644. , _extends({
  7645. __unstableExplicitMenuItem: true,
  7646. scope: "core/edit-post"
  7647. }, props));
  7648. }
  7649. ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/index.js
  7650. /**
  7651. * WordPress dependencies
  7652. */
  7653. /**
  7654. * Internal dependencies
  7655. */
  7656. /**
  7657. * Reinitializes the editor after the user chooses to reboot the editor after
  7658. * an unhandled error occurs, replacing previously mounted editor element using
  7659. * an initial state from prior to the crash.
  7660. *
  7661. * @param {Object} postType Post type of the post to edit.
  7662. * @param {Object} postId ID of the post to edit.
  7663. * @param {Element} target DOM node in which editor is rendered.
  7664. * @param {?Object} settings Editor settings object.
  7665. * @param {Object} initialEdits Programmatic edits to apply initially, to be
  7666. * considered as non-user-initiated (bypass for
  7667. * unsaved changes prompt).
  7668. */
  7669. function reinitializeEditor(postType, postId, target, settings, initialEdits) {
  7670. (0,external_wp_element_namespaceObject.unmountComponentAtNode)(target);
  7671. const reboot = reinitializeEditor.bind(null, postType, postId, target, settings, initialEdits);
  7672. (0,external_wp_element_namespaceObject.render)((0,external_wp_element_namespaceObject.createElement)(editor, {
  7673. settings: settings,
  7674. onError: reboot,
  7675. postId: postId,
  7676. postType: postType,
  7677. initialEdits: initialEdits,
  7678. recovery: true
  7679. }), target);
  7680. }
  7681. /**
  7682. * Initializes and returns an instance of Editor.
  7683. *
  7684. * @param {string} id Unique identifier for editor instance.
  7685. * @param {string} postType Post type of the post to edit.
  7686. * @param {Object} postId ID of the post to edit.
  7687. * @param {?Object} settings Editor settings object.
  7688. * @param {Object} initialEdits Programmatic edits to apply initially, to be
  7689. * considered as non-user-initiated (bypass for
  7690. * unsaved changes prompt).
  7691. */
  7692. function initializeEditor(id, postType, postId, settings, initialEdits) {
  7693. // Prevent adding template part in the post editor.
  7694. // Only add the filter when the post editor is initialized, not imported.
  7695. (0,external_wp_hooks_namespaceObject.addFilter)('blockEditor.__unstableCanInsertBlockType', 'removeTemplatePartsFromInserter', (can, blockType) => {
  7696. if (!(0,external_wp_data_namespaceObject.select)(store_store).isEditingTemplate() && blockType.name === 'core/template-part') {
  7697. return false;
  7698. }
  7699. return can;
  7700. });
  7701. const target = document.getElementById(id);
  7702. const reboot = reinitializeEditor.bind(null, postType, postId, target, settings, initialEdits);
  7703. (0,external_wp_data_namespaceObject.dispatch)(external_wp_preferences_namespaceObject.store).setDefaults('core/edit-post', {
  7704. editorMode: 'visual',
  7705. fixedToolbar: false,
  7706. fullscreenMode: true,
  7707. hiddenBlockTypes: [],
  7708. inactivePanels: [],
  7709. isPublishSidebarEnabled: true,
  7710. openPanels: ['post-status'],
  7711. preferredStyleVariations: {},
  7712. showBlockBreadcrumbs: true,
  7713. showIconLabels: false,
  7714. themeStyles: true,
  7715. welcomeGuide: true,
  7716. welcomeGuideTemplate: true
  7717. });
  7718. (0,external_wp_data_namespaceObject.dispatch)(external_wp_blocks_namespaceObject.store).__experimentalReapplyBlockTypeFilters();
  7719. (0,external_wp_blockLibrary_namespaceObject.registerCoreBlocks)();
  7720. if (false) {} // Show a console log warning if the browser is not in Standards rendering mode.
  7721. const documentMode = document.compatMode === 'CSS1Compat' ? 'Standards' : 'Quirks';
  7722. if (documentMode !== 'Standards') {
  7723. // eslint-disable-next-line no-console
  7724. console.warn("Your browser is using Quirks Mode. \nThis can cause rendering issues such as blocks overlaying meta boxes in the editor. Quirks Mode can be triggered by PHP errors or HTML code appearing before the opening <!DOCTYPE html>. Try checking the raw page source or your site's PHP error log and resolving errors there, removing any HTML before the doctype, or disabling plugins.");
  7725. } // This is a temporary fix for a couple of issues specific to Webkit on iOS.
  7726. // Without this hack the browser scrolls the mobile toolbar off-screen.
  7727. // Once supported in Safari we can replace this in favor of preventScroll.
  7728. // For details see issue #18632 and PR #18686
  7729. // Specifically, we scroll `interface-interface-skeleton__body` to enable a fixed top toolbar.
  7730. // But Mobile Safari forces the `html` element to scroll upwards, hiding the toolbar.
  7731. const isIphone = window.navigator.userAgent.indexOf('iPhone') !== -1;
  7732. if (isIphone) {
  7733. window.addEventListener('scroll', event => {
  7734. const editorScrollContainer = document.getElementsByClassName('interface-interface-skeleton__body')[0];
  7735. if (event.target === document) {
  7736. // Scroll element into view by scrolling the editor container by the same amount
  7737. // that Mobile Safari tried to scroll the html element upwards.
  7738. if (window.scrollY > 100) {
  7739. editorScrollContainer.scrollTop = editorScrollContainer.scrollTop + window.scrollY;
  7740. } // Undo unwanted scroll on html element, but only in the visual editor.
  7741. if (document.getElementsByClassName('is-mode-visual')[0]) {
  7742. window.scrollTo(0, 0);
  7743. }
  7744. }
  7745. });
  7746. }
  7747. (0,external_wp_element_namespaceObject.render)((0,external_wp_element_namespaceObject.createElement)(editor, {
  7748. settings: settings,
  7749. onError: reboot,
  7750. postId: postId,
  7751. postType: postType,
  7752. initialEdits: initialEdits
  7753. }), target);
  7754. }
  7755. }();
  7756. (window.wp = window.wp || {}).editPost = __webpack_exports__;
  7757. /******/ })()
  7758. ;