| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926 |
- this["wp"] = this["wp"] || {}; this["wp"]["editor"] =
- /******/ (function(modules) { // webpackBootstrap
- /******/ // The module cache
- /******/ var installedModules = {};
- /******/
- /******/ // The require function
- /******/ function __webpack_require__(moduleId) {
- /******/
- /******/ // Check if module is in cache
- /******/ if(installedModules[moduleId]) {
- /******/ return installedModules[moduleId].exports;
- /******/ }
- /******/ // Create a new module (and put it into the cache)
- /******/ var module = installedModules[moduleId] = {
- /******/ i: moduleId,
- /******/ l: false,
- /******/ exports: {}
- /******/ };
- /******/
- /******/ // Execute the module function
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
- /******/
- /******/ // Flag the module as loaded
- /******/ module.l = true;
- /******/
- /******/ // Return the exports of the module
- /******/ return module.exports;
- /******/ }
- /******/
- /******/
- /******/ // expose the modules object (__webpack_modules__)
- /******/ __webpack_require__.m = modules;
- /******/
- /******/ // expose the module cache
- /******/ __webpack_require__.c = installedModules;
- /******/
- /******/ // define getter function for harmony exports
- /******/ __webpack_require__.d = function(exports, name, getter) {
- /******/ if(!__webpack_require__.o(exports, name)) {
- /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
- /******/ }
- /******/ };
- /******/
- /******/ // define __esModule on exports
- /******/ __webpack_require__.r = function(exports) {
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
- /******/ }
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
- /******/ };
- /******/
- /******/ // create a fake namespace object
- /******/ // mode & 1: value is a module id, require it
- /******/ // mode & 2: merge all properties of value into the ns
- /******/ // mode & 4: return value when already ns object
- /******/ // mode & 8|1: behave like require
- /******/ __webpack_require__.t = function(value, mode) {
- /******/ if(mode & 1) value = __webpack_require__(value);
- /******/ if(mode & 8) return value;
- /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
- /******/ var ns = Object.create(null);
- /******/ __webpack_require__.r(ns);
- /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
- /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
- /******/ return ns;
- /******/ };
- /******/
- /******/ // getDefaultExport function for compatibility with non-harmony modules
- /******/ __webpack_require__.n = function(module) {
- /******/ var getter = module && module.__esModule ?
- /******/ function getDefault() { return module['default']; } :
- /******/ function getModuleExports() { return module; };
- /******/ __webpack_require__.d(getter, 'a', getter);
- /******/ return getter;
- /******/ };
- /******/
- /******/ // Object.prototype.hasOwnProperty.call
- /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
- /******/
- /******/ // __webpack_public_path__
- /******/ __webpack_require__.p = "";
- /******/
- /******/
- /******/ // Load entry module and return exports
- /******/ return __webpack_require__(__webpack_require__.s = "PLxR");
- /******/ })
- /************************************************************************/
- /******/ ({
- /***/ "16Al":
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /**
- * Copyright (c) 2013-present, Facebook, Inc.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
- var ReactPropTypesSecret = __webpack_require__("WbBG");
- function emptyFunction() {}
- function emptyFunctionWithReset() {}
- emptyFunctionWithReset.resetWarningCache = emptyFunction;
- module.exports = function() {
- function shim(props, propName, componentName, location, propFullName, secret) {
- if (secret === ReactPropTypesSecret) {
- // It is still safe when called from React.
- return;
- }
- var err = new Error(
- 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
- 'Use PropTypes.checkPropTypes() to call them. ' +
- 'Read more at http://fb.me/use-check-prop-types'
- );
- err.name = 'Invariant Violation';
- throw err;
- };
- shim.isRequired = shim;
- function getShim() {
- return shim;
- };
- // Important!
- // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
- var ReactPropTypes = {
- array: shim,
- bool: shim,
- func: shim,
- number: shim,
- object: shim,
- string: shim,
- symbol: shim,
- any: shim,
- arrayOf: getShim,
- element: shim,
- elementType: shim,
- instanceOf: getShim,
- node: shim,
- objectOf: getShim,
- oneOf: getShim,
- oneOfType: getShim,
- shape: getShim,
- exact: getShim,
- checkPropTypes: emptyFunctionWithReset,
- resetWarningCache: emptyFunction
- };
- ReactPropTypes.PropTypes = ReactPropTypes;
- return ReactPropTypes;
- };
- /***/ }),
- /***/ "17x9":
- /***/ (function(module, exports, __webpack_require__) {
- /**
- * Copyright (c) 2013-present, Facebook, Inc.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
- if (false) { var throwOnDirectAccess, ReactIs; } else {
- // By explicitly using `prop-types` you are opting into new production behavior.
- // http://fb.me/prop-types-in-prod
- module.exports = __webpack_require__("16Al")();
- }
- /***/ }),
- /***/ "1ZqX":
- /***/ (function(module, exports) {
- (function() { module.exports = window["wp"]["data"]; }());
- /***/ }),
- /***/ "51Zz":
- /***/ (function(module, exports) {
- (function() { module.exports = window["wp"]["dataControls"]; }());
- /***/ }),
- /***/ "6aBm":
- /***/ (function(module, exports) {
- (function() { module.exports = window["wp"]["mediaUtils"]; }());
- /***/ }),
- /***/ "7fqt":
- /***/ (function(module, exports) {
- (function() { module.exports = window["wp"]["wordcount"]; }());
- /***/ }),
- /***/ "CNgt":
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __extends = (this && this.__extends) || (function () {
- var extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return function (d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- })();
- var __assign = (this && this.__assign) || Object.assign || function(t) {
- for (var s, i = 1, n = arguments.length; i < n; i++) {
- s = arguments[i];
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
- t[p] = s[p];
- }
- return t;
- };
- var __rest = (this && this.__rest) || function (s, e) {
- var t = {};
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
- t[p] = s[p];
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
- t[p[i]] = s[p[i]];
- return t;
- };
- exports.__esModule = true;
- var React = __webpack_require__("cDcd");
- var PropTypes = __webpack_require__("17x9");
- var autosize = __webpack_require__("GemG");
- var _getLineHeight = __webpack_require__("Rk8H");
- var getLineHeight = _getLineHeight;
- var RESIZED = "autosize:resized";
- /**
- * A light replacement for built-in textarea component
- * which automaticaly adjusts its height to match the content
- */
- var TextareaAutosizeClass = /** @class */ (function (_super) {
- __extends(TextareaAutosizeClass, _super);
- function TextareaAutosizeClass() {
- var _this = _super !== null && _super.apply(this, arguments) || this;
- _this.state = {
- lineHeight: null
- };
- _this.textarea = null;
- _this.onResize = function (e) {
- if (_this.props.onResize) {
- _this.props.onResize(e);
- }
- };
- _this.updateLineHeight = function () {
- if (_this.textarea) {
- _this.setState({
- lineHeight: getLineHeight(_this.textarea)
- });
- }
- };
- _this.onChange = function (e) {
- var onChange = _this.props.onChange;
- _this.currentValue = e.currentTarget.value;
- onChange && onChange(e);
- };
- return _this;
- }
- TextareaAutosizeClass.prototype.componentDidMount = function () {
- var _this = this;
- var _a = this.props, maxRows = _a.maxRows, async = _a.async;
- if (typeof maxRows === "number") {
- this.updateLineHeight();
- }
- if (typeof maxRows === "number" || async) {
- /*
- the defer is needed to:
- - force "autosize" to activate the scrollbar when this.props.maxRows is passed
- - support StyledComponents (see #71)
- */
- setTimeout(function () { return _this.textarea && autosize(_this.textarea); });
- }
- else {
- this.textarea && autosize(this.textarea);
- }
- if (this.textarea) {
- this.textarea.addEventListener(RESIZED, this.onResize);
- }
- };
- TextareaAutosizeClass.prototype.componentWillUnmount = function () {
- if (this.textarea) {
- this.textarea.removeEventListener(RESIZED, this.onResize);
- autosize.destroy(this.textarea);
- }
- };
- TextareaAutosizeClass.prototype.render = function () {
- var _this = this;
- var _a = this, _b = _a.props, onResize = _b.onResize, maxRows = _b.maxRows, onChange = _b.onChange, style = _b.style, innerRef = _b.innerRef, children = _b.children, props = __rest(_b, ["onResize", "maxRows", "onChange", "style", "innerRef", "children"]), lineHeight = _a.state.lineHeight;
- var maxHeight = maxRows && lineHeight ? lineHeight * maxRows : null;
- return (React.createElement("textarea", __assign({}, props, { onChange: this.onChange, style: maxHeight ? __assign({}, style, { maxHeight: maxHeight }) : style, ref: function (element) {
- _this.textarea = element;
- if (typeof _this.props.innerRef === 'function') {
- _this.props.innerRef(element);
- }
- else if (_this.props.innerRef) {
- _this.props.innerRef.current = element;
- }
- } }), children));
- };
- TextareaAutosizeClass.prototype.componentDidUpdate = function () {
- this.textarea && autosize.update(this.textarea);
- };
- TextareaAutosizeClass.defaultProps = {
- rows: 1,
- async: false
- };
- TextareaAutosizeClass.propTypes = {
- rows: PropTypes.number,
- maxRows: PropTypes.number,
- onResize: PropTypes.func,
- innerRef: PropTypes.any,
- async: PropTypes.bool
- };
- return TextareaAutosizeClass;
- }(React.Component));
- exports.TextareaAutosize = React.forwardRef(function (props, ref) {
- return React.createElement(TextareaAutosizeClass, __assign({}, props, { innerRef: ref }));
- });
- /***/ }),
- /***/ "Civd":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
- /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9");
- /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
- /**
- * WordPress dependencies
- */
- const layout = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
- }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
- 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"
- }));
- /* harmony default export */ __webpack_exports__["a"] = (layout);
- /***/ }),
- /***/ "FqII":
- /***/ (function(module, exports) {
- (function() { module.exports = window["wp"]["date"]; }());
- /***/ }),
- /***/ "GRId":
- /***/ (function(module, exports) {
- (function() { module.exports = window["wp"]["element"]; }());
- /***/ }),
- /***/ "GemG":
- /***/ (function(module, exports, __webpack_require__) {
- var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
- autosize 4.0.4
- license: MIT
- http://www.jacklmoore.com/autosize
- */
- (function (global, factory) {
- if (true) {
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
- __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
- (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
- } else { var mod; }
- })(this, function (module, exports) {
- 'use strict';
- var map = typeof Map === "function" ? new Map() : function () {
- var keys = [];
- var values = [];
- return {
- has: function has(key) {
- return keys.indexOf(key) > -1;
- },
- get: function get(key) {
- return values[keys.indexOf(key)];
- },
- set: function set(key, value) {
- if (keys.indexOf(key) === -1) {
- keys.push(key);
- values.push(value);
- }
- },
- delete: function _delete(key) {
- var index = keys.indexOf(key);
- if (index > -1) {
- keys.splice(index, 1);
- values.splice(index, 1);
- }
- }
- };
- }();
- var createEvent = function createEvent(name) {
- return new Event(name, { bubbles: true });
- };
- try {
- new Event('test');
- } catch (e) {
- // IE does not support `new Event()`
- createEvent = function createEvent(name) {
- var evt = document.createEvent('Event');
- evt.initEvent(name, true, false);
- return evt;
- };
- }
- function assign(ta) {
- if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA' || map.has(ta)) return;
- var heightOffset = null;
- var clientWidth = null;
- var cachedHeight = null;
- function init() {
- var style = window.getComputedStyle(ta, null);
- if (style.resize === 'vertical') {
- ta.style.resize = 'none';
- } else if (style.resize === 'both') {
- ta.style.resize = 'horizontal';
- }
- if (style.boxSizing === 'content-box') {
- heightOffset = -(parseFloat(style.paddingTop) + parseFloat(style.paddingBottom));
- } else {
- heightOffset = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth);
- }
- // Fix when a textarea is not on document body and heightOffset is Not a Number
- if (isNaN(heightOffset)) {
- heightOffset = 0;
- }
- update();
- }
- function changeOverflow(value) {
- {
- // Chrome/Safari-specific fix:
- // When the textarea y-overflow is hidden, Chrome/Safari do not reflow the text to account for the space
- // made available by removing the scrollbar. The following forces the necessary text reflow.
- var width = ta.style.width;
- ta.style.width = '0px';
- // Force reflow:
- /* jshint ignore:start */
- ta.offsetWidth;
- /* jshint ignore:end */
- ta.style.width = width;
- }
- ta.style.overflowY = value;
- }
- function getParentOverflows(el) {
- var arr = [];
- while (el && el.parentNode && el.parentNode instanceof Element) {
- if (el.parentNode.scrollTop) {
- arr.push({
- node: el.parentNode,
- scrollTop: el.parentNode.scrollTop
- });
- }
- el = el.parentNode;
- }
- return arr;
- }
- function resize() {
- if (ta.scrollHeight === 0) {
- // If the scrollHeight is 0, then the element probably has display:none or is detached from the DOM.
- return;
- }
- var overflows = getParentOverflows(ta);
- var docTop = document.documentElement && document.documentElement.scrollTop; // Needed for Mobile IE (ticket #240)
- ta.style.height = '';
- ta.style.height = ta.scrollHeight + heightOffset + 'px';
- // used to check if an update is actually necessary on window.resize
- clientWidth = ta.clientWidth;
- // prevents scroll-position jumping
- overflows.forEach(function (el) {
- el.node.scrollTop = el.scrollTop;
- });
- if (docTop) {
- document.documentElement.scrollTop = docTop;
- }
- }
- function update() {
- resize();
- var styleHeight = Math.round(parseFloat(ta.style.height));
- var computed = window.getComputedStyle(ta, null);
- // Using offsetHeight as a replacement for computed.height in IE, because IE does not account use of border-box
- var actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(computed.height)) : ta.offsetHeight;
- // The actual height not matching the style height (set via the resize method) indicates that
- // the max-height has been exceeded, in which case the overflow should be allowed.
- if (actualHeight < styleHeight) {
- if (computed.overflowY === 'hidden') {
- changeOverflow('scroll');
- resize();
- actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight;
- }
- } else {
- // Normally keep overflow set to hidden, to avoid flash of scrollbar as the textarea expands.
- if (computed.overflowY !== 'hidden') {
- changeOverflow('hidden');
- resize();
- actualHeight = computed.boxSizing === 'content-box' ? Math.round(parseFloat(window.getComputedStyle(ta, null).height)) : ta.offsetHeight;
- }
- }
- if (cachedHeight !== actualHeight) {
- cachedHeight = actualHeight;
- var evt = createEvent('autosize:resized');
- try {
- ta.dispatchEvent(evt);
- } catch (err) {
- // Firefox will throw an error on dispatchEvent for a detached element
- // https://bugzilla.mozilla.org/show_bug.cgi?id=889376
- }
- }
- }
- var pageResize = function pageResize() {
- if (ta.clientWidth !== clientWidth) {
- update();
- }
- };
- var destroy = function (style) {
- window.removeEventListener('resize', pageResize, false);
- ta.removeEventListener('input', update, false);
- ta.removeEventListener('keyup', update, false);
- ta.removeEventListener('autosize:destroy', destroy, false);
- ta.removeEventListener('autosize:update', update, false);
- Object.keys(style).forEach(function (key) {
- ta.style[key] = style[key];
- });
- map.delete(ta);
- }.bind(ta, {
- height: ta.style.height,
- resize: ta.style.resize,
- overflowY: ta.style.overflowY,
- overflowX: ta.style.overflowX,
- wordWrap: ta.style.wordWrap
- });
- ta.addEventListener('autosize:destroy', destroy, false);
- // IE9 does not fire onpropertychange or oninput for deletions,
- // so binding to onkeyup to catch most of those events.
- // There is no way that I know of to detect something like 'cut' in IE9.
- if ('onpropertychange' in ta && 'oninput' in ta) {
- ta.addEventListener('keyup', update, false);
- }
- window.addEventListener('resize', pageResize, false);
- ta.addEventListener('input', update, false);
- ta.addEventListener('autosize:update', update, false);
- ta.style.overflowX = 'hidden';
- ta.style.wordWrap = 'break-word';
- map.set(ta, {
- destroy: destroy,
- update: update
- });
- init();
- }
- function destroy(ta) {
- var methods = map.get(ta);
- if (methods) {
- methods.destroy();
- }
- }
- function update(ta) {
- var methods = map.get(ta);
- if (methods) {
- methods.update();
- }
- }
- var autosize = null;
- // Do nothing in Node.js environment and IE8 (or lower)
- if (typeof window === 'undefined' || typeof window.getComputedStyle !== 'function') {
- autosize = function autosize(el) {
- return el;
- };
- autosize.destroy = function (el) {
- return el;
- };
- autosize.update = function (el) {
- return el;
- };
- } else {
- autosize = function autosize(el, options) {
- if (el) {
- Array.prototype.forEach.call(el.length ? el : [el], function (x) {
- return assign(x, options);
- });
- }
- return el;
- };
- autosize.destroy = function (el) {
- if (el) {
- Array.prototype.forEach.call(el.length ? el : [el], destroy);
- }
- return el;
- };
- autosize.update = function (el) {
- if (el) {
- Array.prototype.forEach.call(el.length ? el : [el], update);
- }
- return el;
- };
- }
- exports.default = autosize;
- module.exports = exports['default'];
- });
- /***/ }),
- /***/ "HSyU":
- /***/ (function(module, exports) {
- (function() { module.exports = window["wp"]["blocks"]; }());
- /***/ }),
- /***/ "JREk":
- /***/ (function(module, exports) {
- (function() { module.exports = window["wp"]["serverSideRender"]; }());
- /***/ }),
- /***/ "K2cm":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
- /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9");
- /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
- /**
- * WordPress dependencies
- */
- const redo = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
- }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
- d: "M15.6 6.5l-1.1 1 2.9 3.3H8c-.9 0-1.7.3-2.3.9-1.4 1.5-1.4 4.2-1.4 5.6v.2h1.5v-.3c0-1.1 0-3.5 1-4.5.3-.3.7-.5 1.3-.5h9.2L14.5 15l1.1 1.1 4.6-4.6-4.6-5z"
- }));
- /* harmony default export */ __webpack_exports__["a"] = (redo);
- /***/ }),
- /***/ "K9lf":
- /***/ (function(module, exports) {
- (function() { module.exports = window["wp"]["compose"]; }());
- /***/ }),
- /***/ "Mmq9":
- /***/ (function(module, exports) {
- (function() { module.exports = window["wp"]["url"]; }());
- /***/ }),
- /***/ "NMb1":
- /***/ (function(module, exports) {
- (function() { module.exports = window["wp"]["deprecated"]; }());
- /***/ }),
- /***/ "Ntru":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
- /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9");
- /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
- /**
- * WordPress dependencies
- */
- const undo = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
- }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
- d: "M18.3 11.7c-.6-.6-1.4-.9-2.3-.9H6.7l2.9-3.3-1.1-1-4.5 5L8.5 16l1-1-2.7-2.7H16c.5 0 .9.2 1.3.5 1 1 1 3.4 1 4.5v.3h1.5v-.2c0-1.5 0-4.3-1.5-5.7z"
- }));
- /* harmony default export */ __webpack_exports__["a"] = (undo);
- /***/ }),
- /***/ "O6Fj":
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- exports.__esModule = true;
- var TextareaAutosize_1 = __webpack_require__("CNgt");
- exports["default"] = TextareaAutosize_1.TextareaAutosize;
- /***/ }),
- /***/ "PLxR":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- // ESM COMPAT FLAG
- __webpack_require__.r(__webpack_exports__);
- // EXPORTS
- __webpack_require__.d(__webpack_exports__, "storeConfig", function() { return /* reexport */ storeConfig; });
- __webpack_require__.d(__webpack_exports__, "store", function() { return /* reexport */ store; });
- __webpack_require__.d(__webpack_exports__, "userAutocompleter", function() { return /* reexport */ autocompleters_user; });
- __webpack_require__.d(__webpack_exports__, "AutosaveMonitor", function() { return /* reexport */ autosave_monitor; });
- __webpack_require__.d(__webpack_exports__, "DocumentOutline", function() { return /* reexport */ document_outline; });
- __webpack_require__.d(__webpack_exports__, "DocumentOutlineCheck", function() { return /* reexport */ check; });
- __webpack_require__.d(__webpack_exports__, "VisualEditorGlobalKeyboardShortcuts", function() { return /* reexport */ visual_editor_shortcuts; });
- __webpack_require__.d(__webpack_exports__, "TextEditorGlobalKeyboardShortcuts", function() { return /* reexport */ TextEditorGlobalKeyboardShortcuts; });
- __webpack_require__.d(__webpack_exports__, "EditorKeyboardShortcutsRegister", function() { return /* reexport */ register_shortcuts; });
- __webpack_require__.d(__webpack_exports__, "EditorHistoryRedo", function() { return /* reexport */ editor_history_redo; });
- __webpack_require__.d(__webpack_exports__, "EditorHistoryUndo", function() { return /* reexport */ editor_history_undo; });
- __webpack_require__.d(__webpack_exports__, "EditorNotices", function() { return /* reexport */ editor_notices; });
- __webpack_require__.d(__webpack_exports__, "EditorSnackbars", function() { return /* reexport */ EditorSnackbars; });
- __webpack_require__.d(__webpack_exports__, "EntitiesSavedStates", function() { return /* reexport */ EntitiesSavedStates; });
- __webpack_require__.d(__webpack_exports__, "ErrorBoundary", function() { return /* reexport */ error_boundary; });
- __webpack_require__.d(__webpack_exports__, "LocalAutosaveMonitor", function() { return /* reexport */ local_autosave_monitor; });
- __webpack_require__.d(__webpack_exports__, "PageAttributesCheck", function() { return /* reexport */ page_attributes_check; });
- __webpack_require__.d(__webpack_exports__, "PageAttributesOrder", function() { return /* reexport */ page_attributes_order; });
- __webpack_require__.d(__webpack_exports__, "PageAttributesParent", function() { return /* reexport */ page_attributes_parent; });
- __webpack_require__.d(__webpack_exports__, "PageTemplate", function() { return /* reexport */ post_template; });
- __webpack_require__.d(__webpack_exports__, "PostAuthor", function() { return /* reexport */ post_author; });
- __webpack_require__.d(__webpack_exports__, "PostAuthorCheck", function() { return /* reexport */ post_author_check; });
- __webpack_require__.d(__webpack_exports__, "PostComments", function() { return /* reexport */ post_comments; });
- __webpack_require__.d(__webpack_exports__, "PostExcerpt", function() { return /* reexport */ post_excerpt; });
- __webpack_require__.d(__webpack_exports__, "PostExcerptCheck", function() { return /* reexport */ post_excerpt_check; });
- __webpack_require__.d(__webpack_exports__, "PostFeaturedImage", function() { return /* reexport */ post_featured_image; });
- __webpack_require__.d(__webpack_exports__, "PostFeaturedImageCheck", function() { return /* reexport */ post_featured_image_check; });
- __webpack_require__.d(__webpack_exports__, "PostFormat", function() { return /* reexport */ PostFormat; });
- __webpack_require__.d(__webpack_exports__, "PostFormatCheck", function() { return /* reexport */ post_format_check; });
- __webpack_require__.d(__webpack_exports__, "PostLastRevision", function() { return /* reexport */ post_last_revision; });
- __webpack_require__.d(__webpack_exports__, "PostLastRevisionCheck", function() { return /* reexport */ post_last_revision_check; });
- __webpack_require__.d(__webpack_exports__, "PostLockedModal", function() { return /* reexport */ PostLockedModal; });
- __webpack_require__.d(__webpack_exports__, "PostPendingStatus", function() { return /* reexport */ post_pending_status; });
- __webpack_require__.d(__webpack_exports__, "PostPendingStatusCheck", function() { return /* reexport */ post_pending_status_check; });
- __webpack_require__.d(__webpack_exports__, "PostPingbacks", function() { return /* reexport */ post_pingbacks; });
- __webpack_require__.d(__webpack_exports__, "PostPreviewButton", function() { return /* reexport */ post_preview_button; });
- __webpack_require__.d(__webpack_exports__, "PostPublishButton", function() { return /* reexport */ post_publish_button; });
- __webpack_require__.d(__webpack_exports__, "PostPublishButtonLabel", function() { return /* reexport */ post_publish_button_label; });
- __webpack_require__.d(__webpack_exports__, "PostPublishPanel", function() { return /* reexport */ post_publish_panel; });
- __webpack_require__.d(__webpack_exports__, "PostSavedState", function() { return /* reexport */ PostSavedState; });
- __webpack_require__.d(__webpack_exports__, "PostSchedule", function() { return /* reexport */ PostSchedule; });
- __webpack_require__.d(__webpack_exports__, "PostScheduleCheck", function() { return /* reexport */ post_schedule_check; });
- __webpack_require__.d(__webpack_exports__, "PostScheduleLabel", function() { return /* reexport */ post_schedule_label; });
- __webpack_require__.d(__webpack_exports__, "PostSlug", function() { return /* reexport */ post_slug; });
- __webpack_require__.d(__webpack_exports__, "PostSlugCheck", function() { return /* reexport */ PostSlugCheck; });
- __webpack_require__.d(__webpack_exports__, "PostSticky", function() { return /* reexport */ post_sticky; });
- __webpack_require__.d(__webpack_exports__, "PostStickyCheck", function() { return /* reexport */ post_sticky_check; });
- __webpack_require__.d(__webpack_exports__, "PostSwitchToDraftButton", function() { return /* reexport */ post_switch_to_draft_button; });
- __webpack_require__.d(__webpack_exports__, "PostTaxonomies", function() { return /* reexport */ post_taxonomies; });
- __webpack_require__.d(__webpack_exports__, "PostTaxonomiesCheck", function() { return /* reexport */ post_taxonomies_check; });
- __webpack_require__.d(__webpack_exports__, "PostTextEditor", function() { return /* reexport */ PostTextEditor; });
- __webpack_require__.d(__webpack_exports__, "PostTitle", function() { return /* reexport */ PostTitle; });
- __webpack_require__.d(__webpack_exports__, "PostTrash", function() { return /* reexport */ post_trash; });
- __webpack_require__.d(__webpack_exports__, "PostTrashCheck", function() { return /* reexport */ post_trash_check; });
- __webpack_require__.d(__webpack_exports__, "PostTypeSupportCheck", function() { return /* reexport */ post_type_support_check; });
- __webpack_require__.d(__webpack_exports__, "PostVisibility", function() { return /* reexport */ post_visibility; });
- __webpack_require__.d(__webpack_exports__, "PostVisibilityLabel", function() { return /* reexport */ post_visibility_label; });
- __webpack_require__.d(__webpack_exports__, "PostVisibilityCheck", function() { return /* reexport */ post_visibility_check; });
- __webpack_require__.d(__webpack_exports__, "TableOfContents", function() { return /* reexport */ table_of_contents; });
- __webpack_require__.d(__webpack_exports__, "UnsavedChangesWarning", function() { return /* reexport */ UnsavedChangesWarning; });
- __webpack_require__.d(__webpack_exports__, "WordCount", function() { return /* reexport */ WordCount; });
- __webpack_require__.d(__webpack_exports__, "EditorProvider", function() { return /* reexport */ provider; });
- __webpack_require__.d(__webpack_exports__, "ServerSideRender", function() { return /* reexport */ external_wp_serverSideRender_default.a; });
- __webpack_require__.d(__webpack_exports__, "RichText", function() { return /* reexport */ RichText; });
- __webpack_require__.d(__webpack_exports__, "Autocomplete", function() { return /* reexport */ Autocomplete; });
- __webpack_require__.d(__webpack_exports__, "AlignmentToolbar", function() { return /* reexport */ AlignmentToolbar; });
- __webpack_require__.d(__webpack_exports__, "BlockAlignmentToolbar", function() { return /* reexport */ BlockAlignmentToolbar; });
- __webpack_require__.d(__webpack_exports__, "BlockControls", function() { return /* reexport */ BlockControls; });
- __webpack_require__.d(__webpack_exports__, "BlockEdit", function() { return /* reexport */ deprecated_BlockEdit; });
- __webpack_require__.d(__webpack_exports__, "BlockEditorKeyboardShortcuts", function() { return /* reexport */ BlockEditorKeyboardShortcuts; });
- __webpack_require__.d(__webpack_exports__, "BlockFormatControls", function() { return /* reexport */ BlockFormatControls; });
- __webpack_require__.d(__webpack_exports__, "BlockIcon", function() { return /* reexport */ BlockIcon; });
- __webpack_require__.d(__webpack_exports__, "BlockInspector", function() { return /* reexport */ BlockInspector; });
- __webpack_require__.d(__webpack_exports__, "BlockList", function() { return /* reexport */ BlockList; });
- __webpack_require__.d(__webpack_exports__, "BlockMover", function() { return /* reexport */ BlockMover; });
- __webpack_require__.d(__webpack_exports__, "BlockNavigationDropdown", function() { return /* reexport */ BlockNavigationDropdown; });
- __webpack_require__.d(__webpack_exports__, "BlockSelectionClearer", function() { return /* reexport */ BlockSelectionClearer; });
- __webpack_require__.d(__webpack_exports__, "BlockSettingsMenu", function() { return /* reexport */ BlockSettingsMenu; });
- __webpack_require__.d(__webpack_exports__, "BlockTitle", function() { return /* reexport */ BlockTitle; });
- __webpack_require__.d(__webpack_exports__, "BlockToolbar", function() { return /* reexport */ BlockToolbar; });
- __webpack_require__.d(__webpack_exports__, "ColorPalette", function() { return /* reexport */ ColorPalette; });
- __webpack_require__.d(__webpack_exports__, "ContrastChecker", function() { return /* reexport */ ContrastChecker; });
- __webpack_require__.d(__webpack_exports__, "CopyHandler", function() { return /* reexport */ CopyHandler; });
- __webpack_require__.d(__webpack_exports__, "DefaultBlockAppender", function() { return /* reexport */ DefaultBlockAppender; });
- __webpack_require__.d(__webpack_exports__, "FontSizePicker", function() { return /* reexport */ FontSizePicker; });
- __webpack_require__.d(__webpack_exports__, "Inserter", function() { return /* reexport */ Inserter; });
- __webpack_require__.d(__webpack_exports__, "InnerBlocks", function() { return /* reexport */ InnerBlocks; });
- __webpack_require__.d(__webpack_exports__, "InspectorAdvancedControls", function() { return /* reexport */ InspectorAdvancedControls; });
- __webpack_require__.d(__webpack_exports__, "InspectorControls", function() { return /* reexport */ InspectorControls; });
- __webpack_require__.d(__webpack_exports__, "PanelColorSettings", function() { return /* reexport */ PanelColorSettings; });
- __webpack_require__.d(__webpack_exports__, "PlainText", function() { return /* reexport */ PlainText; });
- __webpack_require__.d(__webpack_exports__, "RichTextShortcut", function() { return /* reexport */ RichTextShortcut; });
- __webpack_require__.d(__webpack_exports__, "RichTextToolbarButton", function() { return /* reexport */ RichTextToolbarButton; });
- __webpack_require__.d(__webpack_exports__, "__unstableRichTextInputEvent", function() { return /* reexport */ __unstableRichTextInputEvent; });
- __webpack_require__.d(__webpack_exports__, "MediaPlaceholder", function() { return /* reexport */ MediaPlaceholder; });
- __webpack_require__.d(__webpack_exports__, "MediaUpload", function() { return /* reexport */ MediaUpload; });
- __webpack_require__.d(__webpack_exports__, "MediaUploadCheck", function() { return /* reexport */ MediaUploadCheck; });
- __webpack_require__.d(__webpack_exports__, "MultiSelectScrollIntoView", function() { return /* reexport */ MultiSelectScrollIntoView; });
- __webpack_require__.d(__webpack_exports__, "NavigableToolbar", function() { return /* reexport */ NavigableToolbar; });
- __webpack_require__.d(__webpack_exports__, "ObserveTyping", function() { return /* reexport */ ObserveTyping; });
- __webpack_require__.d(__webpack_exports__, "PreserveScrollInReorder", function() { return /* reexport */ PreserveScrollInReorder; });
- __webpack_require__.d(__webpack_exports__, "SkipToSelectedBlock", function() { return /* reexport */ SkipToSelectedBlock; });
- __webpack_require__.d(__webpack_exports__, "URLInput", function() { return /* reexport */ URLInput; });
- __webpack_require__.d(__webpack_exports__, "URLInputButton", function() { return /* reexport */ URLInputButton; });
- __webpack_require__.d(__webpack_exports__, "URLPopover", function() { return /* reexport */ URLPopover; });
- __webpack_require__.d(__webpack_exports__, "Warning", function() { return /* reexport */ Warning; });
- __webpack_require__.d(__webpack_exports__, "WritingFlow", function() { return /* reexport */ WritingFlow; });
- __webpack_require__.d(__webpack_exports__, "createCustomColorsHOC", function() { return /* reexport */ createCustomColorsHOC; });
- __webpack_require__.d(__webpack_exports__, "getColorClassName", function() { return /* reexport */ getColorClassName; });
- __webpack_require__.d(__webpack_exports__, "getColorObjectByAttributeValues", function() { return /* reexport */ getColorObjectByAttributeValues; });
- __webpack_require__.d(__webpack_exports__, "getColorObjectByColorValue", function() { return /* reexport */ getColorObjectByColorValue; });
- __webpack_require__.d(__webpack_exports__, "getFontSize", function() { return /* reexport */ getFontSize; });
- __webpack_require__.d(__webpack_exports__, "getFontSizeClass", function() { return /* reexport */ getFontSizeClass; });
- __webpack_require__.d(__webpack_exports__, "withColorContext", function() { return /* reexport */ withColorContext; });
- __webpack_require__.d(__webpack_exports__, "withColors", function() { return /* reexport */ withColors; });
- __webpack_require__.d(__webpack_exports__, "withFontSizes", function() { return /* reexport */ withFontSizes; });
- __webpack_require__.d(__webpack_exports__, "mediaUpload", function() { return /* reexport */ mediaUpload; });
- __webpack_require__.d(__webpack_exports__, "cleanForSlug", function() { return /* reexport */ cleanForSlug; });
- __webpack_require__.d(__webpack_exports__, "transformStyles", function() { return /* reexport */ external_wp_blockEditor_["transformStyles"]; });
- // NAMESPACE OBJECT: ./node_modules/@wordpress/editor/build-module/store/selectors.js
- var selectors_namespaceObject = {};
- __webpack_require__.r(selectors_namespaceObject);
- __webpack_require__.d(selectors_namespaceObject, "hasEditorUndo", function() { return hasEditorUndo; });
- __webpack_require__.d(selectors_namespaceObject, "hasEditorRedo", function() { return hasEditorRedo; });
- __webpack_require__.d(selectors_namespaceObject, "isEditedPostNew", function() { return selectors_isEditedPostNew; });
- __webpack_require__.d(selectors_namespaceObject, "hasChangedContent", function() { return hasChangedContent; });
- __webpack_require__.d(selectors_namespaceObject, "isEditedPostDirty", function() { return selectors_isEditedPostDirty; });
- __webpack_require__.d(selectors_namespaceObject, "hasNonPostEntityChanges", function() { return selectors_hasNonPostEntityChanges; });
- __webpack_require__.d(selectors_namespaceObject, "isCleanNewPost", function() { return selectors_isCleanNewPost; });
- __webpack_require__.d(selectors_namespaceObject, "getCurrentPost", function() { return selectors_getCurrentPost; });
- __webpack_require__.d(selectors_namespaceObject, "getCurrentPostType", function() { return selectors_getCurrentPostType; });
- __webpack_require__.d(selectors_namespaceObject, "getCurrentPostId", function() { return selectors_getCurrentPostId; });
- __webpack_require__.d(selectors_namespaceObject, "getCurrentPostRevisionsCount", function() { return getCurrentPostRevisionsCount; });
- __webpack_require__.d(selectors_namespaceObject, "getCurrentPostLastRevisionId", function() { return getCurrentPostLastRevisionId; });
- __webpack_require__.d(selectors_namespaceObject, "getPostEdits", function() { return selectors_getPostEdits; });
- __webpack_require__.d(selectors_namespaceObject, "getReferenceByDistinctEdits", function() { return getReferenceByDistinctEdits; });
- __webpack_require__.d(selectors_namespaceObject, "getCurrentPostAttribute", function() { return selectors_getCurrentPostAttribute; });
- __webpack_require__.d(selectors_namespaceObject, "getEditedPostAttribute", function() { return selectors_getEditedPostAttribute; });
- __webpack_require__.d(selectors_namespaceObject, "getAutosaveAttribute", function() { return getAutosaveAttribute; });
- __webpack_require__.d(selectors_namespaceObject, "getEditedPostVisibility", function() { return selectors_getEditedPostVisibility; });
- __webpack_require__.d(selectors_namespaceObject, "isCurrentPostPending", function() { return isCurrentPostPending; });
- __webpack_require__.d(selectors_namespaceObject, "isCurrentPostPublished", function() { return selectors_isCurrentPostPublished; });
- __webpack_require__.d(selectors_namespaceObject, "isCurrentPostScheduled", function() { return selectors_isCurrentPostScheduled; });
- __webpack_require__.d(selectors_namespaceObject, "isEditedPostPublishable", function() { return selectors_isEditedPostPublishable; });
- __webpack_require__.d(selectors_namespaceObject, "isEditedPostSaveable", function() { return selectors_isEditedPostSaveable; });
- __webpack_require__.d(selectors_namespaceObject, "isEditedPostEmpty", function() { return isEditedPostEmpty; });
- __webpack_require__.d(selectors_namespaceObject, "isEditedPostAutosaveable", function() { return selectors_isEditedPostAutosaveable; });
- __webpack_require__.d(selectors_namespaceObject, "getAutosave", function() { return getAutosave; });
- __webpack_require__.d(selectors_namespaceObject, "hasAutosave", function() { return hasAutosave; });
- __webpack_require__.d(selectors_namespaceObject, "isEditedPostBeingScheduled", function() { return selectors_isEditedPostBeingScheduled; });
- __webpack_require__.d(selectors_namespaceObject, "isEditedPostDateFloating", function() { return isEditedPostDateFloating; });
- __webpack_require__.d(selectors_namespaceObject, "isSavingPost", function() { return selectors_isSavingPost; });
- __webpack_require__.d(selectors_namespaceObject, "didPostSaveRequestSucceed", function() { return didPostSaveRequestSucceed; });
- __webpack_require__.d(selectors_namespaceObject, "didPostSaveRequestFail", function() { return didPostSaveRequestFail; });
- __webpack_require__.d(selectors_namespaceObject, "isAutosavingPost", function() { return selectors_isAutosavingPost; });
- __webpack_require__.d(selectors_namespaceObject, "isPreviewingPost", function() { return isPreviewingPost; });
- __webpack_require__.d(selectors_namespaceObject, "getEditedPostPreviewLink", function() { return selectors_getEditedPostPreviewLink; });
- __webpack_require__.d(selectors_namespaceObject, "getSuggestedPostFormat", function() { return selectors_getSuggestedPostFormat; });
- __webpack_require__.d(selectors_namespaceObject, "getBlocksForSerialization", function() { return getBlocksForSerialization; });
- __webpack_require__.d(selectors_namespaceObject, "getEditedPostContent", function() { return getEditedPostContent; });
- __webpack_require__.d(selectors_namespaceObject, "isPublishingPost", function() { return selectors_isPublishingPost; });
- __webpack_require__.d(selectors_namespaceObject, "isPermalinkEditable", function() { return isPermalinkEditable; });
- __webpack_require__.d(selectors_namespaceObject, "getPermalink", function() { return getPermalink; });
- __webpack_require__.d(selectors_namespaceObject, "getEditedPostSlug", function() { return getEditedPostSlug; });
- __webpack_require__.d(selectors_namespaceObject, "getPermalinkParts", function() { return getPermalinkParts; });
- __webpack_require__.d(selectors_namespaceObject, "isPostLocked", function() { return selectors_isPostLocked; });
- __webpack_require__.d(selectors_namespaceObject, "isPostSavingLocked", function() { return selectors_isPostSavingLocked; });
- __webpack_require__.d(selectors_namespaceObject, "isPostAutosavingLocked", function() { return isPostAutosavingLocked; });
- __webpack_require__.d(selectors_namespaceObject, "isPostLockTakeover", function() { return isPostLockTakeover; });
- __webpack_require__.d(selectors_namespaceObject, "getPostLockUser", function() { return getPostLockUser; });
- __webpack_require__.d(selectors_namespaceObject, "getActivePostLock", function() { return getActivePostLock; });
- __webpack_require__.d(selectors_namespaceObject, "canUserUseUnfilteredHTML", function() { return selectors_canUserUseUnfilteredHTML; });
- __webpack_require__.d(selectors_namespaceObject, "isPublishSidebarEnabled", function() { return selectors_isPublishSidebarEnabled; });
- __webpack_require__.d(selectors_namespaceObject, "getEditorBlocks", function() { return getEditorBlocks; });
- __webpack_require__.d(selectors_namespaceObject, "getEditorSelectionStart", function() { return getEditorSelectionStart; });
- __webpack_require__.d(selectors_namespaceObject, "getEditorSelectionEnd", function() { return getEditorSelectionEnd; });
- __webpack_require__.d(selectors_namespaceObject, "getEditorSelection", function() { return selectors_getEditorSelection; });
- __webpack_require__.d(selectors_namespaceObject, "__unstableIsEditorReady", function() { return selectors_unstableIsEditorReady; });
- __webpack_require__.d(selectors_namespaceObject, "getEditorSettings", function() { return selectors_getEditorSettings; });
- __webpack_require__.d(selectors_namespaceObject, "getStateBeforeOptimisticTransaction", function() { return getStateBeforeOptimisticTransaction; });
- __webpack_require__.d(selectors_namespaceObject, "inSomeHistory", function() { return inSomeHistory; });
- __webpack_require__.d(selectors_namespaceObject, "getBlockName", function() { return getBlockName; });
- __webpack_require__.d(selectors_namespaceObject, "isBlockValid", function() { return isBlockValid; });
- __webpack_require__.d(selectors_namespaceObject, "getBlockAttributes", function() { return getBlockAttributes; });
- __webpack_require__.d(selectors_namespaceObject, "getBlock", function() { return getBlock; });
- __webpack_require__.d(selectors_namespaceObject, "getBlocks", function() { return selectors_getBlocks; });
- __webpack_require__.d(selectors_namespaceObject, "__unstableGetBlockWithoutInnerBlocks", function() { return __unstableGetBlockWithoutInnerBlocks; });
- __webpack_require__.d(selectors_namespaceObject, "getClientIdsOfDescendants", function() { return getClientIdsOfDescendants; });
- __webpack_require__.d(selectors_namespaceObject, "getClientIdsWithDescendants", function() { return getClientIdsWithDescendants; });
- __webpack_require__.d(selectors_namespaceObject, "getGlobalBlockCount", function() { return selectors_getGlobalBlockCount; });
- __webpack_require__.d(selectors_namespaceObject, "getBlocksByClientId", function() { return getBlocksByClientId; });
- __webpack_require__.d(selectors_namespaceObject, "getBlockCount", function() { return getBlockCount; });
- __webpack_require__.d(selectors_namespaceObject, "getBlockSelectionStart", function() { return getBlockSelectionStart; });
- __webpack_require__.d(selectors_namespaceObject, "getBlockSelectionEnd", function() { return getBlockSelectionEnd; });
- __webpack_require__.d(selectors_namespaceObject, "getSelectedBlockCount", function() { return getSelectedBlockCount; });
- __webpack_require__.d(selectors_namespaceObject, "hasSelectedBlock", function() { return hasSelectedBlock; });
- __webpack_require__.d(selectors_namespaceObject, "getSelectedBlockClientId", function() { return getSelectedBlockClientId; });
- __webpack_require__.d(selectors_namespaceObject, "getSelectedBlock", function() { return getSelectedBlock; });
- __webpack_require__.d(selectors_namespaceObject, "getBlockRootClientId", function() { return getBlockRootClientId; });
- __webpack_require__.d(selectors_namespaceObject, "getBlockHierarchyRootClientId", function() { return getBlockHierarchyRootClientId; });
- __webpack_require__.d(selectors_namespaceObject, "getAdjacentBlockClientId", function() { return getAdjacentBlockClientId; });
- __webpack_require__.d(selectors_namespaceObject, "getPreviousBlockClientId", function() { return getPreviousBlockClientId; });
- __webpack_require__.d(selectors_namespaceObject, "getNextBlockClientId", function() { return getNextBlockClientId; });
- __webpack_require__.d(selectors_namespaceObject, "getSelectedBlocksInitialCaretPosition", function() { return getSelectedBlocksInitialCaretPosition; });
- __webpack_require__.d(selectors_namespaceObject, "getMultiSelectedBlockClientIds", function() { return getMultiSelectedBlockClientIds; });
- __webpack_require__.d(selectors_namespaceObject, "getMultiSelectedBlocks", function() { return getMultiSelectedBlocks; });
- __webpack_require__.d(selectors_namespaceObject, "getFirstMultiSelectedBlockClientId", function() { return getFirstMultiSelectedBlockClientId; });
- __webpack_require__.d(selectors_namespaceObject, "getLastMultiSelectedBlockClientId", function() { return getLastMultiSelectedBlockClientId; });
- __webpack_require__.d(selectors_namespaceObject, "isFirstMultiSelectedBlock", function() { return isFirstMultiSelectedBlock; });
- __webpack_require__.d(selectors_namespaceObject, "isBlockMultiSelected", function() { return isBlockMultiSelected; });
- __webpack_require__.d(selectors_namespaceObject, "isAncestorMultiSelected", function() { return isAncestorMultiSelected; });
- __webpack_require__.d(selectors_namespaceObject, "getMultiSelectedBlocksStartClientId", function() { return getMultiSelectedBlocksStartClientId; });
- __webpack_require__.d(selectors_namespaceObject, "getMultiSelectedBlocksEndClientId", function() { return getMultiSelectedBlocksEndClientId; });
- __webpack_require__.d(selectors_namespaceObject, "getBlockOrder", function() { return getBlockOrder; });
- __webpack_require__.d(selectors_namespaceObject, "getBlockIndex", function() { return getBlockIndex; });
- __webpack_require__.d(selectors_namespaceObject, "isBlockSelected", function() { return isBlockSelected; });
- __webpack_require__.d(selectors_namespaceObject, "hasSelectedInnerBlock", function() { return hasSelectedInnerBlock; });
- __webpack_require__.d(selectors_namespaceObject, "isBlockWithinSelection", function() { return isBlockWithinSelection; });
- __webpack_require__.d(selectors_namespaceObject, "hasMultiSelection", function() { return hasMultiSelection; });
- __webpack_require__.d(selectors_namespaceObject, "isMultiSelecting", function() { return isMultiSelecting; });
- __webpack_require__.d(selectors_namespaceObject, "isSelectionEnabled", function() { return isSelectionEnabled; });
- __webpack_require__.d(selectors_namespaceObject, "getBlockMode", function() { return getBlockMode; });
- __webpack_require__.d(selectors_namespaceObject, "isTyping", function() { return isTyping; });
- __webpack_require__.d(selectors_namespaceObject, "isCaretWithinFormattedText", function() { return isCaretWithinFormattedText; });
- __webpack_require__.d(selectors_namespaceObject, "getBlockInsertionPoint", function() { return getBlockInsertionPoint; });
- __webpack_require__.d(selectors_namespaceObject, "isBlockInsertionPointVisible", function() { return isBlockInsertionPointVisible; });
- __webpack_require__.d(selectors_namespaceObject, "isValidTemplate", function() { return isValidTemplate; });
- __webpack_require__.d(selectors_namespaceObject, "getTemplate", function() { return getTemplate; });
- __webpack_require__.d(selectors_namespaceObject, "getTemplateLock", function() { return getTemplateLock; });
- __webpack_require__.d(selectors_namespaceObject, "canInsertBlockType", function() { return canInsertBlockType; });
- __webpack_require__.d(selectors_namespaceObject, "getInserterItems", function() { return getInserterItems; });
- __webpack_require__.d(selectors_namespaceObject, "hasInserterItems", function() { return hasInserterItems; });
- __webpack_require__.d(selectors_namespaceObject, "getBlockListSettings", function() { return getBlockListSettings; });
- __webpack_require__.d(selectors_namespaceObject, "__experimentalGetDefaultTemplateTypes", function() { return __experimentalGetDefaultTemplateTypes; });
- __webpack_require__.d(selectors_namespaceObject, "__experimentalGetDefaultTemplatePartAreas", function() { return __experimentalGetDefaultTemplatePartAreas; });
- __webpack_require__.d(selectors_namespaceObject, "__experimentalGetDefaultTemplateType", function() { return __experimentalGetDefaultTemplateType; });
- __webpack_require__.d(selectors_namespaceObject, "__experimentalGetTemplateInfo", function() { return __experimentalGetTemplateInfo; });
- // NAMESPACE OBJECT: ./node_modules/@wordpress/editor/build-module/store/actions.js
- var actions_namespaceObject = {};
- __webpack_require__.r(actions_namespaceObject);
- __webpack_require__.d(actions_namespaceObject, "setupEditor", function() { return actions_setupEditor; });
- __webpack_require__.d(actions_namespaceObject, "__experimentalTearDownEditor", function() { return actions_experimentalTearDownEditor; });
- __webpack_require__.d(actions_namespaceObject, "resetPost", function() { return resetPost; });
- __webpack_require__.d(actions_namespaceObject, "resetAutosave", function() { return resetAutosave; });
- __webpack_require__.d(actions_namespaceObject, "__experimentalRequestPostUpdateStart", function() { return __experimentalRequestPostUpdateStart; });
- __webpack_require__.d(actions_namespaceObject, "__experimentalRequestPostUpdateFinish", function() { return __experimentalRequestPostUpdateFinish; });
- __webpack_require__.d(actions_namespaceObject, "updatePost", function() { return updatePost; });
- __webpack_require__.d(actions_namespaceObject, "setupEditorState", function() { return setupEditorState; });
- __webpack_require__.d(actions_namespaceObject, "editPost", function() { return actions_editPost; });
- __webpack_require__.d(actions_namespaceObject, "savePost", function() { return actions_savePost; });
- __webpack_require__.d(actions_namespaceObject, "refreshPost", function() { return refreshPost; });
- __webpack_require__.d(actions_namespaceObject, "trashPost", function() { return trashPost; });
- __webpack_require__.d(actions_namespaceObject, "autosave", function() { return actions_autosave; });
- __webpack_require__.d(actions_namespaceObject, "redo", function() { return actions_redo; });
- __webpack_require__.d(actions_namespaceObject, "undo", function() { return actions_undo; });
- __webpack_require__.d(actions_namespaceObject, "createUndoLevel", function() { return createUndoLevel; });
- __webpack_require__.d(actions_namespaceObject, "updatePostLock", function() { return actions_updatePostLock; });
- __webpack_require__.d(actions_namespaceObject, "enablePublishSidebar", function() { return enablePublishSidebar; });
- __webpack_require__.d(actions_namespaceObject, "disablePublishSidebar", function() { return disablePublishSidebar; });
- __webpack_require__.d(actions_namespaceObject, "lockPostSaving", function() { return lockPostSaving; });
- __webpack_require__.d(actions_namespaceObject, "unlockPostSaving", function() { return unlockPostSaving; });
- __webpack_require__.d(actions_namespaceObject, "lockPostAutosaving", function() { return lockPostAutosaving; });
- __webpack_require__.d(actions_namespaceObject, "unlockPostAutosaving", function() { return unlockPostAutosaving; });
- __webpack_require__.d(actions_namespaceObject, "resetEditorBlocks", function() { return actions_resetEditorBlocks; });
- __webpack_require__.d(actions_namespaceObject, "updateEditorSettings", function() { return actions_updateEditorSettings; });
- __webpack_require__.d(actions_namespaceObject, "resetBlocks", function() { return resetBlocks; });
- __webpack_require__.d(actions_namespaceObject, "receiveBlocks", function() { return receiveBlocks; });
- __webpack_require__.d(actions_namespaceObject, "updateBlock", function() { return updateBlock; });
- __webpack_require__.d(actions_namespaceObject, "updateBlockAttributes", function() { return updateBlockAttributes; });
- __webpack_require__.d(actions_namespaceObject, "selectBlock", function() { return actions_selectBlock; });
- __webpack_require__.d(actions_namespaceObject, "startMultiSelect", function() { return startMultiSelect; });
- __webpack_require__.d(actions_namespaceObject, "stopMultiSelect", function() { return stopMultiSelect; });
- __webpack_require__.d(actions_namespaceObject, "multiSelect", function() { return multiSelect; });
- __webpack_require__.d(actions_namespaceObject, "clearSelectedBlock", function() { return actions_clearSelectedBlock; });
- __webpack_require__.d(actions_namespaceObject, "toggleSelection", function() { return toggleSelection; });
- __webpack_require__.d(actions_namespaceObject, "replaceBlocks", function() { return replaceBlocks; });
- __webpack_require__.d(actions_namespaceObject, "replaceBlock", function() { return replaceBlock; });
- __webpack_require__.d(actions_namespaceObject, "moveBlocksDown", function() { return moveBlocksDown; });
- __webpack_require__.d(actions_namespaceObject, "moveBlocksUp", function() { return moveBlocksUp; });
- __webpack_require__.d(actions_namespaceObject, "moveBlockToPosition", function() { return moveBlockToPosition; });
- __webpack_require__.d(actions_namespaceObject, "insertBlock", function() { return insertBlock; });
- __webpack_require__.d(actions_namespaceObject, "insertBlocks", function() { return actions_insertBlocks; });
- __webpack_require__.d(actions_namespaceObject, "showInsertionPoint", function() { return showInsertionPoint; });
- __webpack_require__.d(actions_namespaceObject, "hideInsertionPoint", function() { return hideInsertionPoint; });
- __webpack_require__.d(actions_namespaceObject, "setTemplateValidity", function() { return actions_setTemplateValidity; });
- __webpack_require__.d(actions_namespaceObject, "synchronizeTemplate", function() { return actions_synchronizeTemplate; });
- __webpack_require__.d(actions_namespaceObject, "mergeBlocks", function() { return mergeBlocks; });
- __webpack_require__.d(actions_namespaceObject, "removeBlocks", function() { return removeBlocks; });
- __webpack_require__.d(actions_namespaceObject, "removeBlock", function() { return removeBlock; });
- __webpack_require__.d(actions_namespaceObject, "toggleBlockMode", function() { return toggleBlockMode; });
- __webpack_require__.d(actions_namespaceObject, "startTyping", function() { return startTyping; });
- __webpack_require__.d(actions_namespaceObject, "stopTyping", function() { return stopTyping; });
- __webpack_require__.d(actions_namespaceObject, "enterFormattedText", function() { return enterFormattedText; });
- __webpack_require__.d(actions_namespaceObject, "exitFormattedText", function() { return exitFormattedText; });
- __webpack_require__.d(actions_namespaceObject, "insertDefaultBlock", function() { return actions_insertDefaultBlock; });
- __webpack_require__.d(actions_namespaceObject, "updateBlockListSettings", function() { return updateBlockListSettings; });
- // EXTERNAL MODULE: external ["wp","blockEditor"]
- var external_wp_blockEditor_ = __webpack_require__("axFQ");
- // EXTERNAL MODULE: external ["wp","coreData"]
- var external_wp_coreData_ = __webpack_require__("jZUy");
- // EXTERNAL MODULE: external ["wp","richText"]
- var external_wp_richText_ = __webpack_require__("qRz9");
- // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
- var esm_extends = __webpack_require__("wx14");
- // EXTERNAL MODULE: external ["wp","element"]
- var external_wp_element_ = __webpack_require__("GRId");
- // EXTERNAL MODULE: external "lodash"
- var external_lodash_ = __webpack_require__("YLtl");
- // EXTERNAL MODULE: external ["wp","blocks"]
- var external_wp_blocks_ = __webpack_require__("HSyU");
- // EXTERNAL MODULE: external ["wp","data"]
- var external_wp_data_ = __webpack_require__("1ZqX");
- // EXTERNAL MODULE: external ["wp","compose"]
- var external_wp_compose_ = __webpack_require__("K9lf");
- // EXTERNAL MODULE: external ["wp","hooks"]
- var external_wp_hooks_ = __webpack_require__("g56x");
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/custom-sources-backwards-compatibility.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /** @typedef {import('@wordpress/compose').WPHigherOrderComponent} WPHigherOrderComponent */
- /** @typedef {import('@wordpress/blocks').WPBlockSettings} WPBlockSettings */
- /**
- * Object whose keys are the names of block attributes, where each value
- * represents the meta key to which the block attribute is intended to save.
- *
- * @see https://developer.wordpress.org/reference/functions/register_meta/
- *
- * @typedef {Object<string,string>} WPMetaAttributeMapping
- */
- /**
- * Given a mapping of attribute names (meta source attributes) to their
- * associated meta key, returns a higher order component that overrides its
- * `attributes` and `setAttributes` props to sync any changes with the edited
- * post's meta keys.
- *
- * @param {WPMetaAttributeMapping} metaAttributes Meta attribute mapping.
- *
- * @return {WPHigherOrderComponent} Higher-order component.
- */
- const createWithMetaAttributeSource = metaAttributes => Object(external_wp_compose_["createHigherOrderComponent"])(BlockEdit => ({
- attributes,
- setAttributes,
- ...props
- }) => {
- const postType = Object(external_wp_data_["useSelect"])(select => select('core/editor').getCurrentPostType(), []);
- const [meta, setMeta] = Object(external_wp_coreData_["useEntityProp"])('postType', postType, 'meta');
- const mergedAttributes = Object(external_wp_element_["useMemo"])(() => ({ ...attributes,
- ...Object(external_lodash_["mapValues"])(metaAttributes, metaKey => meta[metaKey])
- }), [attributes, meta]);
- return Object(external_wp_element_["createElement"])(BlockEdit, Object(esm_extends["a" /* default */])({
- attributes: mergedAttributes,
- setAttributes: nextAttributes => {
- const nextMeta = Object(external_lodash_["mapKeys"])( // Filter to intersection of keys between the updated
- // attributes and those with an associated meta key.
- Object(external_lodash_["pickBy"])(nextAttributes, (value, key) => metaAttributes[key]), // Rename the keys to the expected meta key name.
- (value, attributeKey) => metaAttributes[attributeKey]);
- if (!Object(external_lodash_["isEmpty"])(nextMeta)) {
- setMeta(nextMeta);
- }
- setAttributes(nextAttributes);
- }
- }, props));
- }, 'withMetaAttributeSource');
- /**
- * Filters a registered block's settings to enhance a block's `edit` component
- * to upgrade meta-sourced attributes to use the post's meta entity property.
- *
- * @param {WPBlockSettings} settings Registered block settings.
- *
- * @return {WPBlockSettings} Filtered block settings.
- */
- function shimAttributeSource(settings) {
- /** @type {WPMetaAttributeMapping} */
- const metaAttributes = Object(external_lodash_["mapValues"])(Object(external_lodash_["pickBy"])(settings.attributes, {
- source: 'meta'
- }), 'meta');
- if (!Object(external_lodash_["isEmpty"])(metaAttributes)) {
- settings.edit = createWithMetaAttributeSource(metaAttributes)(settings.edit);
- }
- return settings;
- }
- Object(external_wp_hooks_["addFilter"])('blocks.registerBlockType', 'core/editor/custom-sources-backwards-compatibility/shim-attribute-source', shimAttributeSource); // The above filter will only capture blocks registered after the filter was
- // added. There may already be blocks registered by this point, and those must
- // be updated to apply the shim.
- //
- // The following implementation achieves this, albeit with a couple caveats:
- // - Only blocks registered on the global store will be modified.
- // - The block settings are directly mutated, since there is currently no
- // mechanism to update an existing block registration. This is the reason for
- // `getBlockType` separate from `getBlockTypes`, since the latter returns a
- // _copy_ of the block registration (i.e. the mutation would not affect the
- // actual registered block settings).
- //
- // `getBlockTypes` or `getBlockType` implementation could change in the future
- // in regards to creating settings clones, but the corresponding end-to-end
- // tests for meta blocks should cover against any potential regressions.
- //
- // In the future, we could support updating block settings, at which point this
- // implementation could use that mechanism instead.
- Object(external_wp_data_["select"])(external_wp_blocks_["store"]).getBlockTypes().map(({
- name
- }) => Object(external_wp_data_["select"])(external_wp_blocks_["store"]).getBlockType(name)).forEach(shimAttributeSource);
- // EXTERNAL MODULE: external ["wp","apiFetch"]
- var external_wp_apiFetch_ = __webpack_require__("ywyh");
- var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_);
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/autocompleters/user.js
- /**
- * WordPress dependencies
- */
- /** @typedef {import('@wordpress/components').WPCompleter} WPCompleter */
- /**
- * A user mentions completer.
- *
- * @type {WPCompleter}
- */
- /* harmony default export */ var autocompleters_user = ({
- name: 'users',
- className: 'editor-autocompleters__user',
- triggerPrefix: '@',
- options(search) {
- let payload = '';
- if (search) {
- payload = '?search=' + encodeURIComponent(search);
- }
- return external_wp_apiFetch_default()({
- path: '/wp/v2/users' + payload
- });
- },
- isDebounced: true,
- getOptionKeywords(user) {
- return [user.slug, user.name];
- },
- getOptionLabel(user) {
- const avatar = user.avatar_urls && user.avatar_urls[24] ? Object(external_wp_element_["createElement"])("img", {
- key: "avatar",
- className: "editor-autocompleters__user-avatar",
- alt: "",
- src: user.avatar_urls[24]
- }) : Object(external_wp_element_["createElement"])("span", {
- className: "editor-autocompleters__no-avatar"
- });
- return [avatar, Object(external_wp_element_["createElement"])("span", {
- key: "name",
- className: "editor-autocompleters__user-name"
- }, user.name), Object(external_wp_element_["createElement"])("span", {
- key: "slug",
- className: "editor-autocompleters__user-slug"
- }, user.slug)];
- },
- getOptionCompletion(user) {
- return `@${user.slug}`;
- }
- });
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/default-autocompleters.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function setDefaultCompleters(completers = []) {
- // Provide copies so filters may directly modify them.
- completers.push(Object(external_lodash_["clone"])(autocompleters_user));
- return completers;
- }
- Object(external_wp_hooks_["addFilter"])('editor.Autocomplete.completers', 'editor/autocompleters/set-default-completers', setDefaultCompleters);
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/hooks/index.js
- /**
- * Internal dependencies
- */
- // EXTERNAL MODULE: external ["wp","dataControls"]
- var external_wp_dataControls_ = __webpack_require__("51Zz");
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/defaults.js
- /**
- * WordPress dependencies
- */
- const PREFERENCES_DEFAULTS = {
- insertUsage: {},
- // Should be kept for backward compatibility, see: https://github.com/WordPress/gutenberg/issues/14580.
- isPublishSidebarEnabled: true
- };
- /**
- * The default post editor settings
- *
- * allowedBlockTypes boolean|Array Allowed block types
- * richEditingEnabled boolean Whether rich editing is enabled or not
- * codeEditingEnabled boolean Whether code editing is enabled or not
- * enableCustomFields boolean Whether the WordPress custom fields are enabled or not
- * autosaveInterval number Autosave Interval
- * availableTemplates array? The available post templates
- * disablePostFormats boolean Whether or not the post formats are disabled
- * allowedMimeTypes array? List of allowed mime types and file extensions
- * maxUploadFileSize number Maximum upload file size
- * supportsLayout boolean Whether the editor supports layouts.
- */
- const EDITOR_SETTINGS_DEFAULTS = { ...external_wp_blockEditor_["SETTINGS_DEFAULTS"],
- richEditingEnabled: true,
- codeEditingEnabled: true,
- enableCustomFields: false,
- supportsLayout: true
- };
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/reducer.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- /**
- * Returns a post attribute value, flattening nested rendered content using its
- * raw value in place of its original object form.
- *
- * @param {*} value Original value.
- *
- * @return {*} Raw value.
- */
- function getPostRawValue(value) {
- if (value && 'object' === typeof value && 'raw' in value) {
- return value.raw;
- }
- return value;
- }
- /**
- * Returns true if the two object arguments have the same keys, or false
- * otherwise.
- *
- * @param {Object} a First object.
- * @param {Object} b Second object.
- *
- * @return {boolean} Whether the two objects have the same keys.
- */
- function hasSameKeys(a, b) {
- return Object(external_lodash_["isEqual"])(Object(external_lodash_["keys"])(a), Object(external_lodash_["keys"])(b));
- }
- /**
- * Returns true if, given the currently dispatching action and the previously
- * dispatched action, the two actions are editing the same post property, or
- * false otherwise.
- *
- * @param {Object} action Currently dispatching action.
- * @param {Object} previousAction Previously dispatched action.
- *
- * @return {boolean} Whether actions are updating the same post property.
- */
- function isUpdatingSamePostProperty(action, previousAction) {
- return action.type === 'EDIT_POST' && hasSameKeys(action.edits, previousAction.edits);
- }
- /**
- * Returns true if, given the currently dispatching action and the previously
- * dispatched action, the two actions are modifying the same property such that
- * undo history should be batched.
- *
- * @param {Object} action Currently dispatching action.
- * @param {Object} previousAction Previously dispatched action.
- *
- * @return {boolean} Whether to overwrite present state.
- */
- function shouldOverwriteState(action, previousAction) {
- if (action.type === 'RESET_EDITOR_BLOCKS') {
- return !action.shouldCreateUndoLevel;
- }
- if (!previousAction || action.type !== previousAction.type) {
- return false;
- }
- return isUpdatingSamePostProperty(action, previousAction);
- }
- function reducer_postId(state = null, action) {
- switch (action.type) {
- case 'SETUP_EDITOR_STATE':
- case 'RESET_POST':
- return action.post.id;
- }
- return state;
- }
- function reducer_postType(state = null, action) {
- switch (action.type) {
- case 'SETUP_EDITOR_STATE':
- case 'RESET_POST':
- return action.post.type;
- }
- return state;
- }
- /**
- * Reducer returning whether the post blocks match the defined template or not.
- *
- * @param {Object} state Current state.
- * @param {Object} action Dispatched action.
- *
- * @return {boolean} Updated state.
- */
- function reducer_template(state = {
- isValid: true
- }, action) {
- switch (action.type) {
- case 'SET_TEMPLATE_VALIDITY':
- return { ...state,
- isValid: action.isValid
- };
- }
- return state;
- }
- /**
- * Reducer returning the user preferences.
- *
- * @param {Object} state Current state.
- * @param {Object} action Dispatched action.
- *
- * @return {string} Updated state.
- */
- function preferences(state = PREFERENCES_DEFAULTS, action) {
- switch (action.type) {
- case 'ENABLE_PUBLISH_SIDEBAR':
- return { ...state,
- isPublishSidebarEnabled: true
- };
- case 'DISABLE_PUBLISH_SIDEBAR':
- return { ...state,
- isPublishSidebarEnabled: false
- };
- }
- return state;
- }
- /**
- * Reducer returning current network request state (whether a request to
- * the WP REST API is in progress, successful, or failed).
- *
- * @param {Object} state Current state.
- * @param {Object} action Dispatched action.
- *
- * @return {Object} Updated state.
- */
- function saving(state = {}, action) {
- switch (action.type) {
- case 'REQUEST_POST_UPDATE_START':
- case 'REQUEST_POST_UPDATE_FINISH':
- return {
- pending: action.type === 'REQUEST_POST_UPDATE_START',
- options: action.options || {}
- };
- }
- return state;
- }
- /**
- * Post Lock State.
- *
- * @typedef {Object} PostLockState
- *
- * @property {boolean} isLocked Whether the post is locked.
- * @property {?boolean} isTakeover Whether the post editing has been taken over.
- * @property {?boolean} activePostLock Active post lock value.
- * @property {?Object} user User that took over the post.
- */
- /**
- * Reducer returning the post lock status.
- *
- * @param {PostLockState} state Current state.
- * @param {Object} action Dispatched action.
- *
- * @return {PostLockState} Updated state.
- */
- function postLock(state = {
- isLocked: false
- }, action) {
- switch (action.type) {
- case 'UPDATE_POST_LOCK':
- return action.lock;
- }
- return state;
- }
- /**
- * Post saving lock.
- *
- * When post saving is locked, the post cannot be published or updated.
- *
- * @param {PostLockState} state Current state.
- * @param {Object} action Dispatched action.
- *
- * @return {PostLockState} Updated state.
- */
- function postSavingLock(state = {}, action) {
- switch (action.type) {
- case 'LOCK_POST_SAVING':
- return { ...state,
- [action.lockName]: true
- };
- case 'UNLOCK_POST_SAVING':
- return Object(external_lodash_["omit"])(state, action.lockName);
- }
- return state;
- }
- /**
- * Post autosaving lock.
- *
- * When post autosaving is locked, the post will not autosave.
- *
- * @param {PostLockState} state Current state.
- * @param {Object} action Dispatched action.
- *
- * @return {PostLockState} Updated state.
- */
- function postAutosavingLock(state = {}, action) {
- switch (action.type) {
- case 'LOCK_POST_AUTOSAVING':
- return { ...state,
- [action.lockName]: true
- };
- case 'UNLOCK_POST_AUTOSAVING':
- return Object(external_lodash_["omit"])(state, action.lockName);
- }
- return state;
- }
- /**
- * Reducer returning whether the editor is ready to be rendered.
- * The editor is considered ready to be rendered once
- * the post object is loaded properly and the initial blocks parsed.
- *
- * @param {boolean} state
- * @param {Object} action
- *
- * @return {boolean} Updated state.
- */
- function reducer_isReady(state = false, action) {
- switch (action.type) {
- case 'SETUP_EDITOR_STATE':
- return true;
- case 'TEAR_DOWN_EDITOR':
- return false;
- }
- return state;
- }
- /**
- * Reducer returning the post editor setting.
- *
- * @param {Object} state Current state.
- * @param {Object} action Dispatched action.
- *
- * @return {Object} Updated state.
- */
- function reducer_editorSettings(state = EDITOR_SETTINGS_DEFAULTS, action) {
- switch (action.type) {
- case 'UPDATE_EDITOR_SETTINGS':
- return { ...state,
- ...action.settings
- };
- }
- return state;
- }
- /* harmony default export */ var reducer = (Object(external_wp_data_["combineReducers"])({
- postId: reducer_postId,
- postType: reducer_postType,
- preferences,
- saving,
- postLock,
- template: reducer_template,
- postSavingLock,
- isReady: reducer_isReady,
- editorSettings: reducer_editorSettings,
- postAutosavingLock
- }));
- // EXTERNAL MODULE: ./node_modules/rememo/es/rememo.js
- var rememo = __webpack_require__("pPDe");
- // EXTERNAL MODULE: external ["wp","date"]
- var external_wp_date_ = __webpack_require__("FqII");
- // EXTERNAL MODULE: external ["wp","url"]
- var external_wp_url_ = __webpack_require__("Mmq9");
- // EXTERNAL MODULE: external ["wp","deprecated"]
- var external_wp_deprecated_ = __webpack_require__("NMb1");
- var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_);
- // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/layout.js
- var layout = __webpack_require__("Civd");
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/constants.js
- /**
- * Set of post properties for which edits should assume a merging behavior,
- * assuming an object value.
- *
- * @type {Set}
- */
- const EDIT_MERGE_PROPERTIES = new Set(['meta']);
- /**
- * Constant for the store module (or reducer) key.
- *
- * @type {string}
- */
- const STORE_NAME = 'core/editor';
- const SAVE_POST_NOTICE_ID = 'SAVE_POST_NOTICE_ID';
- const TRASH_POST_NOTICE_ID = 'TRASH_POST_NOTICE_ID';
- const PERMALINK_POSTNAME_REGEX = /%(?:postname|pagename)%/;
- const ONE_MINUTE_IN_MS = 60 * 1000;
- const AUTOSAVE_PROPERTIES = ['title', 'excerpt', 'content'];
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/url.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Returns the URL of a WPAdmin Page.
- *
- * TODO: This should be moved to a module less specific to the editor.
- *
- * @param {string} page Page to navigate to.
- * @param {Object} query Query Args.
- *
- * @return {string} WPAdmin URL.
- */
- function getWPAdminURL(page, query) {
- return Object(external_wp_url_["addQueryArgs"])(page, query);
- }
- /**
- * Performs some basic cleanup of a string for use as a post slug
- *
- * This replicates some of what sanitize_title() does in WordPress core, but
- * is only designed to approximate what the slug will be.
- *
- * Converts Latin-1 Supplement and Latin Extended-A letters to basic Latin letters.
- * Removes combining diacritical marks. Converts whitespace, periods,
- * and forward slashes to hyphens. Removes any remaining non-word characters
- * except hyphens and underscores. Converts remaining string to lowercase.
- * It does not account for octets, HTML entities, or other encoded characters.
- *
- * @param {string} string Title or slug to be processed
- *
- * @return {string} Processed string
- */
- function cleanForSlug(string) {
- if (!string) {
- return '';
- }
- return Object(external_lodash_["trim"])(Object(external_lodash_["deburr"])(string).replace(/[\s\./]+/g, '-').replace(/[^\p{L}\p{N}_-]+/gu, '').toLowerCase(), '-');
- }
- // EXTERNAL MODULE: external ["wp","primitives"]
- var external_wp_primitives_ = __webpack_require__("Tqx9");
- // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/header.js
- /**
- * WordPress dependencies
- */
- const header = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
- }, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], {
- d: "M18.5 10.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"
- }));
- /* harmony default export */ var library_header = (header);
- // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/footer.js
- /**
- * WordPress dependencies
- */
- const footer = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
- }, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], {
- fillRule: "evenodd",
- d: "M18 5.5h-8v8h8.5V6a.5.5 0 00-.5-.5zm-9.5 8h-3V6a.5.5 0 01.5-.5h2.5v8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"
- }));
- /* harmony default export */ var library_footer = (footer);
- // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/sidebar.js
- /**
- * WordPress dependencies
- */
- const sidebar = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
- }, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], {
- 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.5zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"
- }));
- /* harmony default export */ var library_sidebar = (sidebar);
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/utils/get-template-part-icon.js
- /**
- * WordPress dependencies
- */
- /**
- * Helper function to retrieve the corresponding icon by name.
- *
- * @param {string} iconName The name of the icon.
- *
- * @return {Object} The corresponding icon.
- */
- function getTemplatePartIcon(iconName) {
- if ('header' === iconName) {
- return library_header;
- } else if ('footer' === iconName) {
- return library_footer;
- } else if ('sidebar' === iconName) {
- return library_sidebar;
- }
- return layout["a" /* default */];
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/selectors.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- /**
- * Shared reference to an empty object for cases where it is important to avoid
- * returning a new object reference on every invocation, as in a connected or
- * other pure component which performs `shouldComponentUpdate` check on props.
- * This should be used as a last resort, since the normalized data should be
- * maintained by the reducer result in state.
- */
- const EMPTY_OBJECT = {};
- /**
- * Shared reference to an empty array for cases where it is important to avoid
- * returning a new array reference on every invocation, as in a connected or
- * other pure component which performs `shouldComponentUpdate` check on props.
- * This should be used as a last resort, since the normalized data should be
- * maintained by the reducer result in state.
- */
- const EMPTY_ARRAY = [];
- /**
- * Returns true if any past editor history snapshots exist, or false otherwise.
- *
- * @param {Object} state Global application state.
- *
- * @return {boolean} Whether undo history exists.
- */
- const hasEditorUndo = Object(external_wp_data_["createRegistrySelector"])(select => () => {
- return select('core').hasUndo();
- });
- /**
- * Returns true if any future editor history snapshots exist, or false
- * otherwise.
- *
- * @param {Object} state Global application state.
- *
- * @return {boolean} Whether redo history exists.
- */
- const hasEditorRedo = Object(external_wp_data_["createRegistrySelector"])(select => () => {
- return select('core').hasRedo();
- });
- /**
- * Returns true if the currently edited post is yet to be saved, or false if
- * the post has been saved.
- *
- * @param {Object} state Global application state.
- *
- * @return {boolean} Whether the post is new.
- */
- function selectors_isEditedPostNew(state) {
- return selectors_getCurrentPost(state).status === 'auto-draft';
- }
- /**
- * Returns true if content includes unsaved changes, or false otherwise.
- *
- * @param {Object} state Editor state.
- *
- * @return {boolean} Whether content includes unsaved changes.
- */
- function hasChangedContent(state) {
- const edits = selectors_getPostEdits(state);
- return 'blocks' in edits || // `edits` is intended to contain only values which are different from
- // the saved post, so the mere presence of a property is an indicator
- // that the value is different than what is known to be saved. While
- // content in Visual mode is represented by the blocks state, in Text
- // mode it is tracked by `edits.content`.
- 'content' in edits;
- }
- /**
- * Returns true if there are unsaved values for the current edit session, or
- * false if the editing state matches the saved or new post.
- *
- * @param {Object} state Global application state.
- *
- * @return {boolean} Whether unsaved values exist.
- */
- const selectors_isEditedPostDirty = Object(external_wp_data_["createRegistrySelector"])(select => state => {
- // Edits should contain only fields which differ from the saved post (reset
- // at initial load and save complete). Thus, a non-empty edits state can be
- // inferred to contain unsaved values.
- const postType = selectors_getCurrentPostType(state);
- const postId = selectors_getCurrentPostId(state);
- if (select('core').hasEditsForEntityRecord('postType', postType, postId)) {
- return true;
- }
- return false;
- });
- /**
- * Returns true if there are unsaved edits for entities other than
- * the editor's post, and false otherwise.
- *
- * @param {Object} state Global application state.
- *
- * @return {boolean} Whether there are edits or not.
- */
- const selectors_hasNonPostEntityChanges = Object(external_wp_data_["createRegistrySelector"])(select => state => {
- const dirtyEntityRecords = select('core').__experimentalGetDirtyEntityRecords();
- const {
- type,
- id
- } = selectors_getCurrentPost(state);
- return Object(external_lodash_["some"])(dirtyEntityRecords, entityRecord => entityRecord.kind !== 'postType' || entityRecord.name !== type || entityRecord.key !== id);
- });
- /**
- * Returns true if there are no unsaved values for the current edit session and
- * if the currently edited post is new (has never been saved before).
- *
- * @param {Object} state Global application state.
- *
- * @return {boolean} Whether new post and unsaved values exist.
- */
- function selectors_isCleanNewPost(state) {
- return !selectors_isEditedPostDirty(state) && selectors_isEditedPostNew(state);
- }
- /**
- * Returns the post currently being edited in its last known saved state, not
- * including unsaved edits. Returns an object containing relevant default post
- * values if the post has not yet been saved.
- *
- * @param {Object} state Global application state.
- *
- * @return {Object} Post object.
- */
- const selectors_getCurrentPost = Object(external_wp_data_["createRegistrySelector"])(select => state => {
- const postId = selectors_getCurrentPostId(state);
- const postType = selectors_getCurrentPostType(state);
- const post = select('core').getRawEntityRecord('postType', postType, postId);
- if (post) {
- return post;
- } // This exists for compatibility with the previous selector behavior
- // which would guarantee an object return based on the editor reducer's
- // default empty object state.
- return EMPTY_OBJECT;
- });
- /**
- * Returns the post type of the post currently being edited.
- *
- * @param {Object} state Global application state.
- *
- * @return {string} Post type.
- */
- function selectors_getCurrentPostType(state) {
- return state.postType;
- }
- /**
- * Returns the ID of the post currently being edited, or null if the post has
- * not yet been saved.
- *
- * @param {Object} state Global application state.
- *
- * @return {?number} ID of current post.
- */
- function selectors_getCurrentPostId(state) {
- return state.postId;
- }
- /**
- * Returns the number of revisions of the post currently being edited.
- *
- * @param {Object} state Global application state.
- *
- * @return {number} Number of revisions.
- */
- function getCurrentPostRevisionsCount(state) {
- return Object(external_lodash_["get"])(selectors_getCurrentPost(state), ['_links', 'version-history', 0, 'count'], 0);
- }
- /**
- * Returns the last revision ID of the post currently being edited,
- * or null if the post has no revisions.
- *
- * @param {Object} state Global application state.
- *
- * @return {?number} ID of the last revision.
- */
- function getCurrentPostLastRevisionId(state) {
- return Object(external_lodash_["get"])(selectors_getCurrentPost(state), ['_links', 'predecessor-version', 0, 'id'], null);
- }
- /**
- * Returns any post values which have been changed in the editor but not yet
- * been saved.
- *
- * @param {Object} state Global application state.
- *
- * @return {Object} Object of key value pairs comprising unsaved edits.
- */
- const selectors_getPostEdits = Object(external_wp_data_["createRegistrySelector"])(select => state => {
- const postType = selectors_getCurrentPostType(state);
- const postId = selectors_getCurrentPostId(state);
- return select('core').getEntityRecordEdits('postType', postType, postId) || EMPTY_OBJECT;
- });
- /**
- * Returns a new reference when edited values have changed. This is useful in
- * inferring where an edit has been made between states by comparison of the
- * return values using strict equality.
- *
- * @deprecated since Gutenberg 6.5.0.
- *
- * @example
- *
- * ```
- * const hasEditOccurred = (
- * getReferenceByDistinctEdits( beforeState ) !==
- * getReferenceByDistinctEdits( afterState )
- * );
- * ```
- *
- * @param {Object} state Editor state.
- *
- * @return {*} A value whose reference will change only when an edit occurs.
- */
- const getReferenceByDistinctEdits = Object(external_wp_data_["createRegistrySelector"])(select => () =>
- /* state */
- {
- external_wp_deprecated_default()("`wp.data.select( 'core/editor' ).getReferenceByDistinctEdits`", {
- since: '5.4',
- alternative: "`wp.data.select( 'core' ).getReferenceByDistinctEdits`"
- });
- return select('core').getReferenceByDistinctEdits();
- });
- /**
- * Returns an attribute value of the saved post.
- *
- * @param {Object} state Global application state.
- * @param {string} attributeName Post attribute name.
- *
- * @return {*} Post attribute value.
- */
- function selectors_getCurrentPostAttribute(state, attributeName) {
- switch (attributeName) {
- case 'type':
- return selectors_getCurrentPostType(state);
- case 'id':
- return selectors_getCurrentPostId(state);
- default:
- const post = selectors_getCurrentPost(state);
- if (!post.hasOwnProperty(attributeName)) {
- break;
- }
- return getPostRawValue(post[attributeName]);
- }
- }
- /**
- * Returns a single attribute of the post being edited, preferring the unsaved
- * edit if one exists, but merging with the attribute value for the last known
- * saved state of the post (this is needed for some nested attributes like meta).
- *
- * @param {Object} state Global application state.
- * @param {string} attributeName Post attribute name.
- *
- * @return {*} Post attribute value.
- */
- const getNestedEditedPostProperty = (state, attributeName) => {
- const edits = selectors_getPostEdits(state);
- if (!edits.hasOwnProperty(attributeName)) {
- return selectors_getCurrentPostAttribute(state, attributeName);
- }
- return { ...selectors_getCurrentPostAttribute(state, attributeName),
- ...edits[attributeName]
- };
- };
- /**
- * Returns a single attribute of the post being edited, preferring the unsaved
- * edit if one exists, but falling back to the attribute for the last known
- * saved state of the post.
- *
- * @param {Object} state Global application state.
- * @param {string} attributeName Post attribute name.
- *
- * @return {*} Post attribute value.
- */
- function selectors_getEditedPostAttribute(state, attributeName) {
- // Special cases
- switch (attributeName) {
- case 'content':
- return getEditedPostContent(state);
- } // Fall back to saved post value if not edited.
- const edits = selectors_getPostEdits(state);
- if (!edits.hasOwnProperty(attributeName)) {
- return selectors_getCurrentPostAttribute(state, attributeName);
- } // Merge properties are objects which contain only the patch edit in state,
- // and thus must be merged with the current post attribute.
- if (EDIT_MERGE_PROPERTIES.has(attributeName)) {
- return getNestedEditedPostProperty(state, attributeName);
- }
- return edits[attributeName];
- }
- /**
- * Returns an attribute value of the current autosave revision for a post, or
- * null if there is no autosave for the post.
- *
- * @deprecated since 5.6. Callers should use the `getAutosave( postType, postId, userId )` selector
- * from the '@wordpress/core-data' package and access properties on the returned
- * autosave object using getPostRawValue.
- *
- * @param {Object} state Global application state.
- * @param {string} attributeName Autosave attribute name.
- *
- * @return {*} Autosave attribute value.
- */
- const getAutosaveAttribute = Object(external_wp_data_["createRegistrySelector"])(select => (state, attributeName) => {
- if (!Object(external_lodash_["includes"])(AUTOSAVE_PROPERTIES, attributeName) && attributeName !== 'preview_link') {
- return;
- }
- const postType = selectors_getCurrentPostType(state);
- const postId = selectors_getCurrentPostId(state);
- const currentUserId = Object(external_lodash_["get"])(select('core').getCurrentUser(), ['id']);
- const autosave = select('core').getAutosave(postType, postId, currentUserId);
- if (autosave) {
- return getPostRawValue(autosave[attributeName]);
- }
- });
- /**
- * Returns the current visibility of the post being edited, preferring the
- * unsaved value if different than the saved post. The return value is one of
- * "private", "password", or "public".
- *
- * @param {Object} state Global application state.
- *
- * @return {string} Post visibility.
- */
- function selectors_getEditedPostVisibility(state) {
- const status = selectors_getEditedPostAttribute(state, 'status');
- if (status === 'private') {
- return 'private';
- }
- const password = selectors_getEditedPostAttribute(state, 'password');
- if (password) {
- return 'password';
- }
- return 'public';
- }
- /**
- * Returns true if post is pending review.
- *
- * @param {Object} state Global application state.
- *
- * @return {boolean} Whether current post is pending review.
- */
- function isCurrentPostPending(state) {
- return selectors_getCurrentPost(state).status === 'pending';
- }
- /**
- * Return true if the current post has already been published.
- *
- * @param {Object} state Global application state.
- * @param {Object?} currentPost Explicit current post for bypassing registry selector.
- *
- * @return {boolean} Whether the post has been published.
- */
- function selectors_isCurrentPostPublished(state, currentPost) {
- const post = currentPost || selectors_getCurrentPost(state);
- return ['publish', 'private'].indexOf(post.status) !== -1 || post.status === 'future' && !Object(external_wp_date_["isInTheFuture"])(new Date(Number(Object(external_wp_date_["getDate"])(post.date)) - ONE_MINUTE_IN_MS));
- }
- /**
- * Returns true if post is already scheduled.
- *
- * @param {Object} state Global application state.
- *
- * @return {boolean} Whether current post is scheduled to be posted.
- */
- function selectors_isCurrentPostScheduled(state) {
- return selectors_getCurrentPost(state).status === 'future' && !selectors_isCurrentPostPublished(state);
- }
- /**
- * Return true if the post being edited can be published.
- *
- * @param {Object} state Global application state.
- *
- * @return {boolean} Whether the post can been published.
- */
- function selectors_isEditedPostPublishable(state) {
- const post = selectors_getCurrentPost(state); // TODO: Post being publishable should be superset of condition of post
- // being saveable. Currently this restriction is imposed at UI.
- //
- // See: <PostPublishButton /> (`isButtonEnabled` assigned by `isSaveable`)
- return selectors_isEditedPostDirty(state) || ['publish', 'private', 'future'].indexOf(post.status) === -1;
- }
- /**
- * Returns true if the post can be saved, or false otherwise. A post must
- * contain a title, an excerpt, or non-empty content to be valid for save.
- *
- * @param {Object} state Global application state.
- *
- * @return {boolean} Whether the post can be saved.
- */
- function selectors_isEditedPostSaveable(state) {
- if (selectors_isSavingPost(state)) {
- return false;
- } // TODO: Post should not be saveable if not dirty. Cannot be added here at
- // this time since posts where meta boxes are present can be saved even if
- // the post is not dirty. Currently this restriction is imposed at UI, but
- // should be moved here.
- //
- // See: `isEditedPostPublishable` (includes `isEditedPostDirty` condition)
- // See: <PostSavedState /> (`forceIsDirty` prop)
- // See: <PostPublishButton /> (`forceIsDirty` prop)
- // See: https://github.com/WordPress/gutenberg/pull/4184
- return !!selectors_getEditedPostAttribute(state, 'title') || !!selectors_getEditedPostAttribute(state, 'excerpt') || !isEditedPostEmpty(state) || external_wp_element_["Platform"].OS === 'native';
- }
- /**
- * Returns true if the edited post has content. A post has content if it has at
- * least one saveable block or otherwise has a non-empty content property
- * assigned.
- *
- * @param {Object} state Global application state.
- *
- * @return {boolean} Whether post has content.
- */
- function isEditedPostEmpty(state) {
- // While the condition of truthy content string is sufficient to determine
- // emptiness, testing saveable blocks length is a trivial operation. Since
- // this function can be called frequently, optimize for the fast case as a
- // condition of the mere existence of blocks. Note that the value of edited
- // content takes precedent over block content, and must fall through to the
- // default logic.
- const blocks = getEditorBlocks(state);
- if (blocks.length) {
- // Pierce the abstraction of the serializer in knowing that blocks are
- // joined with with newlines such that even if every individual block
- // produces an empty save result, the serialized content is non-empty.
- if (blocks.length > 1) {
- return false;
- } // There are two conditions under which the optimization cannot be
- // assumed, and a fallthrough to getEditedPostContent must occur:
- //
- // 1. getBlocksForSerialization has special treatment in omitting a
- // single unmodified default block.
- // 2. Comment delimiters are omitted for a freeform or unregistered
- // block in its serialization. The freeform block specifically may
- // produce an empty string in its saved output.
- //
- // For all other content, the single block is assumed to make a post
- // non-empty, if only by virtue of its own comment delimiters.
- const blockName = blocks[0].name;
- if (blockName !== Object(external_wp_blocks_["getDefaultBlockName"])() && blockName !== Object(external_wp_blocks_["getFreeformContentHandlerName"])()) {
- return false;
- }
- }
- return !getEditedPostContent(state);
- }
- /**
- * Returns true if the post can be autosaved, or false otherwise.
- *
- * @param {Object} state Global application state.
- * @param {Object} autosave A raw autosave object from the REST API.
- *
- * @return {boolean} Whether the post can be autosaved.
- */
- const selectors_isEditedPostAutosaveable = Object(external_wp_data_["createRegistrySelector"])(select => state => {
- // A post must contain a title, an excerpt, or non-empty content to be valid for autosaving.
- if (!selectors_isEditedPostSaveable(state)) {
- return false;
- } // A post is not autosavable when there is a post autosave lock.
- if (isPostAutosavingLocked(state)) {
- return false;
- }
- const postType = selectors_getCurrentPostType(state);
- const postId = selectors_getCurrentPostId(state);
- const hasFetchedAutosave = select('core').hasFetchedAutosaves(postType, postId);
- const currentUserId = Object(external_lodash_["get"])(select('core').getCurrentUser(), ['id']); // Disable reason - this line causes the side-effect of fetching the autosave
- // via a resolver, moving below the return would result in the autosave never
- // being fetched.
- // eslint-disable-next-line @wordpress/no-unused-vars-before-return
- const autosave = select('core').getAutosave(postType, postId, currentUserId); // If any existing autosaves have not yet been fetched, this function is
- // unable to determine if the post is autosaveable, so return false.
- if (!hasFetchedAutosave) {
- return false;
- } // If we don't already have an autosave, the post is autosaveable.
- if (!autosave) {
- return true;
- } // To avoid an expensive content serialization, use the content dirtiness
- // flag in place of content field comparison against the known autosave.
- // This is not strictly accurate, and relies on a tolerance toward autosave
- // request failures for unnecessary saves.
- if (hasChangedContent(state)) {
- return true;
- } // If the title or excerpt has changed, the post is autosaveable.
- return ['title', 'excerpt'].some(field => getPostRawValue(autosave[field]) !== selectors_getEditedPostAttribute(state, field));
- });
- /**
- * Returns the current autosave, or null if one is not set (i.e. if the post
- * has yet to be autosaved, or has been saved or published since the last
- * autosave).
- *
- * @deprecated since 5.6. Callers should use the `getAutosave( postType, postId, userId )`
- * selector from the '@wordpress/core-data' package.
- *
- * @param {Object} state Editor state.
- *
- * @return {?Object} Current autosave, if exists.
- */
- const getAutosave = Object(external_wp_data_["createRegistrySelector"])(select => state => {
- external_wp_deprecated_default()("`wp.data.select( 'core/editor' ).getAutosave()`", {
- since: '5.3',
- alternative: "`wp.data.select( 'core' ).getAutosave( postType, postId, userId )`"
- });
- const postType = selectors_getCurrentPostType(state);
- const postId = selectors_getCurrentPostId(state);
- const currentUserId = Object(external_lodash_["get"])(select('core').getCurrentUser(), ['id']);
- const autosave = select('core').getAutosave(postType, postId, currentUserId);
- return Object(external_lodash_["mapValues"])(Object(external_lodash_["pick"])(autosave, AUTOSAVE_PROPERTIES), getPostRawValue);
- });
- /**
- * Returns the true if there is an existing autosave, otherwise false.
- *
- * @deprecated since 5.6. Callers should use the `getAutosave( postType, postId, userId )` selector
- * from the '@wordpress/core-data' package and check for a truthy value.
- *
- * @param {Object} state Global application state.
- *
- * @return {boolean} Whether there is an existing autosave.
- */
- const hasAutosave = Object(external_wp_data_["createRegistrySelector"])(select => state => {
- external_wp_deprecated_default()("`wp.data.select( 'core/editor' ).hasAutosave()`", {
- since: '5.3',
- alternative: "`!! wp.data.select( 'core' ).getAutosave( postType, postId, userId )`"
- });
- const postType = selectors_getCurrentPostType(state);
- const postId = selectors_getCurrentPostId(state);
- const currentUserId = Object(external_lodash_["get"])(select('core').getCurrentUser(), ['id']);
- return !!select('core').getAutosave(postType, postId, currentUserId);
- });
- /**
- * Return true if the post being edited is being scheduled. Preferring the
- * unsaved status values.
- *
- * @param {Object} state Global application state.
- *
- * @return {boolean} Whether the post has been published.
- */
- function selectors_isEditedPostBeingScheduled(state) {
- const date = selectors_getEditedPostAttribute(state, 'date'); // Offset the date by one minute (network latency)
- const checkedDate = new Date(Number(Object(external_wp_date_["getDate"])(date)) - ONE_MINUTE_IN_MS);
- return Object(external_wp_date_["isInTheFuture"])(checkedDate);
- }
- /**
- * Returns whether the current post should be considered to have a "floating"
- * date (i.e. that it would publish "Immediately" rather than at a set time).
- *
- * Unlike in the PHP backend, the REST API returns a full date string for posts
- * where the 0000-00-00T00:00:00 placeholder is present in the database. To
- * infer that a post is set to publish "Immediately" we check whether the date
- * and modified date are the same.
- *
- * @param {Object} state Editor state.
- *
- * @return {boolean} Whether the edited post has a floating date value.
- */
- function isEditedPostDateFloating(state) {
- const date = selectors_getEditedPostAttribute(state, 'date');
- const modified = selectors_getEditedPostAttribute(state, 'modified'); // This should be the status of the persisted post
- // It shouldn't use the "edited" status otherwise it breaks the
- // infered post data floating status
- // See https://github.com/WordPress/gutenberg/issues/28083
- const status = selectors_getCurrentPost(state).status;
- if (status === 'draft' || status === 'auto-draft' || status === 'pending') {
- return date === modified || date === null;
- }
- return false;
- }
- /**
- * Returns true if the post is currently being saved, or false otherwise.
- *
- * @param {Object} state Global application state.
- *
- * @return {boolean} Whether post is being saved.
- */
- const selectors_isSavingPost = Object(external_wp_data_["createRegistrySelector"])(select => state => {
- const postType = selectors_getCurrentPostType(state);
- const postId = selectors_getCurrentPostId(state);
- return select('core').isSavingEntityRecord('postType', postType, postId);
- });
- /**
- * Returns true if a previous post save was attempted successfully, or false
- * otherwise.
- *
- * @param {Object} state Global application state.
- *
- * @return {boolean} Whether the post was saved successfully.
- */
- const didPostSaveRequestSucceed = Object(external_wp_data_["createRegistrySelector"])(select => state => {
- const postType = selectors_getCurrentPostType(state);
- const postId = selectors_getCurrentPostId(state);
- return !select('core').getLastEntitySaveError('postType', postType, postId);
- });
- /**
- * Returns true if a previous post save was attempted but failed, or false
- * otherwise.
- *
- * @param {Object} state Global application state.
- *
- * @return {boolean} Whether the post save failed.
- */
- const didPostSaveRequestFail = Object(external_wp_data_["createRegistrySelector"])(select => state => {
- const postType = selectors_getCurrentPostType(state);
- const postId = selectors_getCurrentPostId(state);
- return !!select('core').getLastEntitySaveError('postType', postType, postId);
- });
- /**
- * Returns true if the post is autosaving, or false otherwise.
- *
- * @param {Object} state Global application state.
- *
- * @return {boolean} Whether the post is autosaving.
- */
- function selectors_isAutosavingPost(state) {
- if (!selectors_isSavingPost(state)) {
- return false;
- }
- return !!Object(external_lodash_["get"])(state.saving, ['options', 'isAutosave']);
- }
- /**
- * Returns true if the post is being previewed, or false otherwise.
- *
- * @param {Object} state Global application state.
- *
- * @return {boolean} Whether the post is being previewed.
- */
- function isPreviewingPost(state) {
- if (!selectors_isSavingPost(state)) {
- return false;
- }
- return !!state.saving.options.isPreview;
- }
- /**
- * Returns the post preview link
- *
- * @param {Object} state Global application state.
- *
- * @return {string?} Preview Link.
- */
- function selectors_getEditedPostPreviewLink(state) {
- if (state.saving.pending || selectors_isSavingPost(state)) {
- return;
- }
- let previewLink = getAutosaveAttribute(state, 'preview_link');
- if (!previewLink) {
- previewLink = selectors_getEditedPostAttribute(state, 'link');
- if (previewLink) {
- previewLink = Object(external_wp_url_["addQueryArgs"])(previewLink, {
- preview: true
- });
- }
- }
- const featuredImageId = selectors_getEditedPostAttribute(state, 'featured_media');
- if (previewLink && featuredImageId) {
- return Object(external_wp_url_["addQueryArgs"])(previewLink, {
- _thumbnail_id: featuredImageId
- });
- }
- return previewLink;
- }
- /**
- * Returns a suggested post format for the current post, inferred only if there
- * is a single block within the post and it is of a type known to match a
- * default post format. Returns null if the format cannot be determined.
- *
- * @param {Object} state Global application state.
- *
- * @return {?string} Suggested post format.
- */
- function selectors_getSuggestedPostFormat(state) {
- const blocks = getEditorBlocks(state);
- if (blocks.length > 2) return null;
- let name; // If there is only one block in the content of the post grab its name
- // so we can derive a suitable post format from it.
- if (blocks.length === 1) {
- name = blocks[0].name; // check for core/embed `video` and `audio` eligible suggestions
- if (name === 'core/embed') {
- var _blocks$0$attributes;
- const provider = (_blocks$0$attributes = blocks[0].attributes) === null || _blocks$0$attributes === void 0 ? void 0 : _blocks$0$attributes.providerNameSlug;
- if (['youtube', 'vimeo'].includes(provider)) {
- name = 'core/video';
- } else if (['spotify', 'soundcloud'].includes(provider)) {
- name = 'core/audio';
- }
- }
- } // If there are two blocks in the content and the last one is a text blocks
- // grab the name of the first one to also suggest a post format from it.
- if (blocks.length === 2 && blocks[1].name === 'core/paragraph') {
- name = blocks[0].name;
- } // We only convert to default post formats in core.
- switch (name) {
- case 'core/image':
- return 'image';
- case 'core/quote':
- case 'core/pullquote':
- return 'quote';
- case 'core/gallery':
- return 'gallery';
- case 'core/video':
- return 'video';
- case 'core/audio':
- return 'audio';
- default:
- return null;
- }
- }
- /**
- * Returns a set of blocks which are to be used in consideration of the post's
- * generated save content.
- *
- * @deprecated since Gutenberg 6.2.0.
- *
- * @param {Object} state Editor state.
- *
- * @return {WPBlock[]} Filtered set of blocks for save.
- */
- function getBlocksForSerialization(state) {
- external_wp_deprecated_default()('`core/editor` getBlocksForSerialization selector', {
- since: '5.3',
- alternative: 'getEditorBlocks',
- hint: 'Blocks serialization pre-processing occurs at save time'
- });
- const blocks = state.editor.present.blocks.value; // WARNING: Any changes to the logic of this function should be verified
- // against the implementation of isEditedPostEmpty, which bypasses this
- // function for performance' sake, in an assumption of this current logic
- // being irrelevant to the optimized condition of emptiness.
- // A single unmodified default block is assumed to be equivalent to an
- // empty post.
- const isSingleUnmodifiedDefaultBlock = blocks.length === 1 && Object(external_wp_blocks_["isUnmodifiedDefaultBlock"])(blocks[0]);
- if (isSingleUnmodifiedDefaultBlock) {
- return [];
- }
- return blocks;
- }
- /**
- * Returns the content of the post being edited.
- *
- * @param {Object} state Global application state.
- *
- * @return {string} Post content.
- */
- const getEditedPostContent = Object(external_wp_data_["createRegistrySelector"])(select => state => {
- const postId = selectors_getCurrentPostId(state);
- const postType = selectors_getCurrentPostType(state);
- const record = select('core').getEditedEntityRecord('postType', postType, postId);
- if (record) {
- if (typeof record.content === 'function') {
- return record.content(record);
- } else if (record.blocks) {
- return Object(external_wp_blocks_["__unstableSerializeAndClean"])(record.blocks);
- } else if (record.content) {
- return record.content;
- }
- }
- return '';
- });
- /**
- * Returns true if the post is being published, or false otherwise.
- *
- * @param {Object} state Global application state.
- *
- * @return {boolean} Whether post is being published.
- */
- function selectors_isPublishingPost(state) {
- return selectors_isSavingPost(state) && !selectors_isCurrentPostPublished(state) && selectors_getEditedPostAttribute(state, 'status') === 'publish';
- }
- /**
- * Returns whether the permalink is editable or not.
- *
- * @param {Object} state Editor state.
- *
- * @return {boolean} Whether or not the permalink is editable.
- */
- function isPermalinkEditable(state) {
- const permalinkTemplate = selectors_getEditedPostAttribute(state, 'permalink_template');
- return PERMALINK_POSTNAME_REGEX.test(permalinkTemplate);
- }
- /**
- * Returns the permalink for the post.
- *
- * @param {Object} state Editor state.
- *
- * @return {?string} The permalink, or null if the post is not viewable.
- */
- function getPermalink(state) {
- const permalinkParts = getPermalinkParts(state);
- if (!permalinkParts) {
- return null;
- }
- const {
- prefix,
- postName,
- suffix
- } = permalinkParts;
- if (isPermalinkEditable(state)) {
- return prefix + postName + suffix;
- }
- return prefix;
- }
- /**
- * Returns the slug for the post being edited, preferring a manually edited
- * value if one exists, then a sanitized version of the current post title, and
- * finally the post ID.
- *
- * @param {Object} state Editor state.
- *
- * @return {string} The current slug to be displayed in the editor
- */
- function getEditedPostSlug(state) {
- return selectors_getEditedPostAttribute(state, 'slug') || cleanForSlug(selectors_getEditedPostAttribute(state, 'title')) || selectors_getCurrentPostId(state);
- }
- /**
- * Returns the permalink for a post, split into it's three parts: the prefix,
- * the postName, and the suffix.
- *
- * @param {Object} state Editor state.
- *
- * @return {Object} An object containing the prefix, postName, and suffix for
- * the permalink, or null if the post is not viewable.
- */
- function getPermalinkParts(state) {
- const permalinkTemplate = selectors_getEditedPostAttribute(state, 'permalink_template');
- if (!permalinkTemplate) {
- return null;
- }
- const postName = selectors_getEditedPostAttribute(state, 'slug') || selectors_getEditedPostAttribute(state, 'generated_slug');
- const [prefix, suffix] = permalinkTemplate.split(PERMALINK_POSTNAME_REGEX);
- return {
- prefix,
- postName,
- suffix
- };
- }
- /**
- * Returns whether the post is locked.
- *
- * @param {Object} state Global application state.
- *
- * @return {boolean} Is locked.
- */
- function selectors_isPostLocked(state) {
- return state.postLock.isLocked;
- }
- /**
- * Returns whether post saving is locked.
- *
- * @param {Object} state Global application state.
- *
- * @return {boolean} Is locked.
- */
- function selectors_isPostSavingLocked(state) {
- return Object.keys(state.postSavingLock).length > 0;
- }
- /**
- * Returns whether post autosaving is locked.
- *
- * @param {Object} state Global application state.
- *
- * @return {boolean} Is locked.
- */
- function isPostAutosavingLocked(state) {
- return Object.keys(state.postAutosavingLock).length > 0;
- }
- /**
- * Returns whether the edition of the post has been taken over.
- *
- * @param {Object} state Global application state.
- *
- * @return {boolean} Is post lock takeover.
- */
- function isPostLockTakeover(state) {
- return state.postLock.isTakeover;
- }
- /**
- * Returns details about the post lock user.
- *
- * @param {Object} state Global application state.
- *
- * @return {Object} A user object.
- */
- function getPostLockUser(state) {
- return state.postLock.user;
- }
- /**
- * Returns the active post lock.
- *
- * @param {Object} state Global application state.
- *
- * @return {Object} The lock object.
- */
- function getActivePostLock(state) {
- return state.postLock.activePostLock;
- }
- /**
- * Returns whether or not the user has the unfiltered_html capability.
- *
- * @param {Object} state Editor state.
- *
- * @return {boolean} Whether the user can or can't post unfiltered HTML.
- */
- function selectors_canUserUseUnfilteredHTML(state) {
- return Object(external_lodash_["has"])(selectors_getCurrentPost(state), ['_links', 'wp:action-unfiltered-html']);
- }
- /**
- * Returns whether the pre-publish panel should be shown
- * or skipped when the user clicks the "publish" button.
- *
- * @param {Object} state Global application state.
- *
- * @return {boolean} Whether the pre-publish panel should be shown or not.
- */
- function selectors_isPublishSidebarEnabled(state) {
- if (state.preferences.hasOwnProperty('isPublishSidebarEnabled')) {
- return state.preferences.isPublishSidebarEnabled;
- }
- return PREFERENCES_DEFAULTS.isPublishSidebarEnabled;
- }
- /**
- * Return the current block list.
- *
- * @param {Object} state
- * @return {Array} Block list.
- */
- function getEditorBlocks(state) {
- return selectors_getEditedPostAttribute(state, 'blocks') || EMPTY_ARRAY;
- }
- /**
- * A block selection object.
- *
- * @typedef {Object} WPBlockSelection
- *
- * @property {string} clientId A block client ID.
- * @property {string} attributeKey A block attribute key.
- * @property {number} offset An attribute value offset, based on the rich
- * text value. See `wp.richText.create`.
- */
- /**
- * Returns the current selection start.
- *
- * @param {Object} state
- * @return {WPBlockSelection} The selection start.
- *
- * @deprecated since Gutenberg 10.0.0.
- */
- function getEditorSelectionStart(state) {
- var _getEditedPostAttribu;
- external_wp_deprecated_default()("select('core/editor').getEditorSelectionStart", {
- since: '10.0',
- plugin: 'Gutenberg',
- alternative: "select('core/editor').getEditorSelection"
- });
- return (_getEditedPostAttribu = selectors_getEditedPostAttribute(state, 'selection')) === null || _getEditedPostAttribu === void 0 ? void 0 : _getEditedPostAttribu.selectionStart;
- }
- /**
- * Returns the current selection end.
- *
- * @param {Object} state
- * @return {WPBlockSelection} The selection end.
- *
- * @deprecated since Gutenberg 10.0.0.
- */
- function getEditorSelectionEnd(state) {
- var _getEditedPostAttribu2;
- external_wp_deprecated_default()("select('core/editor').getEditorSelectionStart", {
- since: '10.0',
- plugin: 'Gutenberg',
- alternative: "select('core/editor').getEditorSelection"
- });
- return (_getEditedPostAttribu2 = selectors_getEditedPostAttribute(state, 'selection')) === null || _getEditedPostAttribu2 === void 0 ? void 0 : _getEditedPostAttribu2.selectionEnd;
- }
- /**
- * Returns the current selection.
- *
- * @param {Object} state
- * @return {WPBlockSelection} The selection end.
- */
- function selectors_getEditorSelection(state) {
- return selectors_getEditedPostAttribute(state, 'selection');
- }
- /**
- * Is the editor ready
- *
- * @param {Object} state
- * @return {boolean} is Ready.
- */
- function selectors_unstableIsEditorReady(state) {
- return state.isReady;
- }
- /**
- * Returns the post editor settings.
- *
- * @param {Object} state Editor state.
- *
- * @return {Object} The editor settings object.
- */
- function selectors_getEditorSettings(state) {
- return state.editorSettings;
- }
- /*
- * Backward compatibility
- */
- /**
- * Returns state object prior to a specified optimist transaction ID, or `null`
- * if the transaction corresponding to the given ID cannot be found.
- *
- * @deprecated since Gutenberg 9.7.0.
- */
- function getStateBeforeOptimisticTransaction() {
- external_wp_deprecated_default()("select('core/editor').getStateBeforeOptimisticTransaction", {
- since: '5.7',
- hint: 'No state history is kept on this store anymore'
- });
- return null;
- }
- /**
- * Returns true if an optimistic transaction is pending commit, for which the
- * before state satisfies the given predicate function.
- *
- * @deprecated since Gutenberg 9.7.0.
- */
- function inSomeHistory() {
- external_wp_deprecated_default()("select('core/editor').inSomeHistory", {
- since: '5.7',
- hint: 'No state history is kept on this store anymore'
- });
- return false;
- }
- function getBlockEditorSelector(name) {
- return Object(external_wp_data_["createRegistrySelector"])(select => (state, ...args) => {
- external_wp_deprecated_default()("`wp.data.select( 'core/editor' )." + name + '`', {
- since: '5.3',
- alternative: "`wp.data.select( 'core/block-editor' )." + name + '`'
- });
- return select('core/block-editor')[name](...args);
- });
- }
- /**
- * @see getBlockName in core/block-editor store.
- */
- const getBlockName = getBlockEditorSelector('getBlockName');
- /**
- * @see isBlockValid in core/block-editor store.
- */
- const isBlockValid = getBlockEditorSelector('isBlockValid');
- /**
- * @see getBlockAttributes in core/block-editor store.
- */
- const getBlockAttributes = getBlockEditorSelector('getBlockAttributes');
- /**
- * @see getBlock in core/block-editor store.
- */
- const getBlock = getBlockEditorSelector('getBlock');
- /**
- * @see getBlocks in core/block-editor store.
- */
- const selectors_getBlocks = getBlockEditorSelector('getBlocks');
- /**
- * @see __unstableGetBlockWithoutInnerBlocks in core/block-editor store.
- */
- const __unstableGetBlockWithoutInnerBlocks = getBlockEditorSelector('__unstableGetBlockWithoutInnerBlocks');
- /**
- * @see getClientIdsOfDescendants in core/block-editor store.
- */
- const getClientIdsOfDescendants = getBlockEditorSelector('getClientIdsOfDescendants');
- /**
- * @see getClientIdsWithDescendants in core/block-editor store.
- */
- const getClientIdsWithDescendants = getBlockEditorSelector('getClientIdsWithDescendants');
- /**
- * @see getGlobalBlockCount in core/block-editor store.
- */
- const selectors_getGlobalBlockCount = getBlockEditorSelector('getGlobalBlockCount');
- /**
- * @see getBlocksByClientId in core/block-editor store.
- */
- const getBlocksByClientId = getBlockEditorSelector('getBlocksByClientId');
- /**
- * @see getBlockCount in core/block-editor store.
- */
- const getBlockCount = getBlockEditorSelector('getBlockCount');
- /**
- * @see getBlockSelectionStart in core/block-editor store.
- */
- const getBlockSelectionStart = getBlockEditorSelector('getBlockSelectionStart');
- /**
- * @see getBlockSelectionEnd in core/block-editor store.
- */
- const getBlockSelectionEnd = getBlockEditorSelector('getBlockSelectionEnd');
- /**
- * @see getSelectedBlockCount in core/block-editor store.
- */
- const getSelectedBlockCount = getBlockEditorSelector('getSelectedBlockCount');
- /**
- * @see hasSelectedBlock in core/block-editor store.
- */
- const hasSelectedBlock = getBlockEditorSelector('hasSelectedBlock');
- /**
- * @see getSelectedBlockClientId in core/block-editor store.
- */
- const getSelectedBlockClientId = getBlockEditorSelector('getSelectedBlockClientId');
- /**
- * @see getSelectedBlock in core/block-editor store.
- */
- const getSelectedBlock = getBlockEditorSelector('getSelectedBlock');
- /**
- * @see getBlockRootClientId in core/block-editor store.
- */
- const getBlockRootClientId = getBlockEditorSelector('getBlockRootClientId');
- /**
- * @see getBlockHierarchyRootClientId in core/block-editor store.
- */
- const getBlockHierarchyRootClientId = getBlockEditorSelector('getBlockHierarchyRootClientId');
- /**
- * @see getAdjacentBlockClientId in core/block-editor store.
- */
- const getAdjacentBlockClientId = getBlockEditorSelector('getAdjacentBlockClientId');
- /**
- * @see getPreviousBlockClientId in core/block-editor store.
- */
- const getPreviousBlockClientId = getBlockEditorSelector('getPreviousBlockClientId');
- /**
- * @see getNextBlockClientId in core/block-editor store.
- */
- const getNextBlockClientId = getBlockEditorSelector('getNextBlockClientId');
- /**
- * @see getSelectedBlocksInitialCaretPosition in core/block-editor store.
- */
- const getSelectedBlocksInitialCaretPosition = getBlockEditorSelector('getSelectedBlocksInitialCaretPosition');
- /**
- * @see getMultiSelectedBlockClientIds in core/block-editor store.
- */
- const getMultiSelectedBlockClientIds = getBlockEditorSelector('getMultiSelectedBlockClientIds');
- /**
- * @see getMultiSelectedBlocks in core/block-editor store.
- */
- const getMultiSelectedBlocks = getBlockEditorSelector('getMultiSelectedBlocks');
- /**
- * @see getFirstMultiSelectedBlockClientId in core/block-editor store.
- */
- const getFirstMultiSelectedBlockClientId = getBlockEditorSelector('getFirstMultiSelectedBlockClientId');
- /**
- * @see getLastMultiSelectedBlockClientId in core/block-editor store.
- */
- const getLastMultiSelectedBlockClientId = getBlockEditorSelector('getLastMultiSelectedBlockClientId');
- /**
- * @see isFirstMultiSelectedBlock in core/block-editor store.
- */
- const isFirstMultiSelectedBlock = getBlockEditorSelector('isFirstMultiSelectedBlock');
- /**
- * @see isBlockMultiSelected in core/block-editor store.
- */
- const isBlockMultiSelected = getBlockEditorSelector('isBlockMultiSelected');
- /**
- * @see isAncestorMultiSelected in core/block-editor store.
- */
- const isAncestorMultiSelected = getBlockEditorSelector('isAncestorMultiSelected');
- /**
- * @see getMultiSelectedBlocksStartClientId in core/block-editor store.
- */
- const getMultiSelectedBlocksStartClientId = getBlockEditorSelector('getMultiSelectedBlocksStartClientId');
- /**
- * @see getMultiSelectedBlocksEndClientId in core/block-editor store.
- */
- const getMultiSelectedBlocksEndClientId = getBlockEditorSelector('getMultiSelectedBlocksEndClientId');
- /**
- * @see getBlockOrder in core/block-editor store.
- */
- const getBlockOrder = getBlockEditorSelector('getBlockOrder');
- /**
- * @see getBlockIndex in core/block-editor store.
- */
- const getBlockIndex = getBlockEditorSelector('getBlockIndex');
- /**
- * @see isBlockSelected in core/block-editor store.
- */
- const isBlockSelected = getBlockEditorSelector('isBlockSelected');
- /**
- * @see hasSelectedInnerBlock in core/block-editor store.
- */
- const hasSelectedInnerBlock = getBlockEditorSelector('hasSelectedInnerBlock');
- /**
- * @see isBlockWithinSelection in core/block-editor store.
- */
- const isBlockWithinSelection = getBlockEditorSelector('isBlockWithinSelection');
- /**
- * @see hasMultiSelection in core/block-editor store.
- */
- const hasMultiSelection = getBlockEditorSelector('hasMultiSelection');
- /**
- * @see isMultiSelecting in core/block-editor store.
- */
- const isMultiSelecting = getBlockEditorSelector('isMultiSelecting');
- /**
- * @see isSelectionEnabled in core/block-editor store.
- */
- const isSelectionEnabled = getBlockEditorSelector('isSelectionEnabled');
- /**
- * @see getBlockMode in core/block-editor store.
- */
- const getBlockMode = getBlockEditorSelector('getBlockMode');
- /**
- * @see isTyping in core/block-editor store.
- */
- const isTyping = getBlockEditorSelector('isTyping');
- /**
- * @see isCaretWithinFormattedText in core/block-editor store.
- */
- const isCaretWithinFormattedText = getBlockEditorSelector('isCaretWithinFormattedText');
- /**
- * @see getBlockInsertionPoint in core/block-editor store.
- */
- const getBlockInsertionPoint = getBlockEditorSelector('getBlockInsertionPoint');
- /**
- * @see isBlockInsertionPointVisible in core/block-editor store.
- */
- const isBlockInsertionPointVisible = getBlockEditorSelector('isBlockInsertionPointVisible');
- /**
- * @see isValidTemplate in core/block-editor store.
- */
- const isValidTemplate = getBlockEditorSelector('isValidTemplate');
- /**
- * @see getTemplate in core/block-editor store.
- */
- const getTemplate = getBlockEditorSelector('getTemplate');
- /**
- * @see getTemplateLock in core/block-editor store.
- */
- const getTemplateLock = getBlockEditorSelector('getTemplateLock');
- /**
- * @see canInsertBlockType in core/block-editor store.
- */
- const canInsertBlockType = getBlockEditorSelector('canInsertBlockType');
- /**
- * @see getInserterItems in core/block-editor store.
- */
- const getInserterItems = getBlockEditorSelector('getInserterItems');
- /**
- * @see hasInserterItems in core/block-editor store.
- */
- const hasInserterItems = getBlockEditorSelector('hasInserterItems');
- /**
- * @see getBlockListSettings in core/block-editor store.
- */
- const getBlockListSettings = getBlockEditorSelector('getBlockListSettings');
- /**
- * Returns the default template types.
- *
- * @param {Object} state Global application state.
- *
- * @return {Object} The template types.
- */
- function __experimentalGetDefaultTemplateTypes(state) {
- var _getEditorSettings;
- return (_getEditorSettings = selectors_getEditorSettings(state)) === null || _getEditorSettings === void 0 ? void 0 : _getEditorSettings.defaultTemplateTypes;
- }
- /**
- * Returns the default template part areas.
- *
- * @param {Object} state Global application state.
- *
- * @return {Array} The template part areas.
- */
- const __experimentalGetDefaultTemplatePartAreas = Object(rememo["a" /* default */])(state => {
- var _getEditorSettings2;
- const areas = ((_getEditorSettings2 = selectors_getEditorSettings(state)) === null || _getEditorSettings2 === void 0 ? void 0 : _getEditorSettings2.defaultTemplatePartAreas) || [];
- return areas === null || areas === void 0 ? void 0 : areas.map(item => {
- return { ...item,
- icon: getTemplatePartIcon(item.icon)
- };
- });
- }, state => {
- var _getEditorSettings3;
- return [(_getEditorSettings3 = selectors_getEditorSettings(state)) === null || _getEditorSettings3 === void 0 ? void 0 : _getEditorSettings3.defaultTemplatePartAreas];
- });
- /**
- * Returns a default template type searched by slug.
- *
- * @param {Object} state Global application state.
- * @param {string} slug The template type slug.
- *
- * @return {Object} The template type.
- */
- const __experimentalGetDefaultTemplateType = Object(rememo["a" /* default */])((state, slug) => Object(external_lodash_["find"])(__experimentalGetDefaultTemplateTypes(state), {
- slug
- }) || {}, (state, slug) => [__experimentalGetDefaultTemplateTypes(state), slug]);
- /**
- * Given a template entity, return information about it which is ready to be
- * rendered, such as the title, description, and icon.
- *
- * @param {Object} state Global application state.
- * @param {Object} template The template for which we need information.
- * @return {Object} Information about the template, including title, description, and icon.
- */
- function __experimentalGetTemplateInfo(state, template) {
- var _experimentalGetDefa;
- if (!template) {
- return {};
- }
- const {
- excerpt,
- slug,
- title,
- area
- } = template;
- const {
- title: defaultTitle,
- description: defaultDescription
- } = __experimentalGetDefaultTemplateType(state, slug);
- const templateTitle = Object(external_lodash_["isString"])(title) ? title : title === null || title === void 0 ? void 0 : title.rendered;
- const templateDescription = Object(external_lodash_["isString"])(excerpt) ? excerpt : excerpt === null || excerpt === void 0 ? void 0 : excerpt.raw;
- const templateIcon = ((_experimentalGetDefa = __experimentalGetDefaultTemplatePartAreas(state).find(item => area === item.area)) === null || _experimentalGetDefa === void 0 ? void 0 : _experimentalGetDefa.icon) || layout["a" /* default */];
- return {
- title: templateTitle && templateTitle !== slug ? templateTitle : defaultTitle || slug,
- description: templateDescription || defaultDescription,
- icon: templateIcon
- };
- }
- // EXTERNAL MODULE: external ["wp","notices"]
- var external_wp_notices_ = __webpack_require__("onLe");
- // EXTERNAL MODULE: external ["wp","i18n"]
- var external_wp_i18n_ = __webpack_require__("l3Sj");
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/utils/notice-builder.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- /**
- * External dependencies
- */
- /**
- * Builds the arguments for a success notification dispatch.
- *
- * @param {Object} data Incoming data to build the arguments from.
- *
- * @return {Array} Arguments for dispatch. An empty array signals no
- * notification should be sent.
- */
- function getNotificationArgumentsForSaveSuccess(data) {
- const {
- previousPost,
- post,
- postType
- } = data; // Autosaves are neither shown a notice nor redirected.
- if (Object(external_lodash_["get"])(data.options, ['isAutosave'])) {
- return [];
- }
- const publishStatus = ['publish', 'private', 'future'];
- const isPublished = Object(external_lodash_["includes"])(publishStatus, previousPost.status);
- const willPublish = Object(external_lodash_["includes"])(publishStatus, post.status);
- let noticeMessage;
- let shouldShowLink = Object(external_lodash_["get"])(postType, ['viewable'], false);
- if (!isPublished && !willPublish) {
- // If saving a non-published post, don't show notice.
- noticeMessage = null;
- } else if (isPublished && !willPublish) {
- // If undoing publish status, show specific notice
- noticeMessage = postType.labels.item_reverted_to_draft;
- shouldShowLink = false;
- } else if (!isPublished && willPublish) {
- // If publishing or scheduling a post, show the corresponding
- // publish message
- noticeMessage = {
- publish: postType.labels.item_published,
- private: postType.labels.item_published_privately,
- future: postType.labels.item_scheduled
- }[post.status];
- } else {
- // Generic fallback notice
- noticeMessage = postType.labels.item_updated;
- }
- if (noticeMessage) {
- const actions = [];
- if (shouldShowLink) {
- actions.push({
- label: postType.labels.view_item,
- url: post.link
- });
- }
- return [noticeMessage, {
- id: SAVE_POST_NOTICE_ID,
- type: 'snackbar',
- actions
- }];
- }
- return [];
- }
- /**
- * Builds the fail notification arguments for dispatch.
- *
- * @param {Object} data Incoming data to build the arguments with.
- *
- * @return {Array} Arguments for dispatch. An empty array signals no
- * notification should be sent.
- */
- function getNotificationArgumentsForSaveFail(data) {
- const {
- post,
- edits,
- error
- } = data;
- if (error && 'rest_autosave_no_changes' === error.code) {
- // Autosave requested a new autosave, but there were no changes. This shouldn't
- // result in an error notice for the user.
- return [];
- }
- const publishStatus = ['publish', 'private', 'future'];
- const isPublished = publishStatus.indexOf(post.status) !== -1; // If the post was being published, we show the corresponding publish error message
- // Unless we publish an "updating failed" message
- const messages = {
- publish: Object(external_wp_i18n_["__"])('Publishing failed.'),
- private: Object(external_wp_i18n_["__"])('Publishing failed.'),
- future: Object(external_wp_i18n_["__"])('Scheduling failed.')
- };
- let noticeMessage = !isPublished && publishStatus.indexOf(edits.status) !== -1 ? messages[edits.status] : Object(external_wp_i18n_["__"])('Updating failed.'); // Check if message string contains HTML. Notice text is currently only
- // supported as plaintext, and stripping the tags may muddle the meaning.
- if (error.message && !/<\/?[^>]*>/.test(error.message)) {
- noticeMessage = [noticeMessage, error.message].join(' ');
- }
- return [noticeMessage, {
- id: SAVE_POST_NOTICE_ID
- }];
- }
- /**
- * Builds the trash fail notification arguments for dispatch.
- *
- * @param {Object} data
- *
- * @return {Array} Arguments for dispatch.
- */
- function getNotificationArgumentsForTrashFail(data) {
- return [data.error.message && data.error.code !== 'unknown_error' ? data.error.message : Object(external_wp_i18n_["__"])('Trashing failed'), {
- id: TRASH_POST_NOTICE_ID
- }];
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/actions.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- /**
- * Returns an action generator used in signalling that editor has initialized with
- * the specified post object and editor settings.
- *
- * @param {Object} post Post object.
- * @param {Object} edits Initial edited attributes object.
- * @param {Array?} template Block Template.
- */
- function* actions_setupEditor(post, edits, template) {
- // In order to ensure maximum of a single parse during setup, edits are
- // included as part of editor setup action. Assume edited content as
- // canonical if provided, falling back to post.
- let content;
- if (Object(external_lodash_["has"])(edits, ['content'])) {
- content = edits.content;
- } else {
- content = post.content.raw;
- }
- let blocks = Object(external_wp_blocks_["parse"])(content); // Apply a template for new posts only, if exists.
- const isNewPost = post.status === 'auto-draft';
- if (isNewPost && template) {
- blocks = Object(external_wp_blocks_["synchronizeBlocksWithTemplate"])(blocks, template);
- }
- yield resetPost(post);
- yield {
- type: 'SETUP_EDITOR',
- post,
- edits,
- template
- };
- yield actions_resetEditorBlocks(blocks, {
- __unstableShouldCreateUndoLevel: false
- });
- yield setupEditorState(post);
- if (edits && Object.keys(edits).some(key => edits[key] !== (Object(external_lodash_["has"])(post, [key, 'raw']) ? post[key].raw : post[key]))) {
- yield actions_editPost(edits);
- }
- }
- /**
- * Returns an action object signalling that the editor is being destroyed and
- * that any necessary state or side-effect cleanup should occur.
- *
- * @return {Object} Action object.
- */
- function actions_experimentalTearDownEditor() {
- return {
- type: 'TEAR_DOWN_EDITOR'
- };
- }
- /**
- * Returns an action object used in signalling that the latest version of the
- * post has been received, either by initialization or save.
- *
- * @param {Object} post Post object.
- *
- * @return {Object} Action object.
- */
- function resetPost(post) {
- return {
- type: 'RESET_POST',
- post
- };
- }
- /**
- * Returns an action object used in signalling that the latest autosave of the
- * post has been received, by initialization or autosave.
- *
- * @deprecated since 5.6. Callers should use the `receiveAutosaves( postId, autosave )`
- * selector from the '@wordpress/core-data' package.
- *
- * @param {Object} newAutosave Autosave post object.
- *
- * @return {Object} Action object.
- */
- function* resetAutosave(newAutosave) {
- external_wp_deprecated_default()('resetAutosave action (`core/editor` store)', {
- since: '5.3',
- alternative: 'receiveAutosaves action (`core` store)'
- });
- const postId = yield external_wp_data_["controls"].select(STORE_NAME, 'getCurrentPostId');
- yield external_wp_data_["controls"].dispatch('core', 'receiveAutosaves', postId, newAutosave);
- return {
- type: '__INERT__'
- };
- }
- /**
- * Action for dispatching that a post update request has started.
- *
- * @param {Object} options
- *
- * @return {Object} An action object
- */
- function __experimentalRequestPostUpdateStart(options = {}) {
- return {
- type: 'REQUEST_POST_UPDATE_START',
- options
- };
- }
- /**
- * Action for dispatching that a post update request has finished.
- *
- * @param {Object} options
- *
- * @return {Object} An action object
- */
- function __experimentalRequestPostUpdateFinish(options = {}) {
- return {
- type: 'REQUEST_POST_UPDATE_FINISH',
- options
- };
- }
- /**
- * Returns an action object used in signalling that a patch of updates for the
- * latest version of the post have been received.
- *
- * @return {Object} Action object.
- * @deprecated since Gutenberg 9.7.0.
- */
- function updatePost() {
- external_wp_deprecated_default()("wp.data.dispatch( 'core/editor' ).updatePost", {
- since: '5.7',
- alternative: 'User the core entitires store instead'
- });
- return {
- type: 'DO_NOTHING'
- };
- }
- /**
- * Returns an action object used to setup the editor state when first opening
- * an editor.
- *
- * @param {Object} post Post object.
- *
- * @return {Object} Action object.
- */
- function setupEditorState(post) {
- return {
- type: 'SETUP_EDITOR_STATE',
- post
- };
- }
- /**
- * Returns an action object used in signalling that attributes of the post have
- * been edited.
- *
- * @param {Object} edits Post attributes to edit.
- * @param {Object} options Options for the edit.
- *
- * @yield {Object} Action object or control.
- */
- function* actions_editPost(edits, options) {
- const {
- id,
- type
- } = yield external_wp_data_["controls"].select(STORE_NAME, 'getCurrentPost');
- yield external_wp_data_["controls"].dispatch('core', 'editEntityRecord', 'postType', type, id, edits, options);
- }
- /**
- * Action generator for saving the current post in the editor.
- *
- * @param {Object} options
- */
- function* actions_savePost(options = {}) {
- if (!(yield external_wp_data_["controls"].select(STORE_NAME, 'isEditedPostSaveable'))) {
- return;
- }
- let edits = {
- content: yield external_wp_data_["controls"].select(STORE_NAME, 'getEditedPostContent')
- };
- if (!options.isAutosave) {
- yield external_wp_data_["controls"].dispatch(STORE_NAME, 'editPost', edits, {
- undoIgnore: true
- });
- }
- yield __experimentalRequestPostUpdateStart(options);
- const previousRecord = yield external_wp_data_["controls"].select(STORE_NAME, 'getCurrentPost');
- edits = {
- id: previousRecord.id,
- ...(yield external_wp_data_["controls"].select('core', 'getEntityRecordNonTransientEdits', 'postType', previousRecord.type, previousRecord.id)),
- ...edits
- };
- yield external_wp_data_["controls"].dispatch('core', 'saveEntityRecord', 'postType', previousRecord.type, edits, options);
- yield __experimentalRequestPostUpdateFinish(options);
- const error = yield external_wp_data_["controls"].select('core', 'getLastEntitySaveError', 'postType', previousRecord.type, previousRecord.id);
- if (error) {
- const args = getNotificationArgumentsForSaveFail({
- post: previousRecord,
- edits,
- error
- });
- if (args.length) {
- yield external_wp_data_["controls"].dispatch(external_wp_notices_["store"], 'createErrorNotice', ...args);
- }
- } else {
- const updatedRecord = yield external_wp_data_["controls"].select(STORE_NAME, 'getCurrentPost');
- const args = getNotificationArgumentsForSaveSuccess({
- previousPost: previousRecord,
- post: updatedRecord,
- postType: yield external_wp_data_["controls"].resolveSelect('core', 'getPostType', updatedRecord.type),
- options
- });
- if (args.length) {
- yield external_wp_data_["controls"].dispatch(external_wp_notices_["store"], 'createSuccessNotice', ...args);
- } // Make sure that any edits after saving create an undo level and are
- // considered for change detection.
- if (!options.isAutosave) {
- yield external_wp_data_["controls"].dispatch('core/block-editor', '__unstableMarkLastChangeAsPersistent');
- }
- }
- }
- /**
- * Action generator for handling refreshing the current post.
- */
- function* refreshPost() {
- const post = yield external_wp_data_["controls"].select(STORE_NAME, 'getCurrentPost');
- const postTypeSlug = yield external_wp_data_["controls"].select(STORE_NAME, 'getCurrentPostType');
- const postType = yield external_wp_data_["controls"].resolveSelect('core', 'getPostType', postTypeSlug);
- const newPost = yield Object(external_wp_dataControls_["apiFetch"])({
- // Timestamp arg allows caller to bypass browser caching, which is
- // expected for this specific function.
- path: `/wp/v2/${postType.rest_base}/${post.id}` + `?context=edit&_timestamp=${Date.now()}`
- });
- yield external_wp_data_["controls"].dispatch(STORE_NAME, 'resetPost', newPost);
- }
- /**
- * Action generator for trashing the current post in the editor.
- */
- function* trashPost() {
- const postTypeSlug = yield external_wp_data_["controls"].select(STORE_NAME, 'getCurrentPostType');
- const postType = yield external_wp_data_["controls"].resolveSelect('core', 'getPostType', postTypeSlug);
- yield external_wp_data_["controls"].dispatch(external_wp_notices_["store"], 'removeNotice', TRASH_POST_NOTICE_ID);
- try {
- const post = yield external_wp_data_["controls"].select(STORE_NAME, 'getCurrentPost');
- yield Object(external_wp_dataControls_["apiFetch"])({
- path: `/wp/v2/${postType.rest_base}/${post.id}`,
- method: 'DELETE'
- });
- yield external_wp_data_["controls"].dispatch(STORE_NAME, 'savePost');
- } catch (error) {
- yield external_wp_data_["controls"].dispatch(external_wp_notices_["store"], 'createErrorNotice', ...getNotificationArgumentsForTrashFail({
- error
- }));
- }
- }
- /**
- * Action generator used in signalling that the post should autosave. This
- * includes server-side autosaving (default) and client-side (a.k.a. local)
- * autosaving (e.g. on the Web, the post might be committed to Session
- * Storage).
- *
- * @param {Object?} options Extra flags to identify the autosave.
- */
- function* actions_autosave({
- local = false,
- ...options
- } = {}) {
- if (local) {
- const post = yield external_wp_data_["controls"].select(STORE_NAME, 'getCurrentPost');
- const isPostNew = yield external_wp_data_["controls"].select(STORE_NAME, 'isEditedPostNew');
- const title = yield external_wp_data_["controls"].select(STORE_NAME, 'getEditedPostAttribute', 'title');
- const content = yield external_wp_data_["controls"].select(STORE_NAME, 'getEditedPostAttribute', 'content');
- const excerpt = yield external_wp_data_["controls"].select(STORE_NAME, 'getEditedPostAttribute', 'excerpt');
- yield {
- type: 'LOCAL_AUTOSAVE_SET',
- postId: post.id,
- isPostNew,
- title,
- content,
- excerpt
- };
- } else {
- yield external_wp_data_["controls"].dispatch(STORE_NAME, 'savePost', {
- isAutosave: true,
- ...options
- });
- }
- }
- /**
- * Returns an action object used in signalling that undo history should
- * restore last popped state.
- *
- * @yield {Object} Action object.
- */
- function* actions_redo() {
- yield external_wp_data_["controls"].dispatch('core', 'redo');
- }
- /**
- * Returns an action object used in signalling that undo history should pop.
- *
- * @yield {Object} Action object.
- */
- function* actions_undo() {
- yield external_wp_data_["controls"].dispatch('core', 'undo');
- }
- /**
- * Returns an action object used in signalling that undo history record should
- * be created.
- *
- * @return {Object} Action object.
- */
- function createUndoLevel() {
- return {
- type: 'CREATE_UNDO_LEVEL'
- };
- }
- /**
- * Returns an action object used to lock the editor.
- *
- * @param {Object} lock Details about the post lock status, user, and nonce.
- *
- * @return {Object} Action object.
- */
- function actions_updatePostLock(lock) {
- return {
- type: 'UPDATE_POST_LOCK',
- lock
- };
- }
- /**
- * Returns an action object used in signalling that the user has enabled the
- * publish sidebar.
- *
- * @return {Object} Action object
- */
- function enablePublishSidebar() {
- return {
- type: 'ENABLE_PUBLISH_SIDEBAR'
- };
- }
- /**
- * Returns an action object used in signalling that the user has disabled the
- * publish sidebar.
- *
- * @return {Object} Action object
- */
- function disablePublishSidebar() {
- return {
- type: 'DISABLE_PUBLISH_SIDEBAR'
- };
- }
- /**
- * Returns an action object used to signal that post saving is locked.
- *
- * @param {string} lockName The lock name.
- *
- * @example
- * ```
- * const { subscribe } = wp.data;
- *
- * const initialPostStatus = wp.data.select( 'core/editor' ).getEditedPostAttribute( 'status' );
- *
- * // Only allow publishing posts that are set to a future date.
- * if ( 'publish' !== initialPostStatus ) {
- *
- * // Track locking.
- * let locked = false;
- *
- * // Watch for the publish event.
- * let unssubscribe = subscribe( () => {
- * const currentPostStatus = wp.data.select( 'core/editor' ).getEditedPostAttribute( 'status' );
- * if ( 'publish' !== currentPostStatus ) {
- *
- * // Compare the post date to the current date, lock the post if the date isn't in the future.
- * const postDate = new Date( wp.data.select( 'core/editor' ).getEditedPostAttribute( 'date' ) );
- * const currentDate = new Date();
- * if ( postDate.getTime() <= currentDate.getTime() ) {
- * if ( ! locked ) {
- * locked = true;
- * wp.data.dispatch( 'core/editor' ).lockPostSaving( 'futurelock' );
- * }
- * } else {
- * if ( locked ) {
- * locked = false;
- * wp.data.dispatch( 'core/editor' ).unlockPostSaving( 'futurelock' );
- * }
- * }
- * }
- * } );
- * }
- * ```
- *
- * @return {Object} Action object
- */
- function lockPostSaving(lockName) {
- return {
- type: 'LOCK_POST_SAVING',
- lockName
- };
- }
- /**
- * Returns an action object used to signal that post saving is unlocked.
- *
- * @param {string} lockName The lock name.
- *
- * @example
- * ```
- * // Unlock post saving with the lock key `mylock`:
- * wp.data.dispatch( 'core/editor' ).unlockPostSaving( 'mylock' );
- * ```
- *
- * @return {Object} Action object
- */
- function unlockPostSaving(lockName) {
- return {
- type: 'UNLOCK_POST_SAVING',
- lockName
- };
- }
- /**
- * Returns an action object used to signal that post autosaving is locked.
- *
- * @param {string} lockName The lock name.
- *
- * @example
- * ```
- * // Lock post autosaving with the lock key `mylock`:
- * wp.data.dispatch( 'core/editor' ).lockPostAutosaving( 'mylock' );
- * ```
- *
- * @return {Object} Action object
- */
- function lockPostAutosaving(lockName) {
- return {
- type: 'LOCK_POST_AUTOSAVING',
- lockName
- };
- }
- /**
- * Returns an action object used to signal that post autosaving is unlocked.
- *
- * @param {string} lockName The lock name.
- *
- * @example
- * ```
- * // Unlock post saving with the lock key `mylock`:
- * wp.data.dispatch( 'core/editor' ).unlockPostAutosaving( 'mylock' );
- * ```
- *
- * @return {Object} Action object
- */
- function unlockPostAutosaving(lockName) {
- return {
- type: 'UNLOCK_POST_AUTOSAVING',
- lockName
- };
- }
- /**
- * Returns an action object used to signal that the blocks have been updated.
- *
- * @param {Array} blocks Block Array.
- * @param {?Object} options Optional options.
- *
- * @yield {Object} Action object
- */
- function* actions_resetEditorBlocks(blocks, options = {}) {
- const {
- __unstableShouldCreateUndoLevel,
- selection
- } = options;
- const edits = {
- blocks,
- selection
- };
- if (__unstableShouldCreateUndoLevel !== false) {
- const {
- id,
- type
- } = yield external_wp_data_["controls"].select(STORE_NAME, 'getCurrentPost');
- const noChange = (yield external_wp_data_["controls"].select('core', 'getEditedEntityRecord', 'postType', type, id)).blocks === edits.blocks;
- if (noChange) {
- return yield external_wp_data_["controls"].dispatch('core', '__unstableCreateUndoLevel', 'postType', type, id);
- } // We create a new function here on every persistent edit
- // to make sure the edit makes the post dirty and creates
- // a new undo level.
- edits.content = ({
- blocks: blocksForSerialization = []
- }) => Object(external_wp_blocks_["__unstableSerializeAndClean"])(blocksForSerialization);
- }
- yield* actions_editPost(edits);
- }
- /*
- * Returns an action object used in signalling that the post editor settings have been updated.
- *
- * @param {Object} settings Updated settings
- *
- * @return {Object} Action object
- */
- function actions_updateEditorSettings(settings) {
- return {
- type: 'UPDATE_EDITOR_SETTINGS',
- settings
- };
- }
- /**
- * Backward compatibility
- */
- const getBlockEditorAction = name => function* (...args) {
- external_wp_deprecated_default()("`wp.data.dispatch( 'core/editor' )." + name + '`', {
- since: '5.3',
- alternative: "`wp.data.dispatch( 'core/block-editor' )." + name + '`'
- });
- yield external_wp_data_["controls"].dispatch('core/block-editor', name, ...args);
- };
- /**
- * @see resetBlocks in core/block-editor store.
- */
- const resetBlocks = getBlockEditorAction('resetBlocks');
- /**
- * @see receiveBlocks in core/block-editor store.
- */
- const receiveBlocks = getBlockEditorAction('receiveBlocks');
- /**
- * @see updateBlock in core/block-editor store.
- */
- const updateBlock = getBlockEditorAction('updateBlock');
- /**
- * @see updateBlockAttributes in core/block-editor store.
- */
- const updateBlockAttributes = getBlockEditorAction('updateBlockAttributes');
- /**
- * @see selectBlock in core/block-editor store.
- */
- const actions_selectBlock = getBlockEditorAction('selectBlock');
- /**
- * @see startMultiSelect in core/block-editor store.
- */
- const startMultiSelect = getBlockEditorAction('startMultiSelect');
- /**
- * @see stopMultiSelect in core/block-editor store.
- */
- const stopMultiSelect = getBlockEditorAction('stopMultiSelect');
- /**
- * @see multiSelect in core/block-editor store.
- */
- const multiSelect = getBlockEditorAction('multiSelect');
- /**
- * @see clearSelectedBlock in core/block-editor store.
- */
- const actions_clearSelectedBlock = getBlockEditorAction('clearSelectedBlock');
- /**
- * @see toggleSelection in core/block-editor store.
- */
- const toggleSelection = getBlockEditorAction('toggleSelection');
- /**
- * @see replaceBlocks in core/block-editor store.
- */
- const replaceBlocks = getBlockEditorAction('replaceBlocks');
- /**
- * @see replaceBlock in core/block-editor store.
- */
- const replaceBlock = getBlockEditorAction('replaceBlock');
- /**
- * @see moveBlocksDown in core/block-editor store.
- */
- const moveBlocksDown = getBlockEditorAction('moveBlocksDown');
- /**
- * @see moveBlocksUp in core/block-editor store.
- */
- const moveBlocksUp = getBlockEditorAction('moveBlocksUp');
- /**
- * @see moveBlockToPosition in core/block-editor store.
- */
- const moveBlockToPosition = getBlockEditorAction('moveBlockToPosition');
- /**
- * @see insertBlock in core/block-editor store.
- */
- const insertBlock = getBlockEditorAction('insertBlock');
- /**
- * @see insertBlocks in core/block-editor store.
- */
- const actions_insertBlocks = getBlockEditorAction('insertBlocks');
- /**
- * @see showInsertionPoint in core/block-editor store.
- */
- const showInsertionPoint = getBlockEditorAction('showInsertionPoint');
- /**
- * @see hideInsertionPoint in core/block-editor store.
- */
- const hideInsertionPoint = getBlockEditorAction('hideInsertionPoint');
- /**
- * @see setTemplateValidity in core/block-editor store.
- */
- const actions_setTemplateValidity = getBlockEditorAction('setTemplateValidity');
- /**
- * @see synchronizeTemplate in core/block-editor store.
- */
- const actions_synchronizeTemplate = getBlockEditorAction('synchronizeTemplate');
- /**
- * @see mergeBlocks in core/block-editor store.
- */
- const mergeBlocks = getBlockEditorAction('mergeBlocks');
- /**
- * @see removeBlocks in core/block-editor store.
- */
- const removeBlocks = getBlockEditorAction('removeBlocks');
- /**
- * @see removeBlock in core/block-editor store.
- */
- const removeBlock = getBlockEditorAction('removeBlock');
- /**
- * @see toggleBlockMode in core/block-editor store.
- */
- const toggleBlockMode = getBlockEditorAction('toggleBlockMode');
- /**
- * @see startTyping in core/block-editor store.
- */
- const startTyping = getBlockEditorAction('startTyping');
- /**
- * @see stopTyping in core/block-editor store.
- */
- const stopTyping = getBlockEditorAction('stopTyping');
- /**
- * @see enterFormattedText in core/block-editor store.
- */
- const enterFormattedText = getBlockEditorAction('enterFormattedText');
- /**
- * @see exitFormattedText in core/block-editor store.
- */
- const exitFormattedText = getBlockEditorAction('exitFormattedText');
- /**
- * @see insertDefaultBlock in core/block-editor store.
- */
- const actions_insertDefaultBlock = getBlockEditorAction('insertDefaultBlock');
- /**
- * @see updateBlockListSettings in core/block-editor store.
- */
- const updateBlockListSettings = getBlockEditorAction('updateBlockListSettings');
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/controls.js
- /**
- * Function returning a sessionStorage key to set or retrieve a given post's
- * automatic session backup.
- *
- * Keys are crucially prefixed with 'wp-autosave-' so that wp-login.php's
- * `loggedout` handler can clear sessionStorage of any user-private content.
- *
- * @see https://github.com/WordPress/wordpress-develop/blob/6dad32d2aed47e6c0cf2aee8410645f6d7aba6bd/src/wp-login.php#L103
- *
- * @param {string} postId Post ID.
- * @param {boolean} isPostNew Whether post new.
- * @return {string} sessionStorage key
- */
- function postKey(postId, isPostNew) {
- return `wp-autosave-block-editor-post-${isPostNew ? 'auto-draft' : postId}`;
- }
- function localAutosaveGet(postId, isPostNew) {
- return window.sessionStorage.getItem(postKey(postId, isPostNew));
- }
- function localAutosaveSet(postId, isPostNew, title, content, excerpt) {
- window.sessionStorage.setItem(postKey(postId, isPostNew), JSON.stringify({
- post_title: title,
- content,
- excerpt
- }));
- }
- function localAutosaveClear(postId, isPostNew) {
- window.sessionStorage.removeItem(postKey(postId, isPostNew));
- }
- const controls = {
- LOCAL_AUTOSAVE_SET({
- postId,
- isPostNew,
- title,
- content,
- excerpt
- }) {
- localAutosaveSet(postId, isPostNew, title, content, excerpt);
- }
- };
- /* harmony default export */ var store_controls = (controls);
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/store/index.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- /**
- * Post editor data store configuration.
- *
- * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#registerStore
- *
- * @type {Object}
- */
- const storeConfig = {
- reducer: reducer,
- selectors: selectors_namespaceObject,
- actions: actions_namespaceObject,
- controls: { ...external_wp_dataControls_["controls"],
- ...store_controls
- }
- };
- /**
- * Store definition for the editor namespace.
- *
- * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
- *
- * @type {Object}
- */
- const store = Object(external_wp_data_["createReduxStore"])(STORE_NAME, { ...storeConfig,
- persist: ['preferences']
- }); // Once we build a more generic persistence plugin that works across types of stores
- // we'd be able to replace this with a register call.
- Object(external_wp_data_["registerStore"])(STORE_NAME, { ...storeConfig,
- persist: ['preferences']
- });
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/autocompleters/index.js
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/autosave-monitor/index.js
- /**
- * WordPress dependencies
- */
- /**
- * AutosaveMonitor invokes `props.autosave()` within at most `interval` seconds after an unsaved change is detected.
- *
- * The logic is straightforward: a check is performed every `props.interval` seconds. If any changes are detected, `props.autosave()` is called.
- * The time between the change and the autosave varies but is no larger than `props.interval` seconds. Refer to the code below for more details, such as
- * the specific way of detecting changes.
- *
- * There are two caveats:
- * * If `props.isAutosaveable` happens to be false at a time of checking for changes, the check is retried every second.
- * * The timer may be disabled by setting `props.disableIntervalChecks` to `true`. In that mode, any change will immediately trigger `props.autosave()`.
- */
- class autosave_monitor_AutosaveMonitor extends external_wp_element_["Component"] {
- constructor(props) {
- super(props);
- this.needsAutosave = !!(props.isDirty && props.isAutosaveable);
- }
- componentDidMount() {
- if (!this.props.disableIntervalChecks) {
- this.setAutosaveTimer();
- }
- }
- componentDidUpdate(prevProps) {
- if (this.props.disableIntervalChecks) {
- if (this.props.editsReference !== prevProps.editsReference) {
- this.props.autosave();
- }
- return;
- }
- if (!this.props.isDirty) {
- this.needsAutosave = false;
- return;
- }
- if (this.props.isAutosaving && !prevProps.isAutosaving) {
- this.needsAutosave = false;
- return;
- }
- if (this.props.editsReference !== prevProps.editsReference) {
- this.needsAutosave = true;
- }
- }
- componentWillUnmount() {
- clearTimeout(this.timerId);
- }
- setAutosaveTimer(timeout = this.props.interval * 1000) {
- this.timerId = setTimeout(() => {
- this.autosaveTimerHandler();
- }, timeout);
- }
- autosaveTimerHandler() {
- if (!this.props.isAutosaveable) {
- this.setAutosaveTimer(1000);
- return;
- }
- if (this.needsAutosave) {
- this.needsAutosave = false;
- this.props.autosave();
- }
- this.setAutosaveTimer();
- }
- render() {
- return null;
- }
- }
- /* harmony default export */ var autosave_monitor = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])((select, ownProps) => {
- const {
- getReferenceByDistinctEdits
- } = select('core');
- const {
- isEditedPostDirty,
- isEditedPostAutosaveable,
- isAutosavingPost,
- getEditorSettings
- } = select('core/editor');
- const {
- interval = getEditorSettings().autosaveInterval
- } = ownProps;
- return {
- editsReference: getReferenceByDistinctEdits(),
- isDirty: isEditedPostDirty(),
- isAutosaveable: isEditedPostAutosaveable(),
- isAutosaving: isAutosavingPost(),
- interval
- };
- }), Object(external_wp_data_["withDispatch"])((dispatch, ownProps) => ({
- autosave() {
- const {
- autosave = dispatch('core/editor').autosave
- } = ownProps;
- autosave();
- }
- }))])(autosave_monitor_AutosaveMonitor));
- // EXTERNAL MODULE: ./node_modules/classnames/index.js
- var classnames = __webpack_require__("TSYQ");
- var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/document-outline/item.js
- /**
- * External dependencies
- */
- const TableOfContentsItem = ({
- children,
- isValid,
- level,
- href,
- onSelect
- }) => Object(external_wp_element_["createElement"])("li", {
- className: classnames_default()('document-outline__item', `is-${level.toLowerCase()}`, {
- 'is-invalid': !isValid
- })
- }, Object(external_wp_element_["createElement"])("a", {
- href: href,
- className: "document-outline__button",
- onClick: onSelect
- }, Object(external_wp_element_["createElement"])("span", {
- className: "document-outline__emdash",
- "aria-hidden": "true"
- }), Object(external_wp_element_["createElement"])("strong", {
- className: "document-outline__level"
- }, level), Object(external_wp_element_["createElement"])("span", {
- className: "document-outline__item-content"
- }, children)));
- /* harmony default export */ var document_outline_item = (TableOfContentsItem);
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/document-outline/index.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- /**
- * Module constants
- */
- const emptyHeadingContent = Object(external_wp_element_["createElement"])("em", null, Object(external_wp_i18n_["__"])('(Empty heading)'));
- const incorrectLevelContent = [Object(external_wp_element_["createElement"])("br", {
- key: "incorrect-break"
- }), Object(external_wp_element_["createElement"])("em", {
- key: "incorrect-message"
- }, Object(external_wp_i18n_["__"])('(Incorrect heading level)'))];
- const singleH1Headings = [Object(external_wp_element_["createElement"])("br", {
- key: "incorrect-break-h1"
- }), Object(external_wp_element_["createElement"])("em", {
- key: "incorrect-message-h1"
- }, Object(external_wp_i18n_["__"])('(Your theme may already use a H1 for the post title)'))];
- const multipleH1Headings = [Object(external_wp_element_["createElement"])("br", {
- key: "incorrect-break-multiple-h1"
- }), Object(external_wp_element_["createElement"])("em", {
- key: "incorrect-message-multiple-h1"
- }, Object(external_wp_i18n_["__"])('(Multiple H1 headings are not recommended)'))];
- /**
- * Returns an array of heading blocks enhanced with the following properties:
- * level - An integer with the heading level.
- * isEmpty - Flag indicating if the heading has no content.
- *
- * @param {?Array} blocks An array of blocks.
- *
- * @return {Array} An array of heading blocks enhanced with the properties described above.
- */
- const computeOutlineHeadings = (blocks = []) => {
- return Object(external_lodash_["flatMap"])(blocks, (block = {}) => {
- if (block.name === 'core/heading') {
- return { ...block,
- level: block.attributes.level,
- isEmpty: isEmptyHeading(block)
- };
- }
- return computeOutlineHeadings(block.innerBlocks);
- });
- };
- const isEmptyHeading = heading => !heading.attributes.content || heading.attributes.content.length === 0;
- const DocumentOutline = ({
- blocks = [],
- title,
- onSelect,
- isTitleSupported,
- hasOutlineItemsDisabled
- }) => {
- const headings = computeOutlineHeadings(blocks);
- if (headings.length < 1) {
- return null;
- }
- let prevHeadingLevel = 1; // Not great but it's the simplest way to locate the title right now.
- const titleNode = document.querySelector('.editor-post-title__input');
- const hasTitle = isTitleSupported && title && titleNode;
- const countByLevel = Object(external_lodash_["countBy"])(headings, 'level');
- const hasMultipleH1 = countByLevel[1] > 1;
- return Object(external_wp_element_["createElement"])("div", {
- className: "document-outline"
- }, Object(external_wp_element_["createElement"])("ul", null, hasTitle && Object(external_wp_element_["createElement"])(document_outline_item, {
- level: Object(external_wp_i18n_["__"])('Title'),
- isValid: true,
- onSelect: onSelect,
- href: `#${titleNode.id}`,
- isDisabled: hasOutlineItemsDisabled
- }, title), headings.map((item, index) => {
- // Headings remain the same, go up by one, or down by any amount.
- // Otherwise there are missing levels.
- const isIncorrectLevel = item.level > prevHeadingLevel + 1;
- const isValid = !item.isEmpty && !isIncorrectLevel && !!item.level && (item.level !== 1 || !hasMultipleH1 && !hasTitle);
- prevHeadingLevel = item.level;
- return Object(external_wp_element_["createElement"])(document_outline_item, {
- key: index,
- level: `H${item.level}`,
- isValid: isValid,
- isDisabled: hasOutlineItemsDisabled,
- href: `#block-${item.clientId}`,
- onSelect: onSelect
- }, item.isEmpty ? emptyHeadingContent : Object(external_wp_richText_["getTextContent"])(Object(external_wp_richText_["create"])({
- html: item.attributes.content
- })), isIncorrectLevel && incorrectLevelContent, item.level === 1 && hasMultipleH1 && multipleH1Headings, hasTitle && item.level === 1 && !hasMultipleH1 && singleH1Headings);
- })));
- };
- /* harmony default export */ var document_outline = (Object(external_wp_compose_["compose"])(Object(external_wp_data_["withSelect"])(select => {
- const {
- getBlocks
- } = select(external_wp_blockEditor_["store"]);
- const {
- getEditedPostAttribute
- } = select('core/editor');
- const {
- getPostType
- } = select('core');
- const postType = getPostType(getEditedPostAttribute('type'));
- return {
- title: getEditedPostAttribute('title'),
- blocks: getBlocks(),
- isTitleSupported: Object(external_lodash_["get"])(postType, ['supports', 'title'], false)
- };
- }))(DocumentOutline));
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/document-outline/check.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- function DocumentOutlineCheck({
- blocks,
- children
- }) {
- const headings = Object(external_lodash_["filter"])(blocks, block => block.name === 'core/heading');
- if (headings.length < 1) {
- return null;
- }
- return children;
- }
- /* harmony default export */ var check = (Object(external_wp_data_["withSelect"])(select => ({
- blocks: select(external_wp_blockEditor_["store"]).getBlocks()
- }))(DocumentOutlineCheck));
- // EXTERNAL MODULE: external ["wp","keyboardShortcuts"]
- var external_wp_keyboardShortcuts_ = __webpack_require__("hF7m");
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/save-shortcut.js
- /**
- * WordPress dependencies
- */
- function SaveShortcut({
- resetBlocksOnSave
- }) {
- const {
- resetEditorBlocks,
- savePost
- } = Object(external_wp_data_["useDispatch"])('core/editor');
- const {
- isEditedPostDirty,
- getPostEdits
- } = Object(external_wp_data_["useSelect"])(select => {
- const {
- isEditedPostDirty: _isEditedPostDirty,
- getPostEdits: _getPostEdits
- } = select('core/editor');
- return {
- isEditedPostDirty: _isEditedPostDirty,
- getPostEdits: _getPostEdits
- };
- }, []);
- Object(external_wp_keyboardShortcuts_["useShortcut"])('core/editor/save', event => {
- event.preventDefault(); // TODO: This should be handled in the `savePost` effect in
- // considering `isSaveable`. See note on `isEditedPostSaveable`
- // selector about dirtiness and meta-boxes.
- //
- // See: `isEditedPostSaveable`
- if (!isEditedPostDirty()) {
- return;
- } // The text editor requires that editor blocks are updated for a
- // save to work correctly. Usually this happens when the textarea
- // for the code editors blurs, but the shortcut can be used without
- // blurring the textarea.
- if (resetBlocksOnSave) {
- const postEdits = getPostEdits();
- if (postEdits.content && typeof postEdits.content === 'string') {
- const blocks = Object(external_wp_blocks_["parse"])(postEdits.content);
- resetEditorBlocks(blocks);
- }
- }
- savePost();
- }, {
- bindGlobal: true
- });
- return null;
- }
- /* harmony default export */ var save_shortcut = (SaveShortcut);
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/visual-editor-shortcuts.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function VisualEditorGlobalKeyboardShortcuts() {
- const {
- redo,
- undo
- } = Object(external_wp_data_["useDispatch"])('core/editor');
- Object(external_wp_keyboardShortcuts_["useShortcut"])('core/editor/undo', event => {
- undo();
- event.preventDefault();
- }, {
- bindGlobal: true
- });
- Object(external_wp_keyboardShortcuts_["useShortcut"])('core/editor/redo', event => {
- redo();
- event.preventDefault();
- }, {
- bindGlobal: true
- });
- return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockEditorKeyboardShortcuts"], null), Object(external_wp_element_["createElement"])(save_shortcut, null));
- }
- /* harmony default export */ var visual_editor_shortcuts = (VisualEditorGlobalKeyboardShortcuts);
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/text-editor-shortcuts.js
- /**
- * Internal dependencies
- */
- function TextEditorGlobalKeyboardShortcuts() {
- return Object(external_wp_element_["createElement"])(save_shortcut, {
- resetBlocksOnSave: true
- });
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/global-keyboard-shortcuts/register-shortcuts.js
- /**
- * WordPress dependencies
- */
- function EditorKeyboardShortcutsRegister() {
- // Registering the shortcuts
- const {
- registerShortcut
- } = Object(external_wp_data_["useDispatch"])(external_wp_keyboardShortcuts_["store"]);
- Object(external_wp_element_["useEffect"])(() => {
- registerShortcut({
- name: 'core/editor/save',
- category: 'global',
- description: Object(external_wp_i18n_["__"])('Save your changes.'),
- keyCombination: {
- modifier: 'primary',
- character: 's'
- }
- });
- registerShortcut({
- name: 'core/editor/undo',
- category: 'global',
- description: Object(external_wp_i18n_["__"])('Undo your last changes.'),
- keyCombination: {
- modifier: 'primary',
- character: 'z'
- }
- });
- registerShortcut({
- name: 'core/editor/redo',
- category: 'global',
- description: Object(external_wp_i18n_["__"])('Redo your last undo.'),
- keyCombination: {
- modifier: 'primaryShift',
- character: 'z'
- }
- });
- }, [registerShortcut]);
- return Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockEditorKeyboardShortcuts"].Register, null);
- }
- /* harmony default export */ var register_shortcuts = (EditorKeyboardShortcutsRegister);
- // EXTERNAL MODULE: external ["wp","components"]
- var external_wp_components_ = __webpack_require__("tI+e");
- // EXTERNAL MODULE: external ["wp","keycodes"]
- var external_wp_keycodes_ = __webpack_require__("RxS6");
- // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/redo.js
- var library_redo = __webpack_require__("K2cm");
- // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/undo.js
- var library_undo = __webpack_require__("Ntru");
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-history/redo.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function EditorHistoryRedo(props, ref) {
- const hasRedo = Object(external_wp_data_["useSelect"])(select => select(store).hasEditorRedo(), []);
- const {
- redo
- } = Object(external_wp_data_["useDispatch"])(store);
- return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], Object(esm_extends["a" /* default */])({}, props, {
- ref: ref,
- icon: !Object(external_wp_i18n_["isRTL"])() ? library_redo["a" /* default */] : library_undo["a" /* default */]
- /* translators: button label text should, if possible, be under 16 characters. */
- ,
- label: Object(external_wp_i18n_["__"])('Redo'),
- shortcut: external_wp_keycodes_["displayShortcut"].primaryShift('z') // If there are no redo levels we don't want to actually disable this
- // button, because it will remove focus for keyboard users.
- // See: https://github.com/WordPress/gutenberg/issues/3486
- ,
- "aria-disabled": !hasRedo,
- onClick: hasRedo ? redo : undefined,
- className: "editor-history__redo"
- }));
- }
- /* harmony default export */ var editor_history_redo = (Object(external_wp_element_["forwardRef"])(EditorHistoryRedo));
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-history/undo.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function EditorHistoryUndo(props, ref) {
- const hasUndo = Object(external_wp_data_["useSelect"])(select => select(store).hasEditorUndo(), []);
- const {
- undo
- } = Object(external_wp_data_["useDispatch"])(store);
- return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], Object(esm_extends["a" /* default */])({}, props, {
- ref: ref,
- icon: !Object(external_wp_i18n_["isRTL"])() ? library_undo["a" /* default */] : library_redo["a" /* default */]
- /* translators: button label text should, if possible, be under 16 characters. */
- ,
- label: Object(external_wp_i18n_["__"])('Undo'),
- shortcut: external_wp_keycodes_["displayShortcut"].primary('z') // If there are no undo levels we don't want to actually disable this
- // button, because it will remove focus for keyboard users.
- // See: https://github.com/WordPress/gutenberg/issues/3486
- ,
- "aria-disabled": !hasUndo,
- onClick: hasUndo ? undo : undefined,
- className: "editor-history__undo"
- }));
- }
- /* harmony default export */ var editor_history_undo = (Object(external_wp_element_["forwardRef"])(EditorHistoryUndo));
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/template-validation-notice/index.js
- /**
- * WordPress dependencies
- */
- function TemplateValidationNotice({
- isValid,
- ...props
- }) {
- if (isValid) {
- return null;
- }
- const confirmSynchronization = () => {
- if ( // eslint-disable-next-line no-alert
- window.confirm(Object(external_wp_i18n_["__"])('Resetting the template may result in loss of content, do you want to continue?'))) {
- props.synchronizeTemplate();
- }
- };
- return Object(external_wp_element_["createElement"])(external_wp_components_["Notice"], {
- className: "editor-template-validation-notice",
- isDismissible: false,
- status: "warning",
- actions: [{
- label: Object(external_wp_i18n_["__"])('Keep it as is'),
- onClick: props.resetTemplateValidity
- }, {
- label: Object(external_wp_i18n_["__"])('Reset the template'),
- onClick: confirmSynchronization
- }]
- }, Object(external_wp_i18n_["__"])('The content of your post doesn’t match the template assigned to your post type.'));
- }
- /* harmony default export */ var template_validation_notice = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => ({
- isValid: select(external_wp_blockEditor_["store"]).isValidTemplate()
- })), Object(external_wp_data_["withDispatch"])(dispatch => {
- const {
- setTemplateValidity,
- synchronizeTemplate
- } = dispatch(external_wp_blockEditor_["store"]);
- return {
- resetTemplateValidity: () => setTemplateValidity(true),
- synchronizeTemplate
- };
- })])(TemplateValidationNotice));
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-notices/index.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function EditorNotices({
- notices,
- onRemove
- }) {
- const dismissibleNotices = Object(external_lodash_["filter"])(notices, {
- isDismissible: true,
- type: 'default'
- });
- const nonDismissibleNotices = Object(external_lodash_["filter"])(notices, {
- isDismissible: false,
- type: 'default'
- });
- return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["NoticeList"], {
- notices: nonDismissibleNotices,
- className: "components-editor-notices__pinned"
- }), Object(external_wp_element_["createElement"])(external_wp_components_["NoticeList"], {
- notices: dismissibleNotices,
- className: "components-editor-notices__dismissible",
- onRemove: onRemove
- }, Object(external_wp_element_["createElement"])(template_validation_notice, null)));
- }
- /* harmony default export */ var editor_notices = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => ({
- notices: select(external_wp_notices_["store"]).getNotices()
- })), Object(external_wp_data_["withDispatch"])(dispatch => ({
- onRemove: dispatch(external_wp_notices_["store"]).removeNotice
- }))])(EditorNotices));
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/editor-snackbars/index.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- function EditorSnackbars() {
- const notices = Object(external_wp_data_["useSelect"])(select => select(external_wp_notices_["store"]).getNotices(), []);
- const {
- removeNotice
- } = Object(external_wp_data_["useDispatch"])(external_wp_notices_["store"]);
- const snackbarNotices = Object(external_lodash_["filter"])(notices, {
- type: 'snackbar'
- });
- return Object(external_wp_element_["createElement"])(external_wp_components_["SnackbarList"], {
- notices: snackbarNotices,
- className: "components-editor-notices__snackbar",
- onRemove: removeNotice
- });
- }
- // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/close.js
- var library_close = __webpack_require__("w95h");
- // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/page.js
- /**
- * WordPress dependencies
- */
- const page_page = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
- }, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], {
- d: "M7 5.5h10a.5.5 0 01.5.5v12a.5.5 0 01-.5.5H7a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM17 4H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V6a2 2 0 00-2-2zm-1 3.75H8v1.5h8v-1.5zM8 11h8v1.5H8V11zm6 3.25H8v1.5h6v-1.5z"
- }));
- /* harmony default export */ var library_page = (page_page);
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/entity-record-item.js
- /**
- * WordPress dependencies
- */
- function EntityRecordItem({
- record,
- checked,
- onChange,
- closePanel
- }) {
- const {
- name,
- kind,
- title,
- key
- } = record;
- const parentBlockId = Object(external_wp_data_["useSelect"])(select => {
- var _blocks$;
- // Get entity's blocks.
- const {
- blocks = []
- } = select('core').getEditedEntityRecord(kind, name, key); // Get parents of the entity's first block.
- const parents = select(external_wp_blockEditor_["store"]).getBlockParents((_blocks$ = blocks[0]) === null || _blocks$ === void 0 ? void 0 : _blocks$.clientId); // Return closest parent block's clientId.
- return parents[parents.length - 1];
- }, []); // Handle templates that might use default descriptive titles
- const entityRecordTitle = Object(external_wp_data_["useSelect"])(select => {
- if ('postType' !== kind || 'wp_template' !== name) {
- return title;
- }
- const template = select('core').getEditedEntityRecord(kind, name, key);
- return select('core/editor').__experimentalGetTemplateInfo(template).title;
- }, [name, kind, title, key]);
- const isSelected = Object(external_wp_data_["useSelect"])(select => {
- const selectedBlockId = select(external_wp_blockEditor_["store"]).getSelectedBlockClientId();
- return selectedBlockId === parentBlockId;
- }, [parentBlockId]);
- const isSelectedText = isSelected ? Object(external_wp_i18n_["__"])('Selected') : Object(external_wp_i18n_["__"])('Select');
- const {
- selectBlock
- } = Object(external_wp_data_["useDispatch"])(external_wp_blockEditor_["store"]);
- const selectParentBlock = Object(external_wp_element_["useCallback"])(() => selectBlock(parentBlockId), [parentBlockId]);
- const selectAndDismiss = Object(external_wp_element_["useCallback"])(() => {
- selectBlock(parentBlockId);
- closePanel();
- }, [parentBlockId]);
- return Object(external_wp_element_["createElement"])(external_wp_components_["PanelRow"], null, Object(external_wp_element_["createElement"])(external_wp_components_["CheckboxControl"], {
- label: Object(external_wp_element_["createElement"])("strong", null, entityRecordTitle || Object(external_wp_i18n_["__"])('Untitled')),
- checked: checked,
- onChange: onChange
- }), parentBlockId ? Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
- onClick: selectParentBlock,
- className: "entities-saved-states__find-entity",
- disabled: isSelected
- }, isSelectedText), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
- onClick: selectAndDismiss,
- className: "entities-saved-states__find-entity-small",
- disabled: isSelected
- }, isSelectedText)) : null);
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/entity-type-list.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- const ENTITY_NAME_ICONS = {
- site: layout["a" /* default */],
- page: library_page
- };
- function EntityTypeList({
- list,
- unselectedEntities,
- setUnselectedEntities,
- closePanel
- }) {
- const firstRecord = list[0];
- const entity = Object(external_wp_data_["useSelect"])(select => select(external_wp_coreData_["store"]).getEntity(firstRecord.kind, firstRecord.name), [firstRecord.kind, firstRecord.name]); // Set icon based on type of entity.
- const {
- name
- } = firstRecord;
- const icon = ENTITY_NAME_ICONS[name];
- return Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], {
- title: entity.label,
- initialOpen: true,
- icon: icon
- }, list.map(record => {
- return Object(external_wp_element_["createElement"])(EntityRecordItem, {
- key: record.key || record.property,
- record: record,
- checked: !Object(external_lodash_["some"])(unselectedEntities, elt => elt.kind === record.kind && elt.name === record.name && elt.key === record.key && elt.property === record.property),
- onChange: value => setUnselectedEntities(record, value),
- closePanel: closePanel
- });
- }));
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/entities-saved-states/index.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- const TRANSLATED_SITE_PROTPERTIES = {
- title: Object(external_wp_i18n_["__"])('Title'),
- description: Object(external_wp_i18n_["__"])('Tagline'),
- site_logo: Object(external_wp_i18n_["__"])('Logo'),
- show_on_front: Object(external_wp_i18n_["__"])('Show on front'),
- page_on_front: Object(external_wp_i18n_["__"])('Page on front')
- };
- function EntitiesSavedStates({
- close
- }) {
- const saveButtonRef = Object(external_wp_element_["useRef"])();
- const {
- dirtyEntityRecords
- } = Object(external_wp_data_["useSelect"])(select => {
- const dirtyRecords = select(external_wp_coreData_["store"]).__experimentalGetDirtyEntityRecords(); // Remove site object and decouple into its edited pieces.
- const dirtyRecordsWithoutSite = dirtyRecords.filter(record => !(record.kind === 'root' && record.name === 'site'));
- const siteEdits = select(external_wp_coreData_["store"]).getEntityRecordEdits('root', 'site');
- const siteEditsAsEntities = [];
- for (const property in siteEdits) {
- siteEditsAsEntities.push({
- kind: 'root',
- name: 'site',
- title: TRANSLATED_SITE_PROTPERTIES[property] || property,
- property
- });
- }
- const dirtyRecordsWithSiteItems = [...dirtyRecordsWithoutSite, ...siteEditsAsEntities];
- return {
- dirtyEntityRecords: dirtyRecordsWithSiteItems
- };
- }, []);
- const {
- saveEditedEntityRecord,
- __experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits
- } = Object(external_wp_data_["useDispatch"])(external_wp_coreData_["store"]); // To group entities by type.
- const partitionedSavables = Object.values(Object(external_lodash_["groupBy"])(dirtyEntityRecords, 'name')); // Unchecked entities to be ignored by save function.
- const [unselectedEntities, _setUnselectedEntities] = Object(external_wp_element_["useState"])([]);
- const setUnselectedEntities = ({
- kind,
- name,
- key,
- property
- }, checked) => {
- if (checked) {
- _setUnselectedEntities(unselectedEntities.filter(elt => elt.kind !== kind || elt.name !== name || elt.key !== key || elt.property !== property));
- } else {
- _setUnselectedEntities([...unselectedEntities, {
- kind,
- name,
- key,
- property
- }]);
- }
- };
- const saveCheckedEntities = () => {
- const entitiesToSave = dirtyEntityRecords.filter(({
- kind,
- name,
- key,
- property
- }) => {
- return !Object(external_lodash_["some"])(unselectedEntities, elt => elt.kind === kind && elt.name === name && elt.key === key && elt.property === property);
- });
- close(entitiesToSave);
- const siteItemsToSave = [];
- entitiesToSave.forEach(({
- kind,
- name,
- key,
- property
- }) => {
- if ('root' === kind && 'site' === name) {
- siteItemsToSave.push(property);
- } else {
- saveEditedEntityRecord(kind, name, key);
- }
- });
- saveSpecifiedEntityEdits('root', 'site', undefined, siteItemsToSave);
- }; // Explicitly define this with no argument passed. Using `close` on
- // its own will use the event object in place of the expected saved entities.
- const dismissPanel = Object(external_wp_element_["useCallback"])(() => close(), [close]);
- const [saveDialogRef, saveDialogProps] = Object(external_wp_compose_["__experimentalUseDialog"])({
- onClose: () => dismissPanel()
- });
- return Object(external_wp_element_["createElement"])("div", Object(esm_extends["a" /* default */])({
- ref: saveDialogRef
- }, saveDialogProps, {
- className: "entities-saved-states__panel"
- }), Object(external_wp_element_["createElement"])("div", {
- className: "entities-saved-states__panel-header"
- }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
- ref: saveButtonRef,
- isPrimary: true,
- disabled: dirtyEntityRecords.length - unselectedEntities.length === 0,
- onClick: saveCheckedEntities,
- className: "editor-entities-saved-states__save-button"
- }, Object(external_wp_i18n_["__"])('Save')), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
- icon: library_close["a" /* default */],
- onClick: dismissPanel,
- label: Object(external_wp_i18n_["__"])('Close panel')
- })), Object(external_wp_element_["createElement"])("div", {
- className: "entities-saved-states__text-prompt"
- }, Object(external_wp_element_["createElement"])("strong", null, Object(external_wp_i18n_["__"])('Select the changes you want to save')), Object(external_wp_element_["createElement"])("p", null, Object(external_wp_i18n_["__"])('Some changes may affect other areas of your site.'))), partitionedSavables.map(list => {
- return Object(external_wp_element_["createElement"])(EntityTypeList, {
- key: list[0].name,
- list: list,
- closePanel: dismissPanel,
- unselectedEntities: unselectedEntities,
- setUnselectedEntities: setUnselectedEntities
- });
- }));
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/error-boundary/index.js
- /**
- * WordPress dependencies
- */
- function CopyButton({
- text,
- children
- }) {
- const ref = Object(external_wp_compose_["useCopyToClipboard"])(text);
- return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
- isSecondary: true,
- ref: ref
- }, children);
- }
- class error_boundary_ErrorBoundary extends external_wp_element_["Component"] {
- constructor() {
- super(...arguments);
- this.reboot = this.reboot.bind(this);
- this.getContent = this.getContent.bind(this);
- this.state = {
- error: null
- };
- }
- componentDidCatch(error) {
- this.setState({
- error
- });
- }
- reboot() {
- this.props.onError();
- }
- getContent() {
- try {
- // While `select` in a component is generally discouraged, it is
- // used here because it (a) reduces the chance of data loss in the
- // case of additional errors by performing a direct retrieval and
- // (b) avoids the performance cost associated with unnecessary
- // content serialization throughout the lifetime of a non-erroring
- // application.
- return Object(external_wp_data_["select"])('core/editor').getEditedPostContent();
- } catch (error) {}
- }
- render() {
- const {
- error
- } = this.state;
- if (!error) {
- return this.props.children;
- }
- return Object(external_wp_element_["createElement"])(external_wp_blockEditor_["Warning"], {
- className: "editor-error-boundary",
- actions: [Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
- key: "recovery",
- onClick: this.reboot,
- isSecondary: true
- }, Object(external_wp_i18n_["__"])('Attempt Recovery')), Object(external_wp_element_["createElement"])(CopyButton, {
- key: "copy-post",
- text: this.getContent
- }, Object(external_wp_i18n_["__"])('Copy Post Text')), Object(external_wp_element_["createElement"])(CopyButton, {
- key: "copy-error",
- text: error.stack
- }, Object(external_wp_i18n_["__"])('Copy Error'))]
- }, Object(external_wp_i18n_["__"])('The editor has encountered an unexpected error.'));
- }
- }
- /* harmony default export */ var error_boundary = (error_boundary_ErrorBoundary);
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/local-autosave-monitor/index.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- const requestIdleCallback = window.requestIdleCallback ? window.requestIdleCallback : window.requestAnimationFrame;
- /**
- * Function which returns true if the current environment supports browser
- * sessionStorage, or false otherwise. The result of this function is cached and
- * reused in subsequent invocations.
- */
- const hasSessionStorageSupport = Object(external_lodash_["once"])(() => {
- try {
- // Private Browsing in Safari 10 and earlier will throw an error when
- // attempting to set into sessionStorage. The test here is intentional in
- // causing a thrown error as condition bailing from local autosave.
- window.sessionStorage.setItem('__wpEditorTestSessionStorage', '');
- window.sessionStorage.removeItem('__wpEditorTestSessionStorage');
- return true;
- } catch (error) {
- return false;
- }
- });
- /**
- * Custom hook which manages the creation of a notice prompting the user to
- * restore a local autosave, if one exists.
- */
- function useAutosaveNotice() {
- const {
- postId,
- isEditedPostNew,
- hasRemoteAutosave
- } = Object(external_wp_data_["useSelect"])(select => ({
- postId: select('core/editor').getCurrentPostId(),
- isEditedPostNew: select('core/editor').isEditedPostNew(),
- getEditedPostAttribute: select('core/editor').getEditedPostAttribute,
- hasRemoteAutosave: !!select('core/editor').getEditorSettings().autosave
- }), []);
- const {
- getEditedPostAttribute
- } = Object(external_wp_data_["useSelect"])('core/editor');
- const {
- createWarningNotice,
- removeNotice
- } = Object(external_wp_data_["useDispatch"])(external_wp_notices_["store"]);
- const {
- editPost,
- resetEditorBlocks
- } = Object(external_wp_data_["useDispatch"])('core/editor');
- Object(external_wp_element_["useEffect"])(() => {
- let localAutosave = localAutosaveGet(postId, isEditedPostNew);
- if (!localAutosave) {
- return;
- }
- try {
- localAutosave = JSON.parse(localAutosave);
- } catch (error) {
- // Not usable if it can't be parsed.
- return;
- }
- const {
- post_title: title,
- content,
- excerpt
- } = localAutosave;
- const edits = {
- title,
- content,
- excerpt
- };
- {
- // Only display a notice if there is a difference between what has been
- // saved and that which is stored in sessionStorage.
- const hasDifference = Object.keys(edits).some(key => {
- return edits[key] !== getEditedPostAttribute(key);
- });
- if (!hasDifference) {
- // If there is no difference, it can be safely ejected from storage.
- localAutosaveClear(postId, isEditedPostNew);
- return;
- }
- }
- if (hasRemoteAutosave) {
- return;
- }
- const noticeId = Object(external_lodash_["uniqueId"])('wpEditorAutosaveRestore');
- createWarningNotice(Object(external_wp_i18n_["__"])('The backup of this post in your browser is different from the version below.'), {
- id: noticeId,
- actions: [{
- label: Object(external_wp_i18n_["__"])('Restore the backup'),
- onClick() {
- editPost(Object(external_lodash_["omit"])(edits, ['content']));
- resetEditorBlocks(Object(external_wp_blocks_["parse"])(edits.content));
- removeNotice(noticeId);
- }
- }]
- });
- }, [isEditedPostNew, postId]);
- }
- /**
- * Custom hook which ejects a local autosave after a successful save occurs.
- */
- function useAutosavePurge() {
- const {
- postId,
- isEditedPostNew,
- isDirty,
- isAutosaving,
- didError
- } = Object(external_wp_data_["useSelect"])(select => ({
- postId: select('core/editor').getCurrentPostId(),
- isEditedPostNew: select('core/editor').isEditedPostNew(),
- isDirty: select('core/editor').isEditedPostDirty(),
- isAutosaving: select('core/editor').isAutosavingPost(),
- didError: select('core/editor').didPostSaveRequestFail()
- }), []);
- const lastIsDirty = Object(external_wp_element_["useRef"])(isDirty);
- const lastIsAutosaving = Object(external_wp_element_["useRef"])(isAutosaving);
- Object(external_wp_element_["useEffect"])(() => {
- if (!didError && (lastIsAutosaving.current && !isAutosaving || lastIsDirty.current && !isDirty)) {
- localAutosaveClear(postId, isEditedPostNew);
- }
- lastIsDirty.current = isDirty;
- lastIsAutosaving.current = isAutosaving;
- }, [isDirty, isAutosaving, didError]); // Once the isEditedPostNew changes from true to false, let's clear the auto-draft autosave.
- const wasEditedPostNew = Object(external_wp_compose_["usePrevious"])(isEditedPostNew);
- const prevPostId = Object(external_wp_compose_["usePrevious"])(postId);
- Object(external_wp_element_["useEffect"])(() => {
- if (prevPostId === postId && wasEditedPostNew && !isEditedPostNew) {
- localAutosaveClear(postId, true);
- }
- }, [isEditedPostNew, postId]);
- }
- function LocalAutosaveMonitor() {
- const {
- autosave
- } = Object(external_wp_data_["useDispatch"])('core/editor');
- const deferedAutosave = Object(external_wp_element_["useCallback"])(() => {
- requestIdleCallback(() => autosave({
- local: true
- }));
- }, []);
- useAutosaveNotice();
- useAutosavePurge();
- const {
- localAutosaveInterval
- } = Object(external_wp_data_["useSelect"])(select => ({
- localAutosaveInterval: select('core/editor').getEditorSettings().__experimentalLocalAutosaveInterval
- }), []);
- return Object(external_wp_element_["createElement"])(autosave_monitor, {
- interval: localAutosaveInterval,
- autosave: deferedAutosave
- });
- }
- /* harmony default export */ var local_autosave_monitor = (Object(external_wp_compose_["ifCondition"])(hasSessionStorageSupport)(LocalAutosaveMonitor));
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/page-attributes/check.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function PageAttributesCheck({
- children
- }) {
- const postType = Object(external_wp_data_["useSelect"])(select => {
- const {
- getEditedPostAttribute
- } = select(store);
- const {
- getPostType
- } = select(external_wp_coreData_["store"]);
- return getPostType(getEditedPostAttribute('type'));
- }, []);
- const supportsPageAttributes = Object(external_lodash_["get"])(postType, ['supports', 'page-attributes'], false); // Only render fields if post type supports page attributes or available templates exist.
- if (!supportsPageAttributes) {
- return null;
- }
- return children;
- }
- /* harmony default export */ var page_attributes_check = (PageAttributesCheck);
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-type-support-check/index.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * A component which renders its own children only if the current editor post
- * type supports one of the given `supportKeys` prop.
- *
- * @param {Object} props Props.
- * @param {string} [props.postType] Current post type.
- * @param {WPElement} props.children Children to be rendered if post
- * type supports.
- * @param {(string|string[])} props.supportKeys String or string array of keys
- * to test.
- *
- * @return {WPComponent} The component to be rendered.
- */
- function PostTypeSupportCheck({
- postType,
- children,
- supportKeys
- }) {
- let isSupported = true;
- if (postType) {
- isSupported = Object(external_lodash_["some"])(Object(external_lodash_["castArray"])(supportKeys), key => !!postType.supports[key]);
- }
- if (!isSupported) {
- return null;
- }
- return children;
- }
- /* harmony default export */ var post_type_support_check = (Object(external_wp_data_["withSelect"])(select => {
- const {
- getEditedPostAttribute
- } = select('core/editor');
- const {
- getPostType
- } = select('core');
- return {
- postType: getPostType(getEditedPostAttribute('type'))
- };
- })(PostTypeSupportCheck));
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/page-attributes/order.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- const PageAttributesOrder = Object(external_wp_compose_["withState"])({
- orderInput: null
- })(({
- onUpdateOrder,
- order = 0,
- orderInput,
- setState
- }) => {
- const setUpdatedOrder = value => {
- setState({
- orderInput: value
- });
- const newOrder = Number(value);
- if (Number.isInteger(newOrder) && Object(external_lodash_["invoke"])(value, ['trim']) !== '') {
- onUpdateOrder(Number(value));
- }
- };
- const value = orderInput === null ? order : orderInput;
- return Object(external_wp_element_["createElement"])(external_wp_components_["TextControl"], {
- className: "editor-page-attributes__order",
- type: "number",
- label: Object(external_wp_i18n_["__"])('Order'),
- value: value,
- onChange: setUpdatedOrder,
- size: 6,
- onBlur: () => {
- setState({
- orderInput: null
- });
- }
- });
- });
- function PageAttributesOrderWithChecks(props) {
- return Object(external_wp_element_["createElement"])(post_type_support_check, {
- supportKeys: "page-attributes"
- }, Object(external_wp_element_["createElement"])(PageAttributesOrder, props));
- }
- /* harmony default export */ var page_attributes_order = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => {
- return {
- order: select('core/editor').getEditedPostAttribute('menu_order')
- };
- }), Object(external_wp_data_["withDispatch"])(dispatch => ({
- onUpdateOrder(order) {
- dispatch('core/editor').editPost({
- menu_order: order
- });
- }
- }))])(PageAttributesOrderWithChecks));
- // EXTERNAL MODULE: external ["wp","htmlEntities"]
- var external_wp_htmlEntities_ = __webpack_require__("rmEH");
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/terms.js
- /**
- * External dependencies
- */
- /**
- * Returns terms in a tree form.
- *
- * @param {Array} flatTerms Array of terms in flat format.
- *
- * @return {Array} Array of terms in tree format.
- */
- function buildTermsTree(flatTerms) {
- const flatTermsWithParentAndChildren = flatTerms.map(term => {
- return {
- children: [],
- parent: null,
- ...term
- };
- });
- const termsByParent = Object(external_lodash_["groupBy"])(flatTermsWithParentAndChildren, 'parent');
- if (termsByParent.null && termsByParent.null.length) {
- return flatTermsWithParentAndChildren;
- }
- const fillWithChildren = terms => {
- return terms.map(term => {
- const children = termsByParent[term.id];
- return { ...term,
- children: children && children.length ? fillWithChildren(children) : []
- };
- });
- };
- return fillWithChildren(termsByParent['0'] || []);
- } // Lodash unescape function handles ' but not ' which may be return in some API requests.
- const unescapeString = arg => {
- return Object(external_lodash_["unescape"])(arg.replace(''', "'"));
- };
- /**
- * Returns a term object with name unescaped.
- * The unescape of the name property is done using lodash unescape function.
- *
- * @param {Object} term The term object to unescape.
- *
- * @return {Object} Term object with name property unescaped.
- */
- const unescapeTerm = term => {
- return { ...term,
- name: unescapeString(term.name)
- };
- };
- /**
- * Returns an array of term objects with names unescaped.
- * The unescape of each term is performed using the unescapeTerm function.
- *
- * @param {Object[]} terms Array of term objects to unescape.
- *
- * @return {Object[]} Array of term objects unescaped.
- */
- const unescapeTerms = terms => {
- return Object(external_lodash_["map"])(terms, unescapeTerm);
- };
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/page-attributes/parent.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function getTitle(post) {
- var _post$title;
- return post !== null && post !== void 0 && (_post$title = post.title) !== null && _post$title !== void 0 && _post$title.rendered ? Object(external_wp_htmlEntities_["decodeEntities"])(post.title.rendered) : `#${post.id} (${Object(external_wp_i18n_["__"])('no title')})`;
- }
- const getItemPriority = (name, searchValue) => {
- const normalizedName = Object(external_lodash_["deburr"])(name).toLowerCase();
- const normalizedSearch = Object(external_lodash_["deburr"])(searchValue).toLowerCase();
- if (normalizedName === normalizedSearch) {
- return 0;
- }
- if (normalizedName.startsWith(normalizedSearch)) {
- return normalizedName.length;
- }
- return Infinity;
- };
- function PageAttributesParent() {
- const {
- editPost
- } = Object(external_wp_data_["useDispatch"])('core/editor');
- const [fieldValue, setFieldValue] = Object(external_wp_element_["useState"])(false);
- const {
- parentPost,
- parentPostId,
- items,
- postType
- } = Object(external_wp_data_["useSelect"])(select => {
- const {
- getPostType,
- getEntityRecords,
- getEntityRecord
- } = select('core');
- const {
- getCurrentPostId,
- getEditedPostAttribute
- } = select('core/editor');
- const postTypeSlug = getEditedPostAttribute('type');
- const pageId = getEditedPostAttribute('parent');
- const pType = getPostType(postTypeSlug);
- const postId = getCurrentPostId();
- const isHierarchical = Object(external_lodash_["get"])(pType, ['hierarchical'], false);
- const query = {
- per_page: 100,
- exclude: postId,
- parent_exclude: postId,
- orderby: 'menu_order',
- order: 'asc',
- _fields: 'id,title,parent'
- }; // Perform a search when the field is changed.
- if (!!fieldValue) {
- query.search = fieldValue;
- }
- return {
- parentPostId: pageId,
- parentPost: pageId ? getEntityRecord('postType', postTypeSlug, pageId) : null,
- items: isHierarchical ? getEntityRecords('postType', postTypeSlug, query) : [],
- postType: pType
- };
- }, [fieldValue]);
- const isHierarchical = Object(external_lodash_["get"])(postType, ['hierarchical'], false);
- const parentPageLabel = Object(external_lodash_["get"])(postType, ['labels', 'parent_item_colon']);
- const pageItems = items || [];
- const parentOptions = Object(external_wp_element_["useMemo"])(() => {
- const getOptionsFromTree = (tree, level = 0) => {
- const mappedNodes = tree.map(treeNode => [{
- value: treeNode.id,
- label: Object(external_lodash_["repeat"])('— ', level) + Object(external_lodash_["unescape"])(treeNode.name),
- rawName: treeNode.name
- }, ...getOptionsFromTree(treeNode.children || [], level + 1)]);
- const sortedNodes = mappedNodes.sort(([a], [b]) => {
- const priorityA = getItemPriority(a.rawName, fieldValue);
- const priorityB = getItemPriority(b.rawName, fieldValue);
- return priorityA >= priorityB ? 1 : -1;
- });
- return Object(external_lodash_["flatten"])(sortedNodes);
- };
- let tree = pageItems.map(item => ({
- id: item.id,
- parent: item.parent,
- name: getTitle(item)
- })); // Only build a hierarchical tree when not searching.
- if (!fieldValue) {
- tree = buildTermsTree(tree);
- }
- const opts = getOptionsFromTree(tree); // Ensure the current parent is in the options list.
- const optsHasParent = Object(external_lodash_["find"])(opts, item => item.value === parentPostId);
- if (parentPost && !optsHasParent) {
- opts.unshift({
- value: parentPostId,
- label: getTitle(parentPost)
- });
- }
- return opts;
- }, [pageItems, fieldValue]);
- if (!isHierarchical || !parentPageLabel) {
- return null;
- }
- /**
- * Handle user input.
- *
- * @param {string} inputValue The current value of the input field.
- */
- const handleKeydown = inputValue => {
- setFieldValue(inputValue);
- };
- /**
- * Handle author selection.
- *
- * @param {Object} selectedPostId The selected Author.
- */
- const handleChange = selectedPostId => {
- editPost({
- parent: selectedPostId
- });
- };
- return Object(external_wp_element_["createElement"])(external_wp_components_["ComboboxControl"], {
- className: "editor-page-attributes__parent",
- label: parentPageLabel,
- value: parentPostId,
- options: parentOptions,
- onFilterValueChange: Object(external_lodash_["debounce"])(handleKeydown, 300),
- onChange: handleChange
- });
- }
- /* harmony default export */ var page_attributes_parent = (PageAttributesParent);
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-template/index.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function PostTemplate({}) {
- const {
- availableTemplates,
- selectedTemplate,
- isViewable
- } = Object(external_wp_data_["useSelect"])(select => {
- var _getPostType$viewable, _getPostType;
- const {
- getEditedPostAttribute,
- getEditorSettings,
- getCurrentPostType
- } = select(store);
- const {
- getPostType
- } = select(external_wp_coreData_["store"]);
- return {
- selectedTemplate: getEditedPostAttribute('template'),
- availableTemplates: getEditorSettings().availableTemplates,
- isViewable: (_getPostType$viewable = (_getPostType = getPostType(getCurrentPostType())) === null || _getPostType === void 0 ? void 0 : _getPostType.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false
- };
- }, []);
- const {
- editPost
- } = Object(external_wp_data_["useDispatch"])(store);
- if (!isViewable || Object(external_lodash_["isEmpty"])(availableTemplates)) {
- return null;
- }
- return Object(external_wp_element_["createElement"])(external_wp_components_["SelectControl"], {
- label: Object(external_wp_i18n_["__"])('Template:'),
- value: selectedTemplate,
- onChange: templateSlug => {
- editPost({
- template: templateSlug || ''
- });
- },
- options: Object(external_lodash_["map"])(availableTemplates, (templateName, templateSlug) => ({
- value: templateSlug,
- label: templateName
- }))
- });
- }
- /* harmony default export */ var post_template = (PostTemplate);
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/combobox.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- function PostAuthorCombobox() {
- const [fieldValue, setFieldValue] = Object(external_wp_element_["useState"])();
- const {
- authorId,
- isLoading,
- authors,
- postAuthor
- } = Object(external_wp_data_["useSelect"])(select => {
- const {
- __unstableGetAuthor,
- getAuthors,
- isResolving
- } = select('core');
- const {
- getEditedPostAttribute
- } = select('core/editor');
- const author = __unstableGetAuthor(getEditedPostAttribute('author'));
- const query = !fieldValue || '' === fieldValue ? {} : {
- search: fieldValue
- };
- return {
- authorId: getEditedPostAttribute('author'),
- postAuthor: author,
- authors: getAuthors(query),
- isLoading: isResolving('core', 'getAuthors', [query])
- };
- }, [fieldValue]);
- const {
- editPost
- } = Object(external_wp_data_["useDispatch"])('core/editor');
- const authorOptions = Object(external_wp_element_["useMemo"])(() => {
- const fetchedAuthors = (authors !== null && authors !== void 0 ? authors : []).map(author => {
- return {
- value: author.id,
- label: author.name
- };
- }); // Ensure the current author is included in the dropdown list.
- const foundAuthor = fetchedAuthors.findIndex(({
- value
- }) => (postAuthor === null || postAuthor === void 0 ? void 0 : postAuthor.id) === value);
- if (foundAuthor < 0 && postAuthor) {
- return [{
- value: postAuthor.id,
- label: postAuthor.name
- }, ...fetchedAuthors];
- }
- return fetchedAuthors;
- }, [authors, postAuthor]); // Initializes the post author properly
- // Also ensures external changes are reflected.
- Object(external_wp_element_["useEffect"])(() => {
- if (postAuthor) {
- setFieldValue(postAuthor.name);
- }
- }, [postAuthor]);
- /**
- * Handle author selection.
- *
- * @param {number} postAuthorId The selected Author.
- */
- const handleSelect = postAuthorId => {
- if (!postAuthorId) {
- return;
- }
- editPost({
- author: postAuthorId
- });
- };
- /**
- * Handle user input.
- *
- * @param {string} inputValue The current value of the input field.
- */
- const handleKeydown = inputValue => {
- setFieldValue(inputValue);
- };
- if (!postAuthor) {
- return null;
- }
- return Object(external_wp_element_["createElement"])(external_wp_components_["ComboboxControl"], {
- label: Object(external_wp_i18n_["__"])('Author'),
- options: authorOptions,
- value: authorId,
- onFilterValueChange: Object(external_lodash_["debounce"])(handleKeydown, 300),
- onChange: handleSelect,
- isLoading: isLoading,
- allowReset: false
- });
- }
- /* harmony default export */ var combobox = (PostAuthorCombobox);
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/select.js
- /**
- * WordPress dependencies
- */
- function PostAuthorSelect() {
- const {
- editPost
- } = Object(external_wp_data_["useDispatch"])('core/editor');
- const {
- postAuthor,
- authors
- } = Object(external_wp_data_["useSelect"])(select => {
- const authorsFromAPI = select('core').getAuthors();
- return {
- postAuthor: select('core/editor').getEditedPostAttribute('author'),
- authors: authorsFromAPI.map(author => ({
- label: Object(external_wp_htmlEntities_["decodeEntities"])(author.name),
- value: author.id
- }))
- };
- }, []);
- const setAuthorId = value => {
- const author = Number(value);
- editPost({
- author
- });
- };
- return Object(external_wp_element_["createElement"])(external_wp_components_["SelectControl"], {
- className: "post-author-selector",
- label: Object(external_wp_i18n_["__"])('Author'),
- options: authors,
- onChange: setAuthorId,
- value: postAuthor
- });
- }
- /* harmony default export */ var post_author_select = (PostAuthorSelect);
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/index.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- const minimumUsersForCombobox = 25;
- function PostAuthor() {
- const showCombobox = Object(external_wp_data_["useSelect"])(select => {
- // Not using `getUsers()` because it requires `list_users` capability.
- const authors = select(external_wp_coreData_["store"]).getAuthors();
- return (authors === null || authors === void 0 ? void 0 : authors.length) >= minimumUsersForCombobox;
- }, []);
- if (showCombobox) {
- return Object(external_wp_element_["createElement"])(combobox, null);
- }
- return Object(external_wp_element_["createElement"])(post_author_select, null);
- }
- /* harmony default export */ var post_author = (PostAuthor);
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-author/check.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function PostAuthorCheck({
- hasAssignAuthorAction,
- authors,
- children
- }) {
- if (!hasAssignAuthorAction || !authors || 1 >= authors.length) {
- return null;
- }
- return Object(external_wp_element_["createElement"])(post_type_support_check, {
- supportKeys: "author"
- }, children);
- }
- /* harmony default export */ var post_author_check = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => {
- const post = select('core/editor').getCurrentPost();
- return {
- hasAssignAuthorAction: Object(external_lodash_["get"])(post, ['_links', 'wp:action-assign-author'], false),
- postType: select('core/editor').getCurrentPostType(),
- authors: select('core').getAuthors()
- };
- }), external_wp_compose_["withInstanceId"]])(PostAuthorCheck));
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-comments/index.js
- /**
- * WordPress dependencies
- */
- function PostComments({
- commentStatus = 'open',
- ...props
- }) {
- const onToggleComments = () => props.editPost({
- comment_status: commentStatus === 'open' ? 'closed' : 'open'
- });
- return Object(external_wp_element_["createElement"])(external_wp_components_["CheckboxControl"], {
- label: Object(external_wp_i18n_["__"])('Allow comments'),
- checked: commentStatus === 'open',
- onChange: onToggleComments
- });
- }
- /* harmony default export */ var post_comments = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => {
- return {
- commentStatus: select('core/editor').getEditedPostAttribute('comment_status')
- };
- }), Object(external_wp_data_["withDispatch"])(dispatch => ({
- editPost: dispatch('core/editor').editPost
- }))])(PostComments));
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-excerpt/index.js
- /**
- * WordPress dependencies
- */
- function PostExcerpt({
- excerpt,
- onUpdateExcerpt
- }) {
- return Object(external_wp_element_["createElement"])("div", {
- className: "editor-post-excerpt"
- }, Object(external_wp_element_["createElement"])(external_wp_components_["TextareaControl"], {
- label: Object(external_wp_i18n_["__"])('Write an excerpt (optional)'),
- className: "editor-post-excerpt__textarea",
- onChange: value => onUpdateExcerpt(value),
- value: excerpt
- }), Object(external_wp_element_["createElement"])(external_wp_components_["ExternalLink"], {
- href: Object(external_wp_i18n_["__"])('https://wordpress.org/support/article/excerpt/')
- }, Object(external_wp_i18n_["__"])('Learn more about manual excerpts')));
- }
- /* harmony default export */ var post_excerpt = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => {
- return {
- excerpt: select('core/editor').getEditedPostAttribute('excerpt')
- };
- }), Object(external_wp_data_["withDispatch"])(dispatch => ({
- onUpdateExcerpt(excerpt) {
- dispatch('core/editor').editPost({
- excerpt
- });
- }
- }))])(PostExcerpt));
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-excerpt/check.js
- /**
- * Internal dependencies
- */
- function PostExcerptCheck(props) {
- return Object(external_wp_element_["createElement"])(post_type_support_check, Object(esm_extends["a" /* default */])({}, props, {
- supportKeys: "excerpt"
- }));
- }
- /* harmony default export */ var post_excerpt_check = (PostExcerptCheck);
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/theme-support-check/index.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- function ThemeSupportCheck({
- themeSupports,
- children,
- postType,
- supportKeys
- }) {
- const isSupported = Object(external_lodash_["some"])(Object(external_lodash_["castArray"])(supportKeys), key => {
- const supported = Object(external_lodash_["get"])(themeSupports, [key], false); // 'post-thumbnails' can be boolean or an array of post types.
- // In the latter case, we need to verify `postType` exists
- // within `supported`. If `postType` isn't passed, then the check
- // should fail.
- if ('post-thumbnails' === key && Object(external_lodash_["isArray"])(supported)) {
- return Object(external_lodash_["includes"])(supported, postType);
- }
- return supported;
- });
- if (!isSupported) {
- return null;
- }
- return children;
- }
- /* harmony default export */ var theme_support_check = (Object(external_wp_data_["withSelect"])(select => {
- const {
- getThemeSupports
- } = select('core');
- const {
- getEditedPostAttribute
- } = select('core/editor');
- return {
- postType: getEditedPostAttribute('type'),
- themeSupports: getThemeSupports()
- };
- })(ThemeSupportCheck));
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-featured-image/check.js
- /**
- * Internal dependencies
- */
- function PostFeaturedImageCheck(props) {
- return Object(external_wp_element_["createElement"])(theme_support_check, {
- supportKeys: "post-thumbnails"
- }, Object(external_wp_element_["createElement"])(post_type_support_check, Object(esm_extends["a" /* default */])({}, props, {
- supportKeys: "thumbnail"
- })));
- }
- /* harmony default export */ var post_featured_image_check = (PostFeaturedImageCheck);
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-featured-image/index.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- const ALLOWED_MEDIA_TYPES = ['image']; // Used when labels from post type were not yet loaded or when they are not present.
- const DEFAULT_FEATURE_IMAGE_LABEL = Object(external_wp_i18n_["__"])('Featured image');
- const DEFAULT_SET_FEATURE_IMAGE_LABEL = Object(external_wp_i18n_["__"])('Set featured image');
- const DEFAULT_REMOVE_FEATURE_IMAGE_LABEL = Object(external_wp_i18n_["__"])('Remove image');
- function PostFeaturedImage({
- currentPostId,
- featuredImageId,
- onUpdateImage,
- onDropImage,
- onRemoveImage,
- media,
- postType,
- noticeUI
- }) {
- var _media$media_details$, _media$media_details$2;
- const postLabel = Object(external_lodash_["get"])(postType, ['labels'], {});
- const instructions = Object(external_wp_element_["createElement"])("p", null, Object(external_wp_i18n_["__"])('To edit the featured image, you need permission to upload media.'));
- let mediaWidth, mediaHeight, mediaSourceUrl;
- if (media) {
- const mediaSize = Object(external_wp_hooks_["applyFilters"])('editor.PostFeaturedImage.imageSize', 'post-thumbnail', media.id, currentPostId);
- if (Object(external_lodash_["has"])(media, ['media_details', 'sizes', mediaSize])) {
- // use mediaSize when available
- mediaWidth = media.media_details.sizes[mediaSize].width;
- mediaHeight = media.media_details.sizes[mediaSize].height;
- mediaSourceUrl = media.media_details.sizes[mediaSize].source_url;
- } else {
- // get fallbackMediaSize if mediaSize is not available
- const fallbackMediaSize = Object(external_wp_hooks_["applyFilters"])('editor.PostFeaturedImage.imageSize', 'thumbnail', media.id, currentPostId);
- if (Object(external_lodash_["has"])(media, ['media_details', 'sizes', fallbackMediaSize])) {
- // use fallbackMediaSize when mediaSize is not available
- mediaWidth = media.media_details.sizes[fallbackMediaSize].width;
- mediaHeight = media.media_details.sizes[fallbackMediaSize].height;
- mediaSourceUrl = media.media_details.sizes[fallbackMediaSize].source_url;
- } else {
- // use full image size when mediaFallbackSize and mediaSize are not available
- mediaWidth = media.media_details.width;
- mediaHeight = media.media_details.height;
- mediaSourceUrl = media.source_url;
- }
- }
- }
- return Object(external_wp_element_["createElement"])(post_featured_image_check, null, noticeUI, Object(external_wp_element_["createElement"])("div", {
- className: "editor-post-featured-image"
- }, media && Object(external_wp_element_["createElement"])("div", {
- id: `editor-post-featured-image-${featuredImageId}-describedby`,
- className: "hidden"
- }, media.alt_text && Object(external_wp_i18n_["sprintf"])( // Translators: %s: The selected image alt text.
- Object(external_wp_i18n_["__"])('Current image: %s'), media.alt_text), !media.alt_text && Object(external_wp_i18n_["sprintf"])( // Translators: %s: The selected image filename.
- Object(external_wp_i18n_["__"])('The current image has no alternative text. The file name is: %s'), ((_media$media_details$ = media.media_details.sizes) === null || _media$media_details$ === void 0 ? void 0 : (_media$media_details$2 = _media$media_details$.full) === null || _media$media_details$2 === void 0 ? void 0 : _media$media_details$2.file) || media.slug)), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["MediaUploadCheck"], {
- fallback: instructions
- }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["MediaUpload"], {
- title: postLabel.featured_image || DEFAULT_FEATURE_IMAGE_LABEL,
- onSelect: onUpdateImage,
- unstableFeaturedImageFlow: true,
- allowedTypes: ALLOWED_MEDIA_TYPES,
- modalClass: "editor-post-featured-image__media-modal",
- render: ({
- open
- }) => Object(external_wp_element_["createElement"])("div", {
- className: "editor-post-featured-image__container"
- }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
- className: !featuredImageId ? 'editor-post-featured-image__toggle' : 'editor-post-featured-image__preview',
- onClick: open,
- "aria-label": !featuredImageId ? null : Object(external_wp_i18n_["__"])('Edit or update the image'),
- "aria-describedby": !featuredImageId ? null : `editor-post-featured-image-${featuredImageId}-describedby`
- }, !!featuredImageId && media && Object(external_wp_element_["createElement"])(external_wp_components_["ResponsiveWrapper"], {
- naturalWidth: mediaWidth,
- naturalHeight: mediaHeight,
- isInline: true
- }, Object(external_wp_element_["createElement"])("img", {
- src: mediaSourceUrl,
- alt: ""
- })), !!featuredImageId && !media && Object(external_wp_element_["createElement"])(external_wp_components_["Spinner"], null), !featuredImageId && (postLabel.set_featured_image || DEFAULT_SET_FEATURE_IMAGE_LABEL)), Object(external_wp_element_["createElement"])(external_wp_components_["DropZone"], {
- onFilesDrop: onDropImage
- })),
- value: featuredImageId
- })), !!featuredImageId && media && !media.isLoading && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["MediaUploadCheck"], null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["MediaUpload"], {
- title: postLabel.featured_image || DEFAULT_FEATURE_IMAGE_LABEL,
- onSelect: onUpdateImage,
- unstableFeaturedImageFlow: true,
- allowedTypes: ALLOWED_MEDIA_TYPES,
- modalClass: "editor-post-featured-image__media-modal",
- render: ({
- open
- }) => Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
- onClick: open,
- isSecondary: true
- }, Object(external_wp_i18n_["__"])('Replace Image'))
- })), !!featuredImageId && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["MediaUploadCheck"], null, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
- onClick: onRemoveImage,
- isLink: true,
- isDestructive: true
- }, postLabel.remove_featured_image || DEFAULT_REMOVE_FEATURE_IMAGE_LABEL))));
- }
- const applyWithSelect = Object(external_wp_data_["withSelect"])(select => {
- const {
- getMedia,
- getPostType
- } = select('core');
- const {
- getCurrentPostId,
- getEditedPostAttribute
- } = select('core/editor');
- const featuredImageId = getEditedPostAttribute('featured_media');
- return {
- media: featuredImageId ? getMedia(featuredImageId) : null,
- currentPostId: getCurrentPostId(),
- postType: getPostType(getEditedPostAttribute('type')),
- featuredImageId
- };
- });
- const applyWithDispatch = Object(external_wp_data_["withDispatch"])((dispatch, {
- noticeOperations
- }, {
- select
- }) => {
- const {
- editPost
- } = dispatch('core/editor');
- return {
- onUpdateImage(image) {
- editPost({
- featured_media: image.id
- });
- },
- onDropImage(filesList) {
- select(external_wp_blockEditor_["store"]).getSettings().mediaUpload({
- allowedTypes: ['image'],
- filesList,
- onFileChange([image]) {
- editPost({
- featured_media: image.id
- });
- },
- onError(message) {
- noticeOperations.removeAllNotices();
- noticeOperations.createErrorNotice(message);
- }
- });
- },
- onRemoveImage() {
- editPost({
- featured_media: 0
- });
- }
- };
- });
- /* harmony default export */ var post_featured_image = (Object(external_wp_compose_["compose"])(external_wp_components_["withNotices"], applyWithSelect, applyWithDispatch, Object(external_wp_components_["withFilters"])('editor.PostFeaturedImage'))(PostFeaturedImage));
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-format/check.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function PostFormatCheck({
- disablePostFormats,
- ...props
- }) {
- return !disablePostFormats && Object(external_wp_element_["createElement"])(post_type_support_check, Object(esm_extends["a" /* default */])({}, props, {
- supportKeys: "post-formats"
- }));
- }
- /* harmony default export */ var post_format_check = (Object(external_wp_data_["withSelect"])(select => {
- const editorSettings = select('core/editor').getEditorSettings();
- return {
- disablePostFormats: editorSettings.disablePostFormats
- };
- })(PostFormatCheck));
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-format/index.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- // All WP post formats, sorted alphabetically by translated name.
- const POST_FORMATS = [{
- id: 'aside',
- caption: Object(external_wp_i18n_["__"])('Aside')
- }, {
- id: 'audio',
- caption: Object(external_wp_i18n_["__"])('Audio')
- }, {
- id: 'chat',
- caption: Object(external_wp_i18n_["__"])('Chat')
- }, {
- id: 'gallery',
- caption: Object(external_wp_i18n_["__"])('Gallery')
- }, {
- id: 'image',
- caption: Object(external_wp_i18n_["__"])('Image')
- }, {
- id: 'link',
- caption: Object(external_wp_i18n_["__"])('Link')
- }, {
- id: 'quote',
- caption: Object(external_wp_i18n_["__"])('Quote')
- }, {
- id: 'standard',
- caption: Object(external_wp_i18n_["__"])('Standard')
- }, {
- id: 'status',
- caption: Object(external_wp_i18n_["__"])('Status')
- }, {
- id: 'video',
- caption: Object(external_wp_i18n_["__"])('Video')
- }].sort((a, b) => {
- const normalizedA = a.caption.toUpperCase();
- const normalizedB = b.caption.toUpperCase();
- if (normalizedA < normalizedB) {
- return -1;
- }
- if (normalizedA > normalizedB) {
- return 1;
- }
- return 0;
- });
- function PostFormat() {
- const instanceId = Object(external_wp_compose_["useInstanceId"])(PostFormat);
- const postFormatSelectorId = `post-format-selector-${instanceId}`;
- const {
- postFormat,
- suggestedFormat,
- supportedFormats
- } = Object(external_wp_data_["useSelect"])(select => {
- const {
- getEditedPostAttribute,
- getSuggestedPostFormat
- } = select('core/editor');
- const _postFormat = getEditedPostAttribute('format');
- const themeSupports = select('core').getThemeSupports();
- return {
- postFormat: _postFormat !== null && _postFormat !== void 0 ? _postFormat : 'standard',
- suggestedFormat: getSuggestedPostFormat(),
- // Ensure current format is always in the set.
- // The current format may not be a format supported by the theme.
- supportedFormats: Object(external_lodash_["union"])([_postFormat], Object(external_lodash_["get"])(themeSupports, ['formats'], []))
- };
- }, []);
- const formats = POST_FORMATS.filter(format => Object(external_lodash_["includes"])(supportedFormats, format.id));
- const suggestion = Object(external_lodash_["find"])(formats, format => format.id === suggestedFormat);
- const {
- editPost
- } = Object(external_wp_data_["useDispatch"])('core/editor');
- const onUpdatePostFormat = format => editPost({
- format
- });
- return Object(external_wp_element_["createElement"])(post_format_check, null, Object(external_wp_element_["createElement"])("div", {
- className: "editor-post-format"
- }, Object(external_wp_element_["createElement"])("div", {
- className: "editor-post-format__content"
- }, Object(external_wp_element_["createElement"])("label", {
- htmlFor: postFormatSelectorId
- }, Object(external_wp_i18n_["__"])('Post Format')), Object(external_wp_element_["createElement"])(external_wp_components_["SelectControl"], {
- value: postFormat,
- onChange: format => onUpdatePostFormat(format),
- id: postFormatSelectorId,
- options: formats.map(format => ({
- label: format.caption,
- value: format.id
- }))
- })), suggestion && suggestion.id !== postFormat && Object(external_wp_element_["createElement"])("div", {
- className: "editor-post-format__suggestion"
- }, Object(external_wp_i18n_["__"])('Suggestion:'), ' ', Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
- isLink: true,
- onClick: () => onUpdatePostFormat(suggestion.id)
- }, suggestion.caption))));
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/backup.js
- /**
- * WordPress dependencies
- */
- const backup = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
- }, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], {
- d: "M5.5 12h1.75l-2.5 3-2.5-3H4a8 8 0 113.134 6.35l.907-1.194A6.5 6.5 0 105.5 12zm9.53 1.97l-2.28-2.28V8.5a.75.75 0 00-1.5 0V12a.747.747 0 00.218.529l1.282-.84-1.28.842 2.5 2.5a.75.75 0 101.06-1.061z"
- }));
- /* harmony default export */ var library_backup = (backup);
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-last-revision/check.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function PostLastRevisionCheck({
- lastRevisionId,
- revisionsCount,
- children
- }) {
- if (!lastRevisionId || revisionsCount < 2) {
- return null;
- }
- return Object(external_wp_element_["createElement"])(post_type_support_check, {
- supportKeys: "revisions"
- }, children);
- }
- /* harmony default export */ var post_last_revision_check = (Object(external_wp_data_["withSelect"])(select => {
- const {
- getCurrentPostLastRevisionId,
- getCurrentPostRevisionsCount
- } = select('core/editor');
- return {
- lastRevisionId: getCurrentPostLastRevisionId(),
- revisionsCount: getCurrentPostRevisionsCount()
- };
- })(PostLastRevisionCheck));
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-last-revision/index.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function LastRevision({
- lastRevisionId,
- revisionsCount
- }) {
- return Object(external_wp_element_["createElement"])(post_last_revision_check, null, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
- href: getWPAdminURL('revision.php', {
- revision: lastRevisionId,
- gutenberg: true
- }),
- className: "editor-post-last-revision__title",
- icon: library_backup
- }, Object(external_wp_i18n_["sprintf"])(
- /* translators: %d: number of revisions */
- Object(external_wp_i18n_["_n"])('%d Revision', '%d Revisions', revisionsCount), revisionsCount)));
- }
- /* harmony default export */ var post_last_revision = (Object(external_wp_data_["withSelect"])(select => {
- const {
- getCurrentPostLastRevisionId,
- getCurrentPostRevisionsCount
- } = select('core/editor');
- return {
- lastRevisionId: getCurrentPostLastRevisionId(),
- revisionsCount: getCurrentPostRevisionsCount()
- };
- })(LastRevision));
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-preview-button/index.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- function writeInterstitialMessage(targetDocument) {
- let markup = Object(external_wp_element_["renderToString"])(Object(external_wp_element_["createElement"])("div", {
- className: "editor-post-preview-button__interstitial-message"
- }, Object(external_wp_element_["createElement"])(external_wp_components_["SVG"], {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 96 96"
- }, Object(external_wp_element_["createElement"])(external_wp_components_["Path"], {
- className: "outer",
- d: "M48 12c19.9 0 36 16.1 36 36S67.9 84 48 84 12 67.9 12 48s16.1-36 36-36",
- fill: "none"
- }), Object(external_wp_element_["createElement"])(external_wp_components_["Path"], {
- className: "inner",
- d: "M69.5 46.4c0-3.9-1.4-6.7-2.6-8.8-1.6-2.6-3.1-4.9-3.1-7.5 0-2.9 2.2-5.7 5.4-5.7h.4C63.9 19.2 56.4 16 48 16c-11.2 0-21 5.7-26.7 14.4h2.1c3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3L40 67.5l7-20.9L42 33c-1.7-.1-3.3-.3-3.3-.3-1.7-.1-1.5-2.7.2-2.6 0 0 5.3.4 8.4.4 3.3 0 8.5-.4 8.5-.4 1.7-.1 1.9 2.4.2 2.6 0 0-1.7.2-3.7.3l11.5 34.3 3.3-10.4c1.6-4.5 2.4-7.8 2.4-10.5zM16.1 48c0 12.6 7.3 23.5 18 28.7L18.8 35c-1.7 4-2.7 8.4-2.7 13zm32.5 2.8L39 78.6c2.9.8 5.9 1.3 9 1.3 3.7 0 7.3-.6 10.6-1.8-.1-.1-.2-.3-.2-.4l-9.8-26.9zM76.2 36c0 3.2-.6 6.9-2.4 11.4L64 75.6c9.5-5.5 15.9-15.8 15.9-27.6 0-5.5-1.4-10.8-3.9-15.3.1 1 .2 2.1.2 3.3z",
- fill: "none"
- })), Object(external_wp_element_["createElement"])("p", null, Object(external_wp_i18n_["__"])('Generating preview…'))));
- markup += `
- <style>
- body {
- margin: 0;
- }
- .editor-post-preview-button__interstitial-message {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- height: 100vh;
- width: 100vw;
- }
- @-webkit-keyframes paint {
- 0% {
- stroke-dashoffset: 0;
- }
- }
- @-moz-keyframes paint {
- 0% {
- stroke-dashoffset: 0;
- }
- }
- @-o-keyframes paint {
- 0% {
- stroke-dashoffset: 0;
- }
- }
- @keyframes paint {
- 0% {
- stroke-dashoffset: 0;
- }
- }
- .editor-post-preview-button__interstitial-message svg {
- width: 192px;
- height: 192px;
- stroke: #555d66;
- stroke-width: 0.75;
- }
- .editor-post-preview-button__interstitial-message svg .outer,
- .editor-post-preview-button__interstitial-message svg .inner {
- stroke-dasharray: 280;
- stroke-dashoffset: 280;
- -webkit-animation: paint 1.5s ease infinite alternate;
- -moz-animation: paint 1.5s ease infinite alternate;
- -o-animation: paint 1.5s ease infinite alternate;
- animation: paint 1.5s ease infinite alternate;
- }
- p {
- text-align: center;
- font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
- }
- </style>
- `;
- /**
- * Filters the interstitial message shown when generating previews.
- *
- * @param {string} markup The preview interstitial markup.
- */
- markup = Object(external_wp_hooks_["applyFilters"])('editor.PostPreview.interstitialMarkup', markup);
- targetDocument.write(markup);
- targetDocument.title = Object(external_wp_i18n_["__"])('Generating preview…');
- targetDocument.close();
- }
- class post_preview_button_PostPreviewButton extends external_wp_element_["Component"] {
- constructor() {
- super(...arguments);
- this.buttonRef = Object(external_wp_element_["createRef"])();
- this.openPreviewWindow = this.openPreviewWindow.bind(this);
- }
- componentDidUpdate(prevProps) {
- const {
- previewLink
- } = this.props; // This relies on the window being responsible to unset itself when
- // navigation occurs or a new preview window is opened, to avoid
- // unintentional forceful redirects.
- if (previewLink && !prevProps.previewLink) {
- this.setPreviewWindowLink(previewLink);
- }
- }
- /**
- * Sets the preview window's location to the given URL, if a preview window
- * exists and is not closed.
- *
- * @param {string} url URL to assign as preview window location.
- */
- setPreviewWindowLink(url) {
- const {
- previewWindow
- } = this;
- if (previewWindow && !previewWindow.closed) {
- previewWindow.location = url;
- if (this.buttonRef.current) {
- this.buttonRef.current.focus();
- }
- }
- }
- getWindowTarget() {
- const {
- postId
- } = this.props;
- return `wp-preview-${postId}`;
- }
- openPreviewWindow(event) {
- // Our Preview button has its 'href' and 'target' set correctly for a11y
- // purposes. Unfortunately, though, we can't rely on the default 'click'
- // handler since sometimes it incorrectly opens a new tab instead of reusing
- // the existing one.
- // https://github.com/WordPress/gutenberg/pull/8330
- event.preventDefault(); // Open up a Preview tab if needed. This is where we'll show the preview.
- if (!this.previewWindow || this.previewWindow.closed) {
- this.previewWindow = window.open('', this.getWindowTarget());
- } // Focus the Preview tab. This might not do anything, depending on the browser's
- // and user's preferences.
- // https://html.spec.whatwg.org/multipage/interaction.html#dom-window-focus
- this.previewWindow.focus();
- if ( // If we don't need to autosave the post before previewing, then we simply
- // load the Preview URL in the Preview tab.
- !this.props.isAutosaveable || // Do not save or overwrite the post, if the post is already locked.
- this.props.isPostLocked) {
- this.setPreviewWindowLink(event.target.href);
- return;
- } // Request an autosave. This happens asynchronously and causes the component
- // to update when finished.
- if (this.props.isDraft) {
- this.props.savePost({
- isPreview: true
- });
- } else {
- this.props.autosave({
- isPreview: true
- });
- } // Display a 'Generating preview' message in the Preview tab while we wait for the
- // autosave to finish.
- writeInterstitialMessage(this.previewWindow.document);
- }
- render() {
- const {
- previewLink,
- currentPostLink,
- isSaveable,
- role
- } = this.props; // Link to the `?preview=true` URL if we have it, since this lets us see
- // changes that were autosaved since the post was last published. Otherwise,
- // just link to the post's URL.
- const href = previewLink || currentPostLink;
- const classNames = classnames_default()({
- 'editor-post-preview': !this.props.className
- }, this.props.className);
- return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
- isTertiary: !this.props.className,
- className: classNames,
- href: href,
- target: this.getWindowTarget(),
- disabled: !isSaveable,
- onClick: this.openPreviewWindow,
- ref: this.buttonRef,
- role: role
- }, this.props.textContent ? this.props.textContent : Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_i18n_["_x"])('Preview', 'imperative verb'), Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], {
- as: "span"
- },
- /* translators: accessibility text */
- Object(external_wp_i18n_["__"])('(opens in a new tab)'))));
- }
- }
- /* harmony default export */ var post_preview_button = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])((select, {
- forcePreviewLink,
- forceIsAutosaveable
- }) => {
- const {
- getCurrentPostId,
- getCurrentPostAttribute,
- getEditedPostAttribute,
- isEditedPostSaveable,
- isEditedPostAutosaveable,
- getEditedPostPreviewLink,
- isPostLocked
- } = select('core/editor');
- const {
- getPostType
- } = select('core');
- const previewLink = getEditedPostPreviewLink();
- const postType = getPostType(getEditedPostAttribute('type'));
- return {
- postId: getCurrentPostId(),
- currentPostLink: getCurrentPostAttribute('link'),
- previewLink: forcePreviewLink !== undefined ? forcePreviewLink : previewLink,
- isSaveable: isEditedPostSaveable(),
- isAutosaveable: forceIsAutosaveable || isEditedPostAutosaveable(),
- isViewable: Object(external_lodash_["get"])(postType, ['viewable'], false),
- isDraft: ['draft', 'auto-draft'].indexOf(getEditedPostAttribute('status')) !== -1,
- isPostLocked: isPostLocked()
- };
- }), Object(external_wp_data_["withDispatch"])(dispatch => ({
- autosave: dispatch('core/editor').autosave,
- savePost: dispatch('core/editor').savePost
- })), Object(external_wp_compose_["ifCondition"])(({
- isViewable
- }) => isViewable)])(post_preview_button_PostPreviewButton));
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-locked-modal/index.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function PostLockedModal() {
- const instanceId = Object(external_wp_compose_["useInstanceId"])(PostLockedModal);
- const hookName = 'core/editor/post-locked-modal-' + instanceId;
- const {
- autosave,
- updatePostLock
- } = Object(external_wp_data_["useDispatch"])('core/editor');
- const {
- isLocked,
- isTakeover,
- user,
- postId,
- postLockUtils,
- activePostLock,
- postType
- } = Object(external_wp_data_["useSelect"])(select => {
- const {
- isPostLocked,
- isPostLockTakeover,
- getPostLockUser,
- getCurrentPostId,
- getActivePostLock,
- getEditedPostAttribute,
- getEditorSettings
- } = select('core/editor');
- const {
- getPostType
- } = select('core');
- return {
- isLocked: isPostLocked(),
- isTakeover: isPostLockTakeover(),
- user: getPostLockUser(),
- postId: getCurrentPostId(),
- postLockUtils: getEditorSettings().postLockUtils,
- activePostLock: getActivePostLock(),
- postType: getPostType(getEditedPostAttribute('type'))
- };
- });
- Object(external_wp_element_["useEffect"])(() => {
- /**
- * Keep the lock refreshed.
- *
- * When the user does not send a heartbeat in a heartbeat-tick
- * the user is no longer editing and another user can start editing.
- *
- * @param {Object} data Data to send in the heartbeat request.
- */
- function sendPostLock(data) {
- if (isLocked) {
- return;
- }
- data['wp-refresh-post-lock'] = {
- lock: activePostLock,
- post_id: postId
- };
- }
- /**
- * Refresh post locks: update the lock string or show the dialog if somebody has taken over editing.
- *
- * @param {Object} data Data received in the heartbeat request
- */
- function receivePostLock(data) {
- if (!data['wp-refresh-post-lock']) {
- return;
- }
- const received = data['wp-refresh-post-lock'];
- if (received.lock_error) {
- // Auto save and display the takeover modal.
- autosave();
- updatePostLock({
- isLocked: true,
- isTakeover: true,
- user: {
- avatar: received.lock_error.avatar_src
- }
- });
- } else if (received.new_lock) {
- updatePostLock({
- isLocked: false,
- activePostLock: received.new_lock
- });
- }
- }
- /**
- * Unlock the post before the window is exited.
- */
- function releasePostLock() {
- if (isLocked || !activePostLock) {
- return;
- }
- const data = new window.FormData();
- data.append('action', 'wp-remove-post-lock');
- data.append('_wpnonce', postLockUtils.unlockNonce);
- data.append('post_ID', postId);
- data.append('active_post_lock', activePostLock);
- if (window.navigator.sendBeacon) {
- window.navigator.sendBeacon(postLockUtils.ajaxUrl, data);
- } else {
- const xhr = new window.XMLHttpRequest();
- xhr.open('POST', postLockUtils.ajaxUrl, false);
- xhr.send(data);
- }
- } // Details on these events on the Heartbeat API docs
- // https://developer.wordpress.org/plugins/javascript/heartbeat-api/
- Object(external_wp_hooks_["addAction"])('heartbeat.send', hookName, sendPostLock);
- Object(external_wp_hooks_["addAction"])('heartbeat.tick', hookName, receivePostLock);
- window.addEventListener('beforeunload', releasePostLock);
- return () => {
- Object(external_wp_hooks_["removeAction"])('heartbeat.send', hookName);
- Object(external_wp_hooks_["removeAction"])('heartbeat.tick', hookName);
- window.removeEventListener('beforeunload', releasePostLock);
- };
- }, []);
- if (!isLocked) {
- return null;
- }
- const userDisplayName = user.name;
- const userAvatar = user.avatar;
- const unlockUrl = Object(external_wp_url_["addQueryArgs"])('post.php', {
- 'get-post-lock': '1',
- lockKey: true,
- post: postId,
- action: 'edit',
- _wpnonce: postLockUtils.nonce
- });
- const allPostsUrl = getWPAdminURL('edit.php', {
- post_type: Object(external_lodash_["get"])(postType, ['slug'])
- });
- const allPostsLabel = Object(external_wp_i18n_["__"])('Exit the Editor');
- return Object(external_wp_element_["createElement"])(external_wp_components_["Modal"], {
- title: isTakeover ? Object(external_wp_i18n_["__"])('Someone else has taken over this post.') : Object(external_wp_i18n_["__"])('This post is already being edited.'),
- focusOnMount: true,
- shouldCloseOnClickOutside: false,
- shouldCloseOnEsc: false,
- isDismissible: false,
- className: "editor-post-locked-modal"
- }, !!userAvatar && Object(external_wp_element_["createElement"])("img", {
- src: userAvatar,
- alt: Object(external_wp_i18n_["__"])('Avatar'),
- className: "editor-post-locked-modal__avatar"
- }), !!isTakeover && Object(external_wp_element_["createElement"])("div", null, Object(external_wp_element_["createElement"])("div", null, userDisplayName ? Object(external_wp_i18n_["sprintf"])(
- /* translators: %s: user's display name */
- Object(external_wp_i18n_["__"])('%s now has editing control of this post. Don’t worry, your changes up to this moment have been saved.'), userDisplayName) : Object(external_wp_i18n_["__"])('Another user now has editing control of this post. Don’t worry, your changes up to this moment have been saved.')), Object(external_wp_element_["createElement"])("div", {
- className: "editor-post-locked-modal__buttons"
- }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
- isPrimary: true,
- href: allPostsUrl
- }, allPostsLabel))), !isTakeover && Object(external_wp_element_["createElement"])("div", null, Object(external_wp_element_["createElement"])("div", null, userDisplayName ? Object(external_wp_i18n_["sprintf"])(
- /* translators: %s: user's display name */
- Object(external_wp_i18n_["__"])('%s is currently working on this post, which means you cannot make changes, unless you take over.'), userDisplayName) : Object(external_wp_i18n_["__"])('Another user is currently working on this post, which means you cannot make changes, unless you take over.')), Object(external_wp_element_["createElement"])("div", {
- className: "editor-post-locked-modal__buttons"
- }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
- isSecondary: true,
- href: allPostsUrl
- }, allPostsLabel), Object(external_wp_element_["createElement"])(post_preview_button, null), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
- isPrimary: true,
- href: unlockUrl
- }, Object(external_wp_i18n_["__"])('Take Over')))));
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-pending-status/check.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- function PostPendingStatusCheck({
- hasPublishAction,
- isPublished,
- children
- }) {
- if (isPublished || !hasPublishAction) {
- return null;
- }
- return children;
- }
- /* harmony default export */ var post_pending_status_check = (Object(external_wp_compose_["compose"])(Object(external_wp_data_["withSelect"])(select => {
- const {
- isCurrentPostPublished,
- getCurrentPostType,
- getCurrentPost
- } = select('core/editor');
- return {
- hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false),
- isPublished: isCurrentPostPublished(),
- postType: getCurrentPostType()
- };
- }))(PostPendingStatusCheck));
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-pending-status/index.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function PostPendingStatus({
- status,
- onUpdateStatus
- }) {
- const togglePendingStatus = () => {
- const updatedStatus = status === 'pending' ? 'draft' : 'pending';
- onUpdateStatus(updatedStatus);
- };
- return Object(external_wp_element_["createElement"])(post_pending_status_check, null, Object(external_wp_element_["createElement"])(external_wp_components_["CheckboxControl"], {
- label: Object(external_wp_i18n_["__"])('Pending review'),
- checked: status === 'pending',
- onChange: togglePendingStatus
- }));
- }
- /* harmony default export */ var post_pending_status = (Object(external_wp_compose_["compose"])(Object(external_wp_data_["withSelect"])(select => ({
- status: select('core/editor').getEditedPostAttribute('status')
- })), Object(external_wp_data_["withDispatch"])(dispatch => ({
- onUpdateStatus(status) {
- dispatch('core/editor').editPost({
- status
- });
- }
- })))(PostPendingStatus));
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-pingbacks/index.js
- /**
- * WordPress dependencies
- */
- function PostPingbacks({
- pingStatus = 'open',
- ...props
- }) {
- const onTogglePingback = () => props.editPost({
- ping_status: pingStatus === 'open' ? 'closed' : 'open'
- });
- return Object(external_wp_element_["createElement"])(external_wp_components_["CheckboxControl"], {
- label: Object(external_wp_i18n_["__"])('Allow pingbacks & trackbacks'),
- checked: pingStatus === 'open',
- onChange: onTogglePingback
- });
- }
- /* harmony default export */ var post_pingbacks = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => {
- return {
- pingStatus: select('core/editor').getEditedPostAttribute('ping_status')
- };
- }), Object(external_wp_data_["withDispatch"])(dispatch => ({
- editPost: dispatch('core/editor').editPost
- }))])(PostPingbacks));
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-button/label.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- function PublishButtonLabel({
- isPublished,
- isBeingScheduled,
- isSaving,
- isPublishing,
- hasPublishAction,
- isAutosaving,
- hasNonPostEntityChanges
- }) {
- if (isPublishing) {
- /* translators: button label text should, if possible, be under 16 characters. */
- return Object(external_wp_i18n_["__"])('Publishing…');
- } else if (isPublished && isSaving && !isAutosaving) {
- /* translators: button label text should, if possible, be under 16 characters. */
- return Object(external_wp_i18n_["__"])('Updating…');
- } else if (isBeingScheduled && isSaving && !isAutosaving) {
- /* translators: button label text should, if possible, be under 16 characters. */
- return Object(external_wp_i18n_["__"])('Scheduling…');
- }
- if (!hasPublishAction) {
- return hasNonPostEntityChanges ? Object(external_wp_i18n_["__"])('Submit for Review…') : Object(external_wp_i18n_["__"])('Submit for Review');
- } else if (isPublished) {
- return hasNonPostEntityChanges ? Object(external_wp_i18n_["__"])('Update…') : Object(external_wp_i18n_["__"])('Update');
- } else if (isBeingScheduled) {
- return hasNonPostEntityChanges ? Object(external_wp_i18n_["__"])('Schedule…') : Object(external_wp_i18n_["__"])('Schedule');
- }
- return Object(external_wp_i18n_["__"])('Publish');
- }
- /* harmony default export */ var post_publish_button_label = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])((select, {
- forceIsSaving
- }) => {
- const {
- isCurrentPostPublished,
- isEditedPostBeingScheduled,
- isSavingPost,
- isPublishingPost,
- getCurrentPost,
- getCurrentPostType,
- isAutosavingPost
- } = select('core/editor');
- return {
- isPublished: isCurrentPostPublished(),
- isBeingScheduled: isEditedPostBeingScheduled(),
- isSaving: forceIsSaving || isSavingPost(),
- isPublishing: isPublishingPost(),
- hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false),
- postType: getCurrentPostType(),
- isAutosaving: isAutosavingPost()
- };
- })])(PublishButtonLabel));
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-button/index.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- class post_publish_button_PostPublishButton extends external_wp_element_["Component"] {
- constructor(props) {
- super(props);
- this.buttonNode = Object(external_wp_element_["createRef"])();
- this.createOnClick = this.createOnClick.bind(this);
- this.closeEntitiesSavedStates = this.closeEntitiesSavedStates.bind(this);
- this.state = {
- entitiesSavedStatesCallback: false
- };
- }
- componentDidMount() {
- if (this.props.focusOnMount) {
- this.buttonNode.current.focus();
- }
- }
- createOnClick(callback) {
- return (...args) => {
- const {
- hasNonPostEntityChanges
- } = this.props;
- if (hasNonPostEntityChanges) {
- // The modal for multiple entity saving will open,
- // hold the callback for saving/publishing the post
- // so that we can call it if the post entity is checked.
- this.setState({
- entitiesSavedStatesCallback: () => callback(...args)
- }); // Open the save panel by setting its callback.
- // To set a function on the useState hook, we must set it
- // with another function (() => myFunction). Passing the
- // function on its own will cause an error when called.
- this.props.setEntitiesSavedStatesCallback(() => this.closeEntitiesSavedStates);
- return external_lodash_["noop"];
- }
- return callback(...args);
- };
- }
- closeEntitiesSavedStates(savedEntities) {
- const {
- postType,
- postId
- } = this.props;
- const {
- entitiesSavedStatesCallback
- } = this.state;
- this.setState({
- entitiesSavedStatesCallback: false
- }, () => {
- if (savedEntities && Object(external_lodash_["some"])(savedEntities, elt => elt.kind === 'postType' && elt.name === postType && elt.key === postId)) {
- // The post entity was checked, call the held callback from `createOnClick`.
- entitiesSavedStatesCallback();
- }
- });
- }
- render() {
- const {
- forceIsDirty,
- forceIsSaving,
- hasPublishAction,
- isBeingScheduled,
- isOpen,
- isPostSavingLocked,
- isPublishable,
- isPublished,
- isSaveable,
- isSaving,
- isAutoSaving,
- isToggle,
- onSave,
- onStatusChange,
- onSubmit = external_lodash_["noop"],
- onToggle,
- visibility,
- hasNonPostEntityChanges
- } = this.props;
- const isButtonDisabled = isSaving || forceIsSaving || !isSaveable || isPostSavingLocked || !isPublishable && !forceIsDirty;
- const isToggleDisabled = isPublished || isSaving || forceIsSaving || !isSaveable || !isPublishable && !forceIsDirty;
- let publishStatus;
- if (!hasPublishAction) {
- publishStatus = 'pending';
- } else if (visibility === 'private') {
- publishStatus = 'private';
- } else if (isBeingScheduled) {
- publishStatus = 'future';
- } else {
- publishStatus = 'publish';
- }
- const onClickButton = () => {
- if (isButtonDisabled) {
- return;
- }
- onSubmit();
- onStatusChange(publishStatus);
- onSave();
- };
- const onClickToggle = () => {
- if (isToggleDisabled) {
- return;
- }
- onToggle();
- };
- const buttonProps = {
- 'aria-disabled': isButtonDisabled && !hasNonPostEntityChanges,
- className: 'editor-post-publish-button',
- isBusy: !isAutoSaving && isSaving && isPublished,
- isPrimary: true,
- onClick: this.createOnClick(onClickButton)
- };
- const toggleProps = {
- 'aria-disabled': isToggleDisabled && !hasNonPostEntityChanges,
- 'aria-expanded': isOpen,
- className: 'editor-post-publish-panel__toggle',
- isBusy: isSaving && isPublished,
- isPrimary: true,
- onClick: this.createOnClick(onClickToggle)
- };
- const toggleChildren = isBeingScheduled ? Object(external_wp_i18n_["__"])('Schedule…') : Object(external_wp_i18n_["__"])('Publish');
- const buttonChildren = Object(external_wp_element_["createElement"])(post_publish_button_label, {
- forceIsSaving: forceIsSaving,
- hasNonPostEntityChanges: hasNonPostEntityChanges
- });
- const componentProps = isToggle ? toggleProps : buttonProps;
- const componentChildren = isToggle ? toggleChildren : buttonChildren;
- return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], Object(esm_extends["a" /* default */])({
- ref: this.buttonNode
- }, componentProps, {
- className: classnames_default()(componentProps.className, 'editor-post-publish-button__button', {
- 'has-changes-dot': hasNonPostEntityChanges
- })
- }), componentChildren));
- }
- }
- /* harmony default export */ var post_publish_button = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => {
- const {
- isSavingPost,
- isAutosavingPost,
- isEditedPostBeingScheduled,
- getEditedPostVisibility,
- isCurrentPostPublished,
- isEditedPostSaveable,
- isEditedPostPublishable,
- isPostSavingLocked,
- getCurrentPost,
- getCurrentPostType,
- getCurrentPostId,
- hasNonPostEntityChanges
- } = select('core/editor');
- const _isAutoSaving = isAutosavingPost();
- return {
- isSaving: isSavingPost() || _isAutoSaving,
- isAutoSaving: _isAutoSaving,
- isBeingScheduled: isEditedPostBeingScheduled(),
- visibility: getEditedPostVisibility(),
- isSaveable: isEditedPostSaveable(),
- isPostSavingLocked: isPostSavingLocked(),
- isPublishable: isEditedPostPublishable(),
- isPublished: isCurrentPostPublished(),
- hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false),
- postType: getCurrentPostType(),
- postId: getCurrentPostId(),
- hasNonPostEntityChanges: hasNonPostEntityChanges()
- };
- }), Object(external_wp_data_["withDispatch"])(dispatch => {
- const {
- editPost,
- savePost
- } = dispatch('core/editor');
- return {
- onStatusChange: status => editPost({
- status
- }, {
- undoIgnore: true
- }),
- onSave: savePost
- };
- })])(post_publish_button_PostPublishButton));
- // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/close-small.js
- var close_small = __webpack_require__("bWcr");
- // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/wordpress.js
- var wordpress = __webpack_require__("wduq");
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-visibility/utils.js
- /**
- * WordPress dependencies
- */
- const visibilityOptions = [{
- value: 'public',
- label: Object(external_wp_i18n_["__"])('Public'),
- info: Object(external_wp_i18n_["__"])('Visible to everyone.')
- }, {
- value: 'private',
- label: Object(external_wp_i18n_["__"])('Private'),
- info: Object(external_wp_i18n_["__"])('Only visible to site admins and editors.')
- }, {
- value: 'password',
- label: Object(external_wp_i18n_["__"])('Password Protected'),
- info: Object(external_wp_i18n_["__"])('Protected with a password you choose. Only those with the password can view this post.')
- }];
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-visibility/index.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- class post_visibility_PostVisibility extends external_wp_element_["Component"] {
- constructor(props) {
- super(...arguments);
- this.setPublic = this.setPublic.bind(this);
- this.setPrivate = this.setPrivate.bind(this);
- this.setPasswordProtected = this.setPasswordProtected.bind(this);
- this.updatePassword = this.updatePassword.bind(this);
- this.state = {
- hasPassword: !!props.password
- };
- }
- setPublic() {
- const {
- visibility,
- onUpdateVisibility,
- status
- } = this.props;
- onUpdateVisibility(visibility === 'private' ? 'draft' : status);
- this.setState({
- hasPassword: false
- });
- }
- setPrivate() {
- if ( // eslint-disable-next-line no-alert
- !window.confirm(Object(external_wp_i18n_["__"])('Would you like to privately publish this post now?'))) {
- return;
- }
- const {
- onUpdateVisibility,
- onSave
- } = this.props;
- onUpdateVisibility('private');
- this.setState({
- hasPassword: false
- });
- onSave();
- }
- setPasswordProtected() {
- const {
- visibility,
- onUpdateVisibility,
- status,
- password
- } = this.props;
- onUpdateVisibility(visibility === 'private' ? 'draft' : status, password || '');
- this.setState({
- hasPassword: true
- });
- }
- updatePassword(event) {
- const {
- status,
- onUpdateVisibility
- } = this.props;
- onUpdateVisibility(status, event.target.value);
- }
- render() {
- const {
- visibility,
- password,
- instanceId
- } = this.props;
- const visibilityHandlers = {
- public: {
- onSelect: this.setPublic,
- checked: visibility === 'public' && !this.state.hasPassword
- },
- private: {
- onSelect: this.setPrivate,
- checked: visibility === 'private'
- },
- password: {
- onSelect: this.setPasswordProtected,
- checked: this.state.hasPassword
- }
- };
- return [Object(external_wp_element_["createElement"])("fieldset", {
- key: "visibility-selector",
- className: "editor-post-visibility__dialog-fieldset"
- }, Object(external_wp_element_["createElement"])("legend", {
- className: "editor-post-visibility__dialog-legend"
- }, Object(external_wp_i18n_["__"])('Post Visibility')), visibilityOptions.map(({
- value,
- label,
- info
- }) => Object(external_wp_element_["createElement"])("div", {
- key: value,
- className: "editor-post-visibility__choice"
- }, Object(external_wp_element_["createElement"])("input", {
- type: "radio",
- name: `editor-post-visibility__setting-${instanceId}`,
- value: value,
- onChange: visibilityHandlers[value].onSelect,
- checked: visibilityHandlers[value].checked,
- id: `editor-post-${value}-${instanceId}`,
- "aria-describedby": `editor-post-${value}-${instanceId}-description`,
- className: "editor-post-visibility__dialog-radio"
- }), Object(external_wp_element_["createElement"])("label", {
- htmlFor: `editor-post-${value}-${instanceId}`,
- className: "editor-post-visibility__dialog-label"
- }, label), Object(external_wp_element_["createElement"])("p", {
- id: `editor-post-${value}-${instanceId}-description`,
- className: "editor-post-visibility__dialog-info"
- }, info)))), this.state.hasPassword && Object(external_wp_element_["createElement"])("div", {
- className: "editor-post-visibility__dialog-password",
- key: "password-selector"
- }, Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], {
- as: "label",
- htmlFor: `editor-post-visibility__dialog-password-input-${instanceId}`
- }, Object(external_wp_i18n_["__"])('Create password')), Object(external_wp_element_["createElement"])("input", {
- className: "editor-post-visibility__dialog-password-input",
- id: `editor-post-visibility__dialog-password-input-${instanceId}`,
- type: "text",
- onChange: this.updatePassword,
- value: password,
- placeholder: Object(external_wp_i18n_["__"])('Use a secure password')
- }))];
- }
- }
- /* harmony default export */ var post_visibility = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => {
- const {
- getEditedPostAttribute,
- getEditedPostVisibility
- } = select('core/editor');
- return {
- status: getEditedPostAttribute('status'),
- visibility: getEditedPostVisibility(),
- password: getEditedPostAttribute('password')
- };
- }), Object(external_wp_data_["withDispatch"])(dispatch => {
- const {
- savePost,
- editPost
- } = dispatch('core/editor');
- return {
- onSave: savePost,
- onUpdateVisibility(status, password = '') {
- editPost({
- status,
- password
- });
- }
- };
- }), external_wp_compose_["withInstanceId"]])(post_visibility_PostVisibility));
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-visibility/label.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function PostVisibilityLabel({
- visibility
- }) {
- const getVisibilityLabel = () => Object(external_lodash_["find"])(visibilityOptions, {
- value: visibility
- }).label;
- return getVisibilityLabel(visibility);
- }
- /* harmony default export */ var post_visibility_label = (Object(external_wp_data_["withSelect"])(select => ({
- visibility: select('core/editor').getEditedPostVisibility()
- }))(PostVisibilityLabel));
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-schedule/index.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function getDayOfTheMonth(date = new Date(), firstDay = true) {
- const d = new Date(date);
- return new Date(d.getFullYear(), d.getMonth() + (firstDay ? 0 : 1), firstDay ? 1 : 0).toISOString();
- }
- function PostSchedule() {
- const {
- postDate,
- postType
- } = Object(external_wp_data_["useSelect"])(select => ({
- postDate: select(store).getEditedPostAttribute('date'),
- postType: select(store).getCurrentPostType()
- }), []);
- const {
- editPost
- } = Object(external_wp_data_["useDispatch"])(store);
- const onUpdateDate = date => editPost({
- date
- });
- const [previewedMonth, setPreviewedMonth] = Object(external_wp_element_["useState"])(getDayOfTheMonth(postDate)); // Pick up published and schduled site posts.
- const eventsByPostType = Object(external_wp_data_["useSelect"])(select => select(external_wp_coreData_["store"]).getEntityRecords('postType', postType, {
- status: 'publish,future',
- after: getDayOfTheMonth(previewedMonth),
- before: getDayOfTheMonth(previewedMonth, false),
- exclude: [select(store).getCurrentPostId()]
- }), [previewedMonth, postType]);
- const events = Object(external_wp_element_["useMemo"])(() => (eventsByPostType || []).map(({
- title,
- type,
- date: eventDate
- }) => ({
- title: title === null || title === void 0 ? void 0 : title.rendered,
- type,
- date: new Date(eventDate)
- })), [eventsByPostType]);
- const ref = Object(external_wp_element_["useRef"])();
- const settings = Object(external_wp_date_["__experimentalGetSettings"])(); // To know if the current timezone is a 12 hour time with look for "a" in the time format
- // We also make sure this a is not escaped by a "/"
- const is12HourTime = /a(?!\\)/i.test(settings.formats.time.toLowerCase() // Test only the lower case a
- .replace(/\\\\/g, '') // Replace "//" with empty strings
- .split('').reverse().join('') // Reverse the string and test for "a" not followed by a slash
- );
- function onChange(newDate) {
- onUpdateDate(newDate);
- const {
- ownerDocument
- } = ref.current;
- ownerDocument.activeElement.blur();
- }
- return Object(external_wp_element_["createElement"])(external_wp_components_["DateTimePicker"], {
- ref: ref,
- currentDate: postDate,
- onChange: onChange,
- is12Hour: is12HourTime,
- events: events,
- onMonthPreviewed: setPreviewedMonth
- });
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-schedule/label.js
- /**
- * WordPress dependencies
- */
- function PostScheduleLabel({
- date,
- isFloating
- }) {
- const settings = Object(external_wp_date_["__experimentalGetSettings"])();
- return date && !isFloating ? Object(external_wp_date_["format"])(`${settings.formats.date} ${settings.formats.time}`, date) : Object(external_wp_i18n_["__"])('Immediately');
- }
- /* harmony default export */ var post_schedule_label = (Object(external_wp_data_["withSelect"])(select => {
- return {
- date: select('core/editor').getEditedPostAttribute('date'),
- isFloating: select('core/editor').isEditedPostDateFloating()
- };
- })(PostScheduleLabel));
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/most-used-terms.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- const MAX_MOST_USED_TERMS = 10;
- const DEFAULT_QUERY = {
- per_page: MAX_MOST_USED_TERMS,
- orderby: 'count',
- order: 'desc',
- hide_empty: true,
- _fields: 'id,name,count'
- };
- function MostUsedTerms({
- onSelect,
- taxonomy
- }) {
- const {
- _terms,
- showTerms
- } = Object(external_wp_data_["useSelect"])(select => {
- const mostUsedTerms = select(external_wp_coreData_["store"]).getEntityRecords('taxonomy', taxonomy.slug, DEFAULT_QUERY);
- return {
- _terms: mostUsedTerms,
- showTerms: (mostUsedTerms === null || mostUsedTerms === void 0 ? void 0 : mostUsedTerms.length) >= MAX_MOST_USED_TERMS
- };
- }, []);
- if (!showTerms) {
- return null;
- }
- const terms = unescapeTerms(_terms);
- const label = Object(external_lodash_["get"])(taxonomy, ['labels', 'most_used']);
- return Object(external_wp_element_["createElement"])("div", {
- className: "editor-post-taxonomies__flat-term-most-used"
- }, Object(external_wp_element_["createElement"])("h3", {
- className: "editor-post-taxonomies__flat-term-most-used-label"
- }, label), Object(external_wp_element_["createElement"])("ul", {
- role: "list",
- className: "editor-post-taxonomies__flat-term-most-used-list"
- }, terms.map(term => Object(external_wp_element_["createElement"])("li", {
- key: term.id
- }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
- isLink: true,
- onClick: () => onSelect(term)
- }, term.name)))));
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/flat-term-selector.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- /**
- * Module constants
- */
- const MAX_TERMS_SUGGESTIONS = 20;
- const flat_term_selector_DEFAULT_QUERY = {
- per_page: MAX_TERMS_SUGGESTIONS,
- orderby: 'count',
- order: 'desc',
- _fields: 'id,name,count'
- };
- const isSameTermName = (termA, termB) => unescapeString(termA).toLowerCase() === unescapeString(termB).toLowerCase();
- const termNamesToIds = (names, terms) => {
- return names.map(termName => Object(external_lodash_["find"])(terms, term => isSameTermName(term.name, termName)).id);
- };
- class flat_term_selector_FlatTermSelector extends external_wp_element_["Component"] {
- constructor() {
- super(...arguments);
- this.onChange = this.onChange.bind(this);
- this.searchTerms = Object(external_lodash_["debounce"])(this.searchTerms.bind(this), 500);
- this.findOrCreateTerm = this.findOrCreateTerm.bind(this);
- this.appendTerm = this.appendTerm.bind(this);
- this.state = {
- loading: !Object(external_lodash_["isEmpty"])(this.props.terms),
- availableTerms: [],
- selectedTerms: []
- };
- }
- componentDidMount() {
- if (!Object(external_lodash_["isEmpty"])(this.props.terms)) {
- this.initRequest = this.fetchTerms({
- include: this.props.terms.join(','),
- per_page: -1
- });
- this.initRequest.then(() => {
- this.setState({
- loading: false
- });
- }, xhr => {
- if (xhr.statusText === 'abort') {
- return;
- }
- this.setState({
- loading: false
- });
- });
- }
- }
- componentWillUnmount() {
- Object(external_lodash_["invoke"])(this.initRequest, ['abort']);
- Object(external_lodash_["invoke"])(this.searchRequest, ['abort']);
- }
- componentDidUpdate(prevProps) {
- if (prevProps.terms !== this.props.terms) {
- this.updateSelectedTerms(this.props.terms);
- }
- }
- fetchTerms(params = {}) {
- const {
- taxonomy
- } = this.props;
- const query = { ...flat_term_selector_DEFAULT_QUERY,
- ...params
- };
- const request = external_wp_apiFetch_default()({
- path: Object(external_wp_url_["addQueryArgs"])(`/wp/v2/${taxonomy.rest_base}`, query)
- });
- request.then(unescapeTerms).then(terms => {
- this.setState(state => ({
- availableTerms: state.availableTerms.concat(terms.filter(term => !Object(external_lodash_["find"])(state.availableTerms, availableTerm => availableTerm.id === term.id)))
- }));
- this.updateSelectedTerms(this.props.terms);
- });
- return request;
- }
- updateSelectedTerms(terms = []) {
- const selectedTerms = terms.reduce((accumulator, termId) => {
- const termObject = Object(external_lodash_["find"])(this.state.availableTerms, term => term.id === termId);
- if (termObject) {
- accumulator.push(termObject.name);
- }
- return accumulator;
- }, []);
- this.setState({
- selectedTerms
- });
- }
- findOrCreateTerm(termName) {
- const {
- taxonomy
- } = this.props;
- const termNameEscaped = Object(external_lodash_["escape"])(termName); // Tries to create a term or fetch it if it already exists.
- return external_wp_apiFetch_default()({
- path: `/wp/v2/${taxonomy.rest_base}`,
- method: 'POST',
- data: {
- name: termNameEscaped
- }
- }).catch(error => {
- const errorCode = error.code;
- if (errorCode === 'term_exists') {
- // If the terms exist, fetch it instead of creating a new one.
- this.addRequest = external_wp_apiFetch_default()({
- path: Object(external_wp_url_["addQueryArgs"])(`/wp/v2/${taxonomy.rest_base}`, { ...flat_term_selector_DEFAULT_QUERY,
- search: termNameEscaped
- })
- }).then(unescapeTerms);
- return this.addRequest.then(searchResult => {
- return Object(external_lodash_["find"])(searchResult, result => isSameTermName(result.name, termName));
- });
- }
- return Promise.reject(error);
- }).then(unescapeTerm);
- }
- onChange(termNames) {
- const uniqueTerms = Object(external_lodash_["uniqBy"])(termNames, term => term.toLowerCase());
- this.setState({
- selectedTerms: uniqueTerms
- });
- const newTermNames = uniqueTerms.filter(termName => !Object(external_lodash_["find"])(this.state.availableTerms, term => isSameTermName(term.name, termName)));
- if (newTermNames.length === 0) {
- return this.props.onUpdateTerms(termNamesToIds(uniqueTerms, this.state.availableTerms), this.props.taxonomy.rest_base);
- }
- Promise.all(newTermNames.map(this.findOrCreateTerm)).then(newTerms => {
- const newAvailableTerms = this.state.availableTerms.concat(newTerms);
- this.setState({
- availableTerms: newAvailableTerms
- });
- return this.props.onUpdateTerms(termNamesToIds(uniqueTerms, newAvailableTerms), this.props.taxonomy.rest_base);
- });
- }
- searchTerms(search = '') {
- Object(external_lodash_["invoke"])(this.searchRequest, ['abort']);
- if (search.length >= 3) {
- this.searchRequest = this.fetchTerms({
- search
- });
- }
- }
- appendTerm(newTerm) {
- const {
- onUpdateTerms,
- taxonomy,
- terms = [],
- slug,
- speak
- } = this.props;
- if (terms.includes(newTerm.id)) {
- return;
- }
- const newTerms = [...terms, newTerm.id];
- const termAddedMessage = Object(external_wp_i18n_["sprintf"])(
- /* translators: %s: term name. */
- Object(external_wp_i18n_["_x"])('%s added', 'term'), Object(external_lodash_["get"])(taxonomy, ['labels', 'singular_name'], slug === 'post_tag' ? Object(external_wp_i18n_["__"])('Tag') : Object(external_wp_i18n_["__"])('Term')));
- speak(termAddedMessage, 'assertive');
- this.setState({
- availableTerms: [...this.state.availableTerms, newTerm]
- });
- onUpdateTerms(newTerms, taxonomy.rest_base);
- }
- render() {
- const {
- slug,
- taxonomy,
- hasAssignAction
- } = this.props;
- if (!hasAssignAction) {
- return null;
- }
- const {
- loading,
- availableTerms,
- selectedTerms
- } = this.state;
- const termNames = availableTerms.map(term => term.name);
- const newTermLabel = Object(external_lodash_["get"])(taxonomy, ['labels', 'add_new_item'], slug === 'post_tag' ? Object(external_wp_i18n_["__"])('Add new tag') : Object(external_wp_i18n_["__"])('Add new Term'));
- const singularName = Object(external_lodash_["get"])(taxonomy, ['labels', 'singular_name'], slug === 'post_tag' ? Object(external_wp_i18n_["__"])('Tag') : Object(external_wp_i18n_["__"])('Term'));
- const termAddedLabel = Object(external_wp_i18n_["sprintf"])(
- /* translators: %s: term name. */
- Object(external_wp_i18n_["_x"])('%s added', 'term'), singularName);
- const termRemovedLabel = Object(external_wp_i18n_["sprintf"])(
- /* translators: %s: term name. */
- Object(external_wp_i18n_["_x"])('%s removed', 'term'), singularName);
- const removeTermLabel = Object(external_wp_i18n_["sprintf"])(
- /* translators: %s: term name. */
- Object(external_wp_i18n_["_x"])('Remove %s', 'term'), singularName);
- return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["FormTokenField"], {
- value: selectedTerms,
- suggestions: termNames,
- onChange: this.onChange,
- onInputChange: this.searchTerms,
- maxSuggestions: MAX_TERMS_SUGGESTIONS,
- disabled: loading,
- label: newTermLabel,
- messages: {
- added: termAddedLabel,
- removed: termRemovedLabel,
- remove: removeTermLabel
- }
- }), Object(external_wp_element_["createElement"])(MostUsedTerms, {
- taxonomy: taxonomy,
- onSelect: this.appendTerm
- }));
- }
- }
- /* harmony default export */ var flat_term_selector = (Object(external_wp_compose_["compose"])(Object(external_wp_data_["withSelect"])((select, {
- slug
- }) => {
- const {
- getCurrentPost
- } = select(store);
- const {
- getTaxonomy
- } = select(external_wp_coreData_["store"]);
- const taxonomy = getTaxonomy(slug);
- return {
- hasCreateAction: taxonomy ? Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-create-' + taxonomy.rest_base], false) : false,
- hasAssignAction: taxonomy ? Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-assign-' + taxonomy.rest_base], false) : false,
- terms: taxonomy ? select(store).getEditedPostAttribute(taxonomy.rest_base) : [],
- taxonomy
- };
- }), Object(external_wp_data_["withDispatch"])(dispatch => {
- return {
- onUpdateTerms(terms, restBase) {
- dispatch(store).editPost({
- [restBase]: terms
- });
- }
- };
- }), external_wp_components_["withSpokenMessages"], Object(external_wp_components_["withFilters"])('editor.PostTaxonomyType'))(flat_term_selector_FlatTermSelector));
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/maybe-tags-panel.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- const TagsPanel = () => {
- const panelBodyTitle = [Object(external_wp_i18n_["__"])('Suggestion:'), Object(external_wp_element_["createElement"])("span", {
- className: "editor-post-publish-panel__link",
- key: "label"
- }, Object(external_wp_i18n_["__"])('Add tags'))];
- return Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], {
- initialOpen: false,
- title: panelBodyTitle
- }, Object(external_wp_element_["createElement"])("p", null, Object(external_wp_i18n_["__"])('Tags help users and search engines navigate your site and find your content. Add a few keywords to describe your post.')), Object(external_wp_element_["createElement"])(flat_term_selector, {
- slug: 'post_tag'
- }));
- };
- class maybe_tags_panel_MaybeTagsPanel extends external_wp_element_["Component"] {
- constructor(props) {
- super(props);
- this.state = {
- hadTagsWhenOpeningThePanel: props.hasTags
- };
- }
- /*
- * We only want to show the tag panel if the post didn't have
- * any tags when the user hit the Publish button.
- *
- * We can't use the prop.hasTags because it'll change to true
- * if the user adds a new tag within the pre-publish panel.
- * This would force a re-render and a new prop.hasTags check,
- * hiding this panel and keeping the user from adding
- * more than one tag.
- */
- render() {
- if (!this.state.hadTagsWhenOpeningThePanel) {
- return Object(external_wp_element_["createElement"])(TagsPanel, null);
- }
- return null;
- }
- }
- /* harmony default export */ var maybe_tags_panel = (Object(external_wp_compose_["compose"])(Object(external_wp_data_["withSelect"])(select => {
- const postType = select('core/editor').getCurrentPostType();
- const tagsTaxonomy = select('core').getTaxonomy('post_tag');
- const tags = tagsTaxonomy && select('core/editor').getEditedPostAttribute(tagsTaxonomy.rest_base);
- return {
- areTagsFetched: tagsTaxonomy !== undefined,
- isPostTypeSupported: tagsTaxonomy && Object(external_lodash_["some"])(tagsTaxonomy.types, type => type === postType),
- hasTags: tags && tags.length
- };
- }), Object(external_wp_compose_["ifCondition"])(({
- areTagsFetched,
- isPostTypeSupported
- }) => isPostTypeSupported && areTagsFetched))(maybe_tags_panel_MaybeTagsPanel));
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/maybe-post-format-panel.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- const getSuggestion = (supportedFormats, suggestedPostFormat) => {
- const formats = POST_FORMATS.filter(format => Object(external_lodash_["includes"])(supportedFormats, format.id));
- return Object(external_lodash_["find"])(formats, format => format.id === suggestedPostFormat);
- };
- const PostFormatSuggestion = ({
- suggestedPostFormat,
- suggestionText,
- onUpdatePostFormat
- }) => Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
- isLink: true,
- onClick: () => onUpdatePostFormat(suggestedPostFormat)
- }, suggestionText);
- function PostFormatPanel() {
- const {
- currentPostFormat,
- suggestion
- } = Object(external_wp_data_["useSelect"])(select => {
- const {
- getEditedPostAttribute,
- getSuggestedPostFormat
- } = select('core/editor');
- const supportedFormats = Object(external_lodash_["get"])(select('core').getThemeSupports(), ['formats'], []);
- return {
- currentPostFormat: getEditedPostAttribute('format'),
- suggestion: getSuggestion(supportedFormats, getSuggestedPostFormat())
- };
- }, []);
- const {
- editPost
- } = Object(external_wp_data_["useDispatch"])('core/editor');
- const onUpdatePostFormat = format => editPost({
- format
- });
- const panelBodyTitle = [Object(external_wp_i18n_["__"])('Suggestion:'), Object(external_wp_element_["createElement"])("span", {
- className: "editor-post-publish-panel__link",
- key: "label"
- }, Object(external_wp_i18n_["__"])('Use a post format'))];
- if (!suggestion || suggestion.id === currentPostFormat) {
- return null;
- }
- return Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], {
- initialOpen: false,
- title: panelBodyTitle
- }, Object(external_wp_element_["createElement"])("p", null, Object(external_wp_i18n_["__"])('Your theme uses post formats to highlight different kinds of content, like images or videos. Apply a post format to see this special styling.')), Object(external_wp_element_["createElement"])("p", null, Object(external_wp_element_["createElement"])(PostFormatSuggestion, {
- onUpdatePostFormat: onUpdatePostFormat,
- suggestedPostFormat: suggestion.id,
- suggestionText: Object(external_wp_i18n_["sprintf"])(
- /* translators: %s: post format */
- Object(external_wp_i18n_["__"])('Apply the "%1$s" format.'), suggestion.caption)
- })));
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/prepublish.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function PostPublishPanelPrepublish({
- children
- }) {
- const {
- isBeingScheduled,
- isRequestingSiteIcon,
- hasPublishAction,
- siteIconUrl,
- siteTitle,
- siteHome
- } = Object(external_wp_data_["useSelect"])(select => {
- const {
- isResolving
- } = select('core/data');
- const {
- getCurrentPost,
- isEditedPostBeingScheduled
- } = select('core/editor');
- const {
- getEntityRecord
- } = select('core');
- const siteData = getEntityRecord('root', '__unstableBase', undefined) || {};
- return {
- hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false),
- isBeingScheduled: isEditedPostBeingScheduled(),
- isRequestingSiteIcon: isResolving('core', 'getEntityRecord', ['root', '__unstableBase', undefined]),
- siteIconUrl: siteData.site_icon_url,
- siteTitle: siteData.name,
- siteHome: siteData.home && Object(external_wp_url_["filterURLForDisplay"])(siteData.home)
- };
- }, []);
- let siteIcon = Object(external_wp_element_["createElement"])(external_wp_components_["Icon"], {
- className: "components-site-icon",
- size: "36px",
- icon: wordpress["a" /* default */]
- });
- if (siteIconUrl) {
- siteIcon = Object(external_wp_element_["createElement"])("img", {
- alt: Object(external_wp_i18n_["__"])('Site Icon'),
- className: "components-site-icon",
- src: siteIconUrl
- });
- }
- if (isRequestingSiteIcon) {
- siteIcon = null;
- }
- let prePublishTitle, prePublishBodyText;
- if (!hasPublishAction) {
- prePublishTitle = Object(external_wp_i18n_["__"])('Are you ready to submit for review?');
- prePublishBodyText = Object(external_wp_i18n_["__"])('When you’re ready, submit your work for review, and an Editor will be able to approve it for you.');
- } else if (isBeingScheduled) {
- prePublishTitle = Object(external_wp_i18n_["__"])('Are you ready to schedule?');
- prePublishBodyText = Object(external_wp_i18n_["__"])('Your work will be published at the specified date and time.');
- } else {
- prePublishTitle = Object(external_wp_i18n_["__"])('Are you ready to publish?');
- prePublishBodyText = Object(external_wp_i18n_["__"])('Double-check your settings before publishing.');
- }
- return Object(external_wp_element_["createElement"])("div", {
- className: "editor-post-publish-panel__prepublish"
- }, Object(external_wp_element_["createElement"])("div", null, Object(external_wp_element_["createElement"])("strong", null, prePublishTitle)), Object(external_wp_element_["createElement"])("p", null, prePublishBodyText), Object(external_wp_element_["createElement"])("div", {
- className: "components-site-card"
- }, siteIcon, Object(external_wp_element_["createElement"])("div", {
- className: "components-site-info"
- }, Object(external_wp_element_["createElement"])("span", {
- className: "components-site-name"
- }, siteTitle || Object(external_wp_i18n_["__"])('(Untitled)')), Object(external_wp_element_["createElement"])("span", {
- className: "components-site-home"
- }, siteHome))), hasPublishAction && Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], {
- initialOpen: false,
- title: [Object(external_wp_i18n_["__"])('Visibility:'), Object(external_wp_element_["createElement"])("span", {
- className: "editor-post-publish-panel__link",
- key: "label"
- }, Object(external_wp_element_["createElement"])(post_visibility_label, null))]
- }, Object(external_wp_element_["createElement"])(post_visibility, null)), Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], {
- initialOpen: false,
- title: [Object(external_wp_i18n_["__"])('Publish:'), Object(external_wp_element_["createElement"])("span", {
- className: "editor-post-publish-panel__link",
- key: "label"
- }, Object(external_wp_element_["createElement"])(post_schedule_label, null))]
- }, Object(external_wp_element_["createElement"])(PostSchedule, null))), Object(external_wp_element_["createElement"])(PostFormatPanel, null), Object(external_wp_element_["createElement"])(maybe_tags_panel, null), children);
- }
- /* harmony default export */ var prepublish = (PostPublishPanelPrepublish);
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/postpublish.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- const POSTNAME = '%postname%';
- /**
- * Returns URL for a future post.
- *
- * @param {Object} post Post object.
- *
- * @return {string} PostPublish URL.
- */
- const getFuturePostUrl = post => {
- const {
- slug
- } = post;
- if (post.permalink_template.includes(POSTNAME)) {
- return post.permalink_template.replace(POSTNAME, slug);
- }
- return post.permalink_template;
- };
- function postpublish_CopyButton({
- text,
- onCopy,
- children
- }) {
- const ref = Object(external_wp_compose_["useCopyToClipboard"])(text, onCopy);
- return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
- isSecondary: true,
- ref: ref
- }, children);
- }
- class postpublish_PostPublishPanelPostpublish extends external_wp_element_["Component"] {
- constructor() {
- super(...arguments);
- this.state = {
- showCopyConfirmation: false
- };
- this.onCopy = this.onCopy.bind(this);
- this.onSelectInput = this.onSelectInput.bind(this);
- this.postLink = Object(external_wp_element_["createRef"])();
- }
- componentDidMount() {
- if (this.props.focusOnMount) {
- this.postLink.current.focus();
- }
- }
- componentWillUnmount() {
- clearTimeout(this.dismissCopyConfirmation);
- }
- onCopy() {
- this.setState({
- showCopyConfirmation: true
- });
- clearTimeout(this.dismissCopyConfirmation);
- this.dismissCopyConfirmation = setTimeout(() => {
- this.setState({
- showCopyConfirmation: false
- });
- }, 4000);
- }
- onSelectInput(event) {
- event.target.select();
- }
- render() {
- const {
- children,
- isScheduled,
- post,
- postType
- } = this.props;
- const postLabel = Object(external_lodash_["get"])(postType, ['labels', 'singular_name']);
- const viewPostLabel = Object(external_lodash_["get"])(postType, ['labels', 'view_item']);
- const link = post.status === 'future' ? getFuturePostUrl(post) : post.link;
- const postPublishNonLinkHeader = isScheduled ? Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_i18n_["__"])('is now scheduled. It will go live on'), ' ', Object(external_wp_element_["createElement"])(post_schedule_label, null), ".") : Object(external_wp_i18n_["__"])('is now live.');
- return Object(external_wp_element_["createElement"])("div", {
- className: "post-publish-panel__postpublish"
- }, Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], {
- className: "post-publish-panel__postpublish-header"
- }, Object(external_wp_element_["createElement"])("a", {
- ref: this.postLink,
- href: link
- }, Object(external_wp_htmlEntities_["decodeEntities"])(post.title) || Object(external_wp_i18n_["__"])('(no title)')), ' ', postPublishNonLinkHeader), Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], null, Object(external_wp_element_["createElement"])("p", {
- className: "post-publish-panel__postpublish-subheader"
- }, Object(external_wp_element_["createElement"])("strong", null, Object(external_wp_i18n_["__"])('What’s next?'))), Object(external_wp_element_["createElement"])(external_wp_components_["TextControl"], {
- className: "post-publish-panel__postpublish-post-address",
- readOnly: true,
- label: Object(external_wp_i18n_["sprintf"])(
- /* translators: %s: post type singular name */
- Object(external_wp_i18n_["__"])('%s address'), postLabel),
- value: Object(external_wp_url_["safeDecodeURIComponent"])(link),
- onFocus: this.onSelectInput
- }), Object(external_wp_element_["createElement"])("div", {
- className: "post-publish-panel__postpublish-buttons"
- }, !isScheduled && Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
- isSecondary: true,
- href: link
- }, viewPostLabel), Object(external_wp_element_["createElement"])(postpublish_CopyButton, {
- text: link,
- onCopy: this.onCopy
- }, this.state.showCopyConfirmation ? Object(external_wp_i18n_["__"])('Copied!') : Object(external_wp_i18n_["__"])('Copy Link')))), children);
- }
- }
- /* harmony default export */ var postpublish = (Object(external_wp_data_["withSelect"])(select => {
- const {
- getEditedPostAttribute,
- getCurrentPost,
- isCurrentPostScheduled
- } = select('core/editor');
- const {
- getPostType
- } = select('core');
- return {
- post: getCurrentPost(),
- postType: getPostType(getEditedPostAttribute('type')),
- isScheduled: isCurrentPostScheduled()
- };
- })(postpublish_PostPublishPanelPostpublish));
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-publish-panel/index.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- class post_publish_panel_PostPublishPanel extends external_wp_element_["Component"] {
- constructor() {
- super(...arguments);
- this.onSubmit = this.onSubmit.bind(this);
- }
- componentDidUpdate(prevProps) {
- // Automatically collapse the publish sidebar when a post
- // is published and the user makes an edit.
- if (prevProps.isPublished && !this.props.isSaving && this.props.isDirty) {
- this.props.onClose();
- }
- }
- onSubmit() {
- const {
- onClose,
- hasPublishAction,
- isPostTypeViewable
- } = this.props;
- if (!hasPublishAction || !isPostTypeViewable) {
- onClose();
- }
- }
- render() {
- const {
- forceIsDirty,
- forceIsSaving,
- isBeingScheduled,
- isPublished,
- isPublishSidebarEnabled,
- isScheduled,
- isSaving,
- onClose,
- onTogglePublishSidebar,
- PostPublishExtension,
- PrePublishExtension,
- ...additionalProps
- } = this.props;
- const propsForPanel = Object(external_lodash_["omit"])(additionalProps, ['hasPublishAction', 'isDirty', 'isPostTypeViewable']);
- const isPublishedOrScheduled = isPublished || isScheduled && isBeingScheduled;
- const isPrePublish = !isPublishedOrScheduled && !isSaving;
- const isPostPublish = isPublishedOrScheduled && !isSaving;
- return Object(external_wp_element_["createElement"])("div", Object(esm_extends["a" /* default */])({
- className: "editor-post-publish-panel"
- }, propsForPanel), Object(external_wp_element_["createElement"])("div", {
- className: "editor-post-publish-panel__header"
- }, isPostPublish ? Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
- onClick: onClose,
- icon: close_small["a" /* default */],
- label: Object(external_wp_i18n_["__"])('Close panel')
- }) : Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("div", {
- className: "editor-post-publish-panel__header-publish-button"
- }, Object(external_wp_element_["createElement"])(post_publish_button, {
- focusOnMount: true,
- onSubmit: this.onSubmit,
- forceIsDirty: forceIsDirty,
- forceIsSaving: forceIsSaving
- })), Object(external_wp_element_["createElement"])("div", {
- className: "editor-post-publish-panel__header-cancel-button"
- }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
- onClick: onClose,
- isSecondary: true
- }, Object(external_wp_i18n_["__"])('Cancel'))))), Object(external_wp_element_["createElement"])("div", {
- className: "editor-post-publish-panel__content"
- }, isPrePublish && Object(external_wp_element_["createElement"])(prepublish, null, PrePublishExtension && Object(external_wp_element_["createElement"])(PrePublishExtension, null)), isPostPublish && Object(external_wp_element_["createElement"])(postpublish, {
- focusOnMount: true
- }, PostPublishExtension && Object(external_wp_element_["createElement"])(PostPublishExtension, null)), isSaving && Object(external_wp_element_["createElement"])(external_wp_components_["Spinner"], null)), Object(external_wp_element_["createElement"])("div", {
- className: "editor-post-publish-panel__footer"
- }, Object(external_wp_element_["createElement"])(external_wp_components_["CheckboxControl"], {
- label: Object(external_wp_i18n_["__"])('Always show pre-publish checks.'),
- checked: isPublishSidebarEnabled,
- onChange: onTogglePublishSidebar
- })));
- }
- }
- /* harmony default export */ var post_publish_panel = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => {
- const {
- getPostType
- } = select('core');
- const {
- getCurrentPost,
- getEditedPostAttribute,
- isCurrentPostPublished,
- isCurrentPostScheduled,
- isEditedPostBeingScheduled,
- isEditedPostDirty,
- isSavingPost
- } = select('core/editor');
- const {
- isPublishSidebarEnabled
- } = select('core/editor');
- const postType = getPostType(getEditedPostAttribute('type'));
- return {
- hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false),
- isPostTypeViewable: Object(external_lodash_["get"])(postType, ['viewable'], false),
- isBeingScheduled: isEditedPostBeingScheduled(),
- isDirty: isEditedPostDirty(),
- isPublished: isCurrentPostPublished(),
- isPublishSidebarEnabled: isPublishSidebarEnabled(),
- isSaving: isSavingPost(),
- isScheduled: isCurrentPostScheduled()
- };
- }), Object(external_wp_data_["withDispatch"])((dispatch, {
- isPublishSidebarEnabled
- }) => {
- const {
- disablePublishSidebar,
- enablePublishSidebar
- } = dispatch('core/editor');
- return {
- onTogglePublishSidebar: () => {
- if (isPublishSidebarEnabled) {
- disablePublishSidebar();
- } else {
- enablePublishSidebar();
- }
- }
- };
- }), external_wp_components_["withFocusReturn"], external_wp_components_["withConstrainedTabbing"]])(post_publish_panel_PostPublishPanel));
- // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/icon/index.js
- var build_module_icon = __webpack_require__("iClF");
- // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/cloud.js
- /**
- * WordPress dependencies
- */
- const cloud = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
- }, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], {
- d: "M17.3 10.1c0-2.5-2.1-4.4-4.8-4.4-2.2 0-4.1 1.4-4.6 3.3h-.2C5.7 9 4 10.7 4 12.8c0 2.1 1.7 3.8 3.7 3.8h9c1.8 0 3.2-1.5 3.2-3.3.1-1.6-1.1-2.9-2.6-3.2zm-.5 5.1h-9c-1.2 0-2.2-1.1-2.2-2.3s1-2.4 2.2-2.4h1.3l.3-1.1c.4-1.3 1.7-2.2 3.2-2.2 1.8 0 3.3 1.3 3.3 2.9v1.3l1.3.2c.8.1 1.4.9 1.4 1.8-.1 1-.9 1.8-1.8 1.8z"
- }));
- /* harmony default export */ var library_cloud = (cloud);
- // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/check.js
- var library_check = __webpack_require__("RMJe");
- // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/cloud-upload.js
- /**
- * WordPress dependencies
- */
- const cloudUpload = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
- }, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], {
- d: "M17.3 10.1c0-2.5-2.1-4.4-4.8-4.4-2.2 0-4.1 1.4-4.6 3.3h-.2C5.7 9 4 10.7 4 12.8c0 2.1 1.7 3.8 3.7 3.8h9c1.8 0 3.2-1.5 3.2-3.3.1-1.6-1.1-2.9-2.6-3.2zm-.5 5.1h-4v-2.4L14 14l1-1-3-3-3 3 1 1 1.2-1.2v2.4H7.7c-1.2 0-2.2-1.1-2.2-2.3s1-2.4 2.2-2.4H9l.3-1.1c.4-1.3 1.7-2.2 3.2-2.2 1.8 0 3.3 1.3 3.3 2.9v1.3l1.3.2c.8.1 1.4.9 1.4 1.8 0 1-.8 1.8-1.7 1.8z"
- }));
- /* harmony default export */ var cloud_upload = (cloudUpload);
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-switch-to-draft-button/index.js
- /**
- * WordPress dependencies
- */
- function PostSwitchToDraftButton({
- isSaving,
- isPublished,
- isScheduled,
- onClick
- }) {
- const isMobileViewport = Object(external_wp_compose_["useViewportMatch"])('small', '<');
- if (!isPublished && !isScheduled) {
- return null;
- }
- const onSwitch = () => {
- let alertMessage;
- if (isPublished) {
- alertMessage = Object(external_wp_i18n_["__"])('Are you sure you want to unpublish this post?');
- } else if (isScheduled) {
- alertMessage = Object(external_wp_i18n_["__"])('Are you sure you want to unschedule this post?');
- } // eslint-disable-next-line no-alert
- if (window.confirm(alertMessage)) {
- onClick();
- }
- };
- return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
- className: "editor-post-switch-to-draft",
- onClick: onSwitch,
- disabled: isSaving,
- isTertiary: true
- }, isMobileViewport ? Object(external_wp_i18n_["__"])('Draft') : Object(external_wp_i18n_["__"])('Switch to draft'));
- }
- /* harmony default export */ var post_switch_to_draft_button = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => {
- const {
- isSavingPost,
- isCurrentPostPublished,
- isCurrentPostScheduled
- } = select('core/editor');
- return {
- isSaving: isSavingPost(),
- isPublished: isCurrentPostPublished(),
- isScheduled: isCurrentPostScheduled()
- };
- }), Object(external_wp_data_["withDispatch"])(dispatch => {
- const {
- editPost,
- savePost
- } = dispatch('core/editor');
- return {
- onClick: () => {
- editPost({
- status: 'draft'
- });
- savePost();
- }
- };
- })])(PostSwitchToDraftButton));
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-saved-state/index.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- /**
- * Component showing whether the post is saved or not and providing save
- * buttons.
- *
- * @param {Object} props Component props.
- * @param {?boolean} props.forceIsDirty Whether to force the post to be marked
- * as dirty.
- * @param {?boolean} props.forceIsSaving Whether to force the post to be marked
- * as being saved.
- * @param {?boolean} props.showIconLabels Whether interface buttons show labels instead of icons
- * @return {import('@wordpress/element').WPComponent} The component.
- */
- function PostSavedState({
- forceIsDirty,
- forceIsSaving,
- showIconLabels = false
- }) {
- const [forceSavedMessage, setForceSavedMessage] = Object(external_wp_element_["useState"])(false);
- const isLargeViewport = Object(external_wp_compose_["useViewportMatch"])('small');
- const {
- isAutosaving,
- isDirty,
- isNew,
- isPending,
- isPublished,
- isSaveable,
- isSaving,
- isScheduled,
- hasPublishAction
- } = Object(external_wp_data_["useSelect"])(select => {
- var _getCurrentPost$_link, _getCurrentPost, _getCurrentPost$_link2;
- const {
- isEditedPostNew,
- isCurrentPostPublished,
- isCurrentPostScheduled,
- isEditedPostDirty,
- isSavingPost,
- isEditedPostSaveable,
- getCurrentPost,
- isAutosavingPost,
- getEditedPostAttribute
- } = select('core/editor');
- return {
- isAutosaving: isAutosavingPost(),
- isDirty: forceIsDirty || isEditedPostDirty(),
- isNew: isEditedPostNew(),
- isPending: 'pending' === getEditedPostAttribute('status'),
- isPublished: isCurrentPostPublished(),
- isSaving: forceIsSaving || isSavingPost(),
- isSaveable: isEditedPostSaveable(),
- isScheduled: isCurrentPostScheduled(),
- hasPublishAction: (_getCurrentPost$_link = (_getCurrentPost = getCurrentPost()) === null || _getCurrentPost === void 0 ? void 0 : (_getCurrentPost$_link2 = _getCurrentPost._links) === null || _getCurrentPost$_link2 === void 0 ? void 0 : _getCurrentPost$_link2['wp:action-publish']) !== null && _getCurrentPost$_link !== void 0 ? _getCurrentPost$_link : false
- };
- }, [forceIsDirty, forceIsSaving]);
- const {
- savePost
- } = Object(external_wp_data_["useDispatch"])('core/editor');
- const wasSaving = Object(external_wp_compose_["usePrevious"])(isSaving);
- Object(external_wp_element_["useEffect"])(() => {
- let timeoutId;
- if (wasSaving && !isSaving) {
- setForceSavedMessage(true);
- timeoutId = setTimeout(() => {
- setForceSavedMessage(false);
- }, 1000);
- }
- return () => clearTimeout(timeoutId);
- }, [isSaving]);
- if (isSaving) {
- // TODO: Classes generation should be common across all return
- // paths of this function, including proper naming convention for
- // the "Save Draft" button.
- const classes = classnames_default()('editor-post-saved-state', 'is-saving', Object(external_wp_components_["__unstableGetAnimateClassName"])({
- type: 'loading'
- }), {
- 'is-autosaving': isAutosaving
- });
- return Object(external_wp_element_["createElement"])("span", {
- className: classes
- }, Object(external_wp_element_["createElement"])(build_module_icon["a" /* default */], {
- icon: library_cloud
- }), isAutosaving ? Object(external_wp_i18n_["__"])('Autosaving') : Object(external_wp_i18n_["__"])('Saving'));
- }
- if (isPublished || isScheduled) {
- return Object(external_wp_element_["createElement"])(post_switch_to_draft_button, null);
- }
- if (!isSaveable) {
- return null;
- }
- if (forceSavedMessage || !isNew && !isDirty) {
- return Object(external_wp_element_["createElement"])("span", {
- className: "editor-post-saved-state is-saved"
- }, Object(external_wp_element_["createElement"])(build_module_icon["a" /* default */], {
- icon: library_check["a" /* default */]
- }), Object(external_wp_i18n_["__"])('Saved'));
- } // Once the post has been submitted for review this button
- // is not needed for the contributor role.
- if (!hasPublishAction && isPending) {
- return null;
- }
- /* translators: button label text should, if possible, be under 16 characters. */
- const label = isPending ? Object(external_wp_i18n_["__"])('Save as pending') : Object(external_wp_i18n_["__"])('Save draft');
- /* translators: button label text should, if possible, be under 16 characters. */
- const shortLabel = Object(external_wp_i18n_["__"])('Save');
- if (!isLargeViewport) {
- return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
- className: "editor-post-save-draft",
- label: label,
- onClick: () => savePost(),
- shortcut: external_wp_keycodes_["displayShortcut"].primary('s'),
- icon: cloud_upload
- }, showIconLabels && shortLabel);
- }
- return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
- className: "editor-post-save-draft",
- onClick: () => savePost(),
- shortcut: external_wp_keycodes_["displayShortcut"].primary('s'),
- isTertiary: true
- }, label);
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-schedule/check.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- function PostScheduleCheck({
- hasPublishAction,
- children
- }) {
- if (!hasPublishAction) {
- return null;
- }
- return children;
- }
- /* harmony default export */ var post_schedule_check = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => {
- const {
- getCurrentPost,
- getCurrentPostType
- } = select('core/editor');
- return {
- hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false),
- postType: getCurrentPostType()
- };
- })])(PostScheduleCheck));
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-slug/check.js
- /**
- * Internal dependencies
- */
- function PostSlugCheck({
- children
- }) {
- return Object(external_wp_element_["createElement"])(post_type_support_check, {
- supportKeys: "slug"
- }, children);
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-slug/index.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- class post_slug_PostSlug extends external_wp_element_["Component"] {
- constructor({
- postSlug,
- postTitle,
- postID
- }) {
- super(...arguments);
- this.state = {
- editedSlug: Object(external_wp_url_["safeDecodeURIComponent"])(postSlug) || cleanForSlug(postTitle) || postID
- };
- this.setSlug = this.setSlug.bind(this);
- }
- setSlug(event) {
- const {
- postSlug,
- onUpdateSlug
- } = this.props;
- const {
- value
- } = event.target;
- const editedSlug = cleanForSlug(value);
- if (editedSlug === postSlug) {
- return;
- }
- onUpdateSlug(editedSlug);
- }
- render() {
- const {
- instanceId
- } = this.props;
- const {
- editedSlug
- } = this.state;
- const inputId = 'editor-post-slug-' + instanceId;
- return Object(external_wp_element_["createElement"])(PostSlugCheck, null, Object(external_wp_element_["createElement"])("label", {
- htmlFor: inputId
- }, Object(external_wp_i18n_["__"])('Slug')), Object(external_wp_element_["createElement"])("input", {
- type: "text",
- id: inputId,
- value: editedSlug,
- onChange: event => this.setState({
- editedSlug: event.target.value
- }),
- onBlur: this.setSlug,
- className: "editor-post-slug__input"
- }));
- }
- }
- /* harmony default export */ var post_slug = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => {
- const {
- getCurrentPost,
- getEditedPostAttribute
- } = select('core/editor');
- const {
- id
- } = getCurrentPost();
- return {
- postSlug: getEditedPostAttribute('slug'),
- postTitle: getEditedPostAttribute('title'),
- postID: id
- };
- }), Object(external_wp_data_["withDispatch"])(dispatch => {
- const {
- editPost
- } = dispatch('core/editor');
- return {
- onUpdateSlug(slug) {
- editPost({
- slug
- });
- }
- };
- }), external_wp_compose_["withInstanceId"]])(post_slug_PostSlug));
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-sticky/check.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- function PostStickyCheck({
- hasStickyAction,
- postType,
- children
- }) {
- if (postType !== 'post' || !hasStickyAction) {
- return null;
- }
- return children;
- }
- /* harmony default export */ var post_sticky_check = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => {
- const post = select('core/editor').getCurrentPost();
- return {
- hasStickyAction: Object(external_lodash_["get"])(post, ['_links', 'wp:action-sticky'], false),
- postType: select('core/editor').getCurrentPostType()
- };
- })])(PostStickyCheck));
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-sticky/index.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function PostSticky({
- onUpdateSticky,
- postSticky = false
- }) {
- return Object(external_wp_element_["createElement"])(post_sticky_check, null, Object(external_wp_element_["createElement"])(external_wp_components_["CheckboxControl"], {
- label: Object(external_wp_i18n_["__"])('Stick to the top of the blog'),
- checked: postSticky,
- onChange: () => onUpdateSticky(!postSticky)
- }));
- }
- /* harmony default export */ var post_sticky = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => {
- return {
- postSticky: select('core/editor').getEditedPostAttribute('sticky')
- };
- }), Object(external_wp_data_["withDispatch"])(dispatch => {
- return {
- onUpdateSticky(postSticky) {
- dispatch('core/editor').editPost({
- sticky: postSticky
- });
- }
- };
- })])(PostSticky));
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/hierarchical-term-selector.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- /**
- * Module Constants
- */
- const hierarchical_term_selector_DEFAULT_QUERY = {
- per_page: -1,
- orderby: 'name',
- order: 'asc',
- _fields: 'id,name,parent'
- };
- const MIN_TERMS_COUNT_FOR_FILTER = 8;
- class hierarchical_term_selector_HierarchicalTermSelector extends external_wp_element_["Component"] {
- constructor() {
- super(...arguments);
- this.findTerm = this.findTerm.bind(this);
- this.onChange = this.onChange.bind(this);
- this.onChangeFormName = this.onChangeFormName.bind(this);
- this.onChangeFormParent = this.onChangeFormParent.bind(this);
- this.onAddTerm = this.onAddTerm.bind(this);
- this.onToggleForm = this.onToggleForm.bind(this);
- this.setFilterValue = this.setFilterValue.bind(this);
- this.sortBySelected = this.sortBySelected.bind(this);
- this.state = {
- loading: true,
- availableTermsTree: [],
- availableTerms: [],
- adding: false,
- formName: '',
- formParent: '',
- showForm: false,
- filterValue: '',
- filteredTermsTree: []
- };
- }
- onChange(termId) {
- const {
- onUpdateTerms,
- terms = [],
- taxonomy
- } = this.props;
- const hasTerm = terms.indexOf(termId) !== -1;
- const newTerms = hasTerm ? Object(external_lodash_["without"])(terms, termId) : [...terms, termId];
- onUpdateTerms(newTerms, taxonomy.rest_base);
- }
- onChangeFormName(event) {
- const newValue = event.target.value.trim() === '' ? '' : event.target.value;
- this.setState({
- formName: newValue
- });
- }
- onChangeFormParent(newParent) {
- this.setState({
- formParent: newParent
- });
- }
- onToggleForm() {
- this.setState(state => ({
- showForm: !state.showForm
- }));
- }
- findTerm(terms, parent, name) {
- return Object(external_lodash_["find"])(terms, term => {
- return (!term.parent && !parent || parseInt(term.parent) === parseInt(parent)) && term.name.toLowerCase() === name.toLowerCase();
- });
- }
- onAddTerm(event) {
- event.preventDefault();
- const {
- onUpdateTerms,
- taxonomy,
- terms,
- slug
- } = this.props;
- const {
- formName,
- formParent,
- adding,
- availableTerms
- } = this.state;
- if (formName === '' || adding) {
- return;
- } // check if the term we are adding already exists
- const existingTerm = this.findTerm(availableTerms, formParent, formName);
- if (existingTerm) {
- // if the term we are adding exists but is not selected select it
- if (!Object(external_lodash_["some"])(terms, term => term === existingTerm.id)) {
- onUpdateTerms([...terms, existingTerm.id], taxonomy.rest_base);
- }
- this.setState({
- formName: '',
- formParent: ''
- });
- return;
- }
- this.setState({
- adding: true
- });
- this.addRequest = external_wp_apiFetch_default()({
- path: `/wp/v2/${taxonomy.rest_base}`,
- method: 'POST',
- data: {
- name: formName,
- parent: formParent ? formParent : undefined
- }
- }); // Tries to create a term or fetch it if it already exists
- const findOrCreatePromise = this.addRequest.catch(error => {
- const errorCode = error.code;
- if (errorCode === 'term_exists') {
- // search the new category created since last fetch
- this.addRequest = external_wp_apiFetch_default()({
- path: Object(external_wp_url_["addQueryArgs"])(`/wp/v2/${taxonomy.rest_base}`, { ...hierarchical_term_selector_DEFAULT_QUERY,
- parent: formParent || 0,
- search: formName
- })
- });
- return this.addRequest.then(searchResult => {
- return this.findTerm(searchResult, formParent, formName);
- });
- }
- return Promise.reject(error);
- });
- findOrCreatePromise.then(term => {
- const hasTerm = !!Object(external_lodash_["find"])(this.state.availableTerms, availableTerm => availableTerm.id === term.id);
- const newAvailableTerms = hasTerm ? this.state.availableTerms : [term, ...this.state.availableTerms];
- const termAddedMessage = Object(external_wp_i18n_["sprintf"])(
- /* translators: %s: taxonomy name */
- Object(external_wp_i18n_["_x"])('%s added', 'term'), Object(external_lodash_["get"])(this.props.taxonomy, ['labels', 'singular_name'], slug === 'category' ? Object(external_wp_i18n_["__"])('Category') : Object(external_wp_i18n_["__"])('Term')));
- this.props.speak(termAddedMessage, 'assertive');
- this.addRequest = null;
- this.setState({
- adding: false,
- formName: '',
- formParent: '',
- availableTerms: newAvailableTerms,
- availableTermsTree: this.sortBySelected(buildTermsTree(newAvailableTerms))
- });
- onUpdateTerms([...terms, term.id], taxonomy.rest_base);
- }, xhr => {
- if (xhr.statusText === 'abort') {
- return;
- }
- this.addRequest = null;
- this.setState({
- adding: false
- });
- });
- }
- componentDidMount() {
- this.fetchTerms();
- }
- componentWillUnmount() {
- Object(external_lodash_["invoke"])(this.fetchRequest, ['abort']);
- Object(external_lodash_["invoke"])(this.addRequest, ['abort']);
- }
- componentDidUpdate(prevProps) {
- if (this.props.taxonomy !== prevProps.taxonomy) {
- this.fetchTerms();
- }
- }
- fetchTerms() {
- const {
- taxonomy
- } = this.props;
- if (!taxonomy) {
- return;
- }
- this.fetchRequest = external_wp_apiFetch_default()({
- path: Object(external_wp_url_["addQueryArgs"])(`/wp/v2/${taxonomy.rest_base}`, hierarchical_term_selector_DEFAULT_QUERY)
- });
- this.fetchRequest.then(terms => {
- // resolve
- const availableTermsTree = this.sortBySelected(buildTermsTree(terms));
- this.fetchRequest = null;
- this.setState({
- loading: false,
- availableTermsTree,
- availableTerms: terms
- });
- }, xhr => {
- // reject
- if (xhr.statusText === 'abort') {
- return;
- }
- this.fetchRequest = null;
- this.setState({
- loading: false
- });
- });
- }
- sortBySelected(termsTree) {
- const {
- terms
- } = this.props;
- const treeHasSelection = termTree => {
- if (terms.indexOf(termTree.id) !== -1) {
- return true;
- }
- if (undefined === termTree.children) {
- return false;
- }
- const anyChildIsSelected = termTree.children.map(treeHasSelection).filter(child => child).length > 0;
- if (anyChildIsSelected) {
- return true;
- }
- return false;
- };
- const termOrChildIsSelected = (termA, termB) => {
- const termASelected = treeHasSelection(termA);
- const termBSelected = treeHasSelection(termB);
- if (termASelected === termBSelected) {
- return 0;
- }
- if (termASelected && !termBSelected) {
- return -1;
- }
- if (!termASelected && termBSelected) {
- return 1;
- }
- return 0;
- };
- termsTree.sort(termOrChildIsSelected);
- return termsTree;
- }
- setFilterValue(event) {
- const {
- availableTermsTree
- } = this.state;
- const filterValue = event.target.value;
- const filteredTermsTree = availableTermsTree.map(this.getFilterMatcher(filterValue)).filter(term => term);
- const getResultCount = terms => {
- let count = 0;
- for (let i = 0; i < terms.length; i++) {
- count++;
- if (undefined !== terms[i].children) {
- count += getResultCount(terms[i].children);
- }
- }
- return count;
- };
- this.setState({
- filterValue,
- filteredTermsTree
- });
- const resultCount = getResultCount(filteredTermsTree);
- const resultsFoundMessage = Object(external_wp_i18n_["sprintf"])(
- /* translators: %d: number of results */
- Object(external_wp_i18n_["_n"])('%d result found.', '%d results found.', resultCount), resultCount);
- this.props.debouncedSpeak(resultsFoundMessage, 'assertive');
- }
- getFilterMatcher(filterValue) {
- const matchTermsForFilter = originalTerm => {
- if ('' === filterValue) {
- return originalTerm;
- } // Shallow clone, because we'll be filtering the term's children and
- // don't want to modify the original term.
- const term = { ...originalTerm
- }; // Map and filter the children, recursive so we deal with grandchildren
- // and any deeper levels.
- if (term.children.length > 0) {
- term.children = term.children.map(matchTermsForFilter).filter(child => child);
- } // If the term's name contains the filterValue, or it has children
- // (i.e. some child matched at some point in the tree) then return it.
- if (-1 !== term.name.toLowerCase().indexOf(filterValue.toLowerCase()) || term.children.length > 0) {
- return term;
- } // Otherwise, return false. After mapping, the list of terms will need
- // to have false values filtered out.
- return false;
- };
- return matchTermsForFilter;
- }
- renderTerms(renderedTerms) {
- const {
- terms = []
- } = this.props;
- return renderedTerms.map(term => {
- return Object(external_wp_element_["createElement"])("div", {
- key: term.id,
- className: "editor-post-taxonomies__hierarchical-terms-choice"
- }, Object(external_wp_element_["createElement"])(external_wp_components_["CheckboxControl"], {
- checked: terms.indexOf(term.id) !== -1,
- onChange: () => {
- const termId = parseInt(term.id, 10);
- this.onChange(termId);
- },
- label: Object(external_lodash_["unescape"])(term.name)
- }), !!term.children.length && Object(external_wp_element_["createElement"])("div", {
- className: "editor-post-taxonomies__hierarchical-terms-subchoices"
- }, this.renderTerms(term.children)));
- });
- }
- render() {
- const {
- slug,
- taxonomy,
- instanceId,
- hasCreateAction,
- hasAssignAction
- } = this.props;
- if (!hasAssignAction) {
- return null;
- }
- const {
- availableTermsTree,
- availableTerms,
- filteredTermsTree,
- formName,
- formParent,
- loading,
- showForm,
- filterValue
- } = this.state;
- const labelWithFallback = (labelProperty, fallbackIsCategory, fallbackIsNotCategory) => Object(external_lodash_["get"])(taxonomy, ['labels', labelProperty], slug === 'category' ? fallbackIsCategory : fallbackIsNotCategory);
- const newTermButtonLabel = labelWithFallback('add_new_item', Object(external_wp_i18n_["__"])('Add new category'), Object(external_wp_i18n_["__"])('Add new term'));
- const newTermLabel = labelWithFallback('new_item_name', Object(external_wp_i18n_["__"])('Add new category'), Object(external_wp_i18n_["__"])('Add new term'));
- const parentSelectLabel = labelWithFallback('parent_item', Object(external_wp_i18n_["__"])('Parent Category'), Object(external_wp_i18n_["__"])('Parent Term'));
- const noParentOption = `— ${parentSelectLabel} —`;
- const newTermSubmitLabel = newTermButtonLabel;
- const inputId = `editor-post-taxonomies__hierarchical-terms-input-${instanceId}`;
- const filterInputId = `editor-post-taxonomies__hierarchical-terms-filter-${instanceId}`;
- const filterLabel = Object(external_lodash_["get"])(this.props.taxonomy, ['labels', 'search_items'], Object(external_wp_i18n_["__"])('Search Terms'));
- const groupLabel = Object(external_lodash_["get"])(this.props.taxonomy, ['name'], Object(external_wp_i18n_["__"])('Terms'));
- const showFilter = availableTerms.length >= MIN_TERMS_COUNT_FOR_FILTER;
- return [showFilter && Object(external_wp_element_["createElement"])("label", {
- key: "filter-label",
- htmlFor: filterInputId
- }, filterLabel), showFilter && Object(external_wp_element_["createElement"])("input", {
- type: "search",
- id: filterInputId,
- value: filterValue,
- onChange: this.setFilterValue,
- className: "editor-post-taxonomies__hierarchical-terms-filter",
- key: "term-filter-input"
- }), Object(external_wp_element_["createElement"])("div", {
- className: "editor-post-taxonomies__hierarchical-terms-list",
- key: "term-list",
- tabIndex: "0",
- role: "group",
- "aria-label": groupLabel
- }, this.renderTerms('' !== filterValue ? filteredTermsTree : availableTermsTree)), !loading && hasCreateAction && Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
- key: "term-add-button",
- onClick: this.onToggleForm,
- className: "editor-post-taxonomies__hierarchical-terms-add",
- "aria-expanded": showForm,
- isLink: true
- }, newTermButtonLabel), showForm && Object(external_wp_element_["createElement"])("form", {
- onSubmit: this.onAddTerm,
- key: "hierarchical-terms-form"
- }, Object(external_wp_element_["createElement"])("label", {
- htmlFor: inputId,
- className: "editor-post-taxonomies__hierarchical-terms-label"
- }, newTermLabel), Object(external_wp_element_["createElement"])("input", {
- type: "text",
- id: inputId,
- className: "editor-post-taxonomies__hierarchical-terms-input",
- value: formName,
- onChange: this.onChangeFormName,
- required: true
- }), !!availableTerms.length && Object(external_wp_element_["createElement"])(external_wp_components_["TreeSelect"], {
- label: parentSelectLabel,
- noOptionLabel: noParentOption,
- onChange: this.onChangeFormParent,
- selectedId: formParent,
- tree: availableTermsTree
- }), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
- isSecondary: true,
- type: "submit",
- className: "editor-post-taxonomies__hierarchical-terms-submit"
- }, newTermSubmitLabel))];
- }
- }
- /* harmony default export */ var hierarchical_term_selector = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])((select, {
- slug
- }) => {
- const {
- getCurrentPost
- } = select('core/editor');
- const {
- getTaxonomy
- } = select('core');
- const taxonomy = getTaxonomy(slug);
- return {
- hasCreateAction: taxonomy ? Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-create-' + taxonomy.rest_base], false) : false,
- hasAssignAction: taxonomy ? Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-assign-' + taxonomy.rest_base], false) : false,
- terms: taxonomy ? select('core/editor').getEditedPostAttribute(taxonomy.rest_base) : [],
- taxonomy
- };
- }), Object(external_wp_data_["withDispatch"])(dispatch => ({
- onUpdateTerms(terms, restBase) {
- dispatch('core/editor').editPost({
- [restBase]: terms
- });
- }
- })), external_wp_components_["withSpokenMessages"], external_wp_compose_["withInstanceId"], Object(external_wp_components_["withFilters"])('editor.PostTaxonomyType')])(hierarchical_term_selector_HierarchicalTermSelector));
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/index.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function PostTaxonomies({
- postType,
- taxonomies,
- taxonomyWrapper = external_lodash_["identity"]
- }) {
- const availableTaxonomies = Object(external_lodash_["filter"])(taxonomies, taxonomy => Object(external_lodash_["includes"])(taxonomy.types, postType));
- const visibleTaxonomies = Object(external_lodash_["filter"])(availableTaxonomies, taxonomy => taxonomy.visibility.show_ui);
- return visibleTaxonomies.map(taxonomy => {
- const TaxonomyComponent = taxonomy.hierarchical ? hierarchical_term_selector : flat_term_selector;
- return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], {
- key: `taxonomy-${taxonomy.slug}`
- }, taxonomyWrapper(Object(external_wp_element_["createElement"])(TaxonomyComponent, {
- slug: taxonomy.slug
- }), taxonomy));
- });
- }
- /* harmony default export */ var post_taxonomies = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => {
- return {
- postType: select('core/editor').getCurrentPostType(),
- taxonomies: select('core').getTaxonomies({
- per_page: -1
- })
- };
- })])(PostTaxonomies));
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-taxonomies/check.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- function PostTaxonomiesCheck({
- postType,
- taxonomies,
- children
- }) {
- const hasTaxonomies = Object(external_lodash_["some"])(taxonomies, taxonomy => Object(external_lodash_["includes"])(taxonomy.types, postType));
- if (!hasTaxonomies) {
- return null;
- }
- return children;
- }
- /* harmony default export */ var post_taxonomies_check = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => {
- return {
- postType: select('core/editor').getCurrentPostType(),
- taxonomies: select('core').getTaxonomies({
- per_page: -1
- })
- };
- })])(PostTaxonomiesCheck));
- // EXTERNAL MODULE: ./node_modules/react-autosize-textarea/lib/index.js
- var lib = __webpack_require__("O6Fj");
- var lib_default = /*#__PURE__*/__webpack_require__.n(lib);
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-text-editor/index.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- function PostTextEditor() {
- const postContent = Object(external_wp_data_["useSelect"])(select => select('core/editor').getEditedPostContent(), []);
- const {
- editPost,
- resetEditorBlocks
- } = Object(external_wp_data_["useDispatch"])('core/editor');
- const [value, setValue] = Object(external_wp_element_["useState"])(postContent);
- const [isDirty, setIsDirty] = Object(external_wp_element_["useState"])(false);
- const instanceId = Object(external_wp_compose_["useInstanceId"])(PostTextEditor);
- if (!isDirty && value !== postContent) {
- setValue(postContent);
- }
- /**
- * Handles a textarea change event to notify the onChange prop callback and
- * reflect the new value in the component's own state. This marks the start
- * of the user's edits, if not already changed, preventing future props
- * changes to value from replacing the rendered value. This is expected to
- * be followed by a reset to dirty state via `stopEditing`.
- *
- * @see stopEditing
- *
- * @param {Event} event Change event.
- */
- const onChange = event => {
- const newValue = event.target.value;
- editPost({
- content: newValue
- });
- setValue(newValue);
- setIsDirty(true);
- };
- /**
- * Function called when the user has completed their edits, responsible for
- * ensuring that changes, if made, are surfaced to the onPersist prop
- * callback and resetting dirty state.
- */
- const stopEditing = () => {
- if (isDirty) {
- const blocks = Object(external_wp_blocks_["parse"])(value);
- resetEditorBlocks(blocks);
- setIsDirty(false);
- }
- };
- return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], {
- as: "label",
- htmlFor: `post-content-${instanceId}`
- }, Object(external_wp_i18n_["__"])('Type text or HTML')), Object(external_wp_element_["createElement"])(lib_default.a, {
- autoComplete: "off",
- dir: "auto",
- value: value,
- onChange: onChange,
- onBlur: stopEditing,
- className: "editor-post-text-editor",
- id: `post-content-${instanceId}`,
- placeholder: Object(external_wp_i18n_["__"])('Start writing with text or HTML')
- }));
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-title/index.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- /**
- * Constants
- */
- const REGEXP_NEWLINES = /[\r\n]+/g;
- function PostTitle() {
- const instanceId = Object(external_wp_compose_["useInstanceId"])(PostTitle);
- const ref = Object(external_wp_element_["useRef"])();
- const [isSelected, setIsSelected] = Object(external_wp_element_["useState"])(false);
- const {
- editPost
- } = Object(external_wp_data_["useDispatch"])('core/editor');
- const {
- insertDefaultBlock,
- clearSelectedBlock,
- insertBlocks
- } = Object(external_wp_data_["useDispatch"])(external_wp_blockEditor_["store"]);
- const {
- isCleanNewPost,
- title,
- placeholder,
- isFocusMode,
- hasFixedToolbar
- } = Object(external_wp_data_["useSelect"])(select => {
- const {
- getEditedPostAttribute,
- isCleanNewPost: _isCleanNewPost
- } = select('core/editor');
- const {
- getSettings
- } = select(external_wp_blockEditor_["store"]);
- const {
- titlePlaceholder,
- focusMode,
- hasFixedToolbar: _hasFixedToolbar
- } = getSettings();
- return {
- isCleanNewPost: _isCleanNewPost(),
- title: getEditedPostAttribute('title'),
- placeholder: titlePlaceholder,
- isFocusMode: focusMode,
- hasFixedToolbar: _hasFixedToolbar
- };
- });
- Object(external_wp_element_["useEffect"])(() => {
- if (!ref.current) {
- return;
- }
- const {
- ownerDocument
- } = ref.current;
- const {
- activeElement,
- body
- } = ownerDocument; // Only autofocus the title when the post is entirely empty. This should
- // only happen for a new post, which means we focus the title on new
- // post so the author can start typing right away, without needing to
- // click anything.
- if (isCleanNewPost && (!activeElement || body === activeElement)) {
- ref.current.focus();
- }
- }, [isCleanNewPost]);
- function onEnterPress() {
- insertDefaultBlock(undefined, undefined, 0);
- }
- function onInsertBlockAfter(blocks) {
- insertBlocks(blocks, 0);
- }
- function onUpdate(newTitle) {
- editPost({
- title: newTitle
- });
- }
- function onSelect() {
- setIsSelected(true);
- clearSelectedBlock();
- }
- function onUnselect() {
- setIsSelected(false);
- }
- function onChange(event) {
- onUpdate(event.target.value.replace(REGEXP_NEWLINES, ' '));
- }
- function onKeyDown(event) {
- if (event.keyCode === external_wp_keycodes_["ENTER"]) {
- event.preventDefault();
- onEnterPress();
- }
- }
- function onPaste(event) {
- const clipboardData = event.clipboardData;
- let plainText = '';
- let html = ''; // IE11 only supports `Text` as an argument for `getData` and will
- // otherwise throw an invalid argument error, so we try the standard
- // arguments first, then fallback to `Text` if they fail.
- try {
- plainText = clipboardData.getData('text/plain');
- html = clipboardData.getData('text/html');
- } catch (error1) {
- try {
- html = clipboardData.getData('Text');
- } catch (error2) {
- // Some browsers like UC Browser paste plain text by default and
- // don't support clipboardData at all, so allow default
- // behaviour.
- return;
- }
- } // Allows us to ask for this information when we get a report.
- window.console.log('Received HTML:\n\n', html);
- window.console.log('Received plain text:\n\n', plainText);
- const content = Object(external_wp_blocks_["pasteHandler"])({
- HTML: html,
- plainText
- });
- if (typeof content !== 'string' && content.length) {
- event.preventDefault();
- const [firstBlock] = content;
- if (!title && (firstBlock.name === 'core/heading' || firstBlock.name === 'core/paragraph')) {
- onUpdate(firstBlock.attributes.content);
- onInsertBlockAfter(content.slice(1));
- } else {
- onInsertBlockAfter(content);
- }
- }
- } // The wp-block className is important for editor styles.
- // This same block is used in both the visual and the code editor.
- const className = classnames_default()('wp-block editor-post-title editor-post-title__block', {
- 'is-selected': isSelected,
- 'is-focus-mode': isFocusMode,
- 'has-fixed-toolbar': hasFixedToolbar
- });
- const decodedPlaceholder = Object(external_wp_htmlEntities_["decodeEntities"])(placeholder);
- return Object(external_wp_element_["createElement"])(post_type_support_check, {
- supportKeys: "title"
- }, Object(external_wp_element_["createElement"])("div", {
- className: className
- }, Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], {
- as: "label",
- htmlFor: `post-title-${instanceId}`
- }, decodedPlaceholder || Object(external_wp_i18n_["__"])('Add title')), Object(external_wp_element_["createElement"])(lib_default.a, {
- ref: ref,
- id: `post-title-${instanceId}`,
- className: "editor-post-title__input",
- value: title,
- onChange: onChange,
- placeholder: decodedPlaceholder || Object(external_wp_i18n_["__"])('Add title'),
- onFocus: onSelect,
- onBlur: onUnselect,
- onKeyDown: onKeyDown,
- onKeyPress: onUnselect,
- onPaste: onPaste
- })));
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-trash/index.js
- /**
- * WordPress dependencies
- */
- function PostTrash({
- isNew,
- postId,
- postType,
- ...props
- }) {
- if (isNew || !postId) {
- return null;
- }
- const onClick = () => props.trashPost(postId, postType);
- return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
- className: "editor-post-trash",
- isDestructive: true,
- isTertiary: true,
- onClick: onClick
- }, Object(external_wp_i18n_["__"])('Move to trash'));
- }
- /* harmony default export */ var post_trash = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => {
- const {
- isEditedPostNew,
- getCurrentPostId,
- getCurrentPostType
- } = select('core/editor');
- return {
- isNew: isEditedPostNew(),
- postId: getCurrentPostId(),
- postType: getCurrentPostType()
- };
- }), Object(external_wp_data_["withDispatch"])(dispatch => ({
- trashPost: dispatch('core/editor').trashPost
- }))])(PostTrash));
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-trash/check.js
- /**
- * WordPress dependencies
- */
- function PostTrashCheck({
- isNew,
- postId,
- canUserDelete,
- children
- }) {
- if (isNew || !postId || !canUserDelete) {
- return null;
- }
- return children;
- }
- /* harmony default export */ var post_trash_check = (Object(external_wp_data_["withSelect"])(select => {
- const {
- isEditedPostNew,
- getCurrentPostId,
- getCurrentPostType
- } = select('core/editor');
- const {
- getPostType,
- canUser
- } = select('core');
- const postId = getCurrentPostId();
- const postType = getPostType(getCurrentPostType());
- const resource = (postType === null || postType === void 0 ? void 0 : postType.rest_base) || ''; // eslint-disable-line camelcase
- return {
- isNew: isEditedPostNew(),
- postId,
- canUserDelete: postId && resource ? canUser('delete', resource, postId) : false
- };
- })(PostTrashCheck));
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/post-visibility/check.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- function PostVisibilityCheck({
- hasPublishAction,
- render
- }) {
- const canEdit = hasPublishAction;
- return render({
- canEdit
- });
- }
- /* harmony default export */ var post_visibility_check = (Object(external_wp_compose_["compose"])([Object(external_wp_data_["withSelect"])(select => {
- const {
- getCurrentPost,
- getCurrentPostType
- } = select('core/editor');
- return {
- hasPublishAction: Object(external_lodash_["get"])(getCurrentPost(), ['_links', 'wp:action-publish'], false),
- postType: getCurrentPostType()
- };
- })])(PostVisibilityCheck));
- // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/info.js
- /**
- * WordPress dependencies
- */
- const info_info = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
- }, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], {
- d: "M12 3.2c-4.8 0-8.8 3.9-8.8 8.8 0 4.8 3.9 8.8 8.8 8.8 4.8 0 8.8-3.9 8.8-8.8 0-4.8-4-8.8-8.8-8.8zm0 16c-4 0-7.2-3.3-7.2-7.2C4.8 8 8 4.8 12 4.8s7.2 3.3 7.2 7.2c0 4-3.2 7.2-7.2 7.2zM11 17h2v-6h-2v6zm0-8h2V7h-2v2z"
- }));
- /* harmony default export */ var library_info = (info_info);
- // EXTERNAL MODULE: external ["wp","wordcount"]
- var external_wp_wordcount_ = __webpack_require__("7fqt");
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/word-count/index.js
- /**
- * WordPress dependencies
- */
- function WordCount() {
- const content = Object(external_wp_data_["useSelect"])(select => select('core/editor').getEditedPostAttribute('content'));
- /*
- * translators: If your word count is based on single characters (e.g. East Asian characters),
- * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.
- * Do not translate into your own language.
- */
- const wordCountType = Object(external_wp_i18n_["_x"])('words', 'Word count type. Do not translate!');
- return Object(external_wp_element_["createElement"])("span", {
- className: "word-count"
- }, Object(external_wp_wordcount_["count"])(content, wordCountType));
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/character-count/index.js
- /**
- * WordPress dependencies
- */
- function CharacterCount() {
- const content = Object(external_wp_data_["useSelect"])(select => select('core/editor').getEditedPostAttribute('content'));
- return Object(external_wp_wordcount_["count"])(content, 'characters_including_spaces');
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/table-of-contents/panel.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function TableOfContentsPanel({
- hasOutlineItemsDisabled,
- onRequestClose
- }) {
- const {
- headingCount,
- paragraphCount,
- numberOfBlocks
- } = Object(external_wp_data_["useSelect"])(select => {
- const {
- getGlobalBlockCount
- } = select(external_wp_blockEditor_["store"]);
- return {
- headingCount: getGlobalBlockCount('core/heading'),
- paragraphCount: getGlobalBlockCount('core/paragraph'),
- numberOfBlocks: getGlobalBlockCount()
- };
- }, []);
- return (
- /*
- * Disable reason: The `list` ARIA role is redundant but
- * Safari+VoiceOver won't announce the list otherwise.
- */
- /* eslint-disable jsx-a11y/no-redundant-roles */
- Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("div", {
- className: "table-of-contents__wrapper",
- role: "note",
- "aria-label": Object(external_wp_i18n_["__"])('Document Statistics'),
- tabIndex: "0"
- }, Object(external_wp_element_["createElement"])("ul", {
- role: "list",
- className: "table-of-contents__counts"
- }, Object(external_wp_element_["createElement"])("li", {
- className: "table-of-contents__count"
- }, Object(external_wp_i18n_["__"])('Characters'), Object(external_wp_element_["createElement"])("span", {
- className: "table-of-contents__number"
- }, Object(external_wp_element_["createElement"])(CharacterCount, null))), Object(external_wp_element_["createElement"])("li", {
- className: "table-of-contents__count"
- }, Object(external_wp_i18n_["__"])('Words'), Object(external_wp_element_["createElement"])(WordCount, null)), Object(external_wp_element_["createElement"])("li", {
- className: "table-of-contents__count"
- }, Object(external_wp_i18n_["__"])('Headings'), Object(external_wp_element_["createElement"])("span", {
- className: "table-of-contents__number"
- }, headingCount)), Object(external_wp_element_["createElement"])("li", {
- className: "table-of-contents__count"
- }, Object(external_wp_i18n_["__"])('Paragraphs'), Object(external_wp_element_["createElement"])("span", {
- className: "table-of-contents__number"
- }, paragraphCount)), Object(external_wp_element_["createElement"])("li", {
- className: "table-of-contents__count"
- }, Object(external_wp_i18n_["__"])('Blocks'), Object(external_wp_element_["createElement"])("span", {
- className: "table-of-contents__number"
- }, numberOfBlocks)))), headingCount > 0 && Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("hr", null), Object(external_wp_element_["createElement"])("h2", {
- className: "table-of-contents__title"
- }, Object(external_wp_i18n_["__"])('Document Outline')), Object(external_wp_element_["createElement"])(document_outline, {
- onSelect: onRequestClose,
- hasOutlineItemsDisabled: hasOutlineItemsDisabled
- })))
- /* eslint-enable jsx-a11y/no-redundant-roles */
- );
- }
- /* harmony default export */ var panel = (TableOfContentsPanel);
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/table-of-contents/index.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function TableOfContents({
- hasOutlineItemsDisabled,
- repositionDropdown,
- ...props
- }, ref) {
- const hasBlocks = Object(external_wp_data_["useSelect"])(select => !!select(external_wp_blockEditor_["store"]).getBlockCount(), []);
- return Object(external_wp_element_["createElement"])(external_wp_components_["Dropdown"], {
- position: repositionDropdown ? 'middle right right' : 'bottom',
- className: "table-of-contents",
- contentClassName: "table-of-contents__popover",
- renderToggle: ({
- isOpen,
- onToggle
- }) => Object(external_wp_element_["createElement"])(external_wp_components_["Button"], Object(esm_extends["a" /* default */])({}, props, {
- ref: ref,
- onClick: hasBlocks ? onToggle : undefined,
- icon: library_info,
- "aria-expanded": isOpen,
- "aria-haspopup": "true"
- /* translators: button label text should, if possible, be under 16 characters. */
- ,
- label: Object(external_wp_i18n_["__"])('Details'),
- tooltipPosition: "bottom",
- "aria-disabled": !hasBlocks
- })),
- renderContent: ({
- onClose
- }) => Object(external_wp_element_["createElement"])(panel, {
- onRequestClose: onClose,
- hasOutlineItemsDisabled: hasOutlineItemsDisabled
- })
- });
- }
- /* harmony default export */ var table_of_contents = (Object(external_wp_element_["forwardRef"])(TableOfContents));
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/unsaved-changes-warning/index.js
- /**
- * WordPress dependencies
- */
- /**
- * Warns the user if there are unsaved changes before leaving the editor.
- * Compatible with Post Editor and Site Editor.
- *
- * @return {WPComponent} The component.
- */
- function UnsavedChangesWarning() {
- const isDirty = Object(external_wp_data_["useSelect"])(select => {
- return () => {
- const {
- __experimentalGetDirtyEntityRecords
- } = select('core');
- const dirtyEntityRecords = __experimentalGetDirtyEntityRecords();
- return dirtyEntityRecords.length > 0;
- };
- }, []);
- /**
- * Warns the user if there are unsaved changes before leaving the editor.
- *
- * @param {Event} event `beforeunload` event.
- *
- * @return {?string} Warning prompt message, if unsaved changes exist.
- */
- const warnIfUnsavedChanges = event => {
- // We need to call the selector directly in the listener to avoid race
- // conditions with `BrowserURL` where `componentDidUpdate` gets the
- // new value of `isEditedPostDirty` before this component does,
- // causing this component to incorrectly think a trashed post is still dirty.
- if (isDirty()) {
- event.returnValue = Object(external_wp_i18n_["__"])('You have unsaved changes. If you proceed, they will be lost.');
- return event.returnValue;
- }
- };
- Object(external_wp_element_["useEffect"])(() => {
- window.addEventListener('beforeunload', warnIfUnsavedChanges);
- return () => {
- window.removeEventListener('beforeunload', warnIfUnsavedChanges);
- };
- }, []);
- return null;
- }
- // EXTERNAL MODULE: external ["wp","reusableBlocks"]
- var external_wp_reusableBlocks_ = __webpack_require__("diJD");
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/provider/with-registry-provider.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- const withRegistryProvider = Object(external_wp_compose_["createHigherOrderComponent"])(WrappedComponent => Object(external_wp_data_["withRegistry"])(props => {
- const {
- useSubRegistry = true,
- registry,
- ...additionalProps
- } = props;
- if (!useSubRegistry) {
- return Object(external_wp_element_["createElement"])(WrappedComponent, additionalProps);
- }
- const [subRegistry, setSubRegistry] = Object(external_wp_element_["useState"])(null);
- Object(external_wp_element_["useEffect"])(() => {
- const newRegistry = Object(external_wp_data_["createRegistry"])({
- 'core/block-editor': external_wp_blockEditor_["storeConfig"]
- }, registry);
- newRegistry.registerStore('core/editor', storeConfig);
- setSubRegistry(newRegistry);
- }, [registry]);
- if (!subRegistry) {
- return null;
- }
- return Object(external_wp_element_["createElement"])(external_wp_data_["RegistryProvider"], {
- value: subRegistry
- }, Object(external_wp_element_["createElement"])(WrappedComponent, additionalProps));
- }), 'withRegistryProvider');
- /* harmony default export */ var with_registry_provider = (withRegistryProvider);
- // EXTERNAL MODULE: external ["wp","mediaUtils"]
- var external_wp_mediaUtils_ = __webpack_require__("6aBm");
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/media-upload/index.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Upload a media file when the file upload button is activated.
- * Wrapper around mediaUpload() that injects the current post ID.
- *
- * @param {Object} $0 Parameters object passed to the function.
- * @param {?Object} $0.additionalData Additional data to include in the request.
- * @param {string} $0.allowedTypes Array with the types of media that can be uploaded, if unset all types are allowed.
- * @param {Array} $0.filesList List of files.
- * @param {?number} $0.maxUploadFileSize Maximum upload size in bytes allowed for the site.
- * @param {Function} $0.onError Function called when an error happens.
- * @param {Function} $0.onFileChange Function called each time a file or a temporary representation of the file is available.
- */
- function mediaUpload({
- additionalData = {},
- allowedTypes,
- filesList,
- maxUploadFileSize,
- onError = external_lodash_["noop"],
- onFileChange
- }) {
- const {
- getCurrentPostId,
- getEditorSettings
- } = Object(external_wp_data_["select"])('core/editor');
- const wpAllowedMimeTypes = getEditorSettings().allowedMimeTypes;
- maxUploadFileSize = maxUploadFileSize || getEditorSettings().maxUploadFileSize;
- Object(external_wp_mediaUtils_["uploadMedia"])({
- allowedTypes,
- filesList,
- onFileChange,
- additionalData: {
- post: getCurrentPostId(),
- ...additionalData
- },
- maxUploadFileSize,
- onError: ({
- message
- }) => onError(message),
- wpAllowedMimeTypes
- });
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/provider/use-block-editor-settings.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- /**
- * React hook used to compute the block editor settings to use for the post editor.
- *
- * @param {Object} settings EditorProvider settings prop.
- * @param {boolean} hasTemplate Whether template mode is enabled.
- *
- * @return {Object} Block Editor Settings.
- */
- function useBlockEditorSettings(settings, hasTemplate) {
- const {
- reusableBlocks,
- hasUploadPermissions,
- canUseUnfilteredHTML,
- isTitleSelected
- } = Object(external_wp_data_["useSelect"])(select => {
- const {
- canUserUseUnfilteredHTML,
- isPostTitleSelected
- } = select(store);
- const {
- canUser
- } = select(external_wp_coreData_["store"]);
- return {
- canUseUnfilteredHTML: canUserUseUnfilteredHTML(),
- reusableBlocks: select(external_wp_coreData_["store"]).getEntityRecords('postType', 'wp_block',
- /**
- * Unbounded queries are not supported on native so as a workaround, we set per_page with the maximum value that native version can handle.
- * Related issue: https://github.com/wordpress-mobile/gutenberg-mobile/issues/2661
- */
- {
- per_page: external_wp_element_["Platform"].select({
- web: -1,
- native: 100
- })
- }),
- hasUploadPermissions: Object(external_lodash_["defaultTo"])(canUser('create', 'media'), true),
- // This selector is only defined on mobile.
- isTitleSelected: isPostTitleSelected && isPostTitleSelected()
- };
- }, []);
- const {
- undo
- } = Object(external_wp_data_["useDispatch"])(store);
- return Object(external_wp_element_["useMemo"])(() => ({ ...Object(external_lodash_["pick"])(settings, ['__experimentalBlockDirectory', '__experimentalBlockPatternCategories', '__experimentalBlockPatterns', '__experimentalFeatures', '__experimentalGlobalStylesBaseStyles', '__experimentalGlobalStylesUserEntityId', '__experimentalPreferredStyleVariations', '__experimentalSetIsInserterOpened', 'alignWide', 'allowedBlockTypes', 'bodyPlaceholder', 'codeEditingEnabled', 'colors', 'disableCustomColors', 'disableCustomFontSizes', 'disableCustomGradients', 'enableCustomLineHeight', 'enableCustomSpacing', 'enableCustomUnits', 'focusMode', 'fontSizes', 'gradients', 'hasFixedToolbar', 'hasReducedUI', 'imageDefaultSize', 'imageDimensions', 'imageEditing', 'imageSizes', 'isRTL', 'keepCaretInsideBlock', 'maxWidth', 'onUpdateDefaultBlockStyles', 'styles', 'template', 'templateLock', 'titlePlaceholder', 'supportsLayout', 'widgetTypesToHideFromLegacyWidgetBlock']),
- mediaUpload: hasUploadPermissions ? mediaUpload : undefined,
- __experimentalReusableBlocks: reusableBlocks,
- __experimentalFetchLinkSuggestions: (search, searchOptions) => Object(external_wp_coreData_["__experimentalFetchLinkSuggestions"])(search, searchOptions, settings),
- __experimentalFetchRemoteUrlData: url => Object(external_wp_coreData_["__experimentalFetchRemoteUrlData"])(url),
- __experimentalCanUserUseUnfilteredHTML: canUseUnfilteredHTML,
- __experimentalUndo: undo,
- __experimentalShouldInsertAtTheTop: isTitleSelected,
- outlineMode: hasTemplate
- }), [settings, hasUploadPermissions, reusableBlocks, canUseUnfilteredHTML, undo, isTitleSelected, hasTemplate]);
- }
- /* harmony default export */ var use_block_editor_settings = (useBlockEditorSettings);
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/provider/index.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- function EditorProvider({
- __unstableTemplate,
- post,
- settings,
- recovery,
- initialEdits,
- children
- }) {
- const defaultBlockContext = Object(external_wp_element_["useMemo"])(() => {
- if (post.type === 'wp_template') {
- return {};
- }
- return {
- postId: post.id,
- postType: post.type
- };
- }, [post.id, post.type]);
- const {
- selection,
- isReady
- } = Object(external_wp_data_["useSelect"])(select => {
- const {
- getEditorSelection,
- __unstableIsEditorReady
- } = select(store);
- return {
- isReady: __unstableIsEditorReady(),
- selection: getEditorSelection()
- };
- }, []);
- const {
- id,
- type
- } = __unstableTemplate !== null && __unstableTemplate !== void 0 ? __unstableTemplate : post;
- const [blocks, onInput, onChange] = Object(external_wp_coreData_["useEntityBlockEditor"])('postType', type, {
- id
- });
- const editorSettings = use_block_editor_settings(settings, !!__unstableTemplate);
- const {
- updatePostLock,
- setupEditor,
- updateEditorSettings,
- __experimentalTearDownEditor
- } = Object(external_wp_data_["useDispatch"])(store);
- const {
- createWarningNotice
- } = Object(external_wp_data_["useDispatch"])(external_wp_notices_["store"]); // Iniitialize and tear down the editor.
- // Ideally this should be synced on each change and not just something you do once.
- Object(external_wp_element_["useLayoutEffect"])(() => {
- // Assume that we don't need to initialize in the case of an error recovery.
- if (recovery) {
- return;
- }
- updatePostLock(settings.postLock);
- setupEditor(post, initialEdits, settings.template);
- if (settings.autosave) {
- createWarningNotice(Object(external_wp_i18n_["__"])('There is an autosave of this post that is more recent than the version below.'), {
- id: 'autosave-exists',
- actions: [{
- label: Object(external_wp_i18n_["__"])('View the autosave'),
- url: settings.autosave.editLink
- }]
- });
- }
- return () => {
- __experimentalTearDownEditor();
- };
- }, []); // Synchronize the editor settings as they change
- Object(external_wp_element_["useEffect"])(() => {
- updateEditorSettings(settings);
- }, [settings]);
- if (!isReady) {
- return null;
- }
- return Object(external_wp_element_["createElement"])(external_wp_coreData_["EntityProvider"], {
- kind: "root",
- type: "site"
- }, Object(external_wp_element_["createElement"])(external_wp_coreData_["EntityProvider"], {
- kind: "postType",
- type: post.type,
- id: post.id
- }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockContextProvider"], {
- value: defaultBlockContext
- }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockEditorProvider"], {
- value: blocks,
- onChange: onChange,
- onInput: onInput,
- selection: selection,
- settings: editorSettings,
- useSubRegistry: false
- }, children, Object(external_wp_element_["createElement"])(external_wp_reusableBlocks_["ReusableBlocksMenuItems"], null)))));
- }
- /* harmony default export */ var provider = (with_registry_provider(EditorProvider));
- // EXTERNAL MODULE: external ["wp","serverSideRender"]
- var external_wp_serverSideRender_ = __webpack_require__("JREk");
- var external_wp_serverSideRender_default = /*#__PURE__*/__webpack_require__.n(external_wp_serverSideRender_);
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/deprecated.js
- // Block Creation Components
- /**
- * WordPress dependencies
- */
- function deprecateComponent(name, Wrapped, staticsToHoist = []) {
- const Component = Object(external_wp_element_["forwardRef"])((props, ref) => {
- external_wp_deprecated_default()('wp.editor.' + name, {
- since: '5.3',
- alternative: 'wp.blockEditor.' + name
- });
- return Object(external_wp_element_["createElement"])(Wrapped, Object(esm_extends["a" /* default */])({
- ref: ref
- }, props));
- });
- staticsToHoist.forEach(staticName => {
- Component[staticName] = deprecateComponent(name + '.' + staticName, Wrapped[staticName]);
- });
- return Component;
- }
- function deprecateFunction(name, func) {
- return (...args) => {
- external_wp_deprecated_default()('wp.editor.' + name, {
- since: '5.3',
- alternative: 'wp.blockEditor.' + name
- });
- return func(...args);
- };
- }
- const RichText = deprecateComponent('RichText', external_wp_blockEditor_["RichText"], ['Content']);
- RichText.isEmpty = deprecateFunction('RichText.isEmpty', external_wp_blockEditor_["RichText"].isEmpty);
- const Autocomplete = deprecateComponent('Autocomplete', external_wp_blockEditor_["Autocomplete"]);
- const AlignmentToolbar = deprecateComponent('AlignmentToolbar', external_wp_blockEditor_["AlignmentToolbar"]);
- const BlockAlignmentToolbar = deprecateComponent('BlockAlignmentToolbar', external_wp_blockEditor_["BlockAlignmentToolbar"]);
- const BlockControls = deprecateComponent('BlockControls', external_wp_blockEditor_["BlockControls"], ['Slot']);
- const deprecated_BlockEdit = deprecateComponent('BlockEdit', external_wp_blockEditor_["BlockEdit"]);
- const BlockEditorKeyboardShortcuts = deprecateComponent('BlockEditorKeyboardShortcuts', external_wp_blockEditor_["BlockEditorKeyboardShortcuts"]);
- const BlockFormatControls = deprecateComponent('BlockFormatControls', external_wp_blockEditor_["BlockFormatControls"], ['Slot']);
- const BlockIcon = deprecateComponent('BlockIcon', external_wp_blockEditor_["BlockIcon"]);
- const BlockInspector = deprecateComponent('BlockInspector', external_wp_blockEditor_["BlockInspector"]);
- const BlockList = deprecateComponent('BlockList', external_wp_blockEditor_["BlockList"]);
- const BlockMover = deprecateComponent('BlockMover', external_wp_blockEditor_["BlockMover"]);
- const BlockNavigationDropdown = deprecateComponent('BlockNavigationDropdown', external_wp_blockEditor_["BlockNavigationDropdown"]);
- const BlockSelectionClearer = deprecateComponent('BlockSelectionClearer', external_wp_blockEditor_["BlockSelectionClearer"]);
- const BlockSettingsMenu = deprecateComponent('BlockSettingsMenu', external_wp_blockEditor_["BlockSettingsMenu"]);
- const BlockTitle = deprecateComponent('BlockTitle', external_wp_blockEditor_["BlockTitle"]);
- const BlockToolbar = deprecateComponent('BlockToolbar', external_wp_blockEditor_["BlockToolbar"]);
- const ColorPalette = deprecateComponent('ColorPalette', external_wp_blockEditor_["ColorPalette"]);
- const ContrastChecker = deprecateComponent('ContrastChecker', external_wp_blockEditor_["ContrastChecker"]);
- const CopyHandler = deprecateComponent('CopyHandler', external_wp_blockEditor_["CopyHandler"]);
- const DefaultBlockAppender = deprecateComponent('DefaultBlockAppender', external_wp_blockEditor_["DefaultBlockAppender"]);
- const FontSizePicker = deprecateComponent('FontSizePicker', external_wp_blockEditor_["FontSizePicker"]);
- const Inserter = deprecateComponent('Inserter', external_wp_blockEditor_["Inserter"]);
- const InnerBlocks = deprecateComponent('InnerBlocks', external_wp_blockEditor_["InnerBlocks"], ['ButtonBlockAppender', 'DefaultBlockAppender', 'Content']);
- const InspectorAdvancedControls = deprecateComponent('InspectorAdvancedControls', external_wp_blockEditor_["InspectorAdvancedControls"], ['Slot']);
- const InspectorControls = deprecateComponent('InspectorControls', external_wp_blockEditor_["InspectorControls"], ['Slot']);
- const PanelColorSettings = deprecateComponent('PanelColorSettings', external_wp_blockEditor_["PanelColorSettings"]);
- const PlainText = deprecateComponent('PlainText', external_wp_blockEditor_["PlainText"]);
- const RichTextShortcut = deprecateComponent('RichTextShortcut', external_wp_blockEditor_["RichTextShortcut"]);
- const RichTextToolbarButton = deprecateComponent('RichTextToolbarButton', external_wp_blockEditor_["RichTextToolbarButton"]);
- const __unstableRichTextInputEvent = deprecateComponent('__unstableRichTextInputEvent', external_wp_blockEditor_["__unstableRichTextInputEvent"]);
- const MediaPlaceholder = deprecateComponent('MediaPlaceholder', external_wp_blockEditor_["MediaPlaceholder"]);
- const MediaUpload = deprecateComponent('MediaUpload', external_wp_blockEditor_["MediaUpload"]);
- const MediaUploadCheck = deprecateComponent('MediaUploadCheck', external_wp_blockEditor_["MediaUploadCheck"]);
- const MultiSelectScrollIntoView = deprecateComponent('MultiSelectScrollIntoView', external_wp_blockEditor_["MultiSelectScrollIntoView"]);
- const NavigableToolbar = deprecateComponent('NavigableToolbar', external_wp_blockEditor_["NavigableToolbar"]);
- const ObserveTyping = deprecateComponent('ObserveTyping', external_wp_blockEditor_["ObserveTyping"]);
- const PreserveScrollInReorder = deprecateComponent('PreserveScrollInReorder', external_wp_blockEditor_["PreserveScrollInReorder"]);
- const SkipToSelectedBlock = deprecateComponent('SkipToSelectedBlock', external_wp_blockEditor_["SkipToSelectedBlock"]);
- const URLInput = deprecateComponent('URLInput', external_wp_blockEditor_["URLInput"]);
- const URLInputButton = deprecateComponent('URLInputButton', external_wp_blockEditor_["URLInputButton"]);
- const URLPopover = deprecateComponent('URLPopover', external_wp_blockEditor_["URLPopover"]);
- const Warning = deprecateComponent('Warning', external_wp_blockEditor_["Warning"]);
- const WritingFlow = deprecateComponent('WritingFlow', external_wp_blockEditor_["WritingFlow"]);
- const createCustomColorsHOC = deprecateFunction('createCustomColorsHOC', external_wp_blockEditor_["createCustomColorsHOC"]);
- const getColorClassName = deprecateFunction('getColorClassName', external_wp_blockEditor_["getColorClassName"]);
- const getColorObjectByAttributeValues = deprecateFunction('getColorObjectByAttributeValues', external_wp_blockEditor_["getColorObjectByAttributeValues"]);
- const getColorObjectByColorValue = deprecateFunction('getColorObjectByColorValue', external_wp_blockEditor_["getColorObjectByColorValue"]);
- const getFontSize = deprecateFunction('getFontSize', external_wp_blockEditor_["getFontSize"]);
- const getFontSizeClass = deprecateFunction('getFontSizeClass', external_wp_blockEditor_["getFontSizeClass"]);
- const withColorContext = deprecateFunction('withColorContext', external_wp_blockEditor_["withColorContext"]);
- const withColors = deprecateFunction('withColors', external_wp_blockEditor_["withColors"]);
- const withFontSizes = deprecateFunction('withFontSizes', external_wp_blockEditor_["withFontSizes"]);
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/components/index.js
- // Block Creation Components
- // Post Related Components
- // State Related Components
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/utils/index.js
- /**
- * Internal dependencies
- */
- // CONCATENATED MODULE: ./node_modules/@wordpress/editor/build-module/index.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- /*
- * Backward compatibility
- */
- /***/ }),
- /***/ "RMJe":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
- /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9");
- /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
- /**
- * WordPress dependencies
- */
- const check = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
- }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
- d: "M18.3 5.6L9.9 16.9l-4.6-3.4-.9 1.2 5.8 4.3 9.3-12.6z"
- }));
- /* harmony default export */ __webpack_exports__["a"] = (check);
- /***/ }),
- /***/ "Rk8H":
- /***/ (function(module, exports, __webpack_require__) {
- // Load in dependencies
- var computedStyle = __webpack_require__("jTPX");
- /**
- * Calculate the `line-height` of a given node
- * @param {HTMLElement} node Element to calculate line height of. Must be in the DOM.
- * @returns {Number} `line-height` of the element in pixels
- */
- function lineHeight(node) {
- // Grab the line-height via style
- var lnHeightStr = computedStyle(node, 'line-height');
- var lnHeight = parseFloat(lnHeightStr, 10);
- // If the lineHeight did not contain a unit (i.e. it was numeric), convert it to ems (e.g. '2.3' === '2.3em')
- if (lnHeightStr === lnHeight + '') {
- // Save the old lineHeight style and update the em unit to the element
- var _lnHeightStyle = node.style.lineHeight;
- node.style.lineHeight = lnHeightStr + 'em';
- // Calculate the em based height
- lnHeightStr = computedStyle(node, 'line-height');
- lnHeight = parseFloat(lnHeightStr, 10);
- // Revert the lineHeight style
- if (_lnHeightStyle) {
- node.style.lineHeight = _lnHeightStyle;
- } else {
- delete node.style.lineHeight;
- }
- }
- // If the lineHeight is in `pt`, convert it to pixels (4px for 3pt)
- // DEV: `em` units are converted to `pt` in IE6
- // Conversion ratio from https://developer.mozilla.org/en-US/docs/Web/CSS/length
- if (lnHeightStr.indexOf('pt') !== -1) {
- lnHeight *= 4;
- lnHeight /= 3;
- // Otherwise, if the lineHeight is in `mm`, convert it to pixels (96px for 25.4mm)
- } else if (lnHeightStr.indexOf('mm') !== -1) {
- lnHeight *= 96;
- lnHeight /= 25.4;
- // Otherwise, if the lineHeight is in `cm`, convert it to pixels (96px for 2.54cm)
- } else if (lnHeightStr.indexOf('cm') !== -1) {
- lnHeight *= 96;
- lnHeight /= 2.54;
- // Otherwise, if the lineHeight is in `in`, convert it to pixels (96px for 1in)
- } else if (lnHeightStr.indexOf('in') !== -1) {
- lnHeight *= 96;
- // Otherwise, if the lineHeight is in `pc`, convert it to pixels (12pt for 1pc)
- } else if (lnHeightStr.indexOf('pc') !== -1) {
- lnHeight *= 16;
- }
- // Continue our computation
- lnHeight = Math.round(lnHeight);
- // If the line-height is "normal", calculate by font-size
- if (lnHeightStr === 'normal') {
- // Create a temporary node
- var nodeName = node.nodeName;
- var _node = document.createElement(nodeName);
- _node.innerHTML = ' ';
- // If we have a text area, reset it to only 1 row
- // https://github.com/twolfson/line-height/issues/4
- if (nodeName.toUpperCase() === 'TEXTAREA') {
- _node.setAttribute('rows', '1');
- }
- // Set the font-size of the element
- var fontSizeStr = computedStyle(node, 'font-size');
- _node.style.fontSize = fontSizeStr;
- // Remove default padding/border which can affect offset height
- // https://github.com/twolfson/line-height/issues/4
- // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetHeight
- _node.style.padding = '0px';
- _node.style.border = '0px';
- // Append it to the body
- var body = document.body;
- body.appendChild(_node);
- // Assume the line height of the element is the height
- var height = _node.offsetHeight;
- lnHeight = height;
- // Remove our child from the DOM
- body.removeChild(_node);
- }
- // Return the calculated height
- return lnHeight;
- }
- // Export lineHeight
- module.exports = lineHeight;
- /***/ }),
- /***/ "RxS6":
- /***/ (function(module, exports) {
- (function() { module.exports = window["wp"]["keycodes"]; }());
- /***/ }),
- /***/ "TSYQ":
- /***/ (function(module, exports, __webpack_require__) {
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
- Copyright (c) 2018 Jed Watson.
- Licensed under the MIT License (MIT), see
- http://jedwatson.github.io/classnames
- */
- /* global define */
- (function () {
- 'use strict';
- var hasOwn = {}.hasOwnProperty;
- function classNames() {
- var classes = [];
- for (var i = 0; i < arguments.length; i++) {
- var arg = arguments[i];
- if (!arg) continue;
- var argType = typeof arg;
- if (argType === 'string' || argType === 'number') {
- classes.push(arg);
- } else if (Array.isArray(arg)) {
- if (arg.length) {
- var inner = classNames.apply(null, arg);
- if (inner) {
- classes.push(inner);
- }
- }
- } else if (argType === 'object') {
- if (arg.toString === Object.prototype.toString) {
- for (var key in arg) {
- if (hasOwn.call(arg, key) && arg[key]) {
- classes.push(key);
- }
- }
- } else {
- classes.push(arg.toString());
- }
- }
- }
- return classes.join(' ');
- }
- if ( true && module.exports) {
- classNames.default = classNames;
- module.exports = classNames;
- } else if (true) {
- // register as 'classnames', consistent with npm package name
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
- return classNames;
- }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
- } else {}
- }());
- /***/ }),
- /***/ "Tqx9":
- /***/ (function(module, exports) {
- (function() { module.exports = window["wp"]["primitives"]; }());
- /***/ }),
- /***/ "WbBG":
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /**
- * Copyright (c) 2013-present, Facebook, Inc.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
- var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
- module.exports = ReactPropTypesSecret;
- /***/ }),
- /***/ "YLtl":
- /***/ (function(module, exports) {
- (function() { module.exports = window["lodash"]; }());
- /***/ }),
- /***/ "axFQ":
- /***/ (function(module, exports) {
- (function() { module.exports = window["wp"]["blockEditor"]; }());
- /***/ }),
- /***/ "bWcr":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
- /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9");
- /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
- /**
- * WordPress dependencies
- */
- const closeSmall = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
- }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
- 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"
- }));
- /* harmony default export */ __webpack_exports__["a"] = (closeSmall);
- /***/ }),
- /***/ "cDcd":
- /***/ (function(module, exports) {
- (function() { module.exports = window["React"]; }());
- /***/ }),
- /***/ "diJD":
- /***/ (function(module, exports) {
- (function() { module.exports = window["wp"]["reusableBlocks"]; }());
- /***/ }),
- /***/ "g56x":
- /***/ (function(module, exports) {
- (function() { module.exports = window["wp"]["hooks"]; }());
- /***/ }),
- /***/ "hF7m":
- /***/ (function(module, exports) {
- (function() { module.exports = window["wp"]["keyboardShortcuts"]; }());
- /***/ }),
- /***/ "iClF":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
- /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
- /**
- * WordPress dependencies
- */
- /** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */
- /**
- * Return an SVG icon.
- *
- * @param {IconProps} props icon is the SVG component to render
- * size is a number specifiying the icon size in pixels
- * Other props will be passed to wrapped SVG component
- *
- * @return {JSX.Element} Icon component
- */
- function Icon({
- icon,
- size = 24,
- ...props
- }) {
- return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["cloneElement"])(icon, {
- width: size,
- height: size,
- ...props
- });
- }
- /* harmony default export */ __webpack_exports__["a"] = (Icon);
- /***/ }),
- /***/ "jTPX":
- /***/ (function(module, exports) {
- // This code has been refactored for 140 bytes
- // You can see the original here: https://github.com/twolfson/computedStyle/blob/04cd1da2e30fa45844f95f5cb1ac898e9b9ef050/lib/computedStyle.js
- var computedStyle = function (el, prop, getComputedStyle) {
- getComputedStyle = window.getComputedStyle;
- // In one fell swoop
- return (
- // If we have getComputedStyle
- getComputedStyle ?
- // Query it
- // TODO: From CSS-Query notes, we might need (node, null) for FF
- getComputedStyle(el) :
- // Otherwise, we are in IE and use currentStyle
- el.currentStyle
- )[
- // Switch to camelCase for CSSOM
- // DEV: Grabbed from jQuery
- // https://github.com/jquery/jquery/blob/1.9-stable/src/css.js#L191-L194
- // https://github.com/jquery/jquery/blob/1.9-stable/src/core.js#L593-L597
- prop.replace(/-(\w)/gi, function (word, letter) {
- return letter.toUpperCase();
- })
- ];
- };
- module.exports = computedStyle;
- /***/ }),
- /***/ "jZUy":
- /***/ (function(module, exports) {
- (function() { module.exports = window["wp"]["coreData"]; }());
- /***/ }),
- /***/ "l3Sj":
- /***/ (function(module, exports) {
- (function() { module.exports = window["wp"]["i18n"]; }());
- /***/ }),
- /***/ "onLe":
- /***/ (function(module, exports) {
- (function() { module.exports = window["wp"]["notices"]; }());
- /***/ }),
- /***/ "pPDe":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- var LEAF_KEY, hasWeakMap;
- /**
- * Arbitrary value used as key for referencing cache object in WeakMap tree.
- *
- * @type {Object}
- */
- LEAF_KEY = {};
- /**
- * Whether environment supports WeakMap.
- *
- * @type {boolean}
- */
- hasWeakMap = typeof WeakMap !== 'undefined';
- /**
- * Returns the first argument as the sole entry in an array.
- *
- * @param {*} value Value to return.
- *
- * @return {Array} Value returned as entry in array.
- */
- function arrayOf( value ) {
- return [ value ];
- }
- /**
- * Returns true if the value passed is object-like, or false otherwise. A value
- * is object-like if it can support property assignment, e.g. object or array.
- *
- * @param {*} value Value to test.
- *
- * @return {boolean} Whether value is object-like.
- */
- function isObjectLike( value ) {
- return !! value && 'object' === typeof value;
- }
- /**
- * Creates and returns a new cache object.
- *
- * @return {Object} Cache object.
- */
- function createCache() {
- var cache = {
- clear: function() {
- cache.head = null;
- },
- };
- return cache;
- }
- /**
- * Returns true if entries within the two arrays are strictly equal by
- * reference from a starting index.
- *
- * @param {Array} a First array.
- * @param {Array} b Second array.
- * @param {number} fromIndex Index from which to start comparison.
- *
- * @return {boolean} Whether arrays are shallowly equal.
- */
- function isShallowEqual( a, b, fromIndex ) {
- var i;
- if ( a.length !== b.length ) {
- return false;
- }
- for ( i = fromIndex; i < a.length; i++ ) {
- if ( a[ i ] !== b[ i ] ) {
- return false;
- }
- }
- return true;
- }
- /**
- * Returns a memoized selector function. The getDependants function argument is
- * called before the memoized selector and is expected to return an immutable
- * reference or array of references on which the selector depends for computing
- * its own return value. The memoize cache is preserved only as long as those
- * dependant references remain the same. If getDependants returns a different
- * reference(s), the cache is cleared and the selector value regenerated.
- *
- * @param {Function} selector Selector function.
- * @param {Function} getDependants Dependant getter returning an immutable
- * reference or array of reference used in
- * cache bust consideration.
- *
- * @return {Function} Memoized selector.
- */
- /* harmony default export */ __webpack_exports__["a"] = (function( selector, getDependants ) {
- var rootCache, getCache;
- // Use object source as dependant if getter not provided
- if ( ! getDependants ) {
- getDependants = arrayOf;
- }
- /**
- * Returns the root cache. If WeakMap is supported, this is assigned to the
- * root WeakMap cache set, otherwise it is a shared instance of the default
- * cache object.
- *
- * @return {(WeakMap|Object)} Root cache object.
- */
- function getRootCache() {
- return rootCache;
- }
- /**
- * Returns the cache for a given dependants array. When possible, a WeakMap
- * will be used to create a unique cache for each set of dependants. This
- * is feasible due to the nature of WeakMap in allowing garbage collection
- * to occur on entries where the key object is no longer referenced. Since
- * WeakMap requires the key to be an object, this is only possible when the
- * dependant is object-like. The root cache is created as a hierarchy where
- * each top-level key is the first entry in a dependants set, the value a
- * WeakMap where each key is the next dependant, and so on. This continues
- * so long as the dependants are object-like. If no dependants are object-
- * like, then the cache is shared across all invocations.
- *
- * @see isObjectLike
- *
- * @param {Array} dependants Selector dependants.
- *
- * @return {Object} Cache object.
- */
- function getWeakMapCache( dependants ) {
- var caches = rootCache,
- isUniqueByDependants = true,
- i, dependant, map, cache;
- for ( i = 0; i < dependants.length; i++ ) {
- dependant = dependants[ i ];
- // Can only compose WeakMap from object-like key.
- if ( ! isObjectLike( dependant ) ) {
- isUniqueByDependants = false;
- break;
- }
- // Does current segment of cache already have a WeakMap?
- if ( caches.has( dependant ) ) {
- // Traverse into nested WeakMap.
- caches = caches.get( dependant );
- } else {
- // Create, set, and traverse into a new one.
- map = new WeakMap();
- caches.set( dependant, map );
- caches = map;
- }
- }
- // We use an arbitrary (but consistent) object as key for the last item
- // in the WeakMap to serve as our running cache.
- if ( ! caches.has( LEAF_KEY ) ) {
- cache = createCache();
- cache.isUniqueByDependants = isUniqueByDependants;
- caches.set( LEAF_KEY, cache );
- }
- return caches.get( LEAF_KEY );
- }
- // Assign cache handler by availability of WeakMap
- getCache = hasWeakMap ? getWeakMapCache : getRootCache;
- /**
- * Resets root memoization cache.
- */
- function clear() {
- rootCache = hasWeakMap ? new WeakMap() : createCache();
- }
- // eslint-disable-next-line jsdoc/check-param-names
- /**
- * The augmented selector call, considering first whether dependants have
- * changed before passing it to underlying memoize function.
- *
- * @param {Object} source Source object for derivation.
- * @param {...*} extraArgs Additional arguments to pass to selector.
- *
- * @return {*} Selector result.
- */
- function callSelector( /* source, ...extraArgs */ ) {
- var len = arguments.length,
- cache, node, i, args, dependants;
- // Create copy of arguments (avoid leaking deoptimization).
- args = new Array( len );
- for ( i = 0; i < len; i++ ) {
- args[ i ] = arguments[ i ];
- }
- dependants = getDependants.apply( null, args );
- cache = getCache( dependants );
- // If not guaranteed uniqueness by dependants (primitive type or lack
- // of WeakMap support), shallow compare against last dependants and, if
- // references have changed, destroy cache to recalculate result.
- if ( ! cache.isUniqueByDependants ) {
- if ( cache.lastDependants && ! isShallowEqual( dependants, cache.lastDependants, 0 ) ) {
- cache.clear();
- }
- cache.lastDependants = dependants;
- }
- node = cache.head;
- while ( node ) {
- // Check whether node arguments match arguments
- if ( ! isShallowEqual( node.args, args, 1 ) ) {
- node = node.next;
- continue;
- }
- // At this point we can assume we've found a match
- // Surface matched node to head if not already
- if ( node !== cache.head ) {
- // Adjust siblings to point to each other.
- node.prev.next = node.next;
- if ( node.next ) {
- node.next.prev = node.prev;
- }
- node.next = cache.head;
- node.prev = null;
- cache.head.prev = node;
- cache.head = node;
- }
- // Return immediately
- return node.val;
- }
- // No cached value found. Continue to insertion phase:
- node = {
- // Generate the result from original function
- val: selector.apply( null, args ),
- };
- // Avoid including the source object in the cache.
- args[ 0 ] = null;
- node.args = args;
- // Don't need to check whether node is already head, since it would
- // have been returned above already if it was
- // Shift existing head down list
- if ( cache.head ) {
- cache.head.prev = node;
- node.next = cache.head;
- }
- cache.head = node;
- return node.val;
- }
- callSelector.getDependants = getDependants;
- callSelector.clear = clear;
- clear();
- return callSelector;
- });
- /***/ }),
- /***/ "qRz9":
- /***/ (function(module, exports) {
- (function() { module.exports = window["wp"]["richText"]; }());
- /***/ }),
- /***/ "rmEH":
- /***/ (function(module, exports) {
- (function() { module.exports = window["wp"]["htmlEntities"]; }());
- /***/ }),
- /***/ "tI+e":
- /***/ (function(module, exports) {
- (function() { module.exports = window["wp"]["components"]; }());
- /***/ }),
- /***/ "w95h":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
- /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9");
- /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
- /**
- * WordPress dependencies
- */
- const close = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
- }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
- 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"
- }));
- /* harmony default export */ __webpack_exports__["a"] = (close);
- /***/ }),
- /***/ "wduq":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
- /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9");
- /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
- /**
- * WordPress dependencies
- */
- const wordpress = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
- xmlns: "http://www.w3.org/2000/svg",
- viewBox: "-2 -2 24 24"
- }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
- 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"
- }));
- /* harmony default export */ __webpack_exports__["a"] = (wordpress);
- /***/ }),
- /***/ "wx14":
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _extends; });
- function _extends() {
- _extends = Object.assign || function (target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = arguments[i];
- for (var key in source) {
- if (Object.prototype.hasOwnProperty.call(source, key)) {
- target[key] = source[key];
- }
- }
- }
- return target;
- };
- return _extends.apply(this, arguments);
- }
- /***/ }),
- /***/ "ywyh":
- /***/ (function(module, exports) {
- (function() { module.exports = window["wp"]["apiFetch"]; }());
- /***/ })
- /******/ });
|