1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293 |
- this["wp"] = this["wp"] || {}; this["wp"]["richText"] =
- /******/ (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 = 346);
- /******/ })
- /************************************************************************/
- /******/ ({
- /***/ 0:
- /***/ (function(module, exports) {
- (function() { module.exports = this["wp"]["element"]; }());
- /***/ }),
- /***/ 10:
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; });
- function _defineProperty(obj, key, value) {
- if (key in obj) {
- Object.defineProperty(obj, key, {
- value: value,
- enumerable: true,
- configurable: true,
- writable: true
- });
- } else {
- obj[key] = value;
- }
- return obj;
- }
- /***/ }),
- /***/ 11:
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _createClass; });
- function _defineProperties(target, props) {
- for (var i = 0; i < props.length; i++) {
- var descriptor = props[i];
- descriptor.enumerable = descriptor.enumerable || false;
- descriptor.configurable = true;
- if ("value" in descriptor) descriptor.writable = true;
- Object.defineProperty(target, descriptor.key, descriptor);
- }
- }
- function _createClass(Constructor, protoProps, staticProps) {
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
- if (staticProps) _defineProperties(Constructor, staticProps);
- return Constructor;
- }
- /***/ }),
- /***/ 12:
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _classCallCheck; });
- function _classCallCheck(instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- }
- /***/ }),
- /***/ 13:
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _possibleConstructorReturn; });
- /* harmony import */ var _helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(31);
- /* harmony import */ var _assertThisInitialized__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5);
- function _possibleConstructorReturn(self, call) {
- if (call && (Object(_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(call) === "object" || typeof call === "function")) {
- return call;
- }
- return Object(_assertThisInitialized__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])(self);
- }
- /***/ }),
- /***/ 14:
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _getPrototypeOf; });
- function _getPrototypeOf(o) {
- _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
- return o.__proto__ || Object.getPrototypeOf(o);
- };
- return _getPrototypeOf(o);
- }
- /***/ }),
- /***/ 15:
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js
- function _setPrototypeOf(o, p) {
- _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
- o.__proto__ = p;
- return o;
- };
- return _setPrototypeOf(o, p);
- }
- // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _inherits; });
- function _inherits(subClass, superClass) {
- if (typeof superClass !== "function" && superClass !== null) {
- throw new TypeError("Super expression must either be null or a function");
- }
- subClass.prototype = Object.create(superClass && superClass.prototype, {
- constructor: {
- value: subClass,
- writable: true,
- configurable: true
- }
- });
- if (superClass) _setPrototypeOf(subClass, superClass);
- }
- /***/ }),
- /***/ 16:
- /***/ (function(module, exports, __webpack_require__) {
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
- Copyright (c) 2017 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) && arg.length) {
- var inner = classNames.apply(null, arg);
- if (inner) {
- classes.push(inner);
- }
- } else if (argType === 'object') {
- for (var key in arg) {
- if (hasOwn.call(arg, key) && arg[key]) {
- classes.push(key);
- }
- }
- }
- }
- 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 {}
- }());
- /***/ }),
- /***/ 17:
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
- function _arrayWithoutHoles(arr) {
- if (Array.isArray(arr)) {
- for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
- arr2[i] = arr[i];
- }
- return arr2;
- }
- }
- // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js
- var iterableToArray = __webpack_require__(30);
- // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
- function _nonIterableSpread() {
- throw new TypeError("Invalid attempt to spread non-iterable instance");
- }
- // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _toConsumableArray; });
- function _toConsumableArray(arr) {
- return _arrayWithoutHoles(arr) || Object(iterableToArray["a" /* default */])(arr) || _nonIterableSpread();
- }
- /***/ }),
- /***/ 18:
- /***/ (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);
- }
- /***/ }),
- /***/ 19:
- /***/ (function(module, exports) {
- (function() { module.exports = this["wp"]["keycodes"]; }());
- /***/ }),
- /***/ 2:
- /***/ (function(module, exports) {
- (function() { module.exports = this["lodash"]; }());
- /***/ }),
- /***/ 21:
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js
- function _objectWithoutPropertiesLoose(source, excluded) {
- if (source == null) return {};
- var target = {};
- var sourceKeys = Object.keys(source);
- var key, i;
- for (i = 0; i < sourceKeys.length; i++) {
- key = sourceKeys[i];
- if (excluded.indexOf(key) >= 0) continue;
- target[key] = source[key];
- }
- return target;
- }
- // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectWithoutProperties; });
- function _objectWithoutProperties(source, excluded) {
- if (source == null) return {};
- var target = _objectWithoutPropertiesLoose(source, excluded);
- var key, i;
- if (Object.getOwnPropertySymbols) {
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
- for (i = 0; i < sourceSymbolKeys.length; i++) {
- key = sourceSymbolKeys[i];
- if (excluded.indexOf(key) >= 0) continue;
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
- target[key] = source[key];
- }
- }
- return target;
- }
- /***/ }),
- /***/ 27:
- /***/ (function(module, exports) {
- (function() { module.exports = this["wp"]["hooks"]; }());
- /***/ }),
- /***/ 30:
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _iterableToArray; });
- function _iterableToArray(iter) {
- if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
- }
- /***/ }),
- /***/ 31:
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _typeof; });
- function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof2(obj); }
- function _typeof(obj) {
- if (typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol") {
- _typeof = function _typeof(obj) {
- return _typeof2(obj);
- };
- } else {
- _typeof = function _typeof(obj) {
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof2(obj);
- };
- }
- return _typeof(obj);
- }
- /***/ }),
- /***/ 346:
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- var selectors_namespaceObject = {};
- __webpack_require__.r(selectors_namespaceObject);
- __webpack_require__.d(selectors_namespaceObject, "getFormatTypes", function() { return getFormatTypes; });
- __webpack_require__.d(selectors_namespaceObject, "getFormatType", function() { return getFormatType; });
- __webpack_require__.d(selectors_namespaceObject, "getFormatTypeForBareElement", function() { return getFormatTypeForBareElement; });
- __webpack_require__.d(selectors_namespaceObject, "getFormatTypeForClassName", function() { return getFormatTypeForClassName; });
- var actions_namespaceObject = {};
- __webpack_require__.r(actions_namespaceObject);
- __webpack_require__.d(actions_namespaceObject, "addFormatTypes", function() { return addFormatTypes; });
- __webpack_require__.d(actions_namespaceObject, "removeFormatTypes", function() { return removeFormatTypes; });
- // EXTERNAL MODULE: external {"this":["wp","data"]}
- var external_this_wp_data_ = __webpack_require__(4);
- // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectSpread.js
- var objectSpread = __webpack_require__(7);
- // EXTERNAL MODULE: external "lodash"
- var external_lodash_ = __webpack_require__(2);
- // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/store/reducer.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Reducer managing the format types
- *
- * @param {Object} state Current state.
- * @param {Object} action Dispatched action.
- *
- * @return {Object} Updated state.
- */
- function reducer_formatTypes() {
- var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- var action = arguments.length > 1 ? arguments[1] : undefined;
- switch (action.type) {
- case 'ADD_FORMAT_TYPES':
- return Object(objectSpread["a" /* default */])({}, state, Object(external_lodash_["keyBy"])(action.formatTypes, 'name'));
- case 'REMOVE_FORMAT_TYPES':
- return Object(external_lodash_["omit"])(state, action.names);
- }
- return state;
- }
- /* harmony default export */ var reducer = (Object(external_this_wp_data_["combineReducers"])({
- formatTypes: reducer_formatTypes
- }));
- // EXTERNAL MODULE: ./node_modules/rememo/es/rememo.js
- var rememo = __webpack_require__(36);
- // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/store/selectors.js
- /**
- * External dependencies
- */
- /**
- * Returns all the available format types.
- *
- * @param {Object} state Data state.
- *
- * @return {Array} Format types.
- */
- var getFormatTypes = Object(rememo["a" /* default */])(function (state) {
- return Object.values(state.formatTypes);
- }, function (state) {
- return [state.formatTypes];
- });
- /**
- * Returns a format type by name.
- *
- * @param {Object} state Data state.
- * @param {string} name Format type name.
- *
- * @return {Object?} Format type.
- */
- function getFormatType(state, name) {
- return state.formatTypes[name];
- }
- /**
- * Gets the format type, if any, that can handle a bare element (without a
- * data-format-type attribute), given the tag name of this element.
- *
- * @param {Object} state Data state.
- * @param {string} bareElementTagName The tag name of the element to find a
- * format type for.
- * @return {?Object} Format type.
- */
- function getFormatTypeForBareElement(state, bareElementTagName) {
- return Object(external_lodash_["find"])(getFormatTypes(state), function (_ref) {
- var className = _ref.className,
- tagName = _ref.tagName;
- return className === null && bareElementTagName === tagName;
- });
- }
- /**
- * Gets the format type, if any, that can handle an element, given its classes.
- *
- * @param {Object} state Data state.
- * @param {string} elementClassName The classes of the element to find a format
- * type for.
- * @return {?Object} Format type.
- */
- function getFormatTypeForClassName(state, elementClassName) {
- return Object(external_lodash_["find"])(getFormatTypes(state), function (_ref2) {
- var className = _ref2.className;
- if (className === null) {
- return false;
- }
- return " ".concat(elementClassName, " ").indexOf(" ".concat(className, " ")) >= 0;
- });
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/store/actions.js
- /**
- * External dependencies
- */
- /**
- * Returns an action object used in signalling that format types have been
- * added.
- *
- * @param {Array|Object} formatTypes Format types received.
- *
- * @return {Object} Action object.
- */
- function addFormatTypes(formatTypes) {
- return {
- type: 'ADD_FORMAT_TYPES',
- formatTypes: Object(external_lodash_["castArray"])(formatTypes)
- };
- }
- /**
- * Returns an action object used to remove a registered format type.
- *
- * @param {string|Array} names Format name.
- *
- * @return {Object} Action object.
- */
- function removeFormatTypes(names) {
- return {
- type: 'REMOVE_FORMAT_TYPES',
- names: Object(external_lodash_["castArray"])(names)
- };
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/store/index.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- Object(external_this_wp_data_["registerStore"])('core/rich-text', {
- reducer: reducer,
- selectors: selectors_namespaceObject,
- actions: actions_namespaceObject
- });
- // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules
- var toConsumableArray = __webpack_require__(17);
- // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/is-format-equal.js
- /**
- * Optimised equality check for format objects.
- *
- * @param {?Object} format1 Format to compare.
- * @param {?Object} format2 Format to compare.
- *
- * @return {boolean} True if formats are equal, false if not.
- */
- function isFormatEqual(format1, format2) {
- // Both not defined.
- if (format1 === format2) {
- return true;
- } // Either not defined.
- if (!format1 || !format2) {
- return false;
- }
- if (format1.type !== format2.type) {
- return false;
- }
- var attributes1 = format1.attributes;
- var attributes2 = format2.attributes; // Both not defined.
- if (attributes1 === attributes2) {
- return true;
- } // Either not defined.
- if (!attributes1 || !attributes2) {
- return false;
- }
- var keys1 = Object.keys(attributes1);
- var keys2 = Object.keys(attributes2);
- if (keys1.length !== keys2.length) {
- return false;
- }
- var length = keys1.length; // Optimise for speed.
- for (var i = 0; i < length; i++) {
- var name = keys1[i];
- if (attributes1[name] !== attributes2[name]) {
- return false;
- }
- }
- return true;
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/normalise-formats.js
- /**
- * Internal dependencies
- */
- /**
- * Normalises formats: ensures subsequent adjacent equal formats have the same
- * reference.
- *
- * @param {Object} value Value to normalise formats of.
- *
- * @return {Object} New value with normalised formats.
- */
- function normaliseFormats(value) {
- var newFormats = value.formats.slice();
- newFormats.forEach(function (formatsAtIndex, index) {
- var formatsAtPreviousIndex = newFormats[index - 1];
- if (formatsAtPreviousIndex) {
- var newFormatsAtIndex = formatsAtIndex.slice();
- newFormatsAtIndex.forEach(function (format, formatIndex) {
- var previousFormat = formatsAtPreviousIndex[formatIndex];
- if (isFormatEqual(format, previousFormat)) {
- newFormatsAtIndex[formatIndex] = previousFormat;
- }
- });
- newFormats[index] = newFormatsAtIndex;
- }
- });
- return Object(objectSpread["a" /* default */])({}, value, {
- formats: newFormats
- });
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/apply-format.js
- /**
- * External dependencies
- */
- /**
- * Internal dependencies
- */
- function replace(array, index, value) {
- array = array.slice();
- array[index] = value;
- return array;
- }
- /**
- * Apply a format object to a Rich Text value from the given `startIndex` to the
- * given `endIndex`. Indices are retrieved from the selection if none are
- * provided.
- *
- * @param {Object} value Value to modify.
- * @param {Object} format Format to apply.
- * @param {number} [startIndex] Start index.
- * @param {number} [endIndex] End index.
- *
- * @return {Object} A new value with the format applied.
- */
- function applyFormat(value, format) {
- var startIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : value.start;
- var endIndex = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : value.end;
- var formats = value.formats,
- activeFormats = value.activeFormats;
- var newFormats = formats.slice(); // The selection is collapsed.
- if (startIndex === endIndex) {
- var startFormat = Object(external_lodash_["find"])(newFormats[startIndex], {
- type: format.type
- }); // If the caret is at a format of the same type, expand start and end to
- // the edges of the format. This is useful to apply new attributes.
- if (startFormat) {
- var index = newFormats[startIndex].indexOf(startFormat);
- while (newFormats[startIndex] && newFormats[startIndex][index] === startFormat) {
- newFormats[startIndex] = replace(newFormats[startIndex], index, format);
- startIndex--;
- }
- endIndex++;
- while (newFormats[endIndex] && newFormats[endIndex][index] === startFormat) {
- newFormats[endIndex] = replace(newFormats[endIndex], index, format);
- endIndex++;
- }
- }
- } else {
- // Determine the highest position the new format can be inserted at.
- var position = +Infinity;
- for (var _index = startIndex; _index < endIndex; _index++) {
- if (newFormats[_index]) {
- newFormats[_index] = newFormats[_index].filter(function (_ref) {
- var type = _ref.type;
- return type !== format.type;
- });
- var length = newFormats[_index].length;
- if (length < position) {
- position = length;
- }
- } else {
- newFormats[_index] = [];
- position = 0;
- }
- }
- for (var _index2 = startIndex; _index2 < endIndex; _index2++) {
- newFormats[_index2].splice(position, 0, format);
- }
- }
- return normaliseFormats(Object(objectSpread["a" /* default */])({}, value, {
- formats: newFormats,
- // Always revise active formats. This serves as a placeholder for new
- // inputs with the format so new input appears with the format applied,
- // and ensures a format of the same type uses the latest values.
- activeFormats: [].concat(Object(toConsumableArray["a" /* default */])(Object(external_lodash_["reject"])(activeFormats, {
- type: format.type
- })), [format])
- }));
- }
- // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js
- var esm_typeof = __webpack_require__(31);
- // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/create-element.js
- /**
- * Parse the given HTML into a body element.
- *
- * Note: The current implementation will return a shared reference, reset on
- * each call to `createElement`. Therefore, you should not hold a reference to
- * the value to operate upon asynchronously, as it may have unexpected results.
- *
- * @param {HTMLDocument} document The HTML document to use to parse.
- * @param {string} html The HTML to parse.
- *
- * @return {HTMLBodyElement} Body element with parsed HTML.
- */
- function createElement(_ref, html) {
- var implementation = _ref.implementation;
- // Because `createHTMLDocument` is an expensive operation, and with this
- // function being internal to `rich-text` (full control in avoiding a risk
- // of asynchronous operations on the shared reference), a single document
- // is reused and reset for each call to the function.
- if (!createElement.body) {
- createElement.body = implementation.createHTMLDocument('').body;
- }
- createElement.body.innerHTML = html;
- return createElement.body;
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/special-characters.js
- /**
- * Line separator character, used for multiline text.
- */
- var LINE_SEPARATOR = "\u2028";
- /**
- * Object replacement character, used as a placeholder for objects.
- */
- var OBJECT_REPLACEMENT_CHARACTER = "\uFFFC";
- /**
- * Zero width non-breaking space, used as padding in the editable DOM tree when
- * it is empty otherwise.
- */
- var ZWNBSP = "\uFEFF";
- // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/create.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- /**
- * Browser dependencies
- */
- var _window$Node = window.Node,
- TEXT_NODE = _window$Node.TEXT_NODE,
- ELEMENT_NODE = _window$Node.ELEMENT_NODE;
- function createEmptyValue() {
- return {
- formats: [],
- replacements: [],
- text: ''
- };
- }
- function simpleFindKey(object, value) {
- for (var key in object) {
- if (object[key] === value) {
- return key;
- }
- }
- }
- function toFormat(_ref) {
- var type = _ref.type,
- attributes = _ref.attributes;
- var formatType;
- if (attributes && attributes.class) {
- formatType = Object(external_this_wp_data_["select"])('core/rich-text').getFormatTypeForClassName(attributes.class);
- if (formatType) {
- // Preserve any additional classes.
- attributes.class = " ".concat(attributes.class, " ").replace(" ".concat(formatType.className, " "), ' ').trim();
- if (!attributes.class) {
- delete attributes.class;
- }
- }
- }
- if (!formatType) {
- formatType = Object(external_this_wp_data_["select"])('core/rich-text').getFormatTypeForBareElement(type);
- }
- if (!formatType) {
- return attributes ? {
- type: type,
- attributes: attributes
- } : {
- type: type
- };
- }
- if (formatType.__experimentalCreatePrepareEditableTree && !formatType.__experimentalCreateOnChangeEditableValue) {
- return null;
- }
- if (!attributes) {
- return {
- type: formatType.name
- };
- }
- var registeredAttributes = {};
- var unregisteredAttributes = {};
- for (var name in attributes) {
- var key = simpleFindKey(formatType.attributes, name);
- if (key) {
- registeredAttributes[key] = attributes[name];
- } else {
- unregisteredAttributes[name] = attributes[name];
- }
- }
- return {
- type: formatType.name,
- attributes: registeredAttributes,
- unregisteredAttributes: unregisteredAttributes
- };
- }
- /**
- * Create a RichText value from an `Element` tree (DOM), an HTML string or a
- * plain text string, with optionally a `Range` object to set the selection. If
- * called without any input, an empty value will be created. If
- * `multilineTag` is provided, any content of direct children whose type matches
- * `multilineTag` will be separated by two newlines. The optional functions can
- * be used to filter out content.
- *
- * A value will have the following shape, which you are strongly encouraged not
- * to modify without the use of helper functions:
- *
- * ```js
- * {
- * text: string,
- * formats: Array,
- * replacements: Array,
- * ?start: number,
- * ?end: number,
- * }
- * ```
- *
- * As you can see, text and formatting are separated. `text` holds the text,
- * including any replacement characters for objects and lines. `formats`,
- * `objects` and `lines` are all sparse arrays of the same length as `text`. It
- * holds information about the formatting at the relevant text indices. Finally
- * `start` and `end` state which text indices are selected. They are only
- * provided if a `Range` was given.
- *
- * @param {Object} [$1] Optional named arguments.
- * @param {Element} [$1.element] Element to create value from.
- * @param {string} [$1.text] Text to create value from.
- * @param {string} [$1.html] HTML to create value from.
- * @param {Range} [$1.range] Range to create value from.
- * @param {string} [$1.multilineTag] Multiline tag if the structure is
- * multiline.
- * @param {Array} [$1.multilineWrapperTags] Tags where lines can be found if
- * nesting is possible.
- *
- * @return {Object} A rich text value.
- */
- function create() {
- var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
- element = _ref2.element,
- text = _ref2.text,
- html = _ref2.html,
- range = _ref2.range,
- multilineTag = _ref2.multilineTag,
- multilineWrapperTags = _ref2.multilineWrapperTags,
- isEditableTree = _ref2.__unstableIsEditableTree;
- if (typeof text === 'string' && text.length > 0) {
- return {
- formats: Array(text.length),
- replacements: Array(text.length),
- text: text
- };
- }
- if (typeof html === 'string' && html.length > 0) {
- element = createElement(document, html);
- }
- if (Object(esm_typeof["a" /* default */])(element) !== 'object') {
- return createEmptyValue();
- }
- if (!multilineTag) {
- return createFromElement({
- element: element,
- range: range,
- isEditableTree: isEditableTree
- });
- }
- return createFromMultilineElement({
- element: element,
- range: range,
- multilineTag: multilineTag,
- multilineWrapperTags: multilineWrapperTags,
- isEditableTree: isEditableTree
- });
- }
- /**
- * Helper to accumulate the value's selection start and end from the current
- * node and range.
- *
- * @param {Object} accumulator Object to accumulate into.
- * @param {Node} node Node to create value with.
- * @param {Range} range Range to create value with.
- * @param {Object} value Value that is being accumulated.
- */
- function accumulateSelection(accumulator, node, range, value) {
- if (!range) {
- return;
- }
- var parentNode = node.parentNode;
- var startContainer = range.startContainer,
- startOffset = range.startOffset,
- endContainer = range.endContainer,
- endOffset = range.endOffset;
- var currentLength = accumulator.text.length; // Selection can be extracted from value.
- if (value.start !== undefined) {
- accumulator.start = currentLength + value.start; // Range indicates that the current node has selection.
- } else if (node === startContainer && node.nodeType === TEXT_NODE) {
- accumulator.start = currentLength + startOffset; // Range indicates that the current node is selected.
- } else if (parentNode === startContainer && node === startContainer.childNodes[startOffset]) {
- accumulator.start = currentLength; // Range indicates that the selection is after the current node.
- } else if (parentNode === startContainer && node === startContainer.childNodes[startOffset - 1]) {
- accumulator.start = currentLength + value.text.length; // Fallback if no child inside handled the selection.
- } else if (node === startContainer) {
- accumulator.start = currentLength;
- } // Selection can be extracted from value.
- if (value.end !== undefined) {
- accumulator.end = currentLength + value.end; // Range indicates that the current node has selection.
- } else if (node === endContainer && node.nodeType === TEXT_NODE) {
- accumulator.end = currentLength + endOffset; // Range indicates that the current node is selected.
- } else if (parentNode === endContainer && node === endContainer.childNodes[endOffset - 1]) {
- accumulator.end = currentLength + value.text.length; // Range indicates that the selection is before the current node.
- } else if (parentNode === endContainer && node === endContainer.childNodes[endOffset]) {
- accumulator.end = currentLength; // Fallback if no child inside handled the selection.
- } else if (node === endContainer) {
- accumulator.end = currentLength + endOffset;
- }
- }
- /**
- * Adjusts the start and end offsets from a range based on a text filter.
- *
- * @param {Node} node Node of which the text should be filtered.
- * @param {Range} range The range to filter.
- * @param {Function} filter Function to use to filter the text.
- *
- * @return {?Object} Object containing range properties.
- */
- function filterRange(node, range, filter) {
- if (!range) {
- return;
- }
- var startContainer = range.startContainer,
- endContainer = range.endContainer;
- var startOffset = range.startOffset,
- endOffset = range.endOffset;
- if (node === startContainer) {
- startOffset = filter(node.nodeValue.slice(0, startOffset)).length;
- }
- if (node === endContainer) {
- endOffset = filter(node.nodeValue.slice(0, endOffset)).length;
- }
- return {
- startContainer: startContainer,
- startOffset: startOffset,
- endContainer: endContainer,
- endOffset: endOffset
- };
- }
- var ZWNBSPRegExp = new RegExp(ZWNBSP, 'g');
- function filterString(string) {
- // Reduce any whitespace used for HTML formatting to one space
- // character, because it will also be displayed as such by the browser.
- return string.replace(/[\n\r\t]+/g, ' ') // Remove padding added by `toTree`.
- .replace(ZWNBSPRegExp, '');
- }
- /**
- * Creates a Rich Text value from a DOM element and range.
- *
- * @param {Object} $1 Named argements.
- * @param {?Element} $1.element Element to create value from.
- * @param {?Range} $1.range Range to create value from.
- * @param {?string} $1.multilineTag Multiline tag if the structure is
- * multiline.
- * @param {?Array} $1.multilineWrapperTags Tags where lines can be found if
- * nesting is possible.
- *
- * @return {Object} A rich text value.
- */
- function createFromElement(_ref3) {
- var element = _ref3.element,
- range = _ref3.range,
- multilineTag = _ref3.multilineTag,
- multilineWrapperTags = _ref3.multilineWrapperTags,
- _ref3$currentWrapperT = _ref3.currentWrapperTags,
- currentWrapperTags = _ref3$currentWrapperT === void 0 ? [] : _ref3$currentWrapperT,
- isEditableTree = _ref3.isEditableTree;
- var accumulator = createEmptyValue();
- if (!element) {
- return accumulator;
- }
- if (!element.hasChildNodes()) {
- accumulateSelection(accumulator, element, range, createEmptyValue());
- return accumulator;
- }
- var length = element.childNodes.length; // Optimise for speed.
- var _loop = function _loop(index) {
- var node = element.childNodes[index];
- var type = node.nodeName.toLowerCase();
- if (node.nodeType === TEXT_NODE) {
- var text = filterString(node.nodeValue);
- range = filterRange(node, range, filterString);
- accumulateSelection(accumulator, node, range, {
- text: text
- }); // Create a sparse array of the same length as `text`, in which
- // formats can be added.
- accumulator.formats.length += text.length;
- accumulator.replacements.length += text.length;
- accumulator.text += text;
- return "continue";
- }
- if (node.nodeType !== ELEMENT_NODE) {
- return "continue";
- }
- if (isEditableTree && ( // Ignore any placeholders.
- node.getAttribute('data-rich-text-placeholder') || // Ignore any line breaks that are not inserted by us.
- type === 'br' && !node.getAttribute('data-rich-text-line-break'))) {
- accumulateSelection(accumulator, node, range, createEmptyValue());
- return "continue";
- }
- if (type === 'br') {
- accumulateSelection(accumulator, node, range, createEmptyValue());
- mergePair(accumulator, create({
- text: '\n'
- }));
- return "continue";
- }
- var lastFormats = accumulator.formats[accumulator.formats.length - 1];
- var lastFormat = lastFormats && lastFormats[lastFormats.length - 1];
- var newFormat = toFormat({
- type: type,
- attributes: getAttributes({
- element: node
- })
- });
- var format = isFormatEqual(newFormat, lastFormat) ? lastFormat : newFormat;
- if (multilineWrapperTags && multilineWrapperTags.indexOf(type) !== -1) {
- var _value = createFromMultilineElement({
- element: node,
- range: range,
- multilineTag: multilineTag,
- multilineWrapperTags: multilineWrapperTags,
- currentWrapperTags: [].concat(Object(toConsumableArray["a" /* default */])(currentWrapperTags), [format]),
- isEditableTree: isEditableTree
- });
- accumulateSelection(accumulator, node, range, _value);
- mergePair(accumulator, _value);
- return "continue";
- }
- var value = createFromElement({
- element: node,
- range: range,
- multilineTag: multilineTag,
- multilineWrapperTags: multilineWrapperTags,
- isEditableTree: isEditableTree
- });
- accumulateSelection(accumulator, node, range, value);
- if (!format) {
- mergePair(accumulator, value);
- } else if (value.text.length === 0) {
- if (format.attributes) {
- mergePair(accumulator, {
- formats: [,],
- replacements: [format],
- text: OBJECT_REPLACEMENT_CHARACTER
- });
- }
- } else {
- mergePair(accumulator, Object(objectSpread["a" /* default */])({}, value, {
- formats: Array.from(value.formats, function (formats) {
- return formats ? [format].concat(Object(toConsumableArray["a" /* default */])(formats)) : [format];
- })
- }));
- }
- };
- for (var index = 0; index < length; index++) {
- var _ret = _loop(index);
- if (_ret === "continue") continue;
- }
- return accumulator;
- }
- /**
- * Creates a rich text value from a DOM element and range that should be
- * multiline.
- *
- * @param {Object} $1 Named argements.
- * @param {?Element} $1.element Element to create value from.
- * @param {?Range} $1.range Range to create value from.
- * @param {?string} $1.multilineTag Multiline tag if the structure is
- * multiline.
- * @param {?Array} $1.multilineWrapperTags Tags where lines can be found if
- * nesting is possible.
- * @param {boolean} $1.currentWrapperTags Whether to prepend a line
- * separator.
- *
- * @return {Object} A rich text value.
- */
- function createFromMultilineElement(_ref4) {
- var element = _ref4.element,
- range = _ref4.range,
- multilineTag = _ref4.multilineTag,
- multilineWrapperTags = _ref4.multilineWrapperTags,
- _ref4$currentWrapperT = _ref4.currentWrapperTags,
- currentWrapperTags = _ref4$currentWrapperT === void 0 ? [] : _ref4$currentWrapperT,
- isEditableTree = _ref4.isEditableTree;
- var accumulator = createEmptyValue();
- if (!element || !element.hasChildNodes()) {
- return accumulator;
- }
- var length = element.children.length; // Optimise for speed.
- for (var index = 0; index < length; index++) {
- var node = element.children[index];
- if (node.nodeName.toLowerCase() !== multilineTag) {
- continue;
- }
- var value = createFromElement({
- element: node,
- range: range,
- multilineTag: multilineTag,
- multilineWrapperTags: multilineWrapperTags,
- currentWrapperTags: currentWrapperTags,
- isEditableTree: isEditableTree
- }); // Multiline value text should be separated by a line separator.
- if (index !== 0 || currentWrapperTags.length > 0) {
- mergePair(accumulator, {
- formats: [,],
- replacements: currentWrapperTags.length > 0 ? [currentWrapperTags] : [,],
- text: LINE_SEPARATOR
- });
- }
- accumulateSelection(accumulator, node, range, value);
- mergePair(accumulator, value);
- }
- return accumulator;
- }
- /**
- * Gets the attributes of an element in object shape.
- *
- * @param {Object} $1 Named argements.
- * @param {Element} $1.element Element to get attributes from.
- *
- * @return {?Object} Attribute object or `undefined` if the element has no
- * attributes.
- */
- function getAttributes(_ref5) {
- var element = _ref5.element;
- if (!element.hasAttributes()) {
- return;
- }
- var length = element.attributes.length;
- var accumulator; // Optimise for speed.
- for (var i = 0; i < length; i++) {
- var _element$attributes$i = element.attributes[i],
- name = _element$attributes$i.name,
- value = _element$attributes$i.value;
- if (name.indexOf('data-rich-text-') === 0) {
- continue;
- }
- accumulator = accumulator || {};
- accumulator[name] = value;
- }
- return accumulator;
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/concat.js
- /**
- * Internal dependencies
- */
- /**
- * Concats a pair of rich text values. Not that this mutates `a` and does NOT
- * normalise formats!
- *
- * @param {Object} a Value to mutate.
- * @param {Object} b Value to add read from.
- *
- * @return {Object} `a`, mutated.
- */
- function mergePair(a, b) {
- a.formats = a.formats.concat(b.formats);
- a.replacements = a.replacements.concat(b.replacements);
- a.text += b.text;
- return a;
- }
- /**
- * Combine all Rich Text values into one. This is similar to
- * `String.prototype.concat`.
- *
- * @param {...Object} values Objects to combine.
- *
- * @return {Object} A new value combining all given records.
- */
- function concat() {
- for (var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++) {
- values[_key] = arguments[_key];
- }
- return normaliseFormats(values.reduce(mergePair, create()));
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/get-active-formats.js
- /**
- * Gets the all format objects at the start of the selection.
- *
- * @param {Object} value Value to inspect.
- *
- * @return {?Object} Active format objects.
- */
- function getActiveFormats(_ref) {
- var formats = _ref.formats,
- start = _ref.start,
- end = _ref.end,
- activeFormats = _ref.activeFormats;
- if (start === undefined) {
- return [];
- }
- if (start === end) {
- // For a collapsed caret, it is possible to override the active formats.
- if (activeFormats) {
- return activeFormats;
- }
- var formatsBefore = formats[start - 1] || [];
- var formatsAfter = formats[start] || []; // By default, select the lowest amount of formats possible (which means
- // the caret is positioned outside the format boundary). The user can
- // then use arrow keys to define `activeFormats`.
- if (formatsBefore.length < formatsAfter.length) {
- return formatsBefore;
- }
- return formatsAfter;
- }
- return formats[start] || [];
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/get-active-format.js
- /**
- * External dependencies
- */
- /**
- * Internal dependencies
- */
- /**
- * Gets the format object by type at the start of the selection. This can be
- * used to get e.g. the URL of a link format at the current selection, but also
- * to check if a format is active at the selection. Returns undefined if there
- * is no format at the selection.
- *
- * @param {Object} value Value to inspect.
- * @param {string} formatType Format type to look for.
- *
- * @return {Object|undefined} Active format object of the specified type, or undefined.
- */
- function getActiveFormat(value, formatType) {
- return Object(external_lodash_["find"])(getActiveFormats(value), {
- type: formatType
- });
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/get-active-object.js
- /**
- * Internal dependencies
- */
- /**
- * Gets the active object, if there is any.
- *
- * @param {Object} value Value to inspect.
- *
- * @return {?Object} Active object, or undefined.
- */
- function getActiveObject(_ref) {
- var start = _ref.start,
- end = _ref.end,
- replacements = _ref.replacements,
- text = _ref.text;
- if (start + 1 !== end || text[start] !== OBJECT_REPLACEMENT_CHARACTER) {
- return;
- }
- return replacements[start];
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/get-text-content.js
- /**
- * Get the textual content of a Rich Text value. This is similar to
- * `Element.textContent`.
- *
- * @param {Object} value Value to use.
- *
- * @return {string} The text content.
- */
- function getTextContent(_ref) {
- var text = _ref.text;
- return text;
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/get-line-index.js
- /**
- * Internal dependencies
- */
- /**
- * Gets the currently selected line index, or the first line index if the
- * selection spans over multiple items.
- *
- * @param {Object} value Value to get the line index from.
- * @param {boolean} startIndex Optional index that should be contained by the
- * line. Defaults to the selection start of the
- * value.
- *
- * @return {?boolean} The line index. Undefined if not found.
- */
- function getLineIndex(_ref) {
- var start = _ref.start,
- text = _ref.text;
- var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : start;
- var index = startIndex;
- while (index--) {
- if (text[index] === LINE_SEPARATOR) {
- return index;
- }
- }
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/is-list-root-selected.js
- /**
- * Internal dependencies
- */
- /**
- * Whether or not the root list is selected.
- *
- * @param {Object} value The value to check.
- *
- * @return {boolean} True if the root list or nothing is selected, false if an
- * inner list is selected.
- */
- function isListRootSelected(value) {
- var replacements = value.replacements,
- start = value.start;
- var lineIndex = getLineIndex(value, start);
- var replacement = replacements[lineIndex];
- return !replacement || replacement.length < 1;
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/is-active-list-type.js
- /**
- * Internal dependencies
- */
- /**
- * Wether or not the selected list has the given tag name.
- *
- * @param {Object} value The value to check.
- * @param {string} type The tag name the list should have.
- * @param {string} rootType The current root tag name, to compare with in case
- * nothing is selected.
- *
- * @return {boolean} True if the current list type matches `type`, false if not.
- */
- function isActiveListType(value, type, rootType) {
- var replacements = value.replacements,
- start = value.start;
- var lineIndex = getLineIndex(value, start);
- var replacement = replacements[lineIndex];
- if (!replacement || replacement.length === 0) {
- return type === rootType;
- }
- var lastFormat = replacement[replacement.length - 1];
- return lastFormat.type === type;
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/is-collapsed.js
- /**
- * Check if the selection of a Rich Text value is collapsed or not. Collapsed
- * means that no characters are selected, but there is a caret present. If there
- * is no selection, `undefined` will be returned. This is similar to
- * `window.getSelection().isCollapsed()`.
- *
- * @param {Object} value The rich text value to check.
- *
- * @return {boolean|undefined} True if the selection is collapsed, false if not,
- * undefined if there is no selection.
- */
- function isCollapsed(_ref) {
- var start = _ref.start,
- end = _ref.end;
- if (start === undefined || end === undefined) {
- return;
- }
- return start === end;
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/is-empty.js
- /**
- * Internal dependencies
- */
- /**
- * Check if a Rich Text value is Empty, meaning it contains no text or any
- * objects (such as images).
- *
- * @param {Object} value Value to use.
- *
- * @return {boolean} True if the value is empty, false if not.
- */
- function isEmpty(_ref) {
- var text = _ref.text;
- return text.length === 0;
- }
- /**
- * Check if the current collapsed selection is on an empty line in case of a
- * multiline value.
- *
- * @param {Object} value Value te check.
- *
- * @return {boolean} True if the line is empty, false if not.
- */
- function isEmptyLine(_ref2) {
- var text = _ref2.text,
- start = _ref2.start,
- end = _ref2.end;
- if (start !== end) {
- return false;
- }
- if (text.length === 0) {
- return true;
- }
- if (start === 0 && text.slice(0, 1) === LINE_SEPARATOR) {
- return true;
- }
- if (start === text.length && text.slice(-1) === LINE_SEPARATOR) {
- return true;
- }
- return text.slice(start - 1, end + 1) === "".concat(LINE_SEPARATOR).concat(LINE_SEPARATOR);
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/join.js
- /**
- * Internal dependencies
- */
- /**
- * Combine an array of Rich Text values into one, optionally separated by
- * `separator`, which can be a Rich Text value, HTML string, or plain text
- * string. This is similar to `Array.prototype.join`.
- *
- * @param {Array<Object>} values An array of values to join.
- * @param {string|Object} [separator] Separator string or value.
- *
- * @return {Object} A new combined value.
- */
- function join(values) {
- var separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
- if (typeof separator === 'string') {
- separator = create({
- text: separator
- });
- }
- return normaliseFormats(values.reduce(function (accumlator, _ref) {
- var formats = _ref.formats,
- replacements = _ref.replacements,
- text = _ref.text;
- return {
- formats: accumlator.formats.concat(separator.formats, formats),
- replacements: accumlator.replacements.concat(separator.replacements, replacements),
- text: accumlator.text + separator.text + text
- };
- }));
- }
- // EXTERNAL MODULE: external {"this":["wp","element"]}
- var external_this_wp_element_ = __webpack_require__(0);
- // EXTERNAL MODULE: external {"this":["wp","hooks"]}
- var external_this_wp_hooks_ = __webpack_require__(27);
- // EXTERNAL MODULE: external {"this":["wp","compose"]}
- var external_this_wp_compose_ = __webpack_require__(8);
- // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/register-format-type.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Registers a new format provided a unique name and an object defining its
- * behavior.
- *
- * @param {string} name Format name.
- * @param {Object} settings Format settings.
- * @param {string} settings.tagName The HTML tag this format will wrap the selection with.
- * @param {string} [settings.className] A class to match the format.
- * @param {string} settings.title Name of the format.
- * @param {Function} settings.edit Should return a component for the user to interact with the new registered format.
- *
- * @return {WPFormat|undefined} The format, if it has been successfully registered;
- * otherwise `undefined`.
- */
- function registerFormatType(name, settings) {
- settings = Object(objectSpread["a" /* default */])({
- name: name
- }, settings);
- if (typeof settings.name !== 'string') {
- window.console.error('Format names must be strings.');
- return;
- }
- if (!/^[a-z][a-z0-9-]*\/[a-z][a-z0-9-]*$/.test(settings.name)) {
- window.console.error('Format names must contain a namespace prefix, include only lowercase alphanumeric characters or dashes, and start with a letter. Example: my-plugin/my-custom-format');
- return;
- }
- if (Object(external_this_wp_data_["select"])('core/rich-text').getFormatType(settings.name)) {
- window.console.error('Format "' + settings.name + '" is already registered.');
- return;
- }
- if (typeof settings.tagName !== 'string' || settings.tagName === '') {
- window.console.error('Format tag names must be a string.');
- return;
- }
- if ((typeof settings.className !== 'string' || settings.className === '') && settings.className !== null) {
- window.console.error('Format class names must be a string, or null to handle bare elements.');
- return;
- }
- if (!/^[_a-zA-Z]+[a-zA-Z0-9-]*$/.test(settings.className)) {
- window.console.error('A class name must begin with a letter, followed by any number of hyphens, letters, or numbers.');
- return;
- }
- if (settings.className === null) {
- var formatTypeForBareElement = Object(external_this_wp_data_["select"])('core/rich-text').getFormatTypeForBareElement(settings.tagName);
- if (formatTypeForBareElement) {
- window.console.error("Format \"".concat(formatTypeForBareElement.name, "\" is already registered to handle bare tag name \"").concat(settings.tagName, "\"."));
- return;
- }
- } else {
- var formatTypeForClassName = Object(external_this_wp_data_["select"])('core/rich-text').getFormatTypeForClassName(settings.className);
- if (formatTypeForClassName) {
- window.console.error("Format \"".concat(formatTypeForClassName.name, "\" is already registered to handle class name \"").concat(settings.className, "\"."));
- return;
- }
- }
- if (!('title' in settings) || settings.title === '') {
- window.console.error('The format "' + settings.name + '" must have a title.');
- return;
- }
- if ('keywords' in settings && settings.keywords.length > 3) {
- window.console.error('The format "' + settings.name + '" can have a maximum of 3 keywords.');
- return;
- }
- if (typeof settings.title !== 'string') {
- window.console.error('Format titles must be strings.');
- return;
- }
- Object(external_this_wp_data_["dispatch"])('core/rich-text').addFormatTypes(settings);
- if (settings.__experimentalCreatePrepareEditableTree) {
- Object(external_this_wp_hooks_["addFilter"])('experimentalRichText', name, function (OriginalComponent) {
- var selectPrefix = "format_prepare_props_(".concat(name, ")_");
- var dispatchPrefix = "format_on_change_props_(".concat(name, ")_");
- var Component = function Component(props) {
- var newProps = Object(objectSpread["a" /* default */])({}, props);
- var propsByPrefix = Object.keys(props).reduce(function (accumulator, key) {
- if (key.startsWith(selectPrefix)) {
- accumulator[key.slice(selectPrefix.length)] = props[key];
- }
- if (key.startsWith(dispatchPrefix)) {
- accumulator[key.slice(dispatchPrefix.length)] = props[key];
- }
- return accumulator;
- }, {});
- var args = {
- richTextIdentifier: props.identifier,
- blockClientId: props.clientId
- };
- if (settings.__experimentalCreateOnChangeEditableValue) {
- newProps["format_value_functions_(".concat(name, ")")] = settings.__experimentalCreatePrepareEditableTree(propsByPrefix, args);
- newProps["format_on_change_functions_(".concat(name, ")")] = settings.__experimentalCreateOnChangeEditableValue(propsByPrefix, args);
- } else {
- newProps["format_prepare_functions_(".concat(name, ")")] = settings.__experimentalCreatePrepareEditableTree(propsByPrefix, args);
- }
- return Object(external_this_wp_element_["createElement"])(OriginalComponent, newProps);
- };
- var hocs = [];
- if (settings.__experimentalGetPropsForEditableTreePreparation) {
- hocs.push(Object(external_this_wp_data_["withSelect"])(function (sel, _ref) {
- var clientId = _ref.clientId,
- identifier = _ref.identifier;
- return Object(external_lodash_["mapKeys"])(settings.__experimentalGetPropsForEditableTreePreparation(sel, {
- richTextIdentifier: identifier,
- blockClientId: clientId
- }), function (value, key) {
- return selectPrefix + key;
- });
- }));
- }
- if (settings.__experimentalGetPropsForEditableTreeChangeHandler) {
- hocs.push(Object(external_this_wp_data_["withDispatch"])(function (disp, _ref2) {
- var clientId = _ref2.clientId,
- identifier = _ref2.identifier;
- return Object(external_lodash_["mapKeys"])(settings.__experimentalGetPropsForEditableTreeChangeHandler(disp, {
- richTextIdentifier: identifier,
- blockClientId: clientId
- }), function (value, key) {
- return dispatchPrefix + key;
- });
- }));
- }
- return hocs.length ? Object(external_this_wp_compose_["compose"])(hocs)(Component) : Component;
- });
- }
- return settings;
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/remove-format.js
- /**
- * External dependencies
- */
- /**
- * Internal dependencies
- */
- /**
- * Remove any format object from a Rich Text value by type from the given
- * `startIndex` to the given `endIndex`. Indices are retrieved from the
- * selection if none are provided.
- *
- * @param {Object} value Value to modify.
- * @param {string} formatType Format type to remove.
- * @param {number} [startIndex] Start index.
- * @param {number} [endIndex] End index.
- *
- * @return {Object} A new value with the format applied.
- */
- function removeFormat(value, formatType) {
- var startIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : value.start;
- var endIndex = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : value.end;
- var formats = value.formats,
- activeFormats = value.activeFormats;
- var newFormats = formats.slice(); // If the selection is collapsed, expand start and end to the edges of the
- // format.
- if (startIndex === endIndex) {
- var format = Object(external_lodash_["find"])(newFormats[startIndex], {
- type: formatType
- });
- if (format) {
- while (Object(external_lodash_["find"])(newFormats[startIndex], format)) {
- filterFormats(newFormats, startIndex, formatType);
- startIndex--;
- }
- endIndex++;
- while (Object(external_lodash_["find"])(newFormats[endIndex], format)) {
- filterFormats(newFormats, endIndex, formatType);
- endIndex++;
- }
- }
- } else {
- for (var i = startIndex; i < endIndex; i++) {
- if (newFormats[i]) {
- filterFormats(newFormats, i, formatType);
- }
- }
- }
- return normaliseFormats(Object(objectSpread["a" /* default */])({}, value, {
- formats: newFormats,
- activeFormats: Object(external_lodash_["reject"])(activeFormats, {
- type: formatType
- })
- }));
- }
- function filterFormats(formats, index, formatType) {
- var newFormats = formats[index].filter(function (_ref) {
- var type = _ref.type;
- return type !== formatType;
- });
- if (newFormats.length) {
- formats[index] = newFormats;
- } else {
- delete formats[index];
- }
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/insert.js
- /**
- * Internal dependencies
- */
- /**
- * Insert a Rich Text value, an HTML string, or a plain text string, into a
- * Rich Text value at the given `startIndex`. Any content between `startIndex`
- * and `endIndex` will be removed. Indices are retrieved from the selection if
- * none are provided.
- *
- * @param {Object} value Value to modify.
- * @param {Object|string} valueToInsert Value to insert.
- * @param {number} [startIndex] Start index.
- * @param {number} [endIndex] End index.
- *
- * @return {Object} A new value with the value inserted.
- */
- function insert(value, valueToInsert) {
- var startIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : value.start;
- var endIndex = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : value.end;
- var formats = value.formats,
- replacements = value.replacements,
- text = value.text;
- if (typeof valueToInsert === 'string') {
- valueToInsert = create({
- text: valueToInsert
- });
- }
- var index = startIndex + valueToInsert.text.length;
- return normaliseFormats({
- formats: formats.slice(0, startIndex).concat(valueToInsert.formats, formats.slice(endIndex)),
- replacements: replacements.slice(0, startIndex).concat(valueToInsert.replacements, replacements.slice(endIndex)),
- text: text.slice(0, startIndex) + valueToInsert.text + text.slice(endIndex),
- start: index,
- end: index
- });
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/remove.js
- /**
- * Internal dependencies
- */
- /**
- * Remove content from a Rich Text value between the given `startIndex` and
- * `endIndex`. Indices are retrieved from the selection if none are provided.
- *
- * @param {Object} value Value to modify.
- * @param {number} [startIndex] Start index.
- * @param {number} [endIndex] End index.
- *
- * @return {Object} A new value with the content removed.
- */
- function remove_remove(value, startIndex, endIndex) {
- return insert(value, create(), startIndex, endIndex);
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/replace.js
- /**
- * Internal dependencies
- */
- /**
- * Search a Rich Text value and replace the match(es) with `replacement`. This
- * is similar to `String.prototype.replace`.
- *
- * @param {Object} value The value to modify.
- * @param {RegExp|string} pattern A RegExp object or literal. Can also be
- * a string. It is treated as a verbatim
- * string and is not interpreted as a
- * regular expression. Only the first
- * occurrence will be replaced.
- * @param {Function|string} replacement The match or matches are replaced with
- * the specified or the value returned by
- * the specified function.
- *
- * @return {Object} A new value with replacements applied.
- */
- function replace_replace(_ref, pattern, replacement) {
- var formats = _ref.formats,
- replacements = _ref.replacements,
- text = _ref.text,
- start = _ref.start,
- end = _ref.end;
- text = text.replace(pattern, function (match) {
- for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
- rest[_key - 1] = arguments[_key];
- }
- var offset = rest[rest.length - 2];
- var newText = replacement;
- var newFormats;
- var newReplacements;
- if (typeof newText === 'function') {
- newText = replacement.apply(void 0, [match].concat(rest));
- }
- if (Object(esm_typeof["a" /* default */])(newText) === 'object') {
- newFormats = newText.formats;
- newReplacements = newText.replacements;
- newText = newText.text;
- } else {
- newFormats = Array(newText.length);
- newReplacements = Array(newText.length);
- if (formats[offset]) {
- newFormats = newFormats.fill(formats[offset]);
- }
- }
- formats = formats.slice(0, offset).concat(newFormats, formats.slice(offset + match.length));
- replacements = replacements.slice(0, offset).concat(newReplacements, replacements.slice(offset + match.length));
- if (start) {
- start = end = offset + newText.length;
- }
- return newText;
- });
- return normaliseFormats({
- formats: formats,
- replacements: replacements,
- text: text,
- start: start,
- end: end
- });
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/insert-line-separator.js
- /**
- * Internal dependencies
- */
- /**
- * Insert a line break character into a Rich Text value at the given
- * `startIndex`. Any content between `startIndex` and `endIndex` will be
- * removed. Indices are retrieved from the selection if none are provided.
- *
- * @param {Object} value Value to modify.
- * @param {number} [startIndex] Start index.
- * @param {number} [endIndex] End index.
- *
- * @return {Object} A new value with the value inserted.
- */
- function insertLineSeparator(value) {
- var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : value.start;
- var endIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : value.end;
- var beforeText = getTextContent(value).slice(0, startIndex);
- var previousLineSeparatorIndex = beforeText.lastIndexOf(LINE_SEPARATOR);
- var previousLineSeparatorFormats = value.replacements[previousLineSeparatorIndex];
- var replacements = [,];
- if (previousLineSeparatorFormats) {
- replacements = [previousLineSeparatorFormats];
- }
- var valueToInsert = {
- formats: [,],
- replacements: replacements,
- text: LINE_SEPARATOR
- };
- return insert(value, valueToInsert, startIndex, endIndex);
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/remove-line-separator.js
- /**
- * Internal dependencies
- */
- /**
- * Removes a line separator character, if existing, from a Rich Text value at the current
- * indices. If no line separator exists on the indices it will return undefined.
- *
- * @param {Object} value Value to modify.
- * @param {boolean} backward indicates if are removing from the start index or the end index.
- *
- * @return {Object|undefined} A new value with the line separator removed. Or undefined if no line separator is found on the position.
- */
- function removeLineSeparator(value) {
- var backward = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
- var replacements = value.replacements,
- text = value.text,
- start = value.start,
- end = value.end;
- var collapsed = isCollapsed(value);
- var index = start - 1;
- var removeStart = collapsed ? start - 1 : start;
- var removeEnd = end;
- if (!backward) {
- index = end;
- removeStart = start;
- removeEnd = collapsed ? end + 1 : end;
- }
- if (text[index] !== LINE_SEPARATOR) {
- return;
- }
- var newValue; // If the line separator that is about te be removed
- // contains wrappers, remove the wrappers first.
- if (collapsed && replacements[index] && replacements[index].length) {
- var newReplacements = replacements.slice();
- newReplacements[index] = replacements[index].slice(0, -1);
- newValue = Object(objectSpread["a" /* default */])({}, value, {
- replacements: newReplacements
- });
- } else {
- newValue = remove_remove(value, removeStart, removeEnd);
- }
- return newValue;
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/insert-object.js
- /**
- * Internal dependencies
- */
- var insert_object_OBJECT_REPLACEMENT_CHARACTER = "\uFFFC";
- /**
- * Insert a format as an object into a Rich Text value at the given
- * `startIndex`. Any content between `startIndex` and `endIndex` will be
- * removed. Indices are retrieved from the selection if none are provided.
- *
- * @param {Object} value Value to modify.
- * @param {Object} formatToInsert Format to insert as object.
- * @param {number} [startIndex] Start index.
- * @param {number} [endIndex] End index.
- *
- * @return {Object} A new value with the object inserted.
- */
- function insertObject(value, formatToInsert, startIndex, endIndex) {
- var valueToInsert = {
- formats: [,],
- replacements: [formatToInsert],
- text: insert_object_OBJECT_REPLACEMENT_CHARACTER
- };
- return insert(value, valueToInsert, startIndex, endIndex);
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/slice.js
- /**
- * Slice a Rich Text value from `startIndex` to `endIndex`. Indices are
- * retrieved from the selection if none are provided. This is similar to
- * `String.prototype.slice`.
- *
- * @param {Object} value Value to modify.
- * @param {number} [startIndex] Start index.
- * @param {number} [endIndex] End index.
- *
- * @return {Object} A new extracted value.
- */
- function slice(value) {
- var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : value.start;
- var endIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : value.end;
- var formats = value.formats,
- replacements = value.replacements,
- text = value.text;
- if (startIndex === undefined || endIndex === undefined) {
- return Object(objectSpread["a" /* default */])({}, value);
- }
- return {
- formats: formats.slice(startIndex, endIndex),
- replacements: replacements.slice(startIndex, endIndex),
- text: text.slice(startIndex, endIndex)
- };
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/split.js
- /**
- * Internal dependencies
- */
- /**
- * Split a Rich Text value in two at the given `startIndex` and `endIndex`, or
- * split at the given separator. This is similar to `String.prototype.split`.
- * Indices are retrieved from the selection if none are provided.
- *
- * @param {Object} value
- * @param {Object[]} value.formats
- * @param {Object[]} value.replacements
- * @param {string} value.text
- * @param {number} value.start
- * @param {number} value.end
- * @param {number|string} [string] Start index, or string at which to split.
- *
- * @return {Array} An array of new values.
- */
- function split(_ref, string) {
- var formats = _ref.formats,
- replacements = _ref.replacements,
- text = _ref.text,
- start = _ref.start,
- end = _ref.end;
- if (typeof string !== 'string') {
- return splitAtSelection.apply(void 0, arguments);
- }
- var nextStart = 0;
- return text.split(string).map(function (substring) {
- var startIndex = nextStart;
- var value = {
- formats: formats.slice(startIndex, startIndex + substring.length),
- replacements: replacements.slice(startIndex, startIndex + substring.length),
- text: substring
- };
- nextStart += string.length + substring.length;
- if (start !== undefined && end !== undefined) {
- if (start >= startIndex && start < nextStart) {
- value.start = start - startIndex;
- } else if (start < startIndex && end > startIndex) {
- value.start = 0;
- }
- if (end >= startIndex && end < nextStart) {
- value.end = end - startIndex;
- } else if (start < nextStart && end > nextStart) {
- value.end = substring.length;
- }
- }
- return value;
- });
- }
- function splitAtSelection(_ref2) {
- var formats = _ref2.formats,
- replacements = _ref2.replacements,
- text = _ref2.text,
- start = _ref2.start,
- end = _ref2.end;
- var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : start;
- var endIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : end;
- var before = {
- formats: formats.slice(0, startIndex),
- replacements: replacements.slice(0, startIndex),
- text: text.slice(0, startIndex)
- };
- var after = {
- formats: formats.slice(endIndex),
- replacements: replacements.slice(endIndex),
- text: text.slice(endIndex),
- start: 0,
- end: 0
- };
- return [// Ensure newlines are trimmed.
- replace_replace(before, /\u2028+$/, ''), replace_replace(after, /^\u2028+/, '')];
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/get-format-type.js
- /**
- * WordPress dependencies
- */
- /**
- * Returns a registered format type.
- *
- * @param {string} name Format name.
- *
- * @return {?Object} Format type.
- */
- function get_format_type_getFormatType(name) {
- return Object(external_this_wp_data_["select"])('core/rich-text').getFormatType(name);
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/to-tree.js
- /**
- * Internal dependencies
- */
- /**
- * Converts a format object to information that can be used to create an element
- * from (type, attributes and object).
- *
- * @param {Object} $1 Named parameters.
- * @param {string} $1.type The format type.
- * @param {Object} $1.attributes The format attributes.
- * @param {Object} $1.unregisteredAttributes The unregistered format
- * attributes.
- * @param {boolean} $1.object Wether or not it is an object
- * format.
- * @param {boolean} $1.boundaryClass Wether or not to apply a boundary
- * class.
- * @return {Object} Information to be used for
- * element creation.
- */
- function fromFormat(_ref) {
- var type = _ref.type,
- attributes = _ref.attributes,
- unregisteredAttributes = _ref.unregisteredAttributes,
- object = _ref.object,
- boundaryClass = _ref.boundaryClass;
- var formatType = get_format_type_getFormatType(type);
- var elementAttributes = {};
- if (boundaryClass) {
- elementAttributes['data-rich-text-format-boundary'] = 'true';
- }
- if (!formatType) {
- if (attributes) {
- elementAttributes = Object(objectSpread["a" /* default */])({}, attributes, elementAttributes);
- }
- return {
- type: type,
- attributes: elementAttributes,
- object: object
- };
- }
- elementAttributes = Object(objectSpread["a" /* default */])({}, unregisteredAttributes, elementAttributes);
- for (var name in attributes) {
- var key = formatType.attributes ? formatType.attributes[name] : false;
- if (key) {
- elementAttributes[key] = attributes[name];
- } else {
- elementAttributes[name] = attributes[name];
- }
- }
- if (formatType.className) {
- if (elementAttributes.class) {
- elementAttributes.class = "".concat(formatType.className, " ").concat(elementAttributes.class);
- } else {
- elementAttributes.class = formatType.className;
- }
- }
- return {
- type: formatType.tagName,
- object: formatType.object,
- attributes: elementAttributes
- };
- }
- function toTree(_ref2) {
- var value = _ref2.value,
- multilineTag = _ref2.multilineTag,
- createEmpty = _ref2.createEmpty,
- append = _ref2.append,
- getLastChild = _ref2.getLastChild,
- getParent = _ref2.getParent,
- isText = _ref2.isText,
- getText = _ref2.getText,
- remove = _ref2.remove,
- appendText = _ref2.appendText,
- onStartIndex = _ref2.onStartIndex,
- onEndIndex = _ref2.onEndIndex,
- isEditableTree = _ref2.isEditableTree,
- placeholder = _ref2.placeholder;
- var formats = value.formats,
- replacements = value.replacements,
- text = value.text,
- start = value.start,
- end = value.end;
- var formatsLength = formats.length + 1;
- var tree = createEmpty();
- var multilineFormat = {
- type: multilineTag
- };
- var activeFormats = getActiveFormats(value);
- var deepestActiveFormat = activeFormats[activeFormats.length - 1];
- var lastSeparatorFormats;
- var lastCharacterFormats;
- var lastCharacter; // If we're building a multiline tree, start off with a multiline element.
- if (multilineTag) {
- append(append(tree, {
- type: multilineTag
- }), '');
- lastCharacterFormats = lastSeparatorFormats = [multilineFormat];
- } else {
- append(tree, '');
- }
- var _loop = function _loop(i) {
- var character = text.charAt(i);
- var shouldInsertPadding = isEditableTree && ( // Pad the line if the line is empty.
- !lastCharacter || lastCharacter === LINE_SEPARATOR || // Pad the line if the previous character is a line break, otherwise
- // the line break won't be visible.
- lastCharacter === '\n');
- var characterFormats = formats[i]; // Set multiline tags in queue for building the tree.
- if (multilineTag) {
- if (character === LINE_SEPARATOR) {
- characterFormats = lastSeparatorFormats = (replacements[i] || []).reduce(function (accumulator, format) {
- accumulator.push(format, multilineFormat);
- return accumulator;
- }, [multilineFormat]);
- } else {
- characterFormats = [].concat(Object(toConsumableArray["a" /* default */])(lastSeparatorFormats), Object(toConsumableArray["a" /* default */])(characterFormats || []));
- }
- }
- var pointer = getLastChild(tree);
- if (shouldInsertPadding && character === LINE_SEPARATOR) {
- var node = pointer;
- while (!isText(node)) {
- node = getLastChild(node);
- }
- append(getParent(node), ZWNBSP);
- } // Set selection for the start of line.
- if (lastCharacter === LINE_SEPARATOR) {
- var _node = pointer;
- while (!isText(_node)) {
- _node = getLastChild(_node);
- }
- if (onStartIndex && start === i) {
- onStartIndex(tree, _node);
- }
- if (onEndIndex && end === i) {
- onEndIndex(tree, _node);
- }
- }
- if (characterFormats) {
- characterFormats.forEach(function (format, formatIndex) {
- if (pointer && lastCharacterFormats && format === lastCharacterFormats[formatIndex] && ( // Do not reuse the last element if the character is a
- // line separator.
- character !== LINE_SEPARATOR || characterFormats.length - 1 !== formatIndex)) {
- pointer = getLastChild(pointer);
- return;
- }
- var type = format.type,
- attributes = format.attributes,
- unregisteredAttributes = format.unregisteredAttributes;
- var boundaryClass = isEditableTree && character !== LINE_SEPARATOR && format === deepestActiveFormat;
- var parent = getParent(pointer);
- var newNode = append(parent, fromFormat({
- type: type,
- attributes: attributes,
- unregisteredAttributes: unregisteredAttributes,
- boundaryClass: boundaryClass
- }));
- if (isText(pointer) && getText(pointer).length === 0) {
- remove(pointer);
- }
- pointer = append(newNode, '');
- });
- } // No need for further processing if the character is a line separator.
- if (character === LINE_SEPARATOR) {
- lastCharacterFormats = characterFormats;
- lastCharacter = character;
- return "continue";
- } // If there is selection at 0, handle it before characters are inserted.
- if (i === 0) {
- if (onStartIndex && start === 0) {
- onStartIndex(tree, pointer);
- }
- if (onEndIndex && end === 0) {
- onEndIndex(tree, pointer);
- }
- }
- if (character === OBJECT_REPLACEMENT_CHARACTER) {
- pointer = append(getParent(pointer), fromFormat(Object(objectSpread["a" /* default */])({}, replacements[i], {
- object: true
- }))); // Ensure pointer is text node.
- pointer = append(getParent(pointer), '');
- } else if (character === '\n') {
- pointer = append(getParent(pointer), {
- type: 'br',
- attributes: isEditableTree ? {
- 'data-rich-text-line-break': 'true'
- } : undefined,
- object: true
- }); // Ensure pointer is text node.
- pointer = append(getParent(pointer), '');
- } else if (!isText(pointer)) {
- pointer = append(getParent(pointer), character);
- } else {
- appendText(pointer, character);
- }
- if (onStartIndex && start === i + 1) {
- onStartIndex(tree, pointer);
- }
- if (onEndIndex && end === i + 1) {
- onEndIndex(tree, pointer);
- }
- if (shouldInsertPadding && i === text.length) {
- append(getParent(pointer), ZWNBSP);
- if (placeholder && text.length === 0) {
- append(getParent(pointer), {
- type: 'span',
- attributes: {
- 'data-rich-text-placeholder': placeholder,
- // Necessary to prevent the placeholder from catching
- // selection. The placeholder is also not editable after
- // all.
- contenteditable: 'false'
- }
- });
- }
- }
- lastCharacterFormats = characterFormats;
- lastCharacter = character;
- };
- for (var i = 0; i < formatsLength; i++) {
- var _ret = _loop(i);
- if (_ret === "continue") continue;
- }
- return tree;
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/to-dom.js
- /**
- * Internal dependencies
- */
- /**
- * Browser dependencies
- */
- var to_dom_TEXT_NODE = window.Node.TEXT_NODE;
- /**
- * Creates a path as an array of indices from the given root node to the given
- * node.
- *
- * @param {Node} node Node to find the path of.
- * @param {HTMLElement} rootNode Root node to find the path from.
- * @param {Array} path Initial path to build on.
- *
- * @return {Array} The path from the root node to the node.
- */
- function createPathToNode(node, rootNode, path) {
- var parentNode = node.parentNode;
- var i = 0;
- while (node = node.previousSibling) {
- i++;
- }
- path = [i].concat(Object(toConsumableArray["a" /* default */])(path));
- if (parentNode !== rootNode) {
- path = createPathToNode(parentNode, rootNode, path);
- }
- return path;
- }
- /**
- * Gets a node given a path (array of indices) from the given node.
- *
- * @param {HTMLElement} node Root node to find the wanted node in.
- * @param {Array} path Path (indices) to the wanted node.
- *
- * @return {Object} Object with the found node and the remaining offset (if any).
- */
- function getNodeByPath(node, path) {
- path = Object(toConsumableArray["a" /* default */])(path);
- while (node && path.length > 1) {
- node = node.childNodes[path.shift()];
- }
- return {
- node: node,
- offset: path[0]
- };
- }
- /**
- * Returns a new instance of a DOM tree upon which RichText operations can be
- * applied.
- *
- * Note: The current implementation will return a shared reference, reset on
- * each call to `createEmpty`. Therefore, you should not hold a reference to
- * the value to operate upon asynchronously, as it may have unexpected results.
- *
- * @return {WPRichTextTree} RichText tree.
- */
- var to_dom_createEmpty = function createEmpty() {
- return createElement(document, '');
- };
- function to_dom_append(element, child) {
- if (typeof child === 'string') {
- child = element.ownerDocument.createTextNode(child);
- }
- var _child = child,
- type = _child.type,
- attributes = _child.attributes;
- if (type) {
- child = element.ownerDocument.createElement(type);
- for (var key in attributes) {
- child.setAttribute(key, attributes[key]);
- }
- }
- return element.appendChild(child);
- }
- function to_dom_appendText(node, text) {
- node.appendData(text);
- }
- function to_dom_getLastChild(_ref) {
- var lastChild = _ref.lastChild;
- return lastChild;
- }
- function to_dom_getParent(_ref2) {
- var parentNode = _ref2.parentNode;
- return parentNode;
- }
- function to_dom_isText(_ref3) {
- var nodeType = _ref3.nodeType;
- return nodeType === to_dom_TEXT_NODE;
- }
- function to_dom_getText(_ref4) {
- var nodeValue = _ref4.nodeValue;
- return nodeValue;
- }
- function to_dom_remove(node) {
- return node.parentNode.removeChild(node);
- }
- function toDom(_ref5) {
- var value = _ref5.value,
- multilineTag = _ref5.multilineTag,
- prepareEditableTree = _ref5.prepareEditableTree,
- _ref5$isEditableTree = _ref5.isEditableTree,
- isEditableTree = _ref5$isEditableTree === void 0 ? true : _ref5$isEditableTree,
- placeholder = _ref5.placeholder;
- var startPath = [];
- var endPath = [];
- if (prepareEditableTree) {
- value = Object(objectSpread["a" /* default */])({}, value, {
- formats: prepareEditableTree(value)
- });
- }
- var tree = toTree({
- value: value,
- multilineTag: multilineTag,
- createEmpty: to_dom_createEmpty,
- append: to_dom_append,
- getLastChild: to_dom_getLastChild,
- getParent: to_dom_getParent,
- isText: to_dom_isText,
- getText: to_dom_getText,
- remove: to_dom_remove,
- appendText: to_dom_appendText,
- onStartIndex: function onStartIndex(body, pointer) {
- startPath = createPathToNode(pointer, body, [pointer.nodeValue.length]);
- },
- onEndIndex: function onEndIndex(body, pointer) {
- endPath = createPathToNode(pointer, body, [pointer.nodeValue.length]);
- },
- isEditableTree: isEditableTree,
- placeholder: placeholder
- });
- return {
- body: tree,
- selection: {
- startPath: startPath,
- endPath: endPath
- }
- };
- }
- /**
- * Create an `Element` tree from a Rich Text value and applies the difference to
- * the `Element` tree contained by `current`. If a `multilineTag` is provided,
- * text separated by two new lines will be wrapped in an `Element` of that type.
- *
- * @param {Object} $1 Named arguments.
- * @param {Object} $1.value Value to apply.
- * @param {HTMLElement} $1.current The live root node to apply the element tree to.
- * @param {string} [$1.multilineTag] Multiline tag.
- * @param {Array} [$1.multilineWrapperTags] Tags where lines can be found if nesting is possible.
- */
- function apply(_ref6) {
- var value = _ref6.value,
- current = _ref6.current,
- multilineTag = _ref6.multilineTag,
- prepareEditableTree = _ref6.prepareEditableTree,
- __unstableDomOnly = _ref6.__unstableDomOnly,
- placeholder = _ref6.placeholder;
- // Construct a new element tree in memory.
- var _toDom = toDom({
- value: value,
- multilineTag: multilineTag,
- prepareEditableTree: prepareEditableTree,
- placeholder: placeholder
- }),
- body = _toDom.body,
- selection = _toDom.selection;
- applyValue(body, current);
- if (value.start !== undefined && !__unstableDomOnly) {
- applySelection(selection, current);
- }
- }
- function applyValue(future, current) {
- var i = 0;
- var futureChild;
- while (futureChild = future.firstChild) {
- var currentChild = current.childNodes[i];
- if (!currentChild) {
- current.appendChild(futureChild);
- } else if (!currentChild.isEqualNode(futureChild)) {
- if (currentChild.nodeName !== futureChild.nodeName || currentChild.nodeType === to_dom_TEXT_NODE && currentChild.data !== futureChild.data) {
- current.replaceChild(futureChild, currentChild);
- } else {
- var currentAttributes = currentChild.attributes;
- var futureAttributes = futureChild.attributes;
- if (currentAttributes) {
- var ii = currentAttributes.length; // Reverse loop because `removeAttribute` on `currentChild`
- // changes `currentAttributes`.
- while (ii--) {
- var name = currentAttributes[ii].name;
- if (!futureChild.getAttribute(name)) {
- currentChild.removeAttribute(name);
- }
- }
- }
- if (futureAttributes) {
- for (var _ii = 0; _ii < futureAttributes.length; _ii++) {
- var _futureAttributes$_ii = futureAttributes[_ii],
- name = _futureAttributes$_ii.name,
- value = _futureAttributes$_ii.value;
- if (currentChild.getAttribute(name) !== value) {
- currentChild.setAttribute(name, value);
- }
- }
- }
- applyValue(futureChild, currentChild);
- future.removeChild(futureChild);
- }
- } else {
- future.removeChild(futureChild);
- }
- i++;
- }
- while (current.childNodes[i]) {
- current.removeChild(current.childNodes[i]);
- }
- }
- /**
- * Returns true if two ranges are equal, or false otherwise. Ranges are
- * considered equal if their start and end occur in the same container and
- * offset.
- *
- * @param {Range} a First range object to test.
- * @param {Range} b First range object to test.
- *
- * @return {boolean} Whether the two ranges are equal.
- */
- function isRangeEqual(a, b) {
- return a.startContainer === b.startContainer && a.startOffset === b.startOffset && a.endContainer === b.endContainer && a.endOffset === b.endOffset;
- }
- function applySelection(_ref7, current) {
- var startPath = _ref7.startPath,
- endPath = _ref7.endPath;
- var _getNodeByPath = getNodeByPath(current, startPath),
- startContainer = _getNodeByPath.node,
- startOffset = _getNodeByPath.offset;
- var _getNodeByPath2 = getNodeByPath(current, endPath),
- endContainer = _getNodeByPath2.node,
- endOffset = _getNodeByPath2.offset;
- var selection = window.getSelection();
- var ownerDocument = current.ownerDocument;
- var range = ownerDocument.createRange();
- range.setStart(startContainer, startOffset);
- range.setEnd(endContainer, endOffset); // Set back focus if focus is lost.
- if (ownerDocument.activeElement !== current) {
- current.focus();
- }
- if (selection.rangeCount > 0) {
- // If the to be added range and the live range are the same, there's no
- // need to remove the live range and add the equivalent range.
- if (isRangeEqual(range, selection.getRangeAt(0))) {
- return;
- }
- selection.removeAllRanges();
- }
- selection.addRange(range);
- }
- // EXTERNAL MODULE: external {"this":["wp","escapeHtml"]}
- var external_this_wp_escapeHtml_ = __webpack_require__(71);
- // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/to-html-string.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- /**
- * Create an HTML string from a Rich Text value. If a `multilineTag` is
- * provided, text separated by a line separator will be wrapped in it.
- *
- * @param {Object} $1 Named argements.
- * @param {Object} $1.value Rich text value.
- * @param {string} [$1.multilineTag] Multiline tag.
- *
- * @return {string} HTML string.
- */
- function toHTMLString(_ref) {
- var value = _ref.value,
- multilineTag = _ref.multilineTag;
- var tree = toTree({
- value: value,
- multilineTag: multilineTag,
- createEmpty: to_html_string_createEmpty,
- append: to_html_string_append,
- getLastChild: to_html_string_getLastChild,
- getParent: to_html_string_getParent,
- isText: to_html_string_isText,
- getText: to_html_string_getText,
- remove: to_html_string_remove,
- appendText: to_html_string_appendText
- });
- return createChildrenHTML(tree.children);
- }
- function to_html_string_createEmpty() {
- return {};
- }
- function to_html_string_getLastChild(_ref2) {
- var children = _ref2.children;
- return children && children[children.length - 1];
- }
- function to_html_string_append(parent, object) {
- if (typeof object === 'string') {
- object = {
- text: object
- };
- }
- object.parent = parent;
- parent.children = parent.children || [];
- parent.children.push(object);
- return object;
- }
- function to_html_string_appendText(object, text) {
- object.text += text;
- }
- function to_html_string_getParent(_ref3) {
- var parent = _ref3.parent;
- return parent;
- }
- function to_html_string_isText(_ref4) {
- var text = _ref4.text;
- return typeof text === 'string';
- }
- function to_html_string_getText(_ref5) {
- var text = _ref5.text;
- return text;
- }
- function to_html_string_remove(object) {
- var index = object.parent.children.indexOf(object);
- if (index !== -1) {
- object.parent.children.splice(index, 1);
- }
- return object;
- }
- function createElementHTML(_ref6) {
- var type = _ref6.type,
- attributes = _ref6.attributes,
- object = _ref6.object,
- children = _ref6.children;
- var attributeString = '';
- for (var key in attributes) {
- if (!Object(external_this_wp_escapeHtml_["isValidAttributeName"])(key)) {
- continue;
- }
- attributeString += " ".concat(key, "=\"").concat(Object(external_this_wp_escapeHtml_["escapeAttribute"])(attributes[key]), "\"");
- }
- if (object) {
- return "<".concat(type).concat(attributeString, ">");
- }
- return "<".concat(type).concat(attributeString, ">").concat(createChildrenHTML(children), "</").concat(type, ">");
- }
- function createChildrenHTML() {
- var children = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
- return children.map(function (child) {
- return child.text === undefined ? createElementHTML(child) : Object(external_this_wp_escapeHtml_["escapeHTML"])(child.text);
- }).join('');
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/toggle-format.js
- /**
- * Internal dependencies
- */
- /**
- * Toggles a format object to a Rich Text value at the current selection.
- *
- * @param {Object} value Value to modify.
- * @param {Object} format Format to apply or remove.
- *
- * @return {Object} A new value with the format applied or removed.
- */
- function toggleFormat(value, format) {
- if (getActiveFormat(value, format.type)) {
- return removeFormat(value, format.type);
- }
- return applyFormat(value, format);
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/unregister-format-type.js
- /**
- * WordPress dependencies
- */
- /**
- * Unregisters a format.
- *
- * @param {string} name Format name.
- *
- * @return {WPFormat|undefined} The previous format value, if it has been successfully
- * unregistered; otherwise `undefined`.
- */
- function unregisterFormatType(name) {
- var oldFormat = Object(external_this_wp_data_["select"])('core/rich-text').getFormatType(name);
- if (!oldFormat) {
- window.console.error("Format ".concat(name, " is not registered."));
- return;
- }
- if (oldFormat.__experimentalCreatePrepareEditableTree) {
- Object(external_this_wp_hooks_["removeFilter"])('experimentalRichText', name);
- }
- Object(external_this_wp_data_["dispatch"])('core/rich-text').removeFormatTypes(name);
- return oldFormat;
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/indent-list-items.js
- /**
- * Internal dependencies
- */
- /**
- * Gets the line index of the first previous list item with higher indentation.
- *
- * @param {Object} value Value to search.
- * @param {number} lineIndex Line index of the list item to compare with.
- *
- * @return {boolean} The line index.
- */
- function getTargetLevelLineIndex(_ref, lineIndex) {
- var text = _ref.text,
- replacements = _ref.replacements;
- var startFormats = replacements[lineIndex] || [];
- var index = lineIndex;
- while (index-- >= 0) {
- if (text[index] !== LINE_SEPARATOR) {
- continue;
- }
- var formatsAtIndex = replacements[index] || []; // Return the first line index that is one level higher. If the level is
- // lower or equal, there is no result.
- if (formatsAtIndex.length === startFormats.length + 1) {
- return index;
- } else if (formatsAtIndex.length <= startFormats.length) {
- return;
- }
- }
- }
- /**
- * Indents any selected list items if possible.
- *
- * @param {Object} value Value to change.
- * @param {Object} rootFormat Root format.
- *
- * @return {Object} The changed value.
- */
- function indentListItems(value, rootFormat) {
- var lineIndex = getLineIndex(value); // There is only one line, so the line cannot be indented.
- if (lineIndex === undefined) {
- return value;
- }
- var text = value.text,
- replacements = value.replacements,
- end = value.end;
- var previousLineIndex = getLineIndex(value, lineIndex);
- var formatsAtLineIndex = replacements[lineIndex] || [];
- var formatsAtPreviousLineIndex = replacements[previousLineIndex] || []; // The the indentation of the current line is greater than previous line,
- // then the line cannot be furter indented.
- if (formatsAtLineIndex.length > formatsAtPreviousLineIndex.length) {
- return value;
- }
- var newFormats = replacements.slice();
- var targetLevelLineIndex = getTargetLevelLineIndex(value, lineIndex);
- for (var index = lineIndex; index < end; index++) {
- if (text[index] !== LINE_SEPARATOR) {
- continue;
- } // Get the previous list, and if there's a child list, take over the
- // formats. If not, duplicate the last level and create a new level.
- if (targetLevelLineIndex) {
- var targetFormats = replacements[targetLevelLineIndex] || [];
- newFormats[index] = targetFormats.concat((newFormats[index] || []).slice(targetFormats.length - 1));
- } else {
- var _targetFormats = replacements[previousLineIndex] || [];
- var lastformat = _targetFormats[_targetFormats.length - 1] || rootFormat;
- newFormats[index] = _targetFormats.concat([lastformat], (newFormats[index] || []).slice(_targetFormats.length));
- }
- }
- return Object(objectSpread["a" /* default */])({}, value, {
- replacements: newFormats
- });
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/get-parent-line-index.js
- /**
- * Internal dependencies
- */
- /**
- * Gets the index of the first parent list. To get the parent list formats, we
- * go through every list item until we find one with exactly one format type
- * less.
- *
- * @param {Object} value Value to search.
- * @param {number} lineIndex Line index of a child list item.
- *
- * @return {Array} The parent list line index.
- */
- function getParentLineIndex(_ref, lineIndex) {
- var text = _ref.text,
- replacements = _ref.replacements;
- var startFormats = replacements[lineIndex] || [];
- var index = lineIndex;
- while (index-- >= 0) {
- if (text[index] !== LINE_SEPARATOR) {
- continue;
- }
- var formatsAtIndex = replacements[index] || [];
- if (formatsAtIndex.length === startFormats.length - 1) {
- return index;
- }
- }
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/get-last-child-index.js
- /**
- * Internal dependencies
- */
- /**
- * Gets the line index of the last child in the list.
- *
- * @param {Object} value Value to search.
- * @param {number} lineIndex Line index of a list item in the list.
- *
- * @return {Array} The index of the last child.
- */
- function getLastChildIndex(_ref, lineIndex) {
- var text = _ref.text,
- replacements = _ref.replacements;
- var lineFormats = replacements[lineIndex] || []; // Use the given line index in case there are no next children.
- var childIndex = lineIndex; // `lineIndex` could be `undefined` if it's the first line.
- for (var index = lineIndex || 0; index < text.length; index++) {
- // We're only interested in line indices.
- if (text[index] !== LINE_SEPARATOR) {
- continue;
- }
- var formatsAtIndex = replacements[index] || []; // If the amout of formats is equal or more, store it, then return the
- // last one if the amount of formats is less.
- if (formatsAtIndex.length >= lineFormats.length) {
- childIndex = index;
- } else {
- return childIndex;
- }
- } // If the end of the text is reached, return the last child index.
- return childIndex;
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/outdent-list-items.js
- /**
- * Internal dependencies
- */
- /**
- * Outdents any selected list items if possible.
- *
- * @param {Object} value Value to change.
- *
- * @return {Object} The changed value.
- */
- function outdentListItems(value) {
- var text = value.text,
- replacements = value.replacements,
- start = value.start,
- end = value.end;
- var startingLineIndex = getLineIndex(value, start); // Return early if the starting line index cannot be further outdented.
- if (replacements[startingLineIndex] === undefined) {
- return value;
- }
- var newFormats = replacements.slice(0);
- var parentFormats = replacements[getParentLineIndex(value, startingLineIndex)] || [];
- var endingLineIndex = getLineIndex(value, end);
- var lastChildIndex = getLastChildIndex(value, endingLineIndex); // Outdent all list items from the starting line index until the last child
- // index of the ending list. All children of the ending list need to be
- // outdented, otherwise they'll be orphaned.
- for (var index = startingLineIndex; index <= lastChildIndex; index++) {
- // Skip indices that are not line separators.
- if (text[index] !== LINE_SEPARATOR) {
- continue;
- } // In the case of level 0, the formats at the index are undefined.
- var currentFormats = newFormats[index] || []; // Omit the indentation level where the selection starts.
- newFormats[index] = parentFormats.concat(currentFormats.slice(parentFormats.length + 1));
- if (newFormats[index].length === 0) {
- delete newFormats[index];
- }
- }
- return Object(objectSpread["a" /* default */])({}, value, {
- replacements: newFormats
- });
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/change-list-type.js
- /**
- * Internal dependencies
- */
- /**
- * Changes the list type of the selected indented list, if any. Looks at the
- * currently selected list item and takes the parent list, then changes the list
- * type of this list. When multiple lines are selected, the parent lists are
- * takes and changed.
- *
- * @param {Object} value Value to change.
- * @param {Object} newFormat The new list format object. Choose between
- * `{ type: 'ol' }` and `{ type: 'ul' }`.
- *
- * @return {Object} The changed value.
- */
- function changeListType(value, newFormat) {
- var text = value.text,
- replacements = value.replacements,
- start = value.start,
- end = value.end;
- var startingLineIndex = getLineIndex(value, start);
- var startLineFormats = replacements[startingLineIndex] || [];
- var endLineFormats = replacements[getLineIndex(value, end)] || [];
- var startIndex = getParentLineIndex(value, startingLineIndex);
- var newReplacements = replacements.slice();
- var startCount = startLineFormats.length - 1;
- var endCount = endLineFormats.length - 1;
- var changed;
- for (var index = startIndex + 1 || 0; index < text.length; index++) {
- if (text[index] !== LINE_SEPARATOR) {
- continue;
- }
- if ((newReplacements[index] || []).length <= startCount) {
- break;
- }
- if (!newReplacements[index]) {
- continue;
- }
- changed = true;
- newReplacements[index] = newReplacements[index].map(function (format, i) {
- return i < startCount || i > endCount ? format : newFormat;
- });
- }
- if (!changed) {
- return value;
- }
- return Object(objectSpread["a" /* default */])({}, value, {
- replacements: newReplacements
- });
- }
- // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
- var esm_extends = __webpack_require__(18);
- // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js
- var classCallCheck = __webpack_require__(12);
- // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/createClass.js
- var createClass = __webpack_require__(11);
- // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js
- var possibleConstructorReturn = __webpack_require__(13);
- // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js
- var getPrototypeOf = __webpack_require__(14);
- // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js
- var assertThisInitialized = __webpack_require__(5);
- // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/inherits.js + 1 modules
- var inherits = __webpack_require__(15);
- // EXTERNAL MODULE: ./node_modules/classnames/index.js
- var classnames = __webpack_require__(16);
- var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
- // EXTERNAL MODULE: external {"this":["wp","keycodes"]}
- var external_this_wp_keycodes_ = __webpack_require__(19);
- // EXTERNAL MODULE: external {"this":["wp","isShallowEqual"]}
- var external_this_wp_isShallowEqual_ = __webpack_require__(41);
- var external_this_wp_isShallowEqual_default = /*#__PURE__*/__webpack_require__.n(external_this_wp_isShallowEqual_);
- // EXTERNAL MODULE: external {"this":["wp","deprecated"]}
- var external_this_wp_deprecated_ = __webpack_require__(37);
- var external_this_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_this_wp_deprecated_);
- // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/component/format-edit.js
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- /**
- * Set of all interactive content tags.
- *
- * @see https://html.spec.whatwg.org/multipage/dom.html#interactive-content
- */
- var interactiveContentTags = new Set(['a', 'audio', 'button', 'details', 'embed', 'iframe', 'input', 'label', 'select', 'textarea', 'video']);
- var format_edit_FormatEdit = function FormatEdit(_ref) {
- var formatTypes = _ref.formatTypes,
- onChange = _ref.onChange,
- value = _ref.value,
- allowedFormats = _ref.allowedFormats,
- withoutInteractiveFormatting = _ref.withoutInteractiveFormatting;
- return formatTypes.map(function (_ref2) {
- var name = _ref2.name,
- Edit = _ref2.edit,
- tagName = _ref2.tagName;
- if (!Edit) {
- return null;
- }
- if (allowedFormats && allowedFormats.indexOf(name) === -1) {
- return null;
- }
- if (withoutInteractiveFormatting && interactiveContentTags.has(tagName)) {
- return null;
- }
- var activeFormat = getActiveFormat(value, name);
- var isActive = activeFormat !== undefined;
- var activeObject = getActiveObject(value);
- var isObjectActive = activeObject !== undefined && activeObject.type === name;
- return Object(external_this_wp_element_["createElement"])(Edit, {
- key: name,
- isActive: isActive,
- activeAttributes: isActive ? activeFormat.attributes || {} : {},
- isObjectActive: isObjectActive,
- activeObjectAttributes: isObjectActive ? activeObject.attributes || {} : {},
- value: value,
- onChange: onChange
- });
- });
- };
- /* harmony default export */ var format_edit = (Object(external_this_wp_data_["withSelect"])(function (select) {
- return {
- formatTypes: select('core/rich-text').getFormatTypes()
- };
- })(format_edit_FormatEdit));
- // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js + 1 modules
- var objectWithoutProperties = __webpack_require__(21);
- // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/component/aria.js
- /**
- * External dependencies
- */
- var aria_isAriaPropName = function isAriaPropName(name) {
- return Object(external_lodash_["startsWith"])(name, 'aria-');
- };
- var aria_pickAriaProps = function pickAriaProps(props) {
- return Object(external_lodash_["pickBy"])(props, function (value, key) {
- return aria_isAriaPropName(key) && !Object(external_lodash_["isNil"])(value);
- });
- };
- var aria_diffAriaProps = function diffAriaProps(props, nextProps) {
- var prevAriaKeys = Object(external_lodash_["keys"])(aria_pickAriaProps(props));
- var nextAriaKeys = Object(external_lodash_["keys"])(aria_pickAriaProps(nextProps));
- var removedKeys = Object(external_lodash_["difference"])(prevAriaKeys, nextAriaKeys);
- var updatedKeys = nextAriaKeys.filter(function (key) {
- return !Object(external_lodash_["isEqual"])(props[key], nextProps[key]);
- });
- return {
- removedKeys: removedKeys,
- updatedKeys: updatedKeys
- };
- };
- // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/component/editable.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- var editable_Editable =
- /*#__PURE__*/
- function (_Component) {
- Object(inherits["a" /* default */])(Editable, _Component);
- function Editable() {
- var _this;
- Object(classCallCheck["a" /* default */])(this, Editable);
- _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(Editable).call(this));
- _this.bindEditorNode = _this.bindEditorNode.bind(Object(assertThisInitialized["a" /* default */])(_this));
- return _this;
- } // We must prevent rerenders because the browser will modify the DOM. React
- // will rerender the DOM fine, but we're losing selection and it would be
- // more expensive to do so as it would just set the inner HTML through
- // `dangerouslySetInnerHTML`. Instead RichText does it's own diffing and
- // selection setting.
- //
- // Because we never update the component, we have to look through props and
- // update the attributes on the wrapper nodes here. `componentDidUpdate`
- // will never be called.
- Object(createClass["a" /* default */])(Editable, [{
- key: "shouldComponentUpdate",
- value: function shouldComponentUpdate(nextProps) {
- var _this2 = this;
- if (!Object(external_lodash_["isEqual"])(this.props.style, nextProps.style)) {
- this.editorNode.setAttribute('style', '');
- Object.assign(this.editorNode.style, Object(objectSpread["a" /* default */])({}, nextProps.style || {}, {
- whiteSpace: 'pre-wrap'
- }));
- }
- if (!Object(external_lodash_["isEqual"])(this.props.className, nextProps.className)) {
- this.editorNode.className = nextProps.className;
- }
- if (this.props.start !== nextProps.start) {
- this.editorNode.setAttribute('start', nextProps.start);
- }
- if (this.props.reversed !== nextProps.reversed) {
- this.editorNode.reversed = nextProps.reversed;
- }
- var _diffAriaProps = aria_diffAriaProps(this.props, nextProps),
- removedKeys = _diffAriaProps.removedKeys,
- updatedKeys = _diffAriaProps.updatedKeys;
- removedKeys.forEach(function (key) {
- return _this2.editorNode.removeAttribute(key);
- });
- updatedKeys.forEach(function (key) {
- return _this2.editorNode.setAttribute(key, nextProps[key]);
- });
- return false;
- }
- }, {
- key: "bindEditorNode",
- value: function bindEditorNode(editorNode) {
- this.editorNode = editorNode;
- this.props.setRef(editorNode);
- }
- }, {
- key: "render",
- value: function render() {
- var _this$props = this.props,
- _this$props$tagName = _this$props.tagName,
- tagName = _this$props$tagName === void 0 ? 'div' : _this$props$tagName,
- _this$props$style = _this$props.style,
- style = _this$props$style === void 0 ? {} : _this$props$style,
- record = _this$props.record,
- valueToEditableHTML = _this$props.valueToEditableHTML,
- className = _this$props.className,
- remainingProps = Object(objectWithoutProperties["a" /* default */])(_this$props, ["tagName", "style", "record", "valueToEditableHTML", "className"]);
- delete remainingProps.setRef; // In HTML, leading and trailing spaces are not visible, and multiple
- // spaces elsewhere are visually reduced to one space. This rule
- // prevents spaces from collapsing so all space is visible in the editor
- // and can be removed.
- // It also prevents some browsers from inserting non-breaking spaces at
- // the end of a line to prevent the space from visually disappearing.
- // Sometimes these non breaking spaces can linger in the editor causing
- // unwanted non breaking spaces in between words. If also prevent
- // Firefox from inserting a trailing `br` node to visualise any trailing
- // space, causing the element to be saved.
- //
- // > Authors are encouraged to set the 'white-space' property on editing
- // > hosts and on markup that was originally created through these
- // > editing mechanisms to the value 'pre-wrap'. Default HTML whitespace
- // > handling is not well suited to WYSIWYG editing, and line wrapping
- // > will not work correctly in some corner cases if 'white-space' is
- // > left at its default value.
- // >
- // > https://html.spec.whatwg.org/multipage/interaction.html#best-practices-for-in-page-editors
- var whiteSpace = 'pre-wrap';
- return Object(external_this_wp_element_["createElement"])(tagName, Object(objectSpread["a" /* default */])({
- role: 'textbox',
- 'aria-multiline': true,
- className: className,
- contentEditable: true,
- ref: this.bindEditorNode,
- style: Object(objectSpread["a" /* default */])({}, style, {
- whiteSpace: whiteSpace
- }),
- suppressContentEditableWarning: true,
- dangerouslySetInnerHTML: {
- __html: valueToEditableHTML(record)
- }
- }, remainingProps));
- }
- }]);
- return Editable;
- }(external_this_wp_element_["Component"]);
- // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/update-formats.js
- /**
- * Internal dependencies
- */
- /**
- * Efficiently updates all the formats from `start` (including) until `end`
- * (excluding) with the active formats. Mutates `value`.
- *
- * @param {Object} $1 Named paramentes.
- * @param {Object} $1.value Value te update.
- * @param {number} $1.start Index to update from.
- * @param {number} $1.end Index to update until.
- * @param {Array} $1.formats Replacement formats.
- *
- * @return {Object} Mutated value.
- */
- function updateFormats(_ref) {
- var value = _ref.value,
- start = _ref.start,
- end = _ref.end,
- formats = _ref.formats;
- var formatsBefore = value.formats[start - 1] || [];
- var formatsAfter = value.formats[end] || []; // First, fix the references. If any format right before or after are
- // equal, the replacement format should use the same reference.
- value.activeFormats = formats.map(function (format, index) {
- if (formatsBefore[index]) {
- if (isFormatEqual(format, formatsBefore[index])) {
- return formatsBefore[index];
- }
- } else if (formatsAfter[index]) {
- if (isFormatEqual(format, formatsAfter[index])) {
- return formatsAfter[index];
- }
- }
- return format;
- });
- while (--end >= start) {
- if (value.activeFormats.length > 0) {
- value.formats[end] = value.activeFormats;
- } else {
- delete value.formats[end];
- }
- }
- return value;
- }
- // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/component/index.js
- /**
- * External dependencies
- */
- /**
- * WordPress dependencies
- */
- /**
- * Internal dependencies
- */
- /**
- * Browser dependencies
- */
- var _window = window,
- getSelection = _window.getSelection,
- getComputedStyle = _window.getComputedStyle;
- /**
- * All inserting input types that would insert HTML into the DOM.
- *
- * @see https://www.w3.org/TR/input-events-2/#interface-InputEvent-Attributes
- *
- * @type {Set}
- */
- var INSERTION_INPUT_TYPES_TO_IGNORE = new Set(['insertParagraph', 'insertOrderedList', 'insertUnorderedList', 'insertHorizontalRule', 'insertLink']);
- /**
- * Global stylesheet.
- */
- var globalStyle = document.createElement('style');
- document.head.appendChild(globalStyle);
- function createPrepareEditableTree(props, prefix) {
- var fns = Object.keys(props).reduce(function (accumulator, key) {
- if (key.startsWith(prefix)) {
- accumulator.push(props[key]);
- }
- return accumulator;
- }, []);
- return function (value) {
- return fns.reduce(function (accumulator, fn) {
- return fn(accumulator, value.text);
- }, value.formats);
- };
- }
- /**
- * If the selection is set on the placeholder element, collapse the selection to
- * the start (before the placeholder).
- */
- function fixPlaceholderSelection() {
- var selection = window.getSelection();
- var anchorNode = selection.anchorNode,
- anchorOffset = selection.anchorOffset;
- if (anchorNode.nodeType !== anchorNode.ELEMENT_NODE) {
- return;
- }
- var targetNode = anchorNode.childNodes[anchorOffset];
- if (!targetNode || targetNode.nodeType !== targetNode.ELEMENT_NODE || !targetNode.getAttribute('data-rich-text-placeholder')) {
- return;
- }
- selection.collapseToStart();
- }
- /**
- * See export statement below.
- */
- var component_RichText =
- /*#__PURE__*/
- function (_Component) {
- Object(inherits["a" /* default */])(RichText, _Component);
- function RichText(_ref) {
- var _this;
- var value = _ref.value,
- selectionStart = _ref.selectionStart,
- selectionEnd = _ref.selectionEnd;
- Object(classCallCheck["a" /* default */])(this, RichText);
- _this = Object(possibleConstructorReturn["a" /* default */])(this, Object(getPrototypeOf["a" /* default */])(RichText).apply(this, arguments));
- _this.onFocus = _this.onFocus.bind(Object(assertThisInitialized["a" /* default */])(_this));
- _this.onBlur = _this.onBlur.bind(Object(assertThisInitialized["a" /* default */])(_this));
- _this.onChange = _this.onChange.bind(Object(assertThisInitialized["a" /* default */])(_this));
- _this.handleDelete = _this.handleDelete.bind(Object(assertThisInitialized["a" /* default */])(_this));
- _this.handleEnter = _this.handleEnter.bind(Object(assertThisInitialized["a" /* default */])(_this));
- _this.handleSpace = _this.handleSpace.bind(Object(assertThisInitialized["a" /* default */])(_this));
- _this.handleHorizontalNavigation = _this.handleHorizontalNavigation.bind(Object(assertThisInitialized["a" /* default */])(_this));
- _this.onPaste = _this.onPaste.bind(Object(assertThisInitialized["a" /* default */])(_this));
- _this.onCreateUndoLevel = _this.onCreateUndoLevel.bind(Object(assertThisInitialized["a" /* default */])(_this));
- _this.onInput = _this.onInput.bind(Object(assertThisInitialized["a" /* default */])(_this));
- _this.onCompositionEnd = _this.onCompositionEnd.bind(Object(assertThisInitialized["a" /* default */])(_this));
- _this.onSelectionChange = _this.onSelectionChange.bind(Object(assertThisInitialized["a" /* default */])(_this));
- _this.createRecord = _this.createRecord.bind(Object(assertThisInitialized["a" /* default */])(_this));
- _this.applyRecord = _this.applyRecord.bind(Object(assertThisInitialized["a" /* default */])(_this));
- _this.valueToFormat = _this.valueToFormat.bind(Object(assertThisInitialized["a" /* default */])(_this));
- _this.setRef = _this.setRef.bind(Object(assertThisInitialized["a" /* default */])(_this));
- _this.valueToEditableHTML = _this.valueToEditableHTML.bind(Object(assertThisInitialized["a" /* default */])(_this));
- _this.onPointerDown = _this.onPointerDown.bind(Object(assertThisInitialized["a" /* default */])(_this));
- _this.formatToValue = _this.formatToValue.bind(Object(assertThisInitialized["a" /* default */])(_this));
- _this.Editable = _this.Editable.bind(Object(assertThisInitialized["a" /* default */])(_this));
- _this.onKeyDown = function (event) {
- if (event.defaultPrevented) {
- return;
- }
- _this.handleDelete(event);
- _this.handleEnter(event);
- _this.handleSpace(event);
- _this.handleHorizontalNavigation(event);
- };
- _this.state = {};
- _this.lastHistoryValue = value; // Internal values are updated synchronously, unlike props and state.
- _this.value = value;
- _this.record = _this.formatToValue(value);
- _this.record.start = selectionStart;
- _this.record.end = selectionEnd;
- return _this;
- }
- Object(createClass["a" /* default */])(RichText, [{
- key: "componentWillUnmount",
- value: function componentWillUnmount() {
- document.removeEventListener('selectionchange', this.onSelectionChange);
- window.cancelAnimationFrame(this.rafId);
- }
- }, {
- key: "setRef",
- value: function setRef(node) {
- if (node) {
- if (false) { var computedStyle; }
- this.editableRef = node;
- } else {
- delete this.editableRef;
- }
- }
- }, {
- key: "createRecord",
- value: function createRecord() {
- var multilineTag = this.props.__unstableMultilineTag;
- var selection = getSelection();
- var range = selection.rangeCount > 0 ? selection.getRangeAt(0) : null;
- return create({
- element: this.editableRef,
- range: range,
- multilineTag: multilineTag,
- multilineWrapperTags: multilineTag === 'li' ? ['ul', 'ol'] : undefined,
- __unstableIsEditableTree: true
- });
- }
- }, {
- key: "applyRecord",
- value: function applyRecord(record) {
- var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
- domOnly = _ref2.domOnly;
- var multilineTag = this.props.__unstableMultilineTag;
- apply({
- value: record,
- current: this.editableRef,
- multilineTag: multilineTag,
- multilineWrapperTags: multilineTag === 'li' ? ['ul', 'ol'] : undefined,
- prepareEditableTree: createPrepareEditableTree(this.props, 'format_prepare_functions'),
- __unstableDomOnly: domOnly,
- placeholder: this.props.placeholder
- });
- }
- /**
- * Handles a paste event.
- *
- * Saves the pasted data as plain text in `pastedPlainText`.
- *
- * @param {PasteEvent} event The paste event.
- */
- }, {
- key: "onPaste",
- value: function onPaste(event) {
- var _this$props = this.props,
- formatTypes = _this$props.formatTypes,
- onPaste = _this$props.onPaste;
- var clipboardData = event.clipboardData;
- var items = clipboardData.items,
- files = clipboardData.files; // In Edge these properties can be null instead of undefined, so a more
- // rigorous test is required over using default values.
- items = Object(external_lodash_["isNil"])(items) ? [] : items;
- files = Object(external_lodash_["isNil"])(files) ? [] : files;
- var plainText = '';
- var 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;
- }
- }
- event.preventDefault(); // 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);
- var record = this.record;
- var transformed = formatTypes.reduce(function (accumlator, _ref3) {
- var __unstablePasteRule = _ref3.__unstablePasteRule;
- // Only allow one transform.
- if (__unstablePasteRule && accumlator === record) {
- accumlator = __unstablePasteRule(record, {
- html: html,
- plainText: plainText
- });
- }
- return accumlator;
- }, record);
- if (transformed !== record) {
- this.onChange(transformed);
- return;
- }
- if (onPaste) {
- // Only process file if no HTML is present.
- // Note: a pasted file may have the URL as plain text.
- var image = Object(external_lodash_["find"])([].concat(Object(toConsumableArray["a" /* default */])(items), Object(toConsumableArray["a" /* default */])(files)), function (_ref4) {
- var type = _ref4.type;
- return /^image\/(?:jpe?g|png|gif)$/.test(type);
- });
- onPaste({
- value: this.removeEditorOnlyFormats(record),
- onChange: this.onChange,
- html: html,
- plainText: plainText,
- image: image
- });
- }
- }
- /**
- * Handles a focus event on the contenteditable field, calling the
- * `unstableOnFocus` prop callback if one is defined. The callback does not
- * receive any arguments.
- *
- * This is marked as a private API and the `unstableOnFocus` prop is not
- * documented, as the current requirements where it is used are subject to
- * future refactoring following `isSelected` handling.
- *
- * In contrast with `setFocusedElement`, this is only triggered in response
- * to focus within the contenteditable field, whereas `setFocusedElement`
- * is triggered on focus within any `RichText` descendent element.
- *
- * @see setFocusedElement
- *
- * @private
- */
- }, {
- key: "onFocus",
- value: function onFocus() {
- var unstableOnFocus = this.props.unstableOnFocus;
- if (unstableOnFocus) {
- unstableOnFocus();
- }
- this.recalculateBoundaryStyle(); // We know for certain that on focus, the old selection is invalid. It
- // will be recalculated on the next mouseup, keyup, or touchend event.
- var index = undefined;
- var activeFormats = undefined;
- this.record = Object(objectSpread["a" /* default */])({}, this.record, {
- start: index,
- end: index,
- activeFormats: activeFormats
- });
- this.props.onSelectionChange(index, index);
- this.setState({
- activeFormats: activeFormats
- }); // Update selection as soon as possible, which is at the next animation
- // frame. The event listener for selection changes may be added too late
- // at this point, but this focus event is still too early to calculate
- // the selection.
- this.rafId = window.requestAnimationFrame(this.onSelectionChange);
- document.addEventListener('selectionchange', this.onSelectionChange);
- if (this.props.setFocusedElement) {
- external_this_wp_deprecated_default()('wp.blockEditor.RichText setFocusedElement prop', {
- alternative: 'selection state from the block editor store.'
- });
- this.props.setFocusedElement(this.props.instanceId);
- }
- }
- }, {
- key: "onBlur",
- value: function onBlur() {
- document.removeEventListener('selectionchange', this.onSelectionChange);
- }
- /**
- * Handle input on the next selection change event.
- *
- * @param {SyntheticEvent} event Synthetic input event.
- */
- }, {
- key: "onInput",
- value: function onInput(event) {
- // For Input Method Editor (IME), used in Chinese, Japanese, and Korean
- // (CJK), do not trigger a change if characters are being composed.
- // Browsers setting `isComposing` to `true` will usually emit a final
- // `input` event when the characters are composed.
- if (event && event.nativeEvent && event.nativeEvent.isComposing) {
- // Also don't update any selection.
- document.removeEventListener('selectionchange', this.onSelectionChange);
- return;
- }
- var inputType;
- if (event) {
- inputType = event.inputType;
- }
- if (!inputType) {
- inputType = event.nativeEvent.inputType;
- } // The browser formatted something or tried to insert HTML.
- // Overwrite it. It will be handled later by the format library if
- // needed.
- if (inputType && (inputType.indexOf('format') === 0 || INSERTION_INPUT_TYPES_TO_IGNORE.has(inputType))) {
- this.applyRecord(this.record);
- return;
- }
- var value = this.createRecord();
- var _this$record = this.record,
- start = _this$record.start,
- _this$record$activeFo = _this$record.activeFormats,
- activeFormats = _this$record$activeFo === void 0 ? [] : _this$record$activeFo; // Update the formats between the last and new caret position.
- var change = updateFormats({
- value: value,
- start: start,
- end: value.start,
- formats: activeFormats
- });
- this.onChange(change, {
- withoutHistory: true
- });
- var _this$props2 = this.props,
- inputRule = _this$props2.__unstableInputRule,
- markAutomaticChange = _this$props2.__unstableMarkAutomaticChange,
- formatTypes = _this$props2.formatTypes,
- setTimeout = _this$props2.setTimeout,
- clearTimeout = _this$props2.clearTimeout; // Create an undo level when input stops for over a second.
- clearTimeout(this.onInput.timeout);
- this.onInput.timeout = setTimeout(this.onCreateUndoLevel, 1000); // Only run input rules when inserting text.
- if (inputType !== 'insertText') {
- return;
- }
- if (inputRule) {
- inputRule(change, this.valueToFormat);
- }
- var transformed = formatTypes.reduce(function (accumlator, _ref5) {
- var __unstableInputRule = _ref5.__unstableInputRule;
- if (__unstableInputRule) {
- accumlator = __unstableInputRule(accumlator);
- }
- return accumlator;
- }, change);
- if (transformed !== change) {
- this.onCreateUndoLevel();
- this.onChange(Object(objectSpread["a" /* default */])({}, transformed, {
- activeFormats: activeFormats
- }));
- markAutomaticChange();
- }
- }
- }, {
- key: "onCompositionEnd",
- value: function onCompositionEnd() {
- // Ensure the value is up-to-date for browsers that don't emit a final
- // input event after composition.
- this.onInput({
- inputType: 'insertText'
- }); // Tracking selection changes can be resumed.
- document.addEventListener('selectionchange', this.onSelectionChange);
- }
- /**
- * Syncs the selection to local state. A callback for the `selectionchange`
- * native events, `keyup`, `mouseup` and `touchend` synthetic events, and
- * animation frames after the `focus` event.
- *
- * @param {Event|SyntheticEvent|DOMHighResTimeStamp} event
- */
- }, {
- key: "onSelectionChange",
- value: function onSelectionChange(event) {
- if (event.type !== 'selectionchange' && !this.props.__unstableIsSelected) {
- return;
- } // In case of a keyboard event, ignore selection changes during
- // composition.
- if (event.nativeEvent && event.nativeEvent.isComposing) {
- return;
- }
- var _this$createRecord = this.createRecord(),
- start = _this$createRecord.start,
- end = _this$createRecord.end,
- text = _this$createRecord.text;
- var value = this.record; // Fallback mechanism for IE11, which doesn't support the input event.
- // Any input results in a selection change.
- if (text !== value.text) {
- this.onInput();
- return;
- }
- if (start === value.start && end === value.end) {
- // Sometimes the browser may set the selection on the placeholder
- // element, in which case the caret is not visible. We need to set
- // the caret before the placeholder if that's the case.
- if (value.text.length === 0 && start === 0) {
- fixPlaceholderSelection();
- }
- return;
- }
- var _this$props3 = this.props,
- isCaretWithinFormattedText = _this$props3.__unstableIsCaretWithinFormattedText,
- onEnterFormattedText = _this$props3.__unstableOnEnterFormattedText,
- onExitFormattedText = _this$props3.__unstableOnExitFormattedText;
- var newValue = Object(objectSpread["a" /* default */])({}, value, {
- start: start,
- end: end,
- // Allow `getActiveFormats` to get new `activeFormats`.
- activeFormats: undefined
- });
- var activeFormats = getActiveFormats(newValue); // Update the value with the new active formats.
- newValue.activeFormats = activeFormats;
- if (!isCaretWithinFormattedText && activeFormats.length) {
- onEnterFormattedText();
- } else if (isCaretWithinFormattedText && !activeFormats.length) {
- onExitFormattedText();
- } // It is important that the internal value is updated first,
- // otherwise the value will be wrong on render!
- this.record = newValue;
- this.applyRecord(newValue, {
- domOnly: true
- });
- this.props.onSelectionChange(start, end);
- this.setState({
- activeFormats: activeFormats
- });
- if (activeFormats.length > 0) {
- this.recalculateBoundaryStyle();
- }
- }
- }, {
- key: "recalculateBoundaryStyle",
- value: function recalculateBoundaryStyle() {
- var boundarySelector = '*[data-rich-text-format-boundary]';
- var element = this.editableRef.querySelector(boundarySelector);
- if (!element) {
- return;
- }
- var computedStyle = getComputedStyle(element);
- var newColor = computedStyle.color.replace(')', ', 0.2)').replace('rgb', 'rgba');
- var selector = ".rich-text:focus ".concat(boundarySelector);
- var rule = "background-color: ".concat(newColor);
- globalStyle.innerHTML = "".concat(selector, " {").concat(rule, "}");
- }
- /**
- * Sync the value to global state. The node tree and selection will also be
- * updated if differences are found.
- *
- * @param {Object} record The record to sync and apply.
- * @param {Object} $2 Named options.
- * @param {boolean} $2.withoutHistory If true, no undo level will be
- * created.
- */
- }, {
- key: "onChange",
- value: function onChange(record) {
- var _ref6 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
- withoutHistory = _ref6.withoutHistory;
- this.applyRecord(record);
- var start = record.start,
- end = record.end,
- _record$activeFormats = record.activeFormats,
- activeFormats = _record$activeFormats === void 0 ? [] : _record$activeFormats;
- var changeHandlers = Object(external_lodash_["pickBy"])(this.props, function (v, key) {
- return key.startsWith('format_on_change_functions_');
- });
- Object.values(changeHandlers).forEach(function (changeHandler) {
- changeHandler(record.formats, record.text);
- });
- this.value = this.valueToFormat(record);
- this.record = record;
- this.props.onChange(this.value);
- this.props.onSelectionChange(start, end);
- this.setState({
- activeFormats: activeFormats
- });
- if (!withoutHistory) {
- this.onCreateUndoLevel();
- }
- }
- }, {
- key: "onCreateUndoLevel",
- value: function onCreateUndoLevel() {
- // If the content is the same, no level needs to be created.
- if (this.lastHistoryValue === this.value) {
- return;
- }
- this.props.__unstableOnCreateUndoLevel();
- this.lastHistoryValue = this.value;
- }
- /**
- * Handles delete on keydown:
- * - outdent list items,
- * - delete content if everything is selected,
- * - trigger the onDelete prop when selection is uncollapsed and at an edge.
- *
- * @param {SyntheticEvent} event A synthetic keyboard event.
- */
- }, {
- key: "handleDelete",
- value: function handleDelete(event) {
- var keyCode = event.keyCode;
- if (keyCode !== external_this_wp_keycodes_["DELETE"] && keyCode !== external_this_wp_keycodes_["BACKSPACE"] && keyCode !== external_this_wp_keycodes_["ESCAPE"]) {
- return;
- }
- if (this.props.__unstableDidAutomaticChange) {
- event.preventDefault();
- this.props.__unstableUndo();
- return;
- }
- if (keyCode === external_this_wp_keycodes_["ESCAPE"]) {
- return;
- }
- var _this$props4 = this.props,
- onDelete = _this$props4.onDelete,
- multilineTag = _this$props4.__unstableMultilineTag;
- var _this$state$activeFor = this.state.activeFormats,
- activeFormats = _this$state$activeFor === void 0 ? [] : _this$state$activeFor;
- var value = this.createRecord();
- var start = value.start,
- end = value.end,
- text = value.text;
- var isReverse = keyCode === external_this_wp_keycodes_["BACKSPACE"];
- if (multilineTag) {
- var newValue = removeLineSeparator(value, isReverse);
- if (newValue) {
- this.onChange(newValue);
- event.preventDefault();
- }
- } // Always handle full content deletion ourselves.
- if (start === 0 && end !== 0 && end === text.length) {
- this.onChange(remove_remove(value));
- event.preventDefault();
- return;
- } // Only process delete if the key press occurs at an uncollapsed edge.
- if (!onDelete || !isCollapsed(value) || activeFormats.length || isReverse && start !== 0 || !isReverse && end !== text.length) {
- return;
- }
- onDelete({
- isReverse: isReverse,
- value: value
- });
- event.preventDefault();
- }
- /**
- * Triggers the `onEnter` prop on keydown.
- *
- * @param {SyntheticEvent} event A synthetic keyboard event.
- */
- }, {
- key: "handleEnter",
- value: function handleEnter(event) {
- if (event.keyCode !== external_this_wp_keycodes_["ENTER"]) {
- return;
- }
- event.preventDefault();
- var onEnter = this.props.onEnter;
- if (!onEnter) {
- return;
- }
- onEnter({
- value: this.removeEditorOnlyFormats(this.createRecord()),
- onChange: this.onChange,
- shiftKey: event.shiftKey
- });
- }
- /**
- * Indents list items on space keydown.
- *
- * @param {SyntheticEvent} event A synthetic keyboard event.
- */
- }, {
- key: "handleSpace",
- value: function handleSpace(event) {
- var keyCode = event.keyCode,
- shiftKey = event.shiftKey,
- altKey = event.altKey,
- metaKey = event.metaKey,
- ctrlKey = event.ctrlKey;
- var _this$props5 = this.props,
- tagName = _this$props5.tagName,
- multilineTag = _this$props5.__unstableMultilineTag;
- if ( // Only override when no modifiers are pressed.
- shiftKey || altKey || metaKey || ctrlKey || keyCode !== external_this_wp_keycodes_["SPACE"] || multilineTag !== 'li') {
- return;
- }
- var value = this.createRecord();
- if (!isCollapsed(value)) {
- return;
- }
- var text = value.text,
- start = value.start;
- var characterBefore = text[start - 1]; // The caret must be at the start of a line.
- if (characterBefore && characterBefore !== LINE_SEPARATOR) {
- return;
- }
- this.onChange(indentListItems(value, {
- type: tagName
- }));
- event.preventDefault();
- }
- /**
- * Handles horizontal keyboard navigation when no modifiers are pressed. The
- * navigation is handled separately to move correctly around format
- * boundaries.
- *
- * @param {SyntheticEvent} event A synthetic keyboard event.
- */
- }, {
- key: "handleHorizontalNavigation",
- value: function handleHorizontalNavigation(event) {
- var _this2 = this;
- var keyCode = event.keyCode,
- shiftKey = event.shiftKey,
- altKey = event.altKey,
- metaKey = event.metaKey,
- ctrlKey = event.ctrlKey;
- if ( // Only override left and right keys without modifiers pressed.
- shiftKey || altKey || metaKey || ctrlKey || keyCode !== external_this_wp_keycodes_["LEFT"] && keyCode !== external_this_wp_keycodes_["RIGHT"]) {
- return;
- }
- var value = this.record;
- var text = value.text,
- formats = value.formats,
- start = value.start,
- end = value.end,
- _value$activeFormats = value.activeFormats,
- activeFormats = _value$activeFormats === void 0 ? [] : _value$activeFormats;
- var collapsed = isCollapsed(value); // To do: ideally, we should look at visual position instead.
- var _getComputedStyle = getComputedStyle(this.editableRef),
- direction = _getComputedStyle.direction;
- var reverseKey = direction === 'rtl' ? external_this_wp_keycodes_["RIGHT"] : external_this_wp_keycodes_["LEFT"];
- var isReverse = event.keyCode === reverseKey; // If the selection is collapsed and at the very start, do nothing if
- // navigating backward.
- // If the selection is collapsed and at the very end, do nothing if
- // navigating forward.
- if (collapsed && activeFormats.length === 0) {
- if (start === 0 && isReverse) {
- return;
- }
- if (end === text.length && !isReverse) {
- return;
- }
- } // If the selection is not collapsed, let the browser handle collapsing
- // the selection for now. Later we could expand this logic to set
- // boundary positions if needed.
- if (!collapsed) {
- return;
- } // In all other cases, prevent default behaviour.
- event.preventDefault();
- var formatsBefore = formats[start - 1] || [];
- var formatsAfter = formats[start] || [];
- var newActiveFormatsLength = activeFormats.length;
- var source = formatsAfter;
- if (formatsBefore.length > formatsAfter.length) {
- source = formatsBefore;
- } // If the amount of formats before the caret and after the caret is
- // different, the caret is at a format boundary.
- if (formatsBefore.length < formatsAfter.length) {
- if (!isReverse && activeFormats.length < formatsAfter.length) {
- newActiveFormatsLength++;
- }
- if (isReverse && activeFormats.length > formatsBefore.length) {
- newActiveFormatsLength--;
- }
- } else if (formatsBefore.length > formatsAfter.length) {
- if (!isReverse && activeFormats.length > formatsAfter.length) {
- newActiveFormatsLength--;
- }
- if (isReverse && activeFormats.length < formatsBefore.length) {
- newActiveFormatsLength++;
- }
- } // Wait for boundary class to be added.
- this.props.setTimeout(function () {
- return _this2.recalculateBoundaryStyle();
- });
- if (newActiveFormatsLength !== activeFormats.length) {
- var _newActiveFormats = source.slice(0, newActiveFormatsLength);
- var _newValue = Object(objectSpread["a" /* default */])({}, value, {
- activeFormats: _newActiveFormats
- });
- this.record = _newValue;
- this.applyRecord(_newValue);
- this.setState({
- activeFormats: _newActiveFormats
- });
- return;
- }
- var newPos = start + (isReverse ? -1 : 1);
- var newActiveFormats = isReverse ? formatsBefore : formatsAfter;
- var newValue = Object(objectSpread["a" /* default */])({}, value, {
- start: newPos,
- end: newPos,
- activeFormats: newActiveFormats
- });
- this.record = newValue;
- this.applyRecord(newValue);
- this.props.onSelectionChange(newPos, newPos);
- this.setState({
- activeFormats: newActiveFormats
- });
- }
- /**
- * Select object when they are clicked. The browser will not set any
- * selection when clicking e.g. an image.
- *
- * @param {SyntheticEvent} event Synthetic mousedown or touchstart event.
- */
- }, {
- key: "onPointerDown",
- value: function onPointerDown(event) {
- var target = event.target; // If the child element has no text content, it must be an object.
- if (target === this.editableRef || target.textContent) {
- return;
- }
- var parentNode = target.parentNode;
- var index = Array.from(parentNode.childNodes).indexOf(target);
- var range = target.ownerDocument.createRange();
- var selection = getSelection();
- range.setStart(target.parentNode, index);
- range.setEnd(target.parentNode, index + 1);
- selection.removeAllRanges();
- selection.addRange(range);
- }
- }, {
- key: "componentDidUpdate",
- value: function componentDidUpdate(prevProps) {
- var _this$props6 = this.props,
- tagName = _this$props6.tagName,
- value = _this$props6.value,
- selectionStart = _this$props6.selectionStart,
- selectionEnd = _this$props6.selectionEnd,
- placeholder = _this$props6.placeholder,
- isSelected = _this$props6.__unstableIsSelected; // Check if the content changed.
- var shouldReapply = tagName === prevProps.tagName && value !== prevProps.value && value !== this.value; // Check if the selection changed.
- shouldReapply = shouldReapply || isSelected && !prevProps.isSelected && (this.record.start !== selectionStart || this.record.end !== selectionEnd);
- var prefix = 'format_prepare_props_';
- var predicate = function predicate(v, key) {
- return key.startsWith(prefix);
- };
- var prepareProps = Object(external_lodash_["pickBy"])(this.props, predicate);
- var prevPrepareProps = Object(external_lodash_["pickBy"])(prevProps, predicate); // Check if any format props changed.
- shouldReapply = shouldReapply || !external_this_wp_isShallowEqual_default()(prepareProps, prevPrepareProps); // Rerender if the placeholder changed.
- shouldReapply = shouldReapply || placeholder !== prevProps.placeholder;
- if (shouldReapply) {
- this.value = value;
- this.record = this.formatToValue(value);
- this.record.start = selectionStart;
- this.record.end = selectionEnd;
- this.applyRecord(this.record);
- } else if (this.record.start !== selectionStart || this.record.end !== selectionEnd) {
- this.record = Object(objectSpread["a" /* default */])({}, this.record, {
- start: selectionStart,
- end: selectionEnd
- });
- }
- }
- /**
- * Converts the outside data structure to our internal representation.
- *
- * @param {*} value The outside value, data type depends on props.
- * @return {Object} An internal rich-text value.
- */
- }, {
- key: "formatToValue",
- value: function formatToValue(value) {
- var _this$props7 = this.props,
- format = _this$props7.format,
- multilineTag = _this$props7.__unstableMultilineTag;
- if (format !== 'string') {
- return value;
- }
- var prepare = createPrepareEditableTree(this.props, 'format_value_functions');
- value = create({
- html: value,
- multilineTag: multilineTag,
- multilineWrapperTags: multilineTag === 'li' ? ['ul', 'ol'] : undefined
- });
- value.formats = prepare(value);
- return value;
- }
- }, {
- key: "valueToEditableHTML",
- value: function valueToEditableHTML(value) {
- var multilineTag = this.props.__unstableMultilineTag;
- return toDom({
- value: value,
- multilineTag: multilineTag,
- prepareEditableTree: createPrepareEditableTree(this.props, 'format_prepare_functions'),
- placeholder: this.props.placeholder
- }).body.innerHTML;
- }
- /**
- * Removes editor only formats from the value.
- *
- * Editor only formats are applied using `prepareEditableTree`, so we need to
- * remove them before converting the internal state
- *
- * @param {Object} value The internal rich-text value.
- * @return {Object} A new rich-text value.
- */
- }, {
- key: "removeEditorOnlyFormats",
- value: function removeEditorOnlyFormats(value) {
- this.props.formatTypes.forEach(function (formatType) {
- // Remove formats created by prepareEditableTree, because they are editor only.
- if (formatType.__experimentalCreatePrepareEditableTree) {
- value = removeFormat(value, formatType.name, 0, value.text.length);
- }
- });
- return value;
- }
- /**
- * Converts the internal value to the external data format.
- *
- * @param {Object} value The internal rich-text value.
- * @return {*} The external data format, data type depends on props.
- */
- }, {
- key: "valueToFormat",
- value: function valueToFormat(value) {
- var _this$props8 = this.props,
- format = _this$props8.format,
- multilineTag = _this$props8.__unstableMultilineTag;
- value = this.removeEditorOnlyFormats(value);
- if (format !== 'string') {
- return;
- }
- return toHTMLString({
- value: value,
- multilineTag: multilineTag
- });
- }
- }, {
- key: "Editable",
- value: function Editable(props) {
- var _this3 = this;
- var _this$props9 = this.props,
- _this$props9$tagName = _this$props9.tagName,
- Tagname = _this$props9$tagName === void 0 ? 'div' : _this$props9$tagName,
- style = _this$props9.style,
- className = _this$props9.className,
- placeholder = _this$props9.placeholder; // Generating a key that includes `tagName` ensures that if the tag
- // changes, we replace the relevant element. This is needed because we
- // prevent Editable component updates.
- var key = Tagname;
- return Object(external_this_wp_element_["createElement"])(editable_Editable, Object(esm_extends["a" /* default */])({}, props, {
- tagName: Tagname,
- style: style,
- record: this.record,
- valueToEditableHTML: this.valueToEditableHTML,
- "aria-label": placeholder
- }, aria_pickAriaProps(this.props), {
- className: classnames_default()('rich-text', className),
- key: key,
- onPaste: this.onPaste,
- onInput: this.onInput,
- onCompositionEnd: this.onCompositionEnd,
- onKeyDown: props.onKeyDown ? function (event) {
- props.onKeyDown(event);
- _this3.onKeyDown(event);
- } : this.onKeyDown,
- onFocus: this.onFocus,
- onBlur: this.onBlur,
- onMouseDown: this.onPointerDown,
- onTouchStart: this.onPointerDown,
- setRef: this.setRef // Selection updates must be done at these events as they
- // happen before the `selectionchange` event. In some cases,
- // the `selectionchange` event may not even fire, for
- // example when the window receives focus again on click.
- ,
- onKeyUp: this.onSelectionChange,
- onMouseUp: this.onSelectionChange,
- onTouchEnd: this.onSelectionChange
- }));
- }
- }, {
- key: "render",
- value: function render() {
- var _this$props10 = this.props,
- isSelected = _this$props10.__unstableIsSelected,
- children = _this$props10.children,
- allowedFormats = _this$props10.allowedFormats,
- withoutInteractiveFormatting = _this$props10.withoutInteractiveFormatting;
- return Object(external_this_wp_element_["createElement"])(external_this_wp_element_["Fragment"], null, isSelected && Object(external_this_wp_element_["createElement"])(format_edit, {
- allowedFormats: allowedFormats,
- withoutInteractiveFormatting: withoutInteractiveFormatting,
- value: this.record,
- onChange: this.onChange
- }), children && children({
- isSelected: isSelected,
- value: this.record,
- onChange: this.onChange,
- Editable: this.Editable
- }), !children && Object(external_this_wp_element_["createElement"])(this.Editable, null));
- }
- }]);
- return RichText;
- }(external_this_wp_element_["Component"]);
- component_RichText.defaultProps = {
- format: 'string',
- value: ''
- };
- /**
- * Renders a rich content input, providing users with the option to format the
- * content.
- */
- /* harmony default export */ var component = (Object(external_this_wp_compose_["compose"])([Object(external_this_wp_data_["withSelect"])(function (select) {
- return {
- formatTypes: select('core/rich-text').getFormatTypes()
- };
- }), external_this_wp_compose_["withSafeTimeout"]])(component_RichText));
- // CONCATENATED MODULE: ./node_modules/@wordpress/rich-text/build-module/index.js
- /* concated harmony reexport applyFormat */__webpack_require__.d(__webpack_exports__, "applyFormat", function() { return applyFormat; });
- /* concated harmony reexport concat */__webpack_require__.d(__webpack_exports__, "concat", function() { return concat; });
- /* concated harmony reexport create */__webpack_require__.d(__webpack_exports__, "create", function() { return create; });
- /* concated harmony reexport getActiveFormat */__webpack_require__.d(__webpack_exports__, "getActiveFormat", function() { return getActiveFormat; });
- /* concated harmony reexport getActiveObject */__webpack_require__.d(__webpack_exports__, "getActiveObject", function() { return getActiveObject; });
- /* concated harmony reexport getTextContent */__webpack_require__.d(__webpack_exports__, "getTextContent", function() { return getTextContent; });
- /* concated harmony reexport __unstableIsListRootSelected */__webpack_require__.d(__webpack_exports__, "__unstableIsListRootSelected", function() { return isListRootSelected; });
- /* concated harmony reexport __unstableIsActiveListType */__webpack_require__.d(__webpack_exports__, "__unstableIsActiveListType", function() { return isActiveListType; });
- /* concated harmony reexport isCollapsed */__webpack_require__.d(__webpack_exports__, "isCollapsed", function() { return isCollapsed; });
- /* concated harmony reexport isEmpty */__webpack_require__.d(__webpack_exports__, "isEmpty", function() { return isEmpty; });
- /* concated harmony reexport __unstableIsEmptyLine */__webpack_require__.d(__webpack_exports__, "__unstableIsEmptyLine", function() { return isEmptyLine; });
- /* concated harmony reexport join */__webpack_require__.d(__webpack_exports__, "join", function() { return join; });
- /* concated harmony reexport registerFormatType */__webpack_require__.d(__webpack_exports__, "registerFormatType", function() { return registerFormatType; });
- /* concated harmony reexport removeFormat */__webpack_require__.d(__webpack_exports__, "removeFormat", function() { return removeFormat; });
- /* concated harmony reexport remove */__webpack_require__.d(__webpack_exports__, "remove", function() { return remove_remove; });
- /* concated harmony reexport replace */__webpack_require__.d(__webpack_exports__, "replace", function() { return replace_replace; });
- /* concated harmony reexport insert */__webpack_require__.d(__webpack_exports__, "insert", function() { return insert; });
- /* concated harmony reexport __unstableInsertLineSeparator */__webpack_require__.d(__webpack_exports__, "__unstableInsertLineSeparator", function() { return insertLineSeparator; });
- /* concated harmony reexport __unstableRemoveLineSeparator */__webpack_require__.d(__webpack_exports__, "__unstableRemoveLineSeparator", function() { return removeLineSeparator; });
- /* concated harmony reexport insertObject */__webpack_require__.d(__webpack_exports__, "insertObject", function() { return insertObject; });
- /* concated harmony reexport slice */__webpack_require__.d(__webpack_exports__, "slice", function() { return slice; });
- /* concated harmony reexport split */__webpack_require__.d(__webpack_exports__, "split", function() { return split; });
- /* concated harmony reexport __unstableToDom */__webpack_require__.d(__webpack_exports__, "__unstableToDom", function() { return toDom; });
- /* concated harmony reexport toHTMLString */__webpack_require__.d(__webpack_exports__, "toHTMLString", function() { return toHTMLString; });
- /* concated harmony reexport toggleFormat */__webpack_require__.d(__webpack_exports__, "toggleFormat", function() { return toggleFormat; });
- /* concated harmony reexport __UNSTABLE_LINE_SEPARATOR */__webpack_require__.d(__webpack_exports__, "__UNSTABLE_LINE_SEPARATOR", function() { return LINE_SEPARATOR; });
- /* concated harmony reexport unregisterFormatType */__webpack_require__.d(__webpack_exports__, "unregisterFormatType", function() { return unregisterFormatType; });
- /* concated harmony reexport __unstableIndentListItems */__webpack_require__.d(__webpack_exports__, "__unstableIndentListItems", function() { return indentListItems; });
- /* concated harmony reexport __unstableOutdentListItems */__webpack_require__.d(__webpack_exports__, "__unstableOutdentListItems", function() { return outdentListItems; });
- /* concated harmony reexport __unstableChangeListType */__webpack_require__.d(__webpack_exports__, "__unstableChangeListType", function() { return changeListType; });
- /* concated harmony reexport __unstableCreateElement */__webpack_require__.d(__webpack_exports__, "__unstableCreateElement", function() { return createElement; });
- /* concated harmony reexport __experimentalRichText */__webpack_require__.d(__webpack_exports__, "__experimentalRichText", function() { return component; });
- /* concated harmony reexport __unstableFormatEdit */__webpack_require__.d(__webpack_exports__, "__unstableFormatEdit", function() { return format_edit; });
- /**
- * Internal dependencies
- */
- /***/ }),
- /***/ 36:
- /***/ (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;
- });
- /***/ }),
- /***/ 37:
- /***/ (function(module, exports) {
- (function() { module.exports = this["wp"]["deprecated"]; }());
- /***/ }),
- /***/ 4:
- /***/ (function(module, exports) {
- (function() { module.exports = this["wp"]["data"]; }());
- /***/ }),
- /***/ 41:
- /***/ (function(module, exports) {
- (function() { module.exports = this["wp"]["isShallowEqual"]; }());
- /***/ }),
- /***/ 5:
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _assertThisInitialized; });
- function _assertThisInitialized(self) {
- if (self === void 0) {
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- }
- return self;
- }
- /***/ }),
- /***/ 7:
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectSpread; });
- /* harmony import */ var _defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(10);
- function _objectSpread(target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = arguments[i] != null ? arguments[i] : {};
- var ownKeys = Object.keys(source);
- if (typeof Object.getOwnPropertySymbols === 'function') {
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
- }));
- }
- ownKeys.forEach(function (key) {
- Object(_defineProperty__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(target, key, source[key]);
- });
- }
- return target;
- }
- /***/ }),
- /***/ 71:
- /***/ (function(module, exports) {
- (function() { module.exports = this["wp"]["escapeHtml"]; }());
- /***/ }),
- /***/ 8:
- /***/ (function(module, exports) {
- (function() { module.exports = this["wp"]["compose"]; }());
- /***/ })
- /******/ });
|