quill.js 427 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489
  1. /*!
  2. * Quill Editor v1.3.6
  3. * https://quilljs.com/
  4. * Copyright (c) 2014, Jason Chen
  5. * Copyright (c) 2013, salesforce.com
  6. */
  7. (function webpackUniversalModuleDefinition(root, factory) {
  8. if(typeof exports === 'object' && typeof module === 'object')
  9. module.exports = factory();
  10. else if(typeof define === 'function' && define.amd)
  11. define([], factory);
  12. else if(typeof exports === 'object')
  13. exports["Quill"] = factory();
  14. else
  15. root["Quill"] = factory();
  16. })(typeof self !== 'undefined' ? self : this, function() {
  17. return /******/ (function(modules) { // webpackBootstrap
  18. /******/ // The module cache
  19. /******/ var installedModules = {};
  20. /******/
  21. /******/ // The require function
  22. /******/ function __webpack_require__(moduleId) {
  23. /******/
  24. /******/ // Check if module is in cache
  25. /******/ if(installedModules[moduleId]) {
  26. /******/ return installedModules[moduleId].exports;
  27. /******/ }
  28. /******/ // Create a new module (and put it into the cache)
  29. /******/ var module = installedModules[moduleId] = {
  30. /******/ i: moduleId,
  31. /******/ l: false,
  32. /******/ exports: {}
  33. /******/ };
  34. /******/
  35. /******/ // Execute the module function
  36. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  37. /******/
  38. /******/ // Flag the module as loaded
  39. /******/ module.l = true;
  40. /******/
  41. /******/ // Return the exports of the module
  42. /******/ return module.exports;
  43. /******/ }
  44. /******/
  45. /******/
  46. /******/ // expose the modules object (__webpack_modules__)
  47. /******/ __webpack_require__.m = modules;
  48. /******/
  49. /******/ // expose the module cache
  50. /******/ __webpack_require__.c = installedModules;
  51. /******/
  52. /******/ // define getter function for harmony exports
  53. /******/ __webpack_require__.d = function(exports, name, getter) {
  54. /******/ if(!__webpack_require__.o(exports, name)) {
  55. /******/ Object.defineProperty(exports, name, {
  56. /******/ configurable: false,
  57. /******/ enumerable: true,
  58. /******/ get: getter
  59. /******/ });
  60. /******/ }
  61. /******/ };
  62. /******/
  63. /******/ // getDefaultExport function for compatibility with non-harmony modules
  64. /******/ __webpack_require__.n = function(module) {
  65. /******/ var getter = module && module.__esModule ?
  66. /******/ function getDefault() { return module['default']; } :
  67. /******/ function getModuleExports() { return module; };
  68. /******/ __webpack_require__.d(getter, 'a', getter);
  69. /******/ return getter;
  70. /******/ };
  71. /******/
  72. /******/ // Object.prototype.hasOwnProperty.call
  73. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  74. /******/
  75. /******/ // __webpack_public_path__
  76. /******/ __webpack_require__.p = "";
  77. /******/
  78. /******/ // Load entry module and return exports
  79. /******/ return __webpack_require__(__webpack_require__.s = 109);
  80. /******/ })
  81. /************************************************************************/
  82. /******/ ([
  83. /* 0 */
  84. /***/ (function(module, exports, __webpack_require__) {
  85. "use strict";
  86. Object.defineProperty(exports, "__esModule", { value: true });
  87. var container_1 = __webpack_require__(17);
  88. var format_1 = __webpack_require__(18);
  89. var leaf_1 = __webpack_require__(19);
  90. var scroll_1 = __webpack_require__(45);
  91. var inline_1 = __webpack_require__(46);
  92. var block_1 = __webpack_require__(47);
  93. var embed_1 = __webpack_require__(48);
  94. var text_1 = __webpack_require__(49);
  95. var attributor_1 = __webpack_require__(12);
  96. var class_1 = __webpack_require__(32);
  97. var style_1 = __webpack_require__(33);
  98. var store_1 = __webpack_require__(31);
  99. var Registry = __webpack_require__(1);
  100. var Parchment = {
  101. Scope: Registry.Scope,
  102. create: Registry.create,
  103. find: Registry.find,
  104. query: Registry.query,
  105. register: Registry.register,
  106. Container: container_1.default,
  107. Format: format_1.default,
  108. Leaf: leaf_1.default,
  109. Embed: embed_1.default,
  110. Scroll: scroll_1.default,
  111. Block: block_1.default,
  112. Inline: inline_1.default,
  113. Text: text_1.default,
  114. Attributor: {
  115. Attribute: attributor_1.default,
  116. Class: class_1.default,
  117. Style: style_1.default,
  118. Store: store_1.default,
  119. },
  120. };
  121. exports.default = Parchment;
  122. /***/ }),
  123. /* 1 */
  124. /***/ (function(module, exports, __webpack_require__) {
  125. "use strict";
  126. var __extends = (this && this.__extends) || (function () {
  127. var extendStatics = Object.setPrototypeOf ||
  128. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  129. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  130. return function (d, b) {
  131. extendStatics(d, b);
  132. function __() { this.constructor = d; }
  133. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  134. };
  135. })();
  136. Object.defineProperty(exports, "__esModule", { value: true });
  137. var ParchmentError = /** @class */ (function (_super) {
  138. __extends(ParchmentError, _super);
  139. function ParchmentError(message) {
  140. var _this = this;
  141. message = '[Parchment] ' + message;
  142. _this = _super.call(this, message) || this;
  143. _this.message = message;
  144. _this.name = _this.constructor.name;
  145. return _this;
  146. }
  147. return ParchmentError;
  148. }(Error));
  149. exports.ParchmentError = ParchmentError;
  150. var attributes = {};
  151. var classes = {};
  152. var tags = {};
  153. var types = {};
  154. exports.DATA_KEY = '__blot';
  155. var Scope;
  156. (function (Scope) {
  157. Scope[Scope["TYPE"] = 3] = "TYPE";
  158. Scope[Scope["LEVEL"] = 12] = "LEVEL";
  159. Scope[Scope["ATTRIBUTE"] = 13] = "ATTRIBUTE";
  160. Scope[Scope["BLOT"] = 14] = "BLOT";
  161. Scope[Scope["INLINE"] = 7] = "INLINE";
  162. Scope[Scope["BLOCK"] = 11] = "BLOCK";
  163. Scope[Scope["BLOCK_BLOT"] = 10] = "BLOCK_BLOT";
  164. Scope[Scope["INLINE_BLOT"] = 6] = "INLINE_BLOT";
  165. Scope[Scope["BLOCK_ATTRIBUTE"] = 9] = "BLOCK_ATTRIBUTE";
  166. Scope[Scope["INLINE_ATTRIBUTE"] = 5] = "INLINE_ATTRIBUTE";
  167. Scope[Scope["ANY"] = 15] = "ANY";
  168. })(Scope = exports.Scope || (exports.Scope = {}));
  169. function create(input, value) {
  170. var match = query(input);
  171. if (match == null) {
  172. throw new ParchmentError("Unable to create " + input + " blot");
  173. }
  174. var BlotClass = match;
  175. var node =
  176. // @ts-ignore
  177. input instanceof Node || input['nodeType'] === Node.TEXT_NODE ? input : BlotClass.create(value);
  178. return new BlotClass(node, value);
  179. }
  180. exports.create = create;
  181. function find(node, bubble) {
  182. if (bubble === void 0) { bubble = false; }
  183. if (node == null)
  184. return null;
  185. // @ts-ignore
  186. if (node[exports.DATA_KEY] != null)
  187. return node[exports.DATA_KEY].blot;
  188. if (bubble)
  189. return find(node.parentNode, bubble);
  190. return null;
  191. }
  192. exports.find = find;
  193. function query(query, scope) {
  194. if (scope === void 0) { scope = Scope.ANY; }
  195. var match;
  196. if (typeof query === 'string') {
  197. match = types[query] || attributes[query];
  198. // @ts-ignore
  199. }
  200. else if (query instanceof Text || query['nodeType'] === Node.TEXT_NODE) {
  201. match = types['text'];
  202. }
  203. else if (typeof query === 'number') {
  204. if (query & Scope.LEVEL & Scope.BLOCK) {
  205. match = types['block'];
  206. }
  207. else if (query & Scope.LEVEL & Scope.INLINE) {
  208. match = types['inline'];
  209. }
  210. }
  211. else if (query instanceof HTMLElement) {
  212. var names = (query.getAttribute('class') || '').split(/\s+/);
  213. for (var i in names) {
  214. match = classes[names[i]];
  215. if (match)
  216. break;
  217. }
  218. match = match || tags[query.tagName];
  219. }
  220. if (match == null)
  221. return null;
  222. // @ts-ignore
  223. if (scope & Scope.LEVEL & match.scope && scope & Scope.TYPE & match.scope)
  224. return match;
  225. return null;
  226. }
  227. exports.query = query;
  228. function register() {
  229. var Definitions = [];
  230. for (var _i = 0; _i < arguments.length; _i++) {
  231. Definitions[_i] = arguments[_i];
  232. }
  233. if (Definitions.length > 1) {
  234. return Definitions.map(function (d) {
  235. return register(d);
  236. });
  237. }
  238. var Definition = Definitions[0];
  239. if (typeof Definition.blotName !== 'string' && typeof Definition.attrName !== 'string') {
  240. throw new ParchmentError('Invalid definition');
  241. }
  242. else if (Definition.blotName === 'abstract') {
  243. throw new ParchmentError('Cannot register abstract class');
  244. }
  245. types[Definition.blotName || Definition.attrName] = Definition;
  246. if (typeof Definition.keyName === 'string') {
  247. attributes[Definition.keyName] = Definition;
  248. }
  249. else {
  250. if (Definition.className != null) {
  251. classes[Definition.className] = Definition;
  252. }
  253. if (Definition.tagName != null) {
  254. if (Array.isArray(Definition.tagName)) {
  255. Definition.tagName = Definition.tagName.map(function (tagName) {
  256. return tagName.toUpperCase();
  257. });
  258. }
  259. else {
  260. Definition.tagName = Definition.tagName.toUpperCase();
  261. }
  262. var tagNames = Array.isArray(Definition.tagName) ? Definition.tagName : [Definition.tagName];
  263. tagNames.forEach(function (tag) {
  264. if (tags[tag] == null || Definition.className == null) {
  265. tags[tag] = Definition;
  266. }
  267. });
  268. }
  269. }
  270. return Definition;
  271. }
  272. exports.register = register;
  273. /***/ }),
  274. /* 2 */
  275. /***/ (function(module, exports, __webpack_require__) {
  276. var diff = __webpack_require__(51);
  277. var equal = __webpack_require__(11);
  278. var extend = __webpack_require__(3);
  279. var op = __webpack_require__(20);
  280. var NULL_CHARACTER = String.fromCharCode(0); // Placeholder char for embed in diff()
  281. var Delta = function (ops) {
  282. // Assume we are given a well formed ops
  283. if (Array.isArray(ops)) {
  284. this.ops = ops;
  285. } else if (ops != null && Array.isArray(ops.ops)) {
  286. this.ops = ops.ops;
  287. } else {
  288. this.ops = [];
  289. }
  290. };
  291. Delta.prototype.insert = function (text, attributes) {
  292. var newOp = {};
  293. if (text.length === 0) return this;
  294. newOp.insert = text;
  295. if (attributes != null && typeof attributes === 'object' && Object.keys(attributes).length > 0) {
  296. newOp.attributes = attributes;
  297. }
  298. return this.push(newOp);
  299. };
  300. Delta.prototype['delete'] = function (length) {
  301. if (length <= 0) return this;
  302. return this.push({ 'delete': length });
  303. };
  304. Delta.prototype.retain = function (length, attributes) {
  305. if (length <= 0) return this;
  306. var newOp = { retain: length };
  307. if (attributes != null && typeof attributes === 'object' && Object.keys(attributes).length > 0) {
  308. newOp.attributes = attributes;
  309. }
  310. return this.push(newOp);
  311. };
  312. Delta.prototype.push = function (newOp) {
  313. var index = this.ops.length;
  314. var lastOp = this.ops[index - 1];
  315. newOp = extend(true, {}, newOp);
  316. if (typeof lastOp === 'object') {
  317. if (typeof newOp['delete'] === 'number' && typeof lastOp['delete'] === 'number') {
  318. this.ops[index - 1] = { 'delete': lastOp['delete'] + newOp['delete'] };
  319. return this;
  320. }
  321. // Since it does not matter if we insert before or after deleting at the same index,
  322. // always prefer to insert first
  323. if (typeof lastOp['delete'] === 'number' && newOp.insert != null) {
  324. index -= 1;
  325. lastOp = this.ops[index - 1];
  326. if (typeof lastOp !== 'object') {
  327. this.ops.unshift(newOp);
  328. return this;
  329. }
  330. }
  331. if (equal(newOp.attributes, lastOp.attributes)) {
  332. if (typeof newOp.insert === 'string' && typeof lastOp.insert === 'string') {
  333. this.ops[index - 1] = { insert: lastOp.insert + newOp.insert };
  334. if (typeof newOp.attributes === 'object') this.ops[index - 1].attributes = newOp.attributes
  335. return this;
  336. } else if (typeof newOp.retain === 'number' && typeof lastOp.retain === 'number') {
  337. this.ops[index - 1] = { retain: lastOp.retain + newOp.retain };
  338. if (typeof newOp.attributes === 'object') this.ops[index - 1].attributes = newOp.attributes
  339. return this;
  340. }
  341. }
  342. }
  343. if (index === this.ops.length) {
  344. this.ops.push(newOp);
  345. } else {
  346. this.ops.splice(index, 0, newOp);
  347. }
  348. return this;
  349. };
  350. Delta.prototype.chop = function () {
  351. var lastOp = this.ops[this.ops.length - 1];
  352. if (lastOp && lastOp.retain && !lastOp.attributes) {
  353. this.ops.pop();
  354. }
  355. return this;
  356. };
  357. Delta.prototype.filter = function (predicate) {
  358. return this.ops.filter(predicate);
  359. };
  360. Delta.prototype.forEach = function (predicate) {
  361. this.ops.forEach(predicate);
  362. };
  363. Delta.prototype.map = function (predicate) {
  364. return this.ops.map(predicate);
  365. };
  366. Delta.prototype.partition = function (predicate) {
  367. var passed = [], failed = [];
  368. this.forEach(function(op) {
  369. var target = predicate(op) ? passed : failed;
  370. target.push(op);
  371. });
  372. return [passed, failed];
  373. };
  374. Delta.prototype.reduce = function (predicate, initial) {
  375. return this.ops.reduce(predicate, initial);
  376. };
  377. Delta.prototype.changeLength = function () {
  378. return this.reduce(function (length, elem) {
  379. if (elem.insert) {
  380. return length + op.length(elem);
  381. } else if (elem.delete) {
  382. return length - elem.delete;
  383. }
  384. return length;
  385. }, 0);
  386. };
  387. Delta.prototype.length = function () {
  388. return this.reduce(function (length, elem) {
  389. return length + op.length(elem);
  390. }, 0);
  391. };
  392. Delta.prototype.slice = function (start, end) {
  393. start = start || 0;
  394. if (typeof end !== 'number') end = Infinity;
  395. var ops = [];
  396. var iter = op.iterator(this.ops);
  397. var index = 0;
  398. while (index < end && iter.hasNext()) {
  399. var nextOp;
  400. if (index < start) {
  401. nextOp = iter.next(start - index);
  402. } else {
  403. nextOp = iter.next(end - index);
  404. ops.push(nextOp);
  405. }
  406. index += op.length(nextOp);
  407. }
  408. return new Delta(ops);
  409. };
  410. Delta.prototype.compose = function (other) {
  411. var thisIter = op.iterator(this.ops);
  412. var otherIter = op.iterator(other.ops);
  413. var delta = new Delta();
  414. while (thisIter.hasNext() || otherIter.hasNext()) {
  415. if (otherIter.peekType() === 'insert') {
  416. delta.push(otherIter.next());
  417. } else if (thisIter.peekType() === 'delete') {
  418. delta.push(thisIter.next());
  419. } else {
  420. var length = Math.min(thisIter.peekLength(), otherIter.peekLength());
  421. var thisOp = thisIter.next(length);
  422. var otherOp = otherIter.next(length);
  423. if (typeof otherOp.retain === 'number') {
  424. var newOp = {};
  425. if (typeof thisOp.retain === 'number') {
  426. newOp.retain = length;
  427. } else {
  428. newOp.insert = thisOp.insert;
  429. }
  430. // Preserve null when composing with a retain, otherwise remove it for inserts
  431. var attributes = op.attributes.compose(thisOp.attributes, otherOp.attributes, typeof thisOp.retain === 'number');
  432. if (attributes) newOp.attributes = attributes;
  433. delta.push(newOp);
  434. // Other op should be delete, we could be an insert or retain
  435. // Insert + delete cancels out
  436. } else if (typeof otherOp['delete'] === 'number' && typeof thisOp.retain === 'number') {
  437. delta.push(otherOp);
  438. }
  439. }
  440. }
  441. return delta.chop();
  442. };
  443. Delta.prototype.concat = function (other) {
  444. var delta = new Delta(this.ops.slice());
  445. if (other.ops.length > 0) {
  446. delta.push(other.ops[0]);
  447. delta.ops = delta.ops.concat(other.ops.slice(1));
  448. }
  449. return delta;
  450. };
  451. Delta.prototype.diff = function (other, index) {
  452. if (this.ops === other.ops) {
  453. return new Delta();
  454. }
  455. var strings = [this, other].map(function (delta) {
  456. return delta.map(function (op) {
  457. if (op.insert != null) {
  458. return typeof op.insert === 'string' ? op.insert : NULL_CHARACTER;
  459. }
  460. var prep = (delta === other) ? 'on' : 'with';
  461. throw new Error('diff() called ' + prep + ' non-document');
  462. }).join('');
  463. });
  464. var delta = new Delta();
  465. var diffResult = diff(strings[0], strings[1], index);
  466. var thisIter = op.iterator(this.ops);
  467. var otherIter = op.iterator(other.ops);
  468. diffResult.forEach(function (component) {
  469. var length = component[1].length;
  470. while (length > 0) {
  471. var opLength = 0;
  472. switch (component[0]) {
  473. case diff.INSERT:
  474. opLength = Math.min(otherIter.peekLength(), length);
  475. delta.push(otherIter.next(opLength));
  476. break;
  477. case diff.DELETE:
  478. opLength = Math.min(length, thisIter.peekLength());
  479. thisIter.next(opLength);
  480. delta['delete'](opLength);
  481. break;
  482. case diff.EQUAL:
  483. opLength = Math.min(thisIter.peekLength(), otherIter.peekLength(), length);
  484. var thisOp = thisIter.next(opLength);
  485. var otherOp = otherIter.next(opLength);
  486. if (equal(thisOp.insert, otherOp.insert)) {
  487. delta.retain(opLength, op.attributes.diff(thisOp.attributes, otherOp.attributes));
  488. } else {
  489. delta.push(otherOp)['delete'](opLength);
  490. }
  491. break;
  492. }
  493. length -= opLength;
  494. }
  495. });
  496. return delta.chop();
  497. };
  498. Delta.prototype.eachLine = function (predicate, newline) {
  499. newline = newline || '\n';
  500. var iter = op.iterator(this.ops);
  501. var line = new Delta();
  502. var i = 0;
  503. while (iter.hasNext()) {
  504. if (iter.peekType() !== 'insert') return;
  505. var thisOp = iter.peek();
  506. var start = op.length(thisOp) - iter.peekLength();
  507. var index = typeof thisOp.insert === 'string' ?
  508. thisOp.insert.indexOf(newline, start) - start : -1;
  509. if (index < 0) {
  510. line.push(iter.next());
  511. } else if (index > 0) {
  512. line.push(iter.next(index));
  513. } else {
  514. if (predicate(line, iter.next(1).attributes || {}, i) === false) {
  515. return;
  516. }
  517. i += 1;
  518. line = new Delta();
  519. }
  520. }
  521. if (line.length() > 0) {
  522. predicate(line, {}, i);
  523. }
  524. };
  525. Delta.prototype.transform = function (other, priority) {
  526. priority = !!priority;
  527. if (typeof other === 'number') {
  528. return this.transformPosition(other, priority);
  529. }
  530. var thisIter = op.iterator(this.ops);
  531. var otherIter = op.iterator(other.ops);
  532. var delta = new Delta();
  533. while (thisIter.hasNext() || otherIter.hasNext()) {
  534. if (thisIter.peekType() === 'insert' && (priority || otherIter.peekType() !== 'insert')) {
  535. delta.retain(op.length(thisIter.next()));
  536. } else if (otherIter.peekType() === 'insert') {
  537. delta.push(otherIter.next());
  538. } else {
  539. var length = Math.min(thisIter.peekLength(), otherIter.peekLength());
  540. var thisOp = thisIter.next(length);
  541. var otherOp = otherIter.next(length);
  542. if (thisOp['delete']) {
  543. // Our delete either makes their delete redundant or removes their retain
  544. continue;
  545. } else if (otherOp['delete']) {
  546. delta.push(otherOp);
  547. } else {
  548. // We retain either their retain or insert
  549. delta.retain(length, op.attributes.transform(thisOp.attributes, otherOp.attributes, priority));
  550. }
  551. }
  552. }
  553. return delta.chop();
  554. };
  555. Delta.prototype.transformPosition = function (index, priority) {
  556. priority = !!priority;
  557. var thisIter = op.iterator(this.ops);
  558. var offset = 0;
  559. while (thisIter.hasNext() && offset <= index) {
  560. var length = thisIter.peekLength();
  561. var nextType = thisIter.peekType();
  562. thisIter.next();
  563. if (nextType === 'delete') {
  564. index -= Math.min(length, index - offset);
  565. continue;
  566. } else if (nextType === 'insert' && (offset < index || !priority)) {
  567. index += length;
  568. }
  569. offset += length;
  570. }
  571. return index;
  572. };
  573. module.exports = Delta;
  574. /***/ }),
  575. /* 3 */
  576. /***/ (function(module, exports) {
  577. 'use strict';
  578. var hasOwn = Object.prototype.hasOwnProperty;
  579. var toStr = Object.prototype.toString;
  580. var isArray = function isArray(arr) {
  581. if (typeof Array.isArray === 'function') {
  582. return Array.isArray(arr);
  583. }
  584. return toStr.call(arr) === '[object Array]';
  585. };
  586. var isPlainObject = function isPlainObject(obj) {
  587. if (!obj || toStr.call(obj) !== '[object Object]') {
  588. return false;
  589. }
  590. var hasOwnConstructor = hasOwn.call(obj, 'constructor');
  591. var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf');
  592. // Not own constructor property must be Object
  593. if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {
  594. return false;
  595. }
  596. // Own properties are enumerated firstly, so to speed up,
  597. // if last one is own, then all properties are own.
  598. var key;
  599. for (key in obj) { /**/ }
  600. return typeof key === 'undefined' || hasOwn.call(obj, key);
  601. };
  602. module.exports = function extend() {
  603. var options, name, src, copy, copyIsArray, clone;
  604. var target = arguments[0];
  605. var i = 1;
  606. var length = arguments.length;
  607. var deep = false;
  608. // Handle a deep copy situation
  609. if (typeof target === 'boolean') {
  610. deep = target;
  611. target = arguments[1] || {};
  612. // skip the boolean and the target
  613. i = 2;
  614. }
  615. if (target == null || (typeof target !== 'object' && typeof target !== 'function')) {
  616. target = {};
  617. }
  618. for (; i < length; ++i) {
  619. options = arguments[i];
  620. // Only deal with non-null/undefined values
  621. if (options != null) {
  622. // Extend the base object
  623. for (name in options) {
  624. src = target[name];
  625. copy = options[name];
  626. // Prevent never-ending loop
  627. if (target !== copy) {
  628. // Recurse if we're merging plain objects or arrays
  629. if (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) {
  630. if (copyIsArray) {
  631. copyIsArray = false;
  632. clone = src && isArray(src) ? src : [];
  633. } else {
  634. clone = src && isPlainObject(src) ? src : {};
  635. }
  636. // Never move original objects, clone them
  637. target[name] = extend(deep, clone, copy);
  638. // Don't bring in undefined values
  639. } else if (typeof copy !== 'undefined') {
  640. target[name] = copy;
  641. }
  642. }
  643. }
  644. }
  645. }
  646. // Return the modified object
  647. return target;
  648. };
  649. /***/ }),
  650. /* 4 */
  651. /***/ (function(module, exports, __webpack_require__) {
  652. "use strict";
  653. Object.defineProperty(exports, "__esModule", {
  654. value: true
  655. });
  656. exports.default = exports.BlockEmbed = exports.bubbleFormats = undefined;
  657. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  658. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  659. var _extend = __webpack_require__(3);
  660. var _extend2 = _interopRequireDefault(_extend);
  661. var _quillDelta = __webpack_require__(2);
  662. var _quillDelta2 = _interopRequireDefault(_quillDelta);
  663. var _parchment = __webpack_require__(0);
  664. var _parchment2 = _interopRequireDefault(_parchment);
  665. var _break = __webpack_require__(16);
  666. var _break2 = _interopRequireDefault(_break);
  667. var _inline = __webpack_require__(6);
  668. var _inline2 = _interopRequireDefault(_inline);
  669. var _text = __webpack_require__(7);
  670. var _text2 = _interopRequireDefault(_text);
  671. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  672. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  673. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  674. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  675. var NEWLINE_LENGTH = 1;
  676. var BlockEmbed = function (_Parchment$Embed) {
  677. _inherits(BlockEmbed, _Parchment$Embed);
  678. function BlockEmbed() {
  679. _classCallCheck(this, BlockEmbed);
  680. return _possibleConstructorReturn(this, (BlockEmbed.__proto__ || Object.getPrototypeOf(BlockEmbed)).apply(this, arguments));
  681. }
  682. _createClass(BlockEmbed, [{
  683. key: 'attach',
  684. value: function attach() {
  685. _get(BlockEmbed.prototype.__proto__ || Object.getPrototypeOf(BlockEmbed.prototype), 'attach', this).call(this);
  686. this.attributes = new _parchment2.default.Attributor.Store(this.domNode);
  687. }
  688. }, {
  689. key: 'delta',
  690. value: function delta() {
  691. return new _quillDelta2.default().insert(this.value(), (0, _extend2.default)(this.formats(), this.attributes.values()));
  692. }
  693. }, {
  694. key: 'format',
  695. value: function format(name, value) {
  696. var attribute = _parchment2.default.query(name, _parchment2.default.Scope.BLOCK_ATTRIBUTE);
  697. if (attribute != null) {
  698. this.attributes.attribute(attribute, value);
  699. }
  700. }
  701. }, {
  702. key: 'formatAt',
  703. value: function formatAt(index, length, name, value) {
  704. this.format(name, value);
  705. }
  706. }, {
  707. key: 'insertAt',
  708. value: function insertAt(index, value, def) {
  709. if (typeof value === 'string' && value.endsWith('\n')) {
  710. var block = _parchment2.default.create(Block.blotName);
  711. this.parent.insertBefore(block, index === 0 ? this : this.next);
  712. block.insertAt(0, value.slice(0, -1));
  713. } else {
  714. _get(BlockEmbed.prototype.__proto__ || Object.getPrototypeOf(BlockEmbed.prototype), 'insertAt', this).call(this, index, value, def);
  715. }
  716. }
  717. }]);
  718. return BlockEmbed;
  719. }(_parchment2.default.Embed);
  720. BlockEmbed.scope = _parchment2.default.Scope.BLOCK_BLOT;
  721. // It is important for cursor behavior BlockEmbeds use tags that are block level elements
  722. var Block = function (_Parchment$Block) {
  723. _inherits(Block, _Parchment$Block);
  724. function Block(domNode) {
  725. _classCallCheck(this, Block);
  726. var _this2 = _possibleConstructorReturn(this, (Block.__proto__ || Object.getPrototypeOf(Block)).call(this, domNode));
  727. _this2.cache = {};
  728. return _this2;
  729. }
  730. _createClass(Block, [{
  731. key: 'delta',
  732. value: function delta() {
  733. if (this.cache.delta == null) {
  734. this.cache.delta = this.descendants(_parchment2.default.Leaf).reduce(function (delta, leaf) {
  735. if (leaf.length() === 0) {
  736. return delta;
  737. } else {
  738. return delta.insert(leaf.value(), bubbleFormats(leaf));
  739. }
  740. }, new _quillDelta2.default()).insert('\n', bubbleFormats(this));
  741. }
  742. return this.cache.delta;
  743. }
  744. }, {
  745. key: 'deleteAt',
  746. value: function deleteAt(index, length) {
  747. _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'deleteAt', this).call(this, index, length);
  748. this.cache = {};
  749. }
  750. }, {
  751. key: 'formatAt',
  752. value: function formatAt(index, length, name, value) {
  753. if (length <= 0) return;
  754. if (_parchment2.default.query(name, _parchment2.default.Scope.BLOCK)) {
  755. if (index + length === this.length()) {
  756. this.format(name, value);
  757. }
  758. } else {
  759. _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'formatAt', this).call(this, index, Math.min(length, this.length() - index - 1), name, value);
  760. }
  761. this.cache = {};
  762. }
  763. }, {
  764. key: 'insertAt',
  765. value: function insertAt(index, value, def) {
  766. if (def != null) return _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'insertAt', this).call(this, index, value, def);
  767. if (value.length === 0) return;
  768. var lines = value.split('\n');
  769. var text = lines.shift();
  770. if (text.length > 0) {
  771. if (index < this.length() - 1 || this.children.tail == null) {
  772. _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'insertAt', this).call(this, Math.min(index, this.length() - 1), text);
  773. } else {
  774. this.children.tail.insertAt(this.children.tail.length(), text);
  775. }
  776. this.cache = {};
  777. }
  778. var block = this;
  779. lines.reduce(function (index, line) {
  780. block = block.split(index, true);
  781. block.insertAt(0, line);
  782. return line.length;
  783. }, index + text.length);
  784. }
  785. }, {
  786. key: 'insertBefore',
  787. value: function insertBefore(blot, ref) {
  788. var head = this.children.head;
  789. _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'insertBefore', this).call(this, blot, ref);
  790. if (head instanceof _break2.default) {
  791. head.remove();
  792. }
  793. this.cache = {};
  794. }
  795. }, {
  796. key: 'length',
  797. value: function length() {
  798. if (this.cache.length == null) {
  799. this.cache.length = _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'length', this).call(this) + NEWLINE_LENGTH;
  800. }
  801. return this.cache.length;
  802. }
  803. }, {
  804. key: 'moveChildren',
  805. value: function moveChildren(target, ref) {
  806. _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'moveChildren', this).call(this, target, ref);
  807. this.cache = {};
  808. }
  809. }, {
  810. key: 'optimize',
  811. value: function optimize(context) {
  812. _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'optimize', this).call(this, context);
  813. this.cache = {};
  814. }
  815. }, {
  816. key: 'path',
  817. value: function path(index) {
  818. return _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'path', this).call(this, index, true);
  819. }
  820. }, {
  821. key: 'removeChild',
  822. value: function removeChild(child) {
  823. _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'removeChild', this).call(this, child);
  824. this.cache = {};
  825. }
  826. }, {
  827. key: 'split',
  828. value: function split(index) {
  829. var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  830. if (force && (index === 0 || index >= this.length() - NEWLINE_LENGTH)) {
  831. var clone = this.clone();
  832. if (index === 0) {
  833. this.parent.insertBefore(clone, this);
  834. return this;
  835. } else {
  836. this.parent.insertBefore(clone, this.next);
  837. return clone;
  838. }
  839. } else {
  840. var next = _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'split', this).call(this, index, force);
  841. this.cache = {};
  842. return next;
  843. }
  844. }
  845. }]);
  846. return Block;
  847. }(_parchment2.default.Block);
  848. Block.blotName = 'block';
  849. Block.tagName = 'P';
  850. Block.defaultChild = 'break';
  851. Block.allowedChildren = [_inline2.default, _parchment2.default.Embed, _text2.default];
  852. function bubbleFormats(blot) {
  853. var formats = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  854. if (blot == null) return formats;
  855. if (typeof blot.formats === 'function') {
  856. formats = (0, _extend2.default)(formats, blot.formats());
  857. }
  858. if (blot.parent == null || blot.parent.blotName == 'scroll' || blot.parent.statics.scope !== blot.statics.scope) {
  859. return formats;
  860. }
  861. return bubbleFormats(blot.parent, formats);
  862. }
  863. exports.bubbleFormats = bubbleFormats;
  864. exports.BlockEmbed = BlockEmbed;
  865. exports.default = Block;
  866. /***/ }),
  867. /* 5 */
  868. /***/ (function(module, exports, __webpack_require__) {
  869. "use strict";
  870. Object.defineProperty(exports, "__esModule", {
  871. value: true
  872. });
  873. exports.default = exports.overload = exports.expandConfig = undefined;
  874. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  875. var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
  876. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  877. __webpack_require__(50);
  878. var _quillDelta = __webpack_require__(2);
  879. var _quillDelta2 = _interopRequireDefault(_quillDelta);
  880. var _editor = __webpack_require__(14);
  881. var _editor2 = _interopRequireDefault(_editor);
  882. var _emitter3 = __webpack_require__(8);
  883. var _emitter4 = _interopRequireDefault(_emitter3);
  884. var _module = __webpack_require__(9);
  885. var _module2 = _interopRequireDefault(_module);
  886. var _parchment = __webpack_require__(0);
  887. var _parchment2 = _interopRequireDefault(_parchment);
  888. var _selection = __webpack_require__(15);
  889. var _selection2 = _interopRequireDefault(_selection);
  890. var _extend = __webpack_require__(3);
  891. var _extend2 = _interopRequireDefault(_extend);
  892. var _logger = __webpack_require__(10);
  893. var _logger2 = _interopRequireDefault(_logger);
  894. var _theme = __webpack_require__(34);
  895. var _theme2 = _interopRequireDefault(_theme);
  896. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  897. 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; }
  898. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  899. var debug = (0, _logger2.default)('quill');
  900. var Quill = function () {
  901. _createClass(Quill, null, [{
  902. key: 'debug',
  903. value: function debug(limit) {
  904. if (limit === true) {
  905. limit = 'log';
  906. }
  907. _logger2.default.level(limit);
  908. }
  909. }, {
  910. key: 'find',
  911. value: function find(node) {
  912. return node.__quill || _parchment2.default.find(node);
  913. }
  914. }, {
  915. key: 'import',
  916. value: function _import(name) {
  917. if (this.imports[name] == null) {
  918. debug.error('Cannot import ' + name + '. Are you sure it was registered?');
  919. }
  920. return this.imports[name];
  921. }
  922. }, {
  923. key: 'register',
  924. value: function register(path, target) {
  925. var _this = this;
  926. var overwrite = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  927. if (typeof path !== 'string') {
  928. var name = path.attrName || path.blotName;
  929. if (typeof name === 'string') {
  930. // register(Blot | Attributor, overwrite)
  931. this.register('formats/' + name, path, target);
  932. } else {
  933. Object.keys(path).forEach(function (key) {
  934. _this.register(key, path[key], target);
  935. });
  936. }
  937. } else {
  938. if (this.imports[path] != null && !overwrite) {
  939. debug.warn('Overwriting ' + path + ' with', target);
  940. }
  941. this.imports[path] = target;
  942. if ((path.startsWith('blots/') || path.startsWith('formats/')) && target.blotName !== 'abstract') {
  943. _parchment2.default.register(target);
  944. } else if (path.startsWith('modules') && typeof target.register === 'function') {
  945. target.register();
  946. }
  947. }
  948. }
  949. }]);
  950. function Quill(container) {
  951. var _this2 = this;
  952. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  953. _classCallCheck(this, Quill);
  954. this.options = expandConfig(container, options);
  955. this.container = this.options.container;
  956. if (this.container == null) {
  957. return debug.error('Invalid Quill container', container);
  958. }
  959. if (this.options.debug) {
  960. Quill.debug(this.options.debug);
  961. }
  962. var html = this.container.innerHTML.trim();
  963. this.container.classList.add('ql-container');
  964. this.container.innerHTML = '';
  965. this.container.__quill = this;
  966. this.root = this.addContainer('ql-editor');
  967. this.root.classList.add('ql-blank');
  968. this.root.setAttribute('data-gramm', false);
  969. this.scrollingContainer = this.options.scrollingContainer || this.root;
  970. this.emitter = new _emitter4.default();
  971. this.scroll = _parchment2.default.create(this.root, {
  972. emitter: this.emitter,
  973. whitelist: this.options.formats
  974. });
  975. this.editor = new _editor2.default(this.scroll);
  976. this.selection = new _selection2.default(this.scroll, this.emitter);
  977. this.theme = new this.options.theme(this, this.options);
  978. this.keyboard = this.theme.addModule('keyboard');
  979. this.clipboard = this.theme.addModule('clipboard');
  980. this.history = this.theme.addModule('history');
  981. this.theme.init();
  982. this.emitter.on(_emitter4.default.events.EDITOR_CHANGE, function (type) {
  983. if (type === _emitter4.default.events.TEXT_CHANGE) {
  984. _this2.root.classList.toggle('ql-blank', _this2.editor.isBlank());
  985. }
  986. });
  987. this.emitter.on(_emitter4.default.events.SCROLL_UPDATE, function (source, mutations) {
  988. var range = _this2.selection.lastRange;
  989. var index = range && range.length === 0 ? range.index : undefined;
  990. modify.call(_this2, function () {
  991. return _this2.editor.update(null, mutations, index);
  992. }, source);
  993. });
  994. var contents = this.clipboard.convert('<div class=\'ql-editor\' style="white-space: normal;">' + html + '<p><br></p></div>');
  995. this.setContents(contents);
  996. this.history.clear();
  997. if (this.options.placeholder) {
  998. this.root.setAttribute('data-placeholder', this.options.placeholder);
  999. }
  1000. if (this.options.readOnly) {
  1001. this.disable();
  1002. }
  1003. }
  1004. _createClass(Quill, [{
  1005. key: 'addContainer',
  1006. value: function addContainer(container) {
  1007. var refNode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  1008. if (typeof container === 'string') {
  1009. var className = container;
  1010. container = document.createElement('div');
  1011. container.classList.add(className);
  1012. }
  1013. this.container.insertBefore(container, refNode);
  1014. return container;
  1015. }
  1016. }, {
  1017. key: 'blur',
  1018. value: function blur() {
  1019. this.selection.setRange(null);
  1020. }
  1021. }, {
  1022. key: 'deleteText',
  1023. value: function deleteText(index, length, source) {
  1024. var _this3 = this;
  1025. var _overload = overload(index, length, source);
  1026. var _overload2 = _slicedToArray(_overload, 4);
  1027. index = _overload2[0];
  1028. length = _overload2[1];
  1029. source = _overload2[3];
  1030. return modify.call(this, function () {
  1031. return _this3.editor.deleteText(index, length);
  1032. }, source, index, -1 * length);
  1033. }
  1034. }, {
  1035. key: 'disable',
  1036. value: function disable() {
  1037. this.enable(false);
  1038. }
  1039. }, {
  1040. key: 'enable',
  1041. value: function enable() {
  1042. var enabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
  1043. this.scroll.enable(enabled);
  1044. this.container.classList.toggle('ql-disabled', !enabled);
  1045. }
  1046. }, {
  1047. key: 'focus',
  1048. value: function focus() {
  1049. var scrollTop = this.scrollingContainer.scrollTop;
  1050. this.selection.focus();
  1051. this.scrollingContainer.scrollTop = scrollTop;
  1052. this.scrollIntoView();
  1053. }
  1054. }, {
  1055. key: 'format',
  1056. value: function format(name, value) {
  1057. var _this4 = this;
  1058. var source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _emitter4.default.sources.API;
  1059. return modify.call(this, function () {
  1060. var range = _this4.getSelection(true);
  1061. var change = new _quillDelta2.default();
  1062. if (range == null) {
  1063. return change;
  1064. } else if (_parchment2.default.query(name, _parchment2.default.Scope.BLOCK)) {
  1065. change = _this4.editor.formatLine(range.index, range.length, _defineProperty({}, name, value));
  1066. } else if (range.length === 0) {
  1067. _this4.selection.format(name, value);
  1068. return change;
  1069. } else {
  1070. change = _this4.editor.formatText(range.index, range.length, _defineProperty({}, name, value));
  1071. }
  1072. _this4.setSelection(range, _emitter4.default.sources.SILENT);
  1073. return change;
  1074. }, source);
  1075. }
  1076. }, {
  1077. key: 'formatLine',
  1078. value: function formatLine(index, length, name, value, source) {
  1079. var _this5 = this;
  1080. var formats = void 0;
  1081. var _overload3 = overload(index, length, name, value, source);
  1082. var _overload4 = _slicedToArray(_overload3, 4);
  1083. index = _overload4[0];
  1084. length = _overload4[1];
  1085. formats = _overload4[2];
  1086. source = _overload4[3];
  1087. return modify.call(this, function () {
  1088. return _this5.editor.formatLine(index, length, formats);
  1089. }, source, index, 0);
  1090. }
  1091. }, {
  1092. key: 'formatText',
  1093. value: function formatText(index, length, name, value, source) {
  1094. var _this6 = this;
  1095. var formats = void 0;
  1096. var _overload5 = overload(index, length, name, value, source);
  1097. var _overload6 = _slicedToArray(_overload5, 4);
  1098. index = _overload6[0];
  1099. length = _overload6[1];
  1100. formats = _overload6[2];
  1101. source = _overload6[3];
  1102. return modify.call(this, function () {
  1103. return _this6.editor.formatText(index, length, formats);
  1104. }, source, index, 0);
  1105. }
  1106. }, {
  1107. key: 'getBounds',
  1108. value: function getBounds(index) {
  1109. var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  1110. var bounds = void 0;
  1111. if (typeof index === 'number') {
  1112. bounds = this.selection.getBounds(index, length);
  1113. } else {
  1114. bounds = this.selection.getBounds(index.index, index.length);
  1115. }
  1116. var containerBounds = this.container.getBoundingClientRect();
  1117. return {
  1118. bottom: bounds.bottom - containerBounds.top,
  1119. height: bounds.height,
  1120. left: bounds.left - containerBounds.left,
  1121. right: bounds.right - containerBounds.left,
  1122. top: bounds.top - containerBounds.top,
  1123. width: bounds.width
  1124. };
  1125. }
  1126. }, {
  1127. key: 'getContents',
  1128. value: function getContents() {
  1129. var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
  1130. var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.getLength() - index;
  1131. var _overload7 = overload(index, length);
  1132. var _overload8 = _slicedToArray(_overload7, 2);
  1133. index = _overload8[0];
  1134. length = _overload8[1];
  1135. return this.editor.getContents(index, length);
  1136. }
  1137. }, {
  1138. key: 'getFormat',
  1139. value: function getFormat() {
  1140. var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.getSelection(true);
  1141. var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  1142. if (typeof index === 'number') {
  1143. return this.editor.getFormat(index, length);
  1144. } else {
  1145. return this.editor.getFormat(index.index, index.length);
  1146. }
  1147. }
  1148. }, {
  1149. key: 'getIndex',
  1150. value: function getIndex(blot) {
  1151. return blot.offset(this.scroll);
  1152. }
  1153. }, {
  1154. key: 'getLength',
  1155. value: function getLength() {
  1156. return this.scroll.length();
  1157. }
  1158. }, {
  1159. key: 'getLeaf',
  1160. value: function getLeaf(index) {
  1161. return this.scroll.leaf(index);
  1162. }
  1163. }, {
  1164. key: 'getLine',
  1165. value: function getLine(index) {
  1166. return this.scroll.line(index);
  1167. }
  1168. }, {
  1169. key: 'getLines',
  1170. value: function getLines() {
  1171. var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
  1172. var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Number.MAX_VALUE;
  1173. if (typeof index !== 'number') {
  1174. return this.scroll.lines(index.index, index.length);
  1175. } else {
  1176. return this.scroll.lines(index, length);
  1177. }
  1178. }
  1179. }, {
  1180. key: 'getModule',
  1181. value: function getModule(name) {
  1182. return this.theme.modules[name];
  1183. }
  1184. }, {
  1185. key: 'getSelection',
  1186. value: function getSelection() {
  1187. var focus = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  1188. if (focus) this.focus();
  1189. this.update(); // Make sure we access getRange with editor in consistent state
  1190. return this.selection.getRange()[0];
  1191. }
  1192. }, {
  1193. key: 'getText',
  1194. value: function getText() {
  1195. var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
  1196. var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.getLength() - index;
  1197. var _overload9 = overload(index, length);
  1198. var _overload10 = _slicedToArray(_overload9, 2);
  1199. index = _overload10[0];
  1200. length = _overload10[1];
  1201. return this.editor.getText(index, length);
  1202. }
  1203. }, {
  1204. key: 'hasFocus',
  1205. value: function hasFocus() {
  1206. return this.selection.hasFocus();
  1207. }
  1208. }, {
  1209. key: 'insertEmbed',
  1210. value: function insertEmbed(index, embed, value) {
  1211. var _this7 = this;
  1212. var source = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : Quill.sources.API;
  1213. return modify.call(this, function () {
  1214. return _this7.editor.insertEmbed(index, embed, value);
  1215. }, source, index);
  1216. }
  1217. }, {
  1218. key: 'insertText',
  1219. value: function insertText(index, text, name, value, source) {
  1220. var _this8 = this;
  1221. var formats = void 0;
  1222. var _overload11 = overload(index, 0, name, value, source);
  1223. var _overload12 = _slicedToArray(_overload11, 4);
  1224. index = _overload12[0];
  1225. formats = _overload12[2];
  1226. source = _overload12[3];
  1227. return modify.call(this, function () {
  1228. return _this8.editor.insertText(index, text, formats);
  1229. }, source, index, text.length);
  1230. }
  1231. }, {
  1232. key: 'isEnabled',
  1233. value: function isEnabled() {
  1234. return !this.container.classList.contains('ql-disabled');
  1235. }
  1236. }, {
  1237. key: 'off',
  1238. value: function off() {
  1239. return this.emitter.off.apply(this.emitter, arguments);
  1240. }
  1241. }, {
  1242. key: 'on',
  1243. value: function on() {
  1244. return this.emitter.on.apply(this.emitter, arguments);
  1245. }
  1246. }, {
  1247. key: 'once',
  1248. value: function once() {
  1249. return this.emitter.once.apply(this.emitter, arguments);
  1250. }
  1251. }, {
  1252. key: 'pasteHTML',
  1253. value: function pasteHTML(index, html, source) {
  1254. this.clipboard.dangerouslyPasteHTML(index, html, source);
  1255. }
  1256. }, {
  1257. key: 'removeFormat',
  1258. value: function removeFormat(index, length, source) {
  1259. var _this9 = this;
  1260. var _overload13 = overload(index, length, source);
  1261. var _overload14 = _slicedToArray(_overload13, 4);
  1262. index = _overload14[0];
  1263. length = _overload14[1];
  1264. source = _overload14[3];
  1265. return modify.call(this, function () {
  1266. return _this9.editor.removeFormat(index, length);
  1267. }, source, index);
  1268. }
  1269. }, {
  1270. key: 'scrollIntoView',
  1271. value: function scrollIntoView() {
  1272. this.selection.scrollIntoView(this.scrollingContainer);
  1273. }
  1274. }, {
  1275. key: 'setContents',
  1276. value: function setContents(delta) {
  1277. var _this10 = this;
  1278. var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _emitter4.default.sources.API;
  1279. return modify.call(this, function () {
  1280. delta = new _quillDelta2.default(delta);
  1281. var length = _this10.getLength();
  1282. var deleted = _this10.editor.deleteText(0, length);
  1283. var applied = _this10.editor.applyDelta(delta);
  1284. var lastOp = applied.ops[applied.ops.length - 1];
  1285. if (lastOp != null && typeof lastOp.insert === 'string' && lastOp.insert[lastOp.insert.length - 1] === '\n') {
  1286. _this10.editor.deleteText(_this10.getLength() - 1, 1);
  1287. applied.delete(1);
  1288. }
  1289. var ret = deleted.compose(applied);
  1290. return ret;
  1291. }, source);
  1292. }
  1293. }, {
  1294. key: 'setSelection',
  1295. value: function setSelection(index, length, source) {
  1296. if (index == null) {
  1297. this.selection.setRange(null, length || Quill.sources.API);
  1298. } else {
  1299. var _overload15 = overload(index, length, source);
  1300. var _overload16 = _slicedToArray(_overload15, 4);
  1301. index = _overload16[0];
  1302. length = _overload16[1];
  1303. source = _overload16[3];
  1304. this.selection.setRange(new _selection.Range(index, length), source);
  1305. if (source !== _emitter4.default.sources.SILENT) {
  1306. this.selection.scrollIntoView(this.scrollingContainer);
  1307. }
  1308. }
  1309. }
  1310. }, {
  1311. key: 'setText',
  1312. value: function setText(text) {
  1313. var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _emitter4.default.sources.API;
  1314. var delta = new _quillDelta2.default().insert(text);
  1315. return this.setContents(delta, source);
  1316. }
  1317. }, {
  1318. key: 'update',
  1319. value: function update() {
  1320. var source = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _emitter4.default.sources.USER;
  1321. var change = this.scroll.update(source); // Will update selection before selection.update() does if text changes
  1322. this.selection.update(source);
  1323. return change;
  1324. }
  1325. }, {
  1326. key: 'updateContents',
  1327. value: function updateContents(delta) {
  1328. var _this11 = this;
  1329. var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _emitter4.default.sources.API;
  1330. return modify.call(this, function () {
  1331. delta = new _quillDelta2.default(delta);
  1332. return _this11.editor.applyDelta(delta, source);
  1333. }, source, true);
  1334. }
  1335. }]);
  1336. return Quill;
  1337. }();
  1338. Quill.DEFAULTS = {
  1339. bounds: null,
  1340. formats: null,
  1341. modules: {},
  1342. placeholder: '',
  1343. readOnly: false,
  1344. scrollingContainer: null,
  1345. strict: true,
  1346. theme: 'default'
  1347. };
  1348. Quill.events = _emitter4.default.events;
  1349. Quill.sources = _emitter4.default.sources;
  1350. // eslint-disable-next-line no-undef
  1351. Quill.version = false ? 'dev' : "1.3.6";
  1352. Quill.imports = {
  1353. 'delta': _quillDelta2.default,
  1354. 'parchment': _parchment2.default,
  1355. 'core/module': _module2.default,
  1356. 'core/theme': _theme2.default
  1357. };
  1358. function expandConfig(container, userConfig) {
  1359. userConfig = (0, _extend2.default)(true, {
  1360. container: container,
  1361. modules: {
  1362. clipboard: true,
  1363. keyboard: true,
  1364. history: true
  1365. }
  1366. }, userConfig);
  1367. if (!userConfig.theme || userConfig.theme === Quill.DEFAULTS.theme) {
  1368. userConfig.theme = _theme2.default;
  1369. } else {
  1370. userConfig.theme = Quill.import('themes/' + userConfig.theme);
  1371. if (userConfig.theme == null) {
  1372. throw new Error('Invalid theme ' + userConfig.theme + '. Did you register it?');
  1373. }
  1374. }
  1375. var themeConfig = (0, _extend2.default)(true, {}, userConfig.theme.DEFAULTS);
  1376. [themeConfig, userConfig].forEach(function (config) {
  1377. config.modules = config.modules || {};
  1378. Object.keys(config.modules).forEach(function (module) {
  1379. if (config.modules[module] === true) {
  1380. config.modules[module] = {};
  1381. }
  1382. });
  1383. });
  1384. var moduleNames = Object.keys(themeConfig.modules).concat(Object.keys(userConfig.modules));
  1385. var moduleConfig = moduleNames.reduce(function (config, name) {
  1386. var moduleClass = Quill.import('modules/' + name);
  1387. if (moduleClass == null) {
  1388. debug.error('Cannot load ' + name + ' module. Are you sure you registered it?');
  1389. } else {
  1390. config[name] = moduleClass.DEFAULTS || {};
  1391. }
  1392. return config;
  1393. }, {});
  1394. // Special case toolbar shorthand
  1395. if (userConfig.modules != null && userConfig.modules.toolbar && userConfig.modules.toolbar.constructor !== Object) {
  1396. userConfig.modules.toolbar = {
  1397. container: userConfig.modules.toolbar
  1398. };
  1399. }
  1400. userConfig = (0, _extend2.default)(true, {}, Quill.DEFAULTS, { modules: moduleConfig }, themeConfig, userConfig);
  1401. ['bounds', 'container', 'scrollingContainer'].forEach(function (key) {
  1402. if (typeof userConfig[key] === 'string') {
  1403. userConfig[key] = document.querySelector(userConfig[key]);
  1404. }
  1405. });
  1406. userConfig.modules = Object.keys(userConfig.modules).reduce(function (config, name) {
  1407. if (userConfig.modules[name]) {
  1408. config[name] = userConfig.modules[name];
  1409. }
  1410. return config;
  1411. }, {});
  1412. return userConfig;
  1413. }
  1414. // Handle selection preservation and TEXT_CHANGE emission
  1415. // common to modification APIs
  1416. function modify(modifier, source, index, shift) {
  1417. if (this.options.strict && !this.isEnabled() && source === _emitter4.default.sources.USER) {
  1418. return new _quillDelta2.default();
  1419. }
  1420. var range = index == null ? null : this.getSelection();
  1421. var oldDelta = this.editor.delta;
  1422. var change = modifier();
  1423. if (range != null) {
  1424. if (index === true) index = range.index;
  1425. if (shift == null) {
  1426. range = shiftRange(range, change, source);
  1427. } else if (shift !== 0) {
  1428. range = shiftRange(range, index, shift, source);
  1429. }
  1430. this.setSelection(range, _emitter4.default.sources.SILENT);
  1431. }
  1432. if (change.length() > 0) {
  1433. var _emitter;
  1434. var args = [_emitter4.default.events.TEXT_CHANGE, change, oldDelta, source];
  1435. (_emitter = this.emitter).emit.apply(_emitter, [_emitter4.default.events.EDITOR_CHANGE].concat(args));
  1436. if (source !== _emitter4.default.sources.SILENT) {
  1437. var _emitter2;
  1438. (_emitter2 = this.emitter).emit.apply(_emitter2, args);
  1439. }
  1440. }
  1441. return change;
  1442. }
  1443. function overload(index, length, name, value, source) {
  1444. var formats = {};
  1445. if (typeof index.index === 'number' && typeof index.length === 'number') {
  1446. // Allow for throwaway end (used by insertText/insertEmbed)
  1447. if (typeof length !== 'number') {
  1448. source = value, value = name, name = length, length = index.length, index = index.index;
  1449. } else {
  1450. length = index.length, index = index.index;
  1451. }
  1452. } else if (typeof length !== 'number') {
  1453. source = value, value = name, name = length, length = 0;
  1454. }
  1455. // Handle format being object, two format name/value strings or excluded
  1456. if ((typeof name === 'undefined' ? 'undefined' : _typeof(name)) === 'object') {
  1457. formats = name;
  1458. source = value;
  1459. } else if (typeof name === 'string') {
  1460. if (value != null) {
  1461. formats[name] = value;
  1462. } else {
  1463. source = name;
  1464. }
  1465. }
  1466. // Handle optional source
  1467. source = source || _emitter4.default.sources.API;
  1468. return [index, length, formats, source];
  1469. }
  1470. function shiftRange(range, index, length, source) {
  1471. if (range == null) return null;
  1472. var start = void 0,
  1473. end = void 0;
  1474. if (index instanceof _quillDelta2.default) {
  1475. var _map = [range.index, range.index + range.length].map(function (pos) {
  1476. return index.transformPosition(pos, source !== _emitter4.default.sources.USER);
  1477. });
  1478. var _map2 = _slicedToArray(_map, 2);
  1479. start = _map2[0];
  1480. end = _map2[1];
  1481. } else {
  1482. var _map3 = [range.index, range.index + range.length].map(function (pos) {
  1483. if (pos < index || pos === index && source === _emitter4.default.sources.USER) return pos;
  1484. if (length >= 0) {
  1485. return pos + length;
  1486. } else {
  1487. return Math.max(index, pos + length);
  1488. }
  1489. });
  1490. var _map4 = _slicedToArray(_map3, 2);
  1491. start = _map4[0];
  1492. end = _map4[1];
  1493. }
  1494. return new _selection.Range(start, end - start);
  1495. }
  1496. exports.expandConfig = expandConfig;
  1497. exports.overload = overload;
  1498. exports.default = Quill;
  1499. /***/ }),
  1500. /* 6 */
  1501. /***/ (function(module, exports, __webpack_require__) {
  1502. "use strict";
  1503. Object.defineProperty(exports, "__esModule", {
  1504. value: true
  1505. });
  1506. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  1507. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  1508. var _text = __webpack_require__(7);
  1509. var _text2 = _interopRequireDefault(_text);
  1510. var _parchment = __webpack_require__(0);
  1511. var _parchment2 = _interopRequireDefault(_parchment);
  1512. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1513. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1514. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  1515. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  1516. var Inline = function (_Parchment$Inline) {
  1517. _inherits(Inline, _Parchment$Inline);
  1518. function Inline() {
  1519. _classCallCheck(this, Inline);
  1520. return _possibleConstructorReturn(this, (Inline.__proto__ || Object.getPrototypeOf(Inline)).apply(this, arguments));
  1521. }
  1522. _createClass(Inline, [{
  1523. key: 'formatAt',
  1524. value: function formatAt(index, length, name, value) {
  1525. if (Inline.compare(this.statics.blotName, name) < 0 && _parchment2.default.query(name, _parchment2.default.Scope.BLOT)) {
  1526. var blot = this.isolate(index, length);
  1527. if (value) {
  1528. blot.wrap(name, value);
  1529. }
  1530. } else {
  1531. _get(Inline.prototype.__proto__ || Object.getPrototypeOf(Inline.prototype), 'formatAt', this).call(this, index, length, name, value);
  1532. }
  1533. }
  1534. }, {
  1535. key: 'optimize',
  1536. value: function optimize(context) {
  1537. _get(Inline.prototype.__proto__ || Object.getPrototypeOf(Inline.prototype), 'optimize', this).call(this, context);
  1538. if (this.parent instanceof Inline && Inline.compare(this.statics.blotName, this.parent.statics.blotName) > 0) {
  1539. var parent = this.parent.isolate(this.offset(), this.length());
  1540. this.moveChildren(parent);
  1541. parent.wrap(this);
  1542. }
  1543. }
  1544. }], [{
  1545. key: 'compare',
  1546. value: function compare(self, other) {
  1547. var selfIndex = Inline.order.indexOf(self);
  1548. var otherIndex = Inline.order.indexOf(other);
  1549. if (selfIndex >= 0 || otherIndex >= 0) {
  1550. return selfIndex - otherIndex;
  1551. } else if (self === other) {
  1552. return 0;
  1553. } else if (self < other) {
  1554. return -1;
  1555. } else {
  1556. return 1;
  1557. }
  1558. }
  1559. }]);
  1560. return Inline;
  1561. }(_parchment2.default.Inline);
  1562. Inline.allowedChildren = [Inline, _parchment2.default.Embed, _text2.default];
  1563. // Lower index means deeper in the DOM tree, since not found (-1) is for embeds
  1564. Inline.order = ['cursor', 'inline', // Must be lower
  1565. 'underline', 'strike', 'italic', 'bold', 'script', 'link', 'code' // Must be higher
  1566. ];
  1567. exports.default = Inline;
  1568. /***/ }),
  1569. /* 7 */
  1570. /***/ (function(module, exports, __webpack_require__) {
  1571. "use strict";
  1572. Object.defineProperty(exports, "__esModule", {
  1573. value: true
  1574. });
  1575. var _parchment = __webpack_require__(0);
  1576. var _parchment2 = _interopRequireDefault(_parchment);
  1577. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1578. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1579. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  1580. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  1581. var TextBlot = function (_Parchment$Text) {
  1582. _inherits(TextBlot, _Parchment$Text);
  1583. function TextBlot() {
  1584. _classCallCheck(this, TextBlot);
  1585. return _possibleConstructorReturn(this, (TextBlot.__proto__ || Object.getPrototypeOf(TextBlot)).apply(this, arguments));
  1586. }
  1587. return TextBlot;
  1588. }(_parchment2.default.Text);
  1589. exports.default = TextBlot;
  1590. /***/ }),
  1591. /* 8 */
  1592. /***/ (function(module, exports, __webpack_require__) {
  1593. "use strict";
  1594. Object.defineProperty(exports, "__esModule", {
  1595. value: true
  1596. });
  1597. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  1598. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  1599. var _eventemitter = __webpack_require__(54);
  1600. var _eventemitter2 = _interopRequireDefault(_eventemitter);
  1601. var _logger = __webpack_require__(10);
  1602. var _logger2 = _interopRequireDefault(_logger);
  1603. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1604. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1605. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  1606. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  1607. var debug = (0, _logger2.default)('quill:events');
  1608. var EVENTS = ['selectionchange', 'mousedown', 'mouseup', 'click'];
  1609. EVENTS.forEach(function (eventName) {
  1610. document.addEventListener(eventName, function () {
  1611. for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
  1612. args[_key] = arguments[_key];
  1613. }
  1614. [].slice.call(document.querySelectorAll('.ql-container')).forEach(function (node) {
  1615. // TODO use WeakMap
  1616. if (node.__quill && node.__quill.emitter) {
  1617. var _node$__quill$emitter;
  1618. (_node$__quill$emitter = node.__quill.emitter).handleDOM.apply(_node$__quill$emitter, args);
  1619. }
  1620. });
  1621. });
  1622. });
  1623. var Emitter = function (_EventEmitter) {
  1624. _inherits(Emitter, _EventEmitter);
  1625. function Emitter() {
  1626. _classCallCheck(this, Emitter);
  1627. var _this = _possibleConstructorReturn(this, (Emitter.__proto__ || Object.getPrototypeOf(Emitter)).call(this));
  1628. _this.listeners = {};
  1629. _this.on('error', debug.error);
  1630. return _this;
  1631. }
  1632. _createClass(Emitter, [{
  1633. key: 'emit',
  1634. value: function emit() {
  1635. debug.log.apply(debug, arguments);
  1636. _get(Emitter.prototype.__proto__ || Object.getPrototypeOf(Emitter.prototype), 'emit', this).apply(this, arguments);
  1637. }
  1638. }, {
  1639. key: 'handleDOM',
  1640. value: function handleDOM(event) {
  1641. for (var _len2 = arguments.length, args = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
  1642. args[_key2 - 1] = arguments[_key2];
  1643. }
  1644. (this.listeners[event.type] || []).forEach(function (_ref) {
  1645. var node = _ref.node,
  1646. handler = _ref.handler;
  1647. if (event.target === node || node.contains(event.target)) {
  1648. handler.apply(undefined, [event].concat(args));
  1649. }
  1650. });
  1651. }
  1652. }, {
  1653. key: 'listenDOM',
  1654. value: function listenDOM(eventName, node, handler) {
  1655. if (!this.listeners[eventName]) {
  1656. this.listeners[eventName] = [];
  1657. }
  1658. this.listeners[eventName].push({ node: node, handler: handler });
  1659. }
  1660. }]);
  1661. return Emitter;
  1662. }(_eventemitter2.default);
  1663. Emitter.events = {
  1664. EDITOR_CHANGE: 'editor-change',
  1665. SCROLL_BEFORE_UPDATE: 'scroll-before-update',
  1666. SCROLL_OPTIMIZE: 'scroll-optimize',
  1667. SCROLL_UPDATE: 'scroll-update',
  1668. SELECTION_CHANGE: 'selection-change',
  1669. TEXT_CHANGE: 'text-change'
  1670. };
  1671. Emitter.sources = {
  1672. API: 'api',
  1673. SILENT: 'silent',
  1674. USER: 'user'
  1675. };
  1676. exports.default = Emitter;
  1677. /***/ }),
  1678. /* 9 */
  1679. /***/ (function(module, exports, __webpack_require__) {
  1680. "use strict";
  1681. Object.defineProperty(exports, "__esModule", {
  1682. value: true
  1683. });
  1684. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1685. var Module = function Module(quill) {
  1686. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  1687. _classCallCheck(this, Module);
  1688. this.quill = quill;
  1689. this.options = options;
  1690. };
  1691. Module.DEFAULTS = {};
  1692. exports.default = Module;
  1693. /***/ }),
  1694. /* 10 */
  1695. /***/ (function(module, exports, __webpack_require__) {
  1696. "use strict";
  1697. Object.defineProperty(exports, "__esModule", {
  1698. value: true
  1699. });
  1700. var levels = ['error', 'warn', 'log', 'info'];
  1701. var level = 'warn';
  1702. function debug(method) {
  1703. if (levels.indexOf(method) <= levels.indexOf(level)) {
  1704. var _console;
  1705. for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  1706. args[_key - 1] = arguments[_key];
  1707. }
  1708. (_console = console)[method].apply(_console, args); // eslint-disable-line no-console
  1709. }
  1710. }
  1711. function namespace(ns) {
  1712. return levels.reduce(function (logger, method) {
  1713. logger[method] = debug.bind(console, method, ns);
  1714. return logger;
  1715. }, {});
  1716. }
  1717. debug.level = namespace.level = function (newLevel) {
  1718. level = newLevel;
  1719. };
  1720. exports.default = namespace;
  1721. /***/ }),
  1722. /* 11 */
  1723. /***/ (function(module, exports, __webpack_require__) {
  1724. var pSlice = Array.prototype.slice;
  1725. var objectKeys = __webpack_require__(52);
  1726. var isArguments = __webpack_require__(53);
  1727. var deepEqual = module.exports = function (actual, expected, opts) {
  1728. if (!opts) opts = {};
  1729. // 7.1. All identical values are equivalent, as determined by ===.
  1730. if (actual === expected) {
  1731. return true;
  1732. } else if (actual instanceof Date && expected instanceof Date) {
  1733. return actual.getTime() === expected.getTime();
  1734. // 7.3. Other pairs that do not both pass typeof value == 'object',
  1735. // equivalence is determined by ==.
  1736. } else if (!actual || !expected || typeof actual != 'object' && typeof expected != 'object') {
  1737. return opts.strict ? actual === expected : actual == expected;
  1738. // 7.4. For all other Object pairs, including Array objects, equivalence is
  1739. // determined by having the same number of owned properties (as verified
  1740. // with Object.prototype.hasOwnProperty.call), the same set of keys
  1741. // (although not necessarily the same order), equivalent values for every
  1742. // corresponding key, and an identical 'prototype' property. Note: this
  1743. // accounts for both named and indexed properties on Arrays.
  1744. } else {
  1745. return objEquiv(actual, expected, opts);
  1746. }
  1747. }
  1748. function isUndefinedOrNull(value) {
  1749. return value === null || value === undefined;
  1750. }
  1751. function isBuffer (x) {
  1752. if (!x || typeof x !== 'object' || typeof x.length !== 'number') return false;
  1753. if (typeof x.copy !== 'function' || typeof x.slice !== 'function') {
  1754. return false;
  1755. }
  1756. if (x.length > 0 && typeof x[0] !== 'number') return false;
  1757. return true;
  1758. }
  1759. function objEquiv(a, b, opts) {
  1760. var i, key;
  1761. if (isUndefinedOrNull(a) || isUndefinedOrNull(b))
  1762. return false;
  1763. // an identical 'prototype' property.
  1764. if (a.prototype !== b.prototype) return false;
  1765. //~~~I've managed to break Object.keys through screwy arguments passing.
  1766. // Converting to array solves the problem.
  1767. if (isArguments(a)) {
  1768. if (!isArguments(b)) {
  1769. return false;
  1770. }
  1771. a = pSlice.call(a);
  1772. b = pSlice.call(b);
  1773. return deepEqual(a, b, opts);
  1774. }
  1775. if (isBuffer(a)) {
  1776. if (!isBuffer(b)) {
  1777. return false;
  1778. }
  1779. if (a.length !== b.length) return false;
  1780. for (i = 0; i < a.length; i++) {
  1781. if (a[i] !== b[i]) return false;
  1782. }
  1783. return true;
  1784. }
  1785. try {
  1786. var ka = objectKeys(a),
  1787. kb = objectKeys(b);
  1788. } catch (e) {//happens when one is a string literal and the other isn't
  1789. return false;
  1790. }
  1791. // having the same number of owned properties (keys incorporates
  1792. // hasOwnProperty)
  1793. if (ka.length != kb.length)
  1794. return false;
  1795. //the same set of keys (although not necessarily the same order),
  1796. ka.sort();
  1797. kb.sort();
  1798. //~~~cheap key test
  1799. for (i = ka.length - 1; i >= 0; i--) {
  1800. if (ka[i] != kb[i])
  1801. return false;
  1802. }
  1803. //equivalent values for every corresponding key, and
  1804. //~~~possibly expensive deep test
  1805. for (i = ka.length - 1; i >= 0; i--) {
  1806. key = ka[i];
  1807. if (!deepEqual(a[key], b[key], opts)) return false;
  1808. }
  1809. return typeof a === typeof b;
  1810. }
  1811. /***/ }),
  1812. /* 12 */
  1813. /***/ (function(module, exports, __webpack_require__) {
  1814. "use strict";
  1815. Object.defineProperty(exports, "__esModule", { value: true });
  1816. var Registry = __webpack_require__(1);
  1817. var Attributor = /** @class */ (function () {
  1818. function Attributor(attrName, keyName, options) {
  1819. if (options === void 0) { options = {}; }
  1820. this.attrName = attrName;
  1821. this.keyName = keyName;
  1822. var attributeBit = Registry.Scope.TYPE & Registry.Scope.ATTRIBUTE;
  1823. if (options.scope != null) {
  1824. // Ignore type bits, force attribute bit
  1825. this.scope = (options.scope & Registry.Scope.LEVEL) | attributeBit;
  1826. }
  1827. else {
  1828. this.scope = Registry.Scope.ATTRIBUTE;
  1829. }
  1830. if (options.whitelist != null)
  1831. this.whitelist = options.whitelist;
  1832. }
  1833. Attributor.keys = function (node) {
  1834. return [].map.call(node.attributes, function (item) {
  1835. return item.name;
  1836. });
  1837. };
  1838. Attributor.prototype.add = function (node, value) {
  1839. if (!this.canAdd(node, value))
  1840. return false;
  1841. node.setAttribute(this.keyName, value);
  1842. return true;
  1843. };
  1844. Attributor.prototype.canAdd = function (node, value) {
  1845. var match = Registry.query(node, Registry.Scope.BLOT & (this.scope | Registry.Scope.TYPE));
  1846. if (match == null)
  1847. return false;
  1848. if (this.whitelist == null)
  1849. return true;
  1850. if (typeof value === 'string') {
  1851. return this.whitelist.indexOf(value.replace(/["']/g, '')) > -1;
  1852. }
  1853. else {
  1854. return this.whitelist.indexOf(value) > -1;
  1855. }
  1856. };
  1857. Attributor.prototype.remove = function (node) {
  1858. node.removeAttribute(this.keyName);
  1859. };
  1860. Attributor.prototype.value = function (node) {
  1861. var value = node.getAttribute(this.keyName);
  1862. if (this.canAdd(node, value) && value) {
  1863. return value;
  1864. }
  1865. return '';
  1866. };
  1867. return Attributor;
  1868. }());
  1869. exports.default = Attributor;
  1870. /***/ }),
  1871. /* 13 */
  1872. /***/ (function(module, exports, __webpack_require__) {
  1873. "use strict";
  1874. Object.defineProperty(exports, "__esModule", {
  1875. value: true
  1876. });
  1877. exports.default = exports.Code = undefined;
  1878. var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
  1879. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  1880. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  1881. var _quillDelta = __webpack_require__(2);
  1882. var _quillDelta2 = _interopRequireDefault(_quillDelta);
  1883. var _parchment = __webpack_require__(0);
  1884. var _parchment2 = _interopRequireDefault(_parchment);
  1885. var _block = __webpack_require__(4);
  1886. var _block2 = _interopRequireDefault(_block);
  1887. var _inline = __webpack_require__(6);
  1888. var _inline2 = _interopRequireDefault(_inline);
  1889. var _text = __webpack_require__(7);
  1890. var _text2 = _interopRequireDefault(_text);
  1891. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1892. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1893. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  1894. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  1895. var Code = function (_Inline) {
  1896. _inherits(Code, _Inline);
  1897. function Code() {
  1898. _classCallCheck(this, Code);
  1899. return _possibleConstructorReturn(this, (Code.__proto__ || Object.getPrototypeOf(Code)).apply(this, arguments));
  1900. }
  1901. return Code;
  1902. }(_inline2.default);
  1903. Code.blotName = 'code';
  1904. Code.tagName = 'CODE';
  1905. var CodeBlock = function (_Block) {
  1906. _inherits(CodeBlock, _Block);
  1907. function CodeBlock() {
  1908. _classCallCheck(this, CodeBlock);
  1909. return _possibleConstructorReturn(this, (CodeBlock.__proto__ || Object.getPrototypeOf(CodeBlock)).apply(this, arguments));
  1910. }
  1911. _createClass(CodeBlock, [{
  1912. key: 'delta',
  1913. value: function delta() {
  1914. var _this3 = this;
  1915. var text = this.domNode.textContent;
  1916. if (text.endsWith('\n')) {
  1917. // Should always be true
  1918. text = text.slice(0, -1);
  1919. }
  1920. return text.split('\n').reduce(function (delta, frag) {
  1921. return delta.insert(frag).insert('\n', _this3.formats());
  1922. }, new _quillDelta2.default());
  1923. }
  1924. }, {
  1925. key: 'format',
  1926. value: function format(name, value) {
  1927. if (name === this.statics.blotName && value) return;
  1928. var _descendant = this.descendant(_text2.default, this.length() - 1),
  1929. _descendant2 = _slicedToArray(_descendant, 1),
  1930. text = _descendant2[0];
  1931. if (text != null) {
  1932. text.deleteAt(text.length() - 1, 1);
  1933. }
  1934. _get(CodeBlock.prototype.__proto__ || Object.getPrototypeOf(CodeBlock.prototype), 'format', this).call(this, name, value);
  1935. }
  1936. }, {
  1937. key: 'formatAt',
  1938. value: function formatAt(index, length, name, value) {
  1939. if (length === 0) return;
  1940. if (_parchment2.default.query(name, _parchment2.default.Scope.BLOCK) == null || name === this.statics.blotName && value === this.statics.formats(this.domNode)) {
  1941. return;
  1942. }
  1943. var nextNewline = this.newlineIndex(index);
  1944. if (nextNewline < 0 || nextNewline >= index + length) return;
  1945. var prevNewline = this.newlineIndex(index, true) + 1;
  1946. var isolateLength = nextNewline - prevNewline + 1;
  1947. var blot = this.isolate(prevNewline, isolateLength);
  1948. var next = blot.next;
  1949. blot.format(name, value);
  1950. if (next instanceof CodeBlock) {
  1951. next.formatAt(0, index - prevNewline + length - isolateLength, name, value);
  1952. }
  1953. }
  1954. }, {
  1955. key: 'insertAt',
  1956. value: function insertAt(index, value, def) {
  1957. if (def != null) return;
  1958. var _descendant3 = this.descendant(_text2.default, index),
  1959. _descendant4 = _slicedToArray(_descendant3, 2),
  1960. text = _descendant4[0],
  1961. offset = _descendant4[1];
  1962. text.insertAt(offset, value);
  1963. }
  1964. }, {
  1965. key: 'length',
  1966. value: function length() {
  1967. var length = this.domNode.textContent.length;
  1968. if (!this.domNode.textContent.endsWith('\n')) {
  1969. return length + 1;
  1970. }
  1971. return length;
  1972. }
  1973. }, {
  1974. key: 'newlineIndex',
  1975. value: function newlineIndex(searchIndex) {
  1976. var reverse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  1977. if (!reverse) {
  1978. var offset = this.domNode.textContent.slice(searchIndex).indexOf('\n');
  1979. return offset > -1 ? searchIndex + offset : -1;
  1980. } else {
  1981. return this.domNode.textContent.slice(0, searchIndex).lastIndexOf('\n');
  1982. }
  1983. }
  1984. }, {
  1985. key: 'optimize',
  1986. value: function optimize(context) {
  1987. if (!this.domNode.textContent.endsWith('\n')) {
  1988. this.appendChild(_parchment2.default.create('text', '\n'));
  1989. }
  1990. _get(CodeBlock.prototype.__proto__ || Object.getPrototypeOf(CodeBlock.prototype), 'optimize', this).call(this, context);
  1991. var next = this.next;
  1992. if (next != null && next.prev === this && next.statics.blotName === this.statics.blotName && this.statics.formats(this.domNode) === next.statics.formats(next.domNode)) {
  1993. next.optimize(context);
  1994. next.moveChildren(this);
  1995. next.remove();
  1996. }
  1997. }
  1998. }, {
  1999. key: 'replace',
  2000. value: function replace(target) {
  2001. _get(CodeBlock.prototype.__proto__ || Object.getPrototypeOf(CodeBlock.prototype), 'replace', this).call(this, target);
  2002. [].slice.call(this.domNode.querySelectorAll('*')).forEach(function (node) {
  2003. var blot = _parchment2.default.find(node);
  2004. if (blot == null) {
  2005. node.parentNode.removeChild(node);
  2006. } else if (blot instanceof _parchment2.default.Embed) {
  2007. blot.remove();
  2008. } else {
  2009. blot.unwrap();
  2010. }
  2011. });
  2012. }
  2013. }], [{
  2014. key: 'create',
  2015. value: function create(value) {
  2016. var domNode = _get(CodeBlock.__proto__ || Object.getPrototypeOf(CodeBlock), 'create', this).call(this, value);
  2017. domNode.setAttribute('spellcheck', false);
  2018. return domNode;
  2019. }
  2020. }, {
  2021. key: 'formats',
  2022. value: function formats() {
  2023. return true;
  2024. }
  2025. }]);
  2026. return CodeBlock;
  2027. }(_block2.default);
  2028. CodeBlock.blotName = 'code-block';
  2029. CodeBlock.tagName = 'PRE';
  2030. CodeBlock.TAB = ' ';
  2031. exports.Code = Code;
  2032. exports.default = CodeBlock;
  2033. /***/ }),
  2034. /* 14 */
  2035. /***/ (function(module, exports, __webpack_require__) {
  2036. "use strict";
  2037. Object.defineProperty(exports, "__esModule", {
  2038. value: true
  2039. });
  2040. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  2041. var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
  2042. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  2043. var _quillDelta = __webpack_require__(2);
  2044. var _quillDelta2 = _interopRequireDefault(_quillDelta);
  2045. var _op = __webpack_require__(20);
  2046. var _op2 = _interopRequireDefault(_op);
  2047. var _parchment = __webpack_require__(0);
  2048. var _parchment2 = _interopRequireDefault(_parchment);
  2049. var _code = __webpack_require__(13);
  2050. var _code2 = _interopRequireDefault(_code);
  2051. var _cursor = __webpack_require__(24);
  2052. var _cursor2 = _interopRequireDefault(_cursor);
  2053. var _block = __webpack_require__(4);
  2054. var _block2 = _interopRequireDefault(_block);
  2055. var _break = __webpack_require__(16);
  2056. var _break2 = _interopRequireDefault(_break);
  2057. var _clone = __webpack_require__(21);
  2058. var _clone2 = _interopRequireDefault(_clone);
  2059. var _deepEqual = __webpack_require__(11);
  2060. var _deepEqual2 = _interopRequireDefault(_deepEqual);
  2061. var _extend = __webpack_require__(3);
  2062. var _extend2 = _interopRequireDefault(_extend);
  2063. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2064. 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; }
  2065. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2066. var ASCII = /^[ -~]*$/;
  2067. var Editor = function () {
  2068. function Editor(scroll) {
  2069. _classCallCheck(this, Editor);
  2070. this.scroll = scroll;
  2071. this.delta = this.getDelta();
  2072. }
  2073. _createClass(Editor, [{
  2074. key: 'applyDelta',
  2075. value: function applyDelta(delta) {
  2076. var _this = this;
  2077. var consumeNextNewline = false;
  2078. this.scroll.update();
  2079. var scrollLength = this.scroll.length();
  2080. this.scroll.batchStart();
  2081. delta = normalizeDelta(delta);
  2082. delta.reduce(function (index, op) {
  2083. var length = op.retain || op.delete || op.insert.length || 1;
  2084. var attributes = op.attributes || {};
  2085. if (op.insert != null) {
  2086. if (typeof op.insert === 'string') {
  2087. var text = op.insert;
  2088. if (text.endsWith('\n') && consumeNextNewline) {
  2089. consumeNextNewline = false;
  2090. text = text.slice(0, -1);
  2091. }
  2092. if (index >= scrollLength && !text.endsWith('\n')) {
  2093. consumeNextNewline = true;
  2094. }
  2095. _this.scroll.insertAt(index, text);
  2096. var _scroll$line = _this.scroll.line(index),
  2097. _scroll$line2 = _slicedToArray(_scroll$line, 2),
  2098. line = _scroll$line2[0],
  2099. offset = _scroll$line2[1];
  2100. var formats = (0, _extend2.default)({}, (0, _block.bubbleFormats)(line));
  2101. if (line instanceof _block2.default) {
  2102. var _line$descendant = line.descendant(_parchment2.default.Leaf, offset),
  2103. _line$descendant2 = _slicedToArray(_line$descendant, 1),
  2104. leaf = _line$descendant2[0];
  2105. formats = (0, _extend2.default)(formats, (0, _block.bubbleFormats)(leaf));
  2106. }
  2107. attributes = _op2.default.attributes.diff(formats, attributes) || {};
  2108. } else if (_typeof(op.insert) === 'object') {
  2109. var key = Object.keys(op.insert)[0]; // There should only be one key
  2110. if (key == null) return index;
  2111. _this.scroll.insertAt(index, key, op.insert[key]);
  2112. }
  2113. scrollLength += length;
  2114. }
  2115. Object.keys(attributes).forEach(function (name) {
  2116. _this.scroll.formatAt(index, length, name, attributes[name]);
  2117. });
  2118. return index + length;
  2119. }, 0);
  2120. delta.reduce(function (index, op) {
  2121. if (typeof op.delete === 'number') {
  2122. _this.scroll.deleteAt(index, op.delete);
  2123. return index;
  2124. }
  2125. return index + (op.retain || op.insert.length || 1);
  2126. }, 0);
  2127. this.scroll.batchEnd();
  2128. return this.update(delta);
  2129. }
  2130. }, {
  2131. key: 'deleteText',
  2132. value: function deleteText(index, length) {
  2133. this.scroll.deleteAt(index, length);
  2134. return this.update(new _quillDelta2.default().retain(index).delete(length));
  2135. }
  2136. }, {
  2137. key: 'formatLine',
  2138. value: function formatLine(index, length) {
  2139. var _this2 = this;
  2140. var formats = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  2141. this.scroll.update();
  2142. Object.keys(formats).forEach(function (format) {
  2143. if (_this2.scroll.whitelist != null && !_this2.scroll.whitelist[format]) return;
  2144. var lines = _this2.scroll.lines(index, Math.max(length, 1));
  2145. var lengthRemaining = length;
  2146. lines.forEach(function (line) {
  2147. var lineLength = line.length();
  2148. if (!(line instanceof _code2.default)) {
  2149. line.format(format, formats[format]);
  2150. } else {
  2151. var codeIndex = index - line.offset(_this2.scroll);
  2152. var codeLength = line.newlineIndex(codeIndex + lengthRemaining) - codeIndex + 1;
  2153. line.formatAt(codeIndex, codeLength, format, formats[format]);
  2154. }
  2155. lengthRemaining -= lineLength;
  2156. });
  2157. });
  2158. this.scroll.optimize();
  2159. return this.update(new _quillDelta2.default().retain(index).retain(length, (0, _clone2.default)(formats)));
  2160. }
  2161. }, {
  2162. key: 'formatText',
  2163. value: function formatText(index, length) {
  2164. var _this3 = this;
  2165. var formats = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  2166. Object.keys(formats).forEach(function (format) {
  2167. _this3.scroll.formatAt(index, length, format, formats[format]);
  2168. });
  2169. return this.update(new _quillDelta2.default().retain(index).retain(length, (0, _clone2.default)(formats)));
  2170. }
  2171. }, {
  2172. key: 'getContents',
  2173. value: function getContents(index, length) {
  2174. return this.delta.slice(index, index + length);
  2175. }
  2176. }, {
  2177. key: 'getDelta',
  2178. value: function getDelta() {
  2179. return this.scroll.lines().reduce(function (delta, line) {
  2180. return delta.concat(line.delta());
  2181. }, new _quillDelta2.default());
  2182. }
  2183. }, {
  2184. key: 'getFormat',
  2185. value: function getFormat(index) {
  2186. var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  2187. var lines = [],
  2188. leaves = [];
  2189. if (length === 0) {
  2190. this.scroll.path(index).forEach(function (path) {
  2191. var _path = _slicedToArray(path, 1),
  2192. blot = _path[0];
  2193. if (blot instanceof _block2.default) {
  2194. lines.push(blot);
  2195. } else if (blot instanceof _parchment2.default.Leaf) {
  2196. leaves.push(blot);
  2197. }
  2198. });
  2199. } else {
  2200. lines = this.scroll.lines(index, length);
  2201. leaves = this.scroll.descendants(_parchment2.default.Leaf, index, length);
  2202. }
  2203. var formatsArr = [lines, leaves].map(function (blots) {
  2204. if (blots.length === 0) return {};
  2205. var formats = (0, _block.bubbleFormats)(blots.shift());
  2206. while (Object.keys(formats).length > 0) {
  2207. var blot = blots.shift();
  2208. if (blot == null) return formats;
  2209. formats = combineFormats((0, _block.bubbleFormats)(blot), formats);
  2210. }
  2211. return formats;
  2212. });
  2213. return _extend2.default.apply(_extend2.default, formatsArr);
  2214. }
  2215. }, {
  2216. key: 'getText',
  2217. value: function getText(index, length) {
  2218. return this.getContents(index, length).filter(function (op) {
  2219. return typeof op.insert === 'string';
  2220. }).map(function (op) {
  2221. return op.insert;
  2222. }).join('');
  2223. }
  2224. }, {
  2225. key: 'insertEmbed',
  2226. value: function insertEmbed(index, embed, value) {
  2227. this.scroll.insertAt(index, embed, value);
  2228. return this.update(new _quillDelta2.default().retain(index).insert(_defineProperty({}, embed, value)));
  2229. }
  2230. }, {
  2231. key: 'insertText',
  2232. value: function insertText(index, text) {
  2233. var _this4 = this;
  2234. var formats = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  2235. text = text.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
  2236. this.scroll.insertAt(index, text);
  2237. Object.keys(formats).forEach(function (format) {
  2238. _this4.scroll.formatAt(index, text.length, format, formats[format]);
  2239. });
  2240. return this.update(new _quillDelta2.default().retain(index).insert(text, (0, _clone2.default)(formats)));
  2241. }
  2242. }, {
  2243. key: 'isBlank',
  2244. value: function isBlank() {
  2245. if (this.scroll.children.length == 0) return true;
  2246. if (this.scroll.children.length > 1) return false;
  2247. var block = this.scroll.children.head;
  2248. if (block.statics.blotName !== _block2.default.blotName) return false;
  2249. if (block.children.length > 1) return false;
  2250. return block.children.head instanceof _break2.default;
  2251. }
  2252. }, {
  2253. key: 'removeFormat',
  2254. value: function removeFormat(index, length) {
  2255. var text = this.getText(index, length);
  2256. var _scroll$line3 = this.scroll.line(index + length),
  2257. _scroll$line4 = _slicedToArray(_scroll$line3, 2),
  2258. line = _scroll$line4[0],
  2259. offset = _scroll$line4[1];
  2260. var suffixLength = 0,
  2261. suffix = new _quillDelta2.default();
  2262. if (line != null) {
  2263. if (!(line instanceof _code2.default)) {
  2264. suffixLength = line.length() - offset;
  2265. } else {
  2266. suffixLength = line.newlineIndex(offset) - offset + 1;
  2267. }
  2268. suffix = line.delta().slice(offset, offset + suffixLength - 1).insert('\n');
  2269. }
  2270. var contents = this.getContents(index, length + suffixLength);
  2271. var diff = contents.diff(new _quillDelta2.default().insert(text).concat(suffix));
  2272. var delta = new _quillDelta2.default().retain(index).concat(diff);
  2273. return this.applyDelta(delta);
  2274. }
  2275. }, {
  2276. key: 'update',
  2277. value: function update(change) {
  2278. var mutations = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  2279. var cursorIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
  2280. var oldDelta = this.delta;
  2281. if (mutations.length === 1 && mutations[0].type === 'characterData' && mutations[0].target.data.match(ASCII) && _parchment2.default.find(mutations[0].target)) {
  2282. // Optimization for character changes
  2283. var textBlot = _parchment2.default.find(mutations[0].target);
  2284. var formats = (0, _block.bubbleFormats)(textBlot);
  2285. var index = textBlot.offset(this.scroll);
  2286. var oldValue = mutations[0].oldValue.replace(_cursor2.default.CONTENTS, '');
  2287. var oldText = new _quillDelta2.default().insert(oldValue);
  2288. var newText = new _quillDelta2.default().insert(textBlot.value());
  2289. var diffDelta = new _quillDelta2.default().retain(index).concat(oldText.diff(newText, cursorIndex));
  2290. change = diffDelta.reduce(function (delta, op) {
  2291. if (op.insert) {
  2292. return delta.insert(op.insert, formats);
  2293. } else {
  2294. return delta.push(op);
  2295. }
  2296. }, new _quillDelta2.default());
  2297. this.delta = oldDelta.compose(change);
  2298. } else {
  2299. this.delta = this.getDelta();
  2300. if (!change || !(0, _deepEqual2.default)(oldDelta.compose(change), this.delta)) {
  2301. change = oldDelta.diff(this.delta, cursorIndex);
  2302. }
  2303. }
  2304. return change;
  2305. }
  2306. }]);
  2307. return Editor;
  2308. }();
  2309. function combineFormats(formats, combined) {
  2310. return Object.keys(combined).reduce(function (merged, name) {
  2311. if (formats[name] == null) return merged;
  2312. if (combined[name] === formats[name]) {
  2313. merged[name] = combined[name];
  2314. } else if (Array.isArray(combined[name])) {
  2315. if (combined[name].indexOf(formats[name]) < 0) {
  2316. merged[name] = combined[name].concat([formats[name]]);
  2317. }
  2318. } else {
  2319. merged[name] = [combined[name], formats[name]];
  2320. }
  2321. return merged;
  2322. }, {});
  2323. }
  2324. function normalizeDelta(delta) {
  2325. return delta.reduce(function (delta, op) {
  2326. if (op.insert === 1) {
  2327. var attributes = (0, _clone2.default)(op.attributes);
  2328. delete attributes['image'];
  2329. return delta.insert({ image: op.attributes.image }, attributes);
  2330. }
  2331. if (op.attributes != null && (op.attributes.list === true || op.attributes.bullet === true)) {
  2332. op = (0, _clone2.default)(op);
  2333. if (op.attributes.list) {
  2334. op.attributes.list = 'ordered';
  2335. } else {
  2336. op.attributes.list = 'bullet';
  2337. delete op.attributes.bullet;
  2338. }
  2339. }
  2340. if (typeof op.insert === 'string') {
  2341. var text = op.insert.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
  2342. return delta.insert(text, op.attributes);
  2343. }
  2344. return delta.push(op);
  2345. }, new _quillDelta2.default());
  2346. }
  2347. exports.default = Editor;
  2348. /***/ }),
  2349. /* 15 */
  2350. /***/ (function(module, exports, __webpack_require__) {
  2351. "use strict";
  2352. Object.defineProperty(exports, "__esModule", {
  2353. value: true
  2354. });
  2355. exports.default = exports.Range = undefined;
  2356. var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
  2357. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  2358. var _parchment = __webpack_require__(0);
  2359. var _parchment2 = _interopRequireDefault(_parchment);
  2360. var _clone = __webpack_require__(21);
  2361. var _clone2 = _interopRequireDefault(_clone);
  2362. var _deepEqual = __webpack_require__(11);
  2363. var _deepEqual2 = _interopRequireDefault(_deepEqual);
  2364. var _emitter3 = __webpack_require__(8);
  2365. var _emitter4 = _interopRequireDefault(_emitter3);
  2366. var _logger = __webpack_require__(10);
  2367. var _logger2 = _interopRequireDefault(_logger);
  2368. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2369. function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
  2370. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2371. var debug = (0, _logger2.default)('quill:selection');
  2372. var Range = function Range(index) {
  2373. var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  2374. _classCallCheck(this, Range);
  2375. this.index = index;
  2376. this.length = length;
  2377. };
  2378. var Selection = function () {
  2379. function Selection(scroll, emitter) {
  2380. var _this = this;
  2381. _classCallCheck(this, Selection);
  2382. this.emitter = emitter;
  2383. this.scroll = scroll;
  2384. this.composing = false;
  2385. this.mouseDown = false;
  2386. this.root = this.scroll.domNode;
  2387. this.cursor = _parchment2.default.create('cursor', this);
  2388. // savedRange is last non-null range
  2389. this.lastRange = this.savedRange = new Range(0, 0);
  2390. this.handleComposition();
  2391. this.handleDragging();
  2392. this.emitter.listenDOM('selectionchange', document, function () {
  2393. if (!_this.mouseDown) {
  2394. setTimeout(_this.update.bind(_this, _emitter4.default.sources.USER), 1);
  2395. }
  2396. });
  2397. this.emitter.on(_emitter4.default.events.EDITOR_CHANGE, function (type, delta) {
  2398. if (type === _emitter4.default.events.TEXT_CHANGE && delta.length() > 0) {
  2399. _this.update(_emitter4.default.sources.SILENT);
  2400. }
  2401. });
  2402. this.emitter.on(_emitter4.default.events.SCROLL_BEFORE_UPDATE, function () {
  2403. if (!_this.hasFocus()) return;
  2404. var native = _this.getNativeRange();
  2405. if (native == null) return;
  2406. if (native.start.node === _this.cursor.textNode) return; // cursor.restore() will handle
  2407. // TODO unclear if this has negative side effects
  2408. _this.emitter.once(_emitter4.default.events.SCROLL_UPDATE, function () {
  2409. try {
  2410. _this.setNativeRange(native.start.node, native.start.offset, native.end.node, native.end.offset);
  2411. } catch (ignored) {}
  2412. });
  2413. });
  2414. this.emitter.on(_emitter4.default.events.SCROLL_OPTIMIZE, function (mutations, context) {
  2415. if (context.range) {
  2416. var _context$range = context.range,
  2417. startNode = _context$range.startNode,
  2418. startOffset = _context$range.startOffset,
  2419. endNode = _context$range.endNode,
  2420. endOffset = _context$range.endOffset;
  2421. _this.setNativeRange(startNode, startOffset, endNode, endOffset);
  2422. }
  2423. });
  2424. this.update(_emitter4.default.sources.SILENT);
  2425. }
  2426. _createClass(Selection, [{
  2427. key: 'handleComposition',
  2428. value: function handleComposition() {
  2429. var _this2 = this;
  2430. this.root.addEventListener('compositionstart', function () {
  2431. _this2.composing = true;
  2432. });
  2433. this.root.addEventListener('compositionend', function () {
  2434. _this2.composing = false;
  2435. if (_this2.cursor.parent) {
  2436. var range = _this2.cursor.restore();
  2437. if (!range) return;
  2438. setTimeout(function () {
  2439. _this2.setNativeRange(range.startNode, range.startOffset, range.endNode, range.endOffset);
  2440. }, 1);
  2441. }
  2442. });
  2443. }
  2444. }, {
  2445. key: 'handleDragging',
  2446. value: function handleDragging() {
  2447. var _this3 = this;
  2448. this.emitter.listenDOM('mousedown', document.body, function () {
  2449. _this3.mouseDown = true;
  2450. });
  2451. this.emitter.listenDOM('mouseup', document.body, function () {
  2452. _this3.mouseDown = false;
  2453. _this3.update(_emitter4.default.sources.USER);
  2454. });
  2455. }
  2456. }, {
  2457. key: 'focus',
  2458. value: function focus() {
  2459. if (this.hasFocus()) return;
  2460. this.root.focus();
  2461. this.setRange(this.savedRange);
  2462. }
  2463. }, {
  2464. key: 'format',
  2465. value: function format(_format, value) {
  2466. if (this.scroll.whitelist != null && !this.scroll.whitelist[_format]) return;
  2467. this.scroll.update();
  2468. var nativeRange = this.getNativeRange();
  2469. if (nativeRange == null || !nativeRange.native.collapsed || _parchment2.default.query(_format, _parchment2.default.Scope.BLOCK)) return;
  2470. if (nativeRange.start.node !== this.cursor.textNode) {
  2471. var blot = _parchment2.default.find(nativeRange.start.node, false);
  2472. if (blot == null) return;
  2473. // TODO Give blot ability to not split
  2474. if (blot instanceof _parchment2.default.Leaf) {
  2475. var after = blot.split(nativeRange.start.offset);
  2476. blot.parent.insertBefore(this.cursor, after);
  2477. } else {
  2478. blot.insertBefore(this.cursor, nativeRange.start.node); // Should never happen
  2479. }
  2480. this.cursor.attach();
  2481. }
  2482. this.cursor.format(_format, value);
  2483. this.scroll.optimize();
  2484. this.setNativeRange(this.cursor.textNode, this.cursor.textNode.data.length);
  2485. this.update();
  2486. }
  2487. }, {
  2488. key: 'getBounds',
  2489. value: function getBounds(index) {
  2490. var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  2491. var scrollLength = this.scroll.length();
  2492. index = Math.min(index, scrollLength - 1);
  2493. length = Math.min(index + length, scrollLength - 1) - index;
  2494. var node = void 0,
  2495. _scroll$leaf = this.scroll.leaf(index),
  2496. _scroll$leaf2 = _slicedToArray(_scroll$leaf, 2),
  2497. leaf = _scroll$leaf2[0],
  2498. offset = _scroll$leaf2[1];
  2499. if (leaf == null) return null;
  2500. var _leaf$position = leaf.position(offset, true);
  2501. var _leaf$position2 = _slicedToArray(_leaf$position, 2);
  2502. node = _leaf$position2[0];
  2503. offset = _leaf$position2[1];
  2504. var range = document.createRange();
  2505. if (length > 0) {
  2506. range.setStart(node, offset);
  2507. var _scroll$leaf3 = this.scroll.leaf(index + length);
  2508. var _scroll$leaf4 = _slicedToArray(_scroll$leaf3, 2);
  2509. leaf = _scroll$leaf4[0];
  2510. offset = _scroll$leaf4[1];
  2511. if (leaf == null) return null;
  2512. var _leaf$position3 = leaf.position(offset, true);
  2513. var _leaf$position4 = _slicedToArray(_leaf$position3, 2);
  2514. node = _leaf$position4[0];
  2515. offset = _leaf$position4[1];
  2516. range.setEnd(node, offset);
  2517. return range.getBoundingClientRect();
  2518. } else {
  2519. var side = 'left';
  2520. var rect = void 0;
  2521. if (node instanceof Text) {
  2522. if (offset < node.data.length) {
  2523. range.setStart(node, offset);
  2524. range.setEnd(node, offset + 1);
  2525. } else {
  2526. range.setStart(node, offset - 1);
  2527. range.setEnd(node, offset);
  2528. side = 'right';
  2529. }
  2530. rect = range.getBoundingClientRect();
  2531. } else {
  2532. rect = leaf.domNode.getBoundingClientRect();
  2533. if (offset > 0) side = 'right';
  2534. }
  2535. return {
  2536. bottom: rect.top + rect.height,
  2537. height: rect.height,
  2538. left: rect[side],
  2539. right: rect[side],
  2540. top: rect.top,
  2541. width: 0
  2542. };
  2543. }
  2544. }
  2545. }, {
  2546. key: 'getNativeRange',
  2547. value: function getNativeRange() {
  2548. var selection = document.getSelection();
  2549. if (selection == null || selection.rangeCount <= 0) return null;
  2550. var nativeRange = selection.getRangeAt(0);
  2551. if (nativeRange == null) return null;
  2552. var range = this.normalizeNative(nativeRange);
  2553. debug.info('getNativeRange', range);
  2554. return range;
  2555. }
  2556. }, {
  2557. key: 'getRange',
  2558. value: function getRange() {
  2559. var normalized = this.getNativeRange();
  2560. if (normalized == null) return [null, null];
  2561. var range = this.normalizedToRange(normalized);
  2562. return [range, normalized];
  2563. }
  2564. }, {
  2565. key: 'hasFocus',
  2566. value: function hasFocus() {
  2567. return document.activeElement === this.root;
  2568. }
  2569. }, {
  2570. key: 'normalizedToRange',
  2571. value: function normalizedToRange(range) {
  2572. var _this4 = this;
  2573. var positions = [[range.start.node, range.start.offset]];
  2574. if (!range.native.collapsed) {
  2575. positions.push([range.end.node, range.end.offset]);
  2576. }
  2577. var indexes = positions.map(function (position) {
  2578. var _position = _slicedToArray(position, 2),
  2579. node = _position[0],
  2580. offset = _position[1];
  2581. var blot = _parchment2.default.find(node, true);
  2582. var index = blot.offset(_this4.scroll);
  2583. if (offset === 0) {
  2584. return index;
  2585. } else if (blot instanceof _parchment2.default.Container) {
  2586. return index + blot.length();
  2587. } else {
  2588. return index + blot.index(node, offset);
  2589. }
  2590. });
  2591. var end = Math.min(Math.max.apply(Math, _toConsumableArray(indexes)), this.scroll.length() - 1);
  2592. var start = Math.min.apply(Math, [end].concat(_toConsumableArray(indexes)));
  2593. return new Range(start, end - start);
  2594. }
  2595. }, {
  2596. key: 'normalizeNative',
  2597. value: function normalizeNative(nativeRange) {
  2598. if (!contains(this.root, nativeRange.startContainer) || !nativeRange.collapsed && !contains(this.root, nativeRange.endContainer)) {
  2599. return null;
  2600. }
  2601. var range = {
  2602. start: { node: nativeRange.startContainer, offset: nativeRange.startOffset },
  2603. end: { node: nativeRange.endContainer, offset: nativeRange.endOffset },
  2604. native: nativeRange
  2605. };
  2606. [range.start, range.end].forEach(function (position) {
  2607. var node = position.node,
  2608. offset = position.offset;
  2609. while (!(node instanceof Text) && node.childNodes.length > 0) {
  2610. if (node.childNodes.length > offset) {
  2611. node = node.childNodes[offset];
  2612. offset = 0;
  2613. } else if (node.childNodes.length === offset) {
  2614. node = node.lastChild;
  2615. offset = node instanceof Text ? node.data.length : node.childNodes.length + 1;
  2616. } else {
  2617. break;
  2618. }
  2619. }
  2620. position.node = node, position.offset = offset;
  2621. });
  2622. return range;
  2623. }
  2624. }, {
  2625. key: 'rangeToNative',
  2626. value: function rangeToNative(range) {
  2627. var _this5 = this;
  2628. var indexes = range.collapsed ? [range.index] : [range.index, range.index + range.length];
  2629. var args = [];
  2630. var scrollLength = this.scroll.length();
  2631. indexes.forEach(function (index, i) {
  2632. index = Math.min(scrollLength - 1, index);
  2633. var node = void 0,
  2634. _scroll$leaf5 = _this5.scroll.leaf(index),
  2635. _scroll$leaf6 = _slicedToArray(_scroll$leaf5, 2),
  2636. leaf = _scroll$leaf6[0],
  2637. offset = _scroll$leaf6[1];
  2638. var _leaf$position5 = leaf.position(offset, i !== 0);
  2639. var _leaf$position6 = _slicedToArray(_leaf$position5, 2);
  2640. node = _leaf$position6[0];
  2641. offset = _leaf$position6[1];
  2642. args.push(node, offset);
  2643. });
  2644. if (args.length < 2) {
  2645. args = args.concat(args);
  2646. }
  2647. return args;
  2648. }
  2649. }, {
  2650. key: 'scrollIntoView',
  2651. value: function scrollIntoView(scrollingContainer) {
  2652. var range = this.lastRange;
  2653. if (range == null) return;
  2654. var bounds = this.getBounds(range.index, range.length);
  2655. if (bounds == null) return;
  2656. var limit = this.scroll.length() - 1;
  2657. var _scroll$line = this.scroll.line(Math.min(range.index, limit)),
  2658. _scroll$line2 = _slicedToArray(_scroll$line, 1),
  2659. first = _scroll$line2[0];
  2660. var last = first;
  2661. if (range.length > 0) {
  2662. var _scroll$line3 = this.scroll.line(Math.min(range.index + range.length, limit));
  2663. var _scroll$line4 = _slicedToArray(_scroll$line3, 1);
  2664. last = _scroll$line4[0];
  2665. }
  2666. if (first == null || last == null) return;
  2667. var scrollBounds = scrollingContainer.getBoundingClientRect();
  2668. if (bounds.top < scrollBounds.top) {
  2669. scrollingContainer.scrollTop -= scrollBounds.top - bounds.top;
  2670. } else if (bounds.bottom > scrollBounds.bottom) {
  2671. scrollingContainer.scrollTop += bounds.bottom - scrollBounds.bottom;
  2672. }
  2673. }
  2674. }, {
  2675. key: 'setNativeRange',
  2676. value: function setNativeRange(startNode, startOffset) {
  2677. var endNode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : startNode;
  2678. var endOffset = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : startOffset;
  2679. var force = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  2680. debug.info('setNativeRange', startNode, startOffset, endNode, endOffset);
  2681. if (startNode != null && (this.root.parentNode == null || startNode.parentNode == null || endNode.parentNode == null)) {
  2682. return;
  2683. }
  2684. var selection = document.getSelection();
  2685. if (selection == null) return;
  2686. if (startNode != null) {
  2687. if (!this.hasFocus()) this.root.focus();
  2688. var native = (this.getNativeRange() || {}).native;
  2689. if (native == null || force || startNode !== native.startContainer || startOffset !== native.startOffset || endNode !== native.endContainer || endOffset !== native.endOffset) {
  2690. if (startNode.tagName == "BR") {
  2691. startOffset = [].indexOf.call(startNode.parentNode.childNodes, startNode);
  2692. startNode = startNode.parentNode;
  2693. }
  2694. if (endNode.tagName == "BR") {
  2695. endOffset = [].indexOf.call(endNode.parentNode.childNodes, endNode);
  2696. endNode = endNode.parentNode;
  2697. }
  2698. var range = document.createRange();
  2699. range.setStart(startNode, startOffset);
  2700. range.setEnd(endNode, endOffset);
  2701. selection.removeAllRanges();
  2702. selection.addRange(range);
  2703. }
  2704. } else {
  2705. selection.removeAllRanges();
  2706. this.root.blur();
  2707. document.body.focus(); // root.blur() not enough on IE11+Travis+SauceLabs (but not local VMs)
  2708. }
  2709. }
  2710. }, {
  2711. key: 'setRange',
  2712. value: function setRange(range) {
  2713. var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  2714. var source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _emitter4.default.sources.API;
  2715. if (typeof force === 'string') {
  2716. source = force;
  2717. force = false;
  2718. }
  2719. debug.info('setRange', range);
  2720. if (range != null) {
  2721. var args = this.rangeToNative(range);
  2722. this.setNativeRange.apply(this, _toConsumableArray(args).concat([force]));
  2723. } else {
  2724. this.setNativeRange(null);
  2725. }
  2726. this.update(source);
  2727. }
  2728. }, {
  2729. key: 'update',
  2730. value: function update() {
  2731. var source = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _emitter4.default.sources.USER;
  2732. var oldRange = this.lastRange;
  2733. var _getRange = this.getRange(),
  2734. _getRange2 = _slicedToArray(_getRange, 2),
  2735. lastRange = _getRange2[0],
  2736. nativeRange = _getRange2[1];
  2737. this.lastRange = lastRange;
  2738. if (this.lastRange != null) {
  2739. this.savedRange = this.lastRange;
  2740. }
  2741. if (!(0, _deepEqual2.default)(oldRange, this.lastRange)) {
  2742. var _emitter;
  2743. if (!this.composing && nativeRange != null && nativeRange.native.collapsed && nativeRange.start.node !== this.cursor.textNode) {
  2744. this.cursor.restore();
  2745. }
  2746. var args = [_emitter4.default.events.SELECTION_CHANGE, (0, _clone2.default)(this.lastRange), (0, _clone2.default)(oldRange), source];
  2747. (_emitter = this.emitter).emit.apply(_emitter, [_emitter4.default.events.EDITOR_CHANGE].concat(args));
  2748. if (source !== _emitter4.default.sources.SILENT) {
  2749. var _emitter2;
  2750. (_emitter2 = this.emitter).emit.apply(_emitter2, args);
  2751. }
  2752. }
  2753. }
  2754. }]);
  2755. return Selection;
  2756. }();
  2757. function contains(parent, descendant) {
  2758. try {
  2759. // Firefox inserts inaccessible nodes around video elements
  2760. descendant.parentNode;
  2761. } catch (e) {
  2762. return false;
  2763. }
  2764. // IE11 has bug with Text nodes
  2765. // https://connect.microsoft.com/IE/feedback/details/780874/node-contains-is-incorrect
  2766. if (descendant instanceof Text) {
  2767. descendant = descendant.parentNode;
  2768. }
  2769. return parent.contains(descendant);
  2770. }
  2771. exports.Range = Range;
  2772. exports.default = Selection;
  2773. /***/ }),
  2774. /* 16 */
  2775. /***/ (function(module, exports, __webpack_require__) {
  2776. "use strict";
  2777. Object.defineProperty(exports, "__esModule", {
  2778. value: true
  2779. });
  2780. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  2781. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  2782. var _parchment = __webpack_require__(0);
  2783. var _parchment2 = _interopRequireDefault(_parchment);
  2784. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2785. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2786. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2787. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2788. var Break = function (_Parchment$Embed) {
  2789. _inherits(Break, _Parchment$Embed);
  2790. function Break() {
  2791. _classCallCheck(this, Break);
  2792. return _possibleConstructorReturn(this, (Break.__proto__ || Object.getPrototypeOf(Break)).apply(this, arguments));
  2793. }
  2794. _createClass(Break, [{
  2795. key: 'insertInto',
  2796. value: function insertInto(parent, ref) {
  2797. if (parent.children.length === 0) {
  2798. _get(Break.prototype.__proto__ || Object.getPrototypeOf(Break.prototype), 'insertInto', this).call(this, parent, ref);
  2799. } else {
  2800. this.remove();
  2801. }
  2802. }
  2803. }, {
  2804. key: 'length',
  2805. value: function length() {
  2806. return 0;
  2807. }
  2808. }, {
  2809. key: 'value',
  2810. value: function value() {
  2811. return '';
  2812. }
  2813. }], [{
  2814. key: 'value',
  2815. value: function value() {
  2816. return undefined;
  2817. }
  2818. }]);
  2819. return Break;
  2820. }(_parchment2.default.Embed);
  2821. Break.blotName = 'break';
  2822. Break.tagName = 'BR';
  2823. exports.default = Break;
  2824. /***/ }),
  2825. /* 17 */
  2826. /***/ (function(module, exports, __webpack_require__) {
  2827. "use strict";
  2828. var __extends = (this && this.__extends) || (function () {
  2829. var extendStatics = Object.setPrototypeOf ||
  2830. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  2831. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  2832. return function (d, b) {
  2833. extendStatics(d, b);
  2834. function __() { this.constructor = d; }
  2835. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  2836. };
  2837. })();
  2838. Object.defineProperty(exports, "__esModule", { value: true });
  2839. var linked_list_1 = __webpack_require__(44);
  2840. var shadow_1 = __webpack_require__(30);
  2841. var Registry = __webpack_require__(1);
  2842. var ContainerBlot = /** @class */ (function (_super) {
  2843. __extends(ContainerBlot, _super);
  2844. function ContainerBlot(domNode) {
  2845. var _this = _super.call(this, domNode) || this;
  2846. _this.build();
  2847. return _this;
  2848. }
  2849. ContainerBlot.prototype.appendChild = function (other) {
  2850. this.insertBefore(other);
  2851. };
  2852. ContainerBlot.prototype.attach = function () {
  2853. _super.prototype.attach.call(this);
  2854. this.children.forEach(function (child) {
  2855. child.attach();
  2856. });
  2857. };
  2858. ContainerBlot.prototype.build = function () {
  2859. var _this = this;
  2860. this.children = new linked_list_1.default();
  2861. // Need to be reversed for if DOM nodes already in order
  2862. [].slice
  2863. .call(this.domNode.childNodes)
  2864. .reverse()
  2865. .forEach(function (node) {
  2866. try {
  2867. var child = makeBlot(node);
  2868. _this.insertBefore(child, _this.children.head || undefined);
  2869. }
  2870. catch (err) {
  2871. if (err instanceof Registry.ParchmentError)
  2872. return;
  2873. else
  2874. throw err;
  2875. }
  2876. });
  2877. };
  2878. ContainerBlot.prototype.deleteAt = function (index, length) {
  2879. if (index === 0 && length === this.length()) {
  2880. return this.remove();
  2881. }
  2882. this.children.forEachAt(index, length, function (child, offset, length) {
  2883. child.deleteAt(offset, length);
  2884. });
  2885. };
  2886. ContainerBlot.prototype.descendant = function (criteria, index) {
  2887. var _a = this.children.find(index), child = _a[0], offset = _a[1];
  2888. if ((criteria.blotName == null && criteria(child)) ||
  2889. (criteria.blotName != null && child instanceof criteria)) {
  2890. return [child, offset];
  2891. }
  2892. else if (child instanceof ContainerBlot) {
  2893. return child.descendant(criteria, offset);
  2894. }
  2895. else {
  2896. return [null, -1];
  2897. }
  2898. };
  2899. ContainerBlot.prototype.descendants = function (criteria, index, length) {
  2900. if (index === void 0) { index = 0; }
  2901. if (length === void 0) { length = Number.MAX_VALUE; }
  2902. var descendants = [];
  2903. var lengthLeft = length;
  2904. this.children.forEachAt(index, length, function (child, index, length) {
  2905. if ((criteria.blotName == null && criteria(child)) ||
  2906. (criteria.blotName != null && child instanceof criteria)) {
  2907. descendants.push(child);
  2908. }
  2909. if (child instanceof ContainerBlot) {
  2910. descendants = descendants.concat(child.descendants(criteria, index, lengthLeft));
  2911. }
  2912. lengthLeft -= length;
  2913. });
  2914. return descendants;
  2915. };
  2916. ContainerBlot.prototype.detach = function () {
  2917. this.children.forEach(function (child) {
  2918. child.detach();
  2919. });
  2920. _super.prototype.detach.call(this);
  2921. };
  2922. ContainerBlot.prototype.formatAt = function (index, length, name, value) {
  2923. this.children.forEachAt(index, length, function (child, offset, length) {
  2924. child.formatAt(offset, length, name, value);
  2925. });
  2926. };
  2927. ContainerBlot.prototype.insertAt = function (index, value, def) {
  2928. var _a = this.children.find(index), child = _a[0], offset = _a[1];
  2929. if (child) {
  2930. child.insertAt(offset, value, def);
  2931. }
  2932. else {
  2933. var blot = def == null ? Registry.create('text', value) : Registry.create(value, def);
  2934. this.appendChild(blot);
  2935. }
  2936. };
  2937. ContainerBlot.prototype.insertBefore = function (childBlot, refBlot) {
  2938. if (this.statics.allowedChildren != null &&
  2939. !this.statics.allowedChildren.some(function (child) {
  2940. return childBlot instanceof child;
  2941. })) {
  2942. throw new Registry.ParchmentError("Cannot insert " + childBlot.statics.blotName + " into " + this.statics.blotName);
  2943. }
  2944. childBlot.insertInto(this, refBlot);
  2945. };
  2946. ContainerBlot.prototype.length = function () {
  2947. return this.children.reduce(function (memo, child) {
  2948. return memo + child.length();
  2949. }, 0);
  2950. };
  2951. ContainerBlot.prototype.moveChildren = function (targetParent, refNode) {
  2952. this.children.forEach(function (child) {
  2953. targetParent.insertBefore(child, refNode);
  2954. });
  2955. };
  2956. ContainerBlot.prototype.optimize = function (context) {
  2957. _super.prototype.optimize.call(this, context);
  2958. if (this.children.length === 0) {
  2959. if (this.statics.defaultChild != null) {
  2960. var child = Registry.create(this.statics.defaultChild);
  2961. this.appendChild(child);
  2962. child.optimize(context);
  2963. }
  2964. else {
  2965. this.remove();
  2966. }
  2967. }
  2968. };
  2969. ContainerBlot.prototype.path = function (index, inclusive) {
  2970. if (inclusive === void 0) { inclusive = false; }
  2971. var _a = this.children.find(index, inclusive), child = _a[0], offset = _a[1];
  2972. var position = [[this, index]];
  2973. if (child instanceof ContainerBlot) {
  2974. return position.concat(child.path(offset, inclusive));
  2975. }
  2976. else if (child != null) {
  2977. position.push([child, offset]);
  2978. }
  2979. return position;
  2980. };
  2981. ContainerBlot.prototype.removeChild = function (child) {
  2982. this.children.remove(child);
  2983. };
  2984. ContainerBlot.prototype.replace = function (target) {
  2985. if (target instanceof ContainerBlot) {
  2986. target.moveChildren(this);
  2987. }
  2988. _super.prototype.replace.call(this, target);
  2989. };
  2990. ContainerBlot.prototype.split = function (index, force) {
  2991. if (force === void 0) { force = false; }
  2992. if (!force) {
  2993. if (index === 0)
  2994. return this;
  2995. if (index === this.length())
  2996. return this.next;
  2997. }
  2998. var after = this.clone();
  2999. this.parent.insertBefore(after, this.next);
  3000. this.children.forEachAt(index, this.length(), function (child, offset, length) {
  3001. child = child.split(offset, force);
  3002. after.appendChild(child);
  3003. });
  3004. return after;
  3005. };
  3006. ContainerBlot.prototype.unwrap = function () {
  3007. this.moveChildren(this.parent, this.next);
  3008. this.remove();
  3009. };
  3010. ContainerBlot.prototype.update = function (mutations, context) {
  3011. var _this = this;
  3012. var addedNodes = [];
  3013. var removedNodes = [];
  3014. mutations.forEach(function (mutation) {
  3015. if (mutation.target === _this.domNode && mutation.type === 'childList') {
  3016. addedNodes.push.apply(addedNodes, mutation.addedNodes);
  3017. removedNodes.push.apply(removedNodes, mutation.removedNodes);
  3018. }
  3019. });
  3020. removedNodes.forEach(function (node) {
  3021. // Check node has actually been removed
  3022. // One exception is Chrome does not immediately remove IFRAMEs
  3023. // from DOM but MutationRecord is correct in its reported removal
  3024. if (node.parentNode != null &&
  3025. // @ts-ignore
  3026. node.tagName !== 'IFRAME' &&
  3027. document.body.compareDocumentPosition(node) & Node.DOCUMENT_POSITION_CONTAINED_BY) {
  3028. return;
  3029. }
  3030. var blot = Registry.find(node);
  3031. if (blot == null)
  3032. return;
  3033. if (blot.domNode.parentNode == null || blot.domNode.parentNode === _this.domNode) {
  3034. blot.detach();
  3035. }
  3036. });
  3037. addedNodes
  3038. .filter(function (node) {
  3039. return node.parentNode == _this.domNode;
  3040. })
  3041. .sort(function (a, b) {
  3042. if (a === b)
  3043. return 0;
  3044. if (a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING) {
  3045. return 1;
  3046. }
  3047. return -1;
  3048. })
  3049. .forEach(function (node) {
  3050. var refBlot = null;
  3051. if (node.nextSibling != null) {
  3052. refBlot = Registry.find(node.nextSibling);
  3053. }
  3054. var blot = makeBlot(node);
  3055. if (blot.next != refBlot || blot.next == null) {
  3056. if (blot.parent != null) {
  3057. blot.parent.removeChild(_this);
  3058. }
  3059. _this.insertBefore(blot, refBlot || undefined);
  3060. }
  3061. });
  3062. };
  3063. return ContainerBlot;
  3064. }(shadow_1.default));
  3065. function makeBlot(node) {
  3066. var blot = Registry.find(node);
  3067. if (blot == null) {
  3068. try {
  3069. blot = Registry.create(node);
  3070. }
  3071. catch (e) {
  3072. blot = Registry.create(Registry.Scope.INLINE);
  3073. [].slice.call(node.childNodes).forEach(function (child) {
  3074. // @ts-ignore
  3075. blot.domNode.appendChild(child);
  3076. });
  3077. if (node.parentNode) {
  3078. node.parentNode.replaceChild(blot.domNode, node);
  3079. }
  3080. blot.attach();
  3081. }
  3082. }
  3083. return blot;
  3084. }
  3085. exports.default = ContainerBlot;
  3086. /***/ }),
  3087. /* 18 */
  3088. /***/ (function(module, exports, __webpack_require__) {
  3089. "use strict";
  3090. var __extends = (this && this.__extends) || (function () {
  3091. var extendStatics = Object.setPrototypeOf ||
  3092. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  3093. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  3094. return function (d, b) {
  3095. extendStatics(d, b);
  3096. function __() { this.constructor = d; }
  3097. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  3098. };
  3099. })();
  3100. Object.defineProperty(exports, "__esModule", { value: true });
  3101. var attributor_1 = __webpack_require__(12);
  3102. var store_1 = __webpack_require__(31);
  3103. var container_1 = __webpack_require__(17);
  3104. var Registry = __webpack_require__(1);
  3105. var FormatBlot = /** @class */ (function (_super) {
  3106. __extends(FormatBlot, _super);
  3107. function FormatBlot(domNode) {
  3108. var _this = _super.call(this, domNode) || this;
  3109. _this.attributes = new store_1.default(_this.domNode);
  3110. return _this;
  3111. }
  3112. FormatBlot.formats = function (domNode) {
  3113. if (typeof this.tagName === 'string') {
  3114. return true;
  3115. }
  3116. else if (Array.isArray(this.tagName)) {
  3117. return domNode.tagName.toLowerCase();
  3118. }
  3119. return undefined;
  3120. };
  3121. FormatBlot.prototype.format = function (name, value) {
  3122. var format = Registry.query(name);
  3123. if (format instanceof attributor_1.default) {
  3124. this.attributes.attribute(format, value);
  3125. }
  3126. else if (value) {
  3127. if (format != null && (name !== this.statics.blotName || this.formats()[name] !== value)) {
  3128. this.replaceWith(name, value);
  3129. }
  3130. }
  3131. };
  3132. FormatBlot.prototype.formats = function () {
  3133. var formats = this.attributes.values();
  3134. var format = this.statics.formats(this.domNode);
  3135. if (format != null) {
  3136. formats[this.statics.blotName] = format;
  3137. }
  3138. return formats;
  3139. };
  3140. FormatBlot.prototype.replaceWith = function (name, value) {
  3141. var replacement = _super.prototype.replaceWith.call(this, name, value);
  3142. this.attributes.copy(replacement);
  3143. return replacement;
  3144. };
  3145. FormatBlot.prototype.update = function (mutations, context) {
  3146. var _this = this;
  3147. _super.prototype.update.call(this, mutations, context);
  3148. if (mutations.some(function (mutation) {
  3149. return mutation.target === _this.domNode && mutation.type === 'attributes';
  3150. })) {
  3151. this.attributes.build();
  3152. }
  3153. };
  3154. FormatBlot.prototype.wrap = function (name, value) {
  3155. var wrapper = _super.prototype.wrap.call(this, name, value);
  3156. if (wrapper instanceof FormatBlot && wrapper.statics.scope === this.statics.scope) {
  3157. this.attributes.move(wrapper);
  3158. }
  3159. return wrapper;
  3160. };
  3161. return FormatBlot;
  3162. }(container_1.default));
  3163. exports.default = FormatBlot;
  3164. /***/ }),
  3165. /* 19 */
  3166. /***/ (function(module, exports, __webpack_require__) {
  3167. "use strict";
  3168. var __extends = (this && this.__extends) || (function () {
  3169. var extendStatics = Object.setPrototypeOf ||
  3170. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  3171. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  3172. return function (d, b) {
  3173. extendStatics(d, b);
  3174. function __() { this.constructor = d; }
  3175. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  3176. };
  3177. })();
  3178. Object.defineProperty(exports, "__esModule", { value: true });
  3179. var shadow_1 = __webpack_require__(30);
  3180. var Registry = __webpack_require__(1);
  3181. var LeafBlot = /** @class */ (function (_super) {
  3182. __extends(LeafBlot, _super);
  3183. function LeafBlot() {
  3184. return _super !== null && _super.apply(this, arguments) || this;
  3185. }
  3186. LeafBlot.value = function (domNode) {
  3187. return true;
  3188. };
  3189. LeafBlot.prototype.index = function (node, offset) {
  3190. if (this.domNode === node ||
  3191. this.domNode.compareDocumentPosition(node) & Node.DOCUMENT_POSITION_CONTAINED_BY) {
  3192. return Math.min(offset, 1);
  3193. }
  3194. return -1;
  3195. };
  3196. LeafBlot.prototype.position = function (index, inclusive) {
  3197. var offset = [].indexOf.call(this.parent.domNode.childNodes, this.domNode);
  3198. if (index > 0)
  3199. offset += 1;
  3200. return [this.parent.domNode, offset];
  3201. };
  3202. LeafBlot.prototype.value = function () {
  3203. return _a = {}, _a[this.statics.blotName] = this.statics.value(this.domNode) || true, _a;
  3204. var _a;
  3205. };
  3206. LeafBlot.scope = Registry.Scope.INLINE_BLOT;
  3207. return LeafBlot;
  3208. }(shadow_1.default));
  3209. exports.default = LeafBlot;
  3210. /***/ }),
  3211. /* 20 */
  3212. /***/ (function(module, exports, __webpack_require__) {
  3213. var equal = __webpack_require__(11);
  3214. var extend = __webpack_require__(3);
  3215. var lib = {
  3216. attributes: {
  3217. compose: function (a, b, keepNull) {
  3218. if (typeof a !== 'object') a = {};
  3219. if (typeof b !== 'object') b = {};
  3220. var attributes = extend(true, {}, b);
  3221. if (!keepNull) {
  3222. attributes = Object.keys(attributes).reduce(function (copy, key) {
  3223. if (attributes[key] != null) {
  3224. copy[key] = attributes[key];
  3225. }
  3226. return copy;
  3227. }, {});
  3228. }
  3229. for (var key in a) {
  3230. if (a[key] !== undefined && b[key] === undefined) {
  3231. attributes[key] = a[key];
  3232. }
  3233. }
  3234. return Object.keys(attributes).length > 0 ? attributes : undefined;
  3235. },
  3236. diff: function(a, b) {
  3237. if (typeof a !== 'object') a = {};
  3238. if (typeof b !== 'object') b = {};
  3239. var attributes = Object.keys(a).concat(Object.keys(b)).reduce(function (attributes, key) {
  3240. if (!equal(a[key], b[key])) {
  3241. attributes[key] = b[key] === undefined ? null : b[key];
  3242. }
  3243. return attributes;
  3244. }, {});
  3245. return Object.keys(attributes).length > 0 ? attributes : undefined;
  3246. },
  3247. transform: function (a, b, priority) {
  3248. if (typeof a !== 'object') return b;
  3249. if (typeof b !== 'object') return undefined;
  3250. if (!priority) return b; // b simply overwrites us without priority
  3251. var attributes = Object.keys(b).reduce(function (attributes, key) {
  3252. if (a[key] === undefined) attributes[key] = b[key]; // null is a valid value
  3253. return attributes;
  3254. }, {});
  3255. return Object.keys(attributes).length > 0 ? attributes : undefined;
  3256. }
  3257. },
  3258. iterator: function (ops) {
  3259. return new Iterator(ops);
  3260. },
  3261. length: function (op) {
  3262. if (typeof op['delete'] === 'number') {
  3263. return op['delete'];
  3264. } else if (typeof op.retain === 'number') {
  3265. return op.retain;
  3266. } else {
  3267. return typeof op.insert === 'string' ? op.insert.length : 1;
  3268. }
  3269. }
  3270. };
  3271. function Iterator(ops) {
  3272. this.ops = ops;
  3273. this.index = 0;
  3274. this.offset = 0;
  3275. };
  3276. Iterator.prototype.hasNext = function () {
  3277. return this.peekLength() < Infinity;
  3278. };
  3279. Iterator.prototype.next = function (length) {
  3280. if (!length) length = Infinity;
  3281. var nextOp = this.ops[this.index];
  3282. if (nextOp) {
  3283. var offset = this.offset;
  3284. var opLength = lib.length(nextOp)
  3285. if (length >= opLength - offset) {
  3286. length = opLength - offset;
  3287. this.index += 1;
  3288. this.offset = 0;
  3289. } else {
  3290. this.offset += length;
  3291. }
  3292. if (typeof nextOp['delete'] === 'number') {
  3293. return { 'delete': length };
  3294. } else {
  3295. var retOp = {};
  3296. if (nextOp.attributes) {
  3297. retOp.attributes = nextOp.attributes;
  3298. }
  3299. if (typeof nextOp.retain === 'number') {
  3300. retOp.retain = length;
  3301. } else if (typeof nextOp.insert === 'string') {
  3302. retOp.insert = nextOp.insert.substr(offset, length);
  3303. } else {
  3304. // offset should === 0, length should === 1
  3305. retOp.insert = nextOp.insert;
  3306. }
  3307. return retOp;
  3308. }
  3309. } else {
  3310. return { retain: Infinity };
  3311. }
  3312. };
  3313. Iterator.prototype.peek = function () {
  3314. return this.ops[this.index];
  3315. };
  3316. Iterator.prototype.peekLength = function () {
  3317. if (this.ops[this.index]) {
  3318. // Should never return 0 if our index is being managed correctly
  3319. return lib.length(this.ops[this.index]) - this.offset;
  3320. } else {
  3321. return Infinity;
  3322. }
  3323. };
  3324. Iterator.prototype.peekType = function () {
  3325. if (this.ops[this.index]) {
  3326. if (typeof this.ops[this.index]['delete'] === 'number') {
  3327. return 'delete';
  3328. } else if (typeof this.ops[this.index].retain === 'number') {
  3329. return 'retain';
  3330. } else {
  3331. return 'insert';
  3332. }
  3333. }
  3334. return 'retain';
  3335. };
  3336. module.exports = lib;
  3337. /***/ }),
  3338. /* 21 */
  3339. /***/ (function(module, exports) {
  3340. var clone = (function() {
  3341. 'use strict';
  3342. function _instanceof(obj, type) {
  3343. return type != null && obj instanceof type;
  3344. }
  3345. var nativeMap;
  3346. try {
  3347. nativeMap = Map;
  3348. } catch(_) {
  3349. // maybe a reference error because no `Map`. Give it a dummy value that no
  3350. // value will ever be an instanceof.
  3351. nativeMap = function() {};
  3352. }
  3353. var nativeSet;
  3354. try {
  3355. nativeSet = Set;
  3356. } catch(_) {
  3357. nativeSet = function() {};
  3358. }
  3359. var nativePromise;
  3360. try {
  3361. nativePromise = Promise;
  3362. } catch(_) {
  3363. nativePromise = function() {};
  3364. }
  3365. /**
  3366. * Clones (copies) an Object using deep copying.
  3367. *
  3368. * This function supports circular references by default, but if you are certain
  3369. * there are no circular references in your object, you can save some CPU time
  3370. * by calling clone(obj, false).
  3371. *
  3372. * Caution: if `circular` is false and `parent` contains circular references,
  3373. * your program may enter an infinite loop and crash.
  3374. *
  3375. * @param `parent` - the object to be cloned
  3376. * @param `circular` - set to true if the object to be cloned may contain
  3377. * circular references. (optional - true by default)
  3378. * @param `depth` - set to a number if the object is only to be cloned to
  3379. * a particular depth. (optional - defaults to Infinity)
  3380. * @param `prototype` - sets the prototype to be used when cloning an object.
  3381. * (optional - defaults to parent prototype).
  3382. * @param `includeNonEnumerable` - set to true if the non-enumerable properties
  3383. * should be cloned as well. Non-enumerable properties on the prototype
  3384. * chain will be ignored. (optional - false by default)
  3385. */
  3386. function clone(parent, circular, depth, prototype, includeNonEnumerable) {
  3387. if (typeof circular === 'object') {
  3388. depth = circular.depth;
  3389. prototype = circular.prototype;
  3390. includeNonEnumerable = circular.includeNonEnumerable;
  3391. circular = circular.circular;
  3392. }
  3393. // maintain two arrays for circular references, where corresponding parents
  3394. // and children have the same index
  3395. var allParents = [];
  3396. var allChildren = [];
  3397. var useBuffer = typeof Buffer != 'undefined';
  3398. if (typeof circular == 'undefined')
  3399. circular = true;
  3400. if (typeof depth == 'undefined')
  3401. depth = Infinity;
  3402. // recurse this function so we don't reset allParents and allChildren
  3403. function _clone(parent, depth) {
  3404. // cloning null always returns null
  3405. if (parent === null)
  3406. return null;
  3407. if (depth === 0)
  3408. return parent;
  3409. var child;
  3410. var proto;
  3411. if (typeof parent != 'object') {
  3412. return parent;
  3413. }
  3414. if (_instanceof(parent, nativeMap)) {
  3415. child = new nativeMap();
  3416. } else if (_instanceof(parent, nativeSet)) {
  3417. child = new nativeSet();
  3418. } else if (_instanceof(parent, nativePromise)) {
  3419. child = new nativePromise(function (resolve, reject) {
  3420. parent.then(function(value) {
  3421. resolve(_clone(value, depth - 1));
  3422. }, function(err) {
  3423. reject(_clone(err, depth - 1));
  3424. });
  3425. });
  3426. } else if (clone.__isArray(parent)) {
  3427. child = [];
  3428. } else if (clone.__isRegExp(parent)) {
  3429. child = new RegExp(parent.source, __getRegExpFlags(parent));
  3430. if (parent.lastIndex) child.lastIndex = parent.lastIndex;
  3431. } else if (clone.__isDate(parent)) {
  3432. child = new Date(parent.getTime());
  3433. } else if (useBuffer && Buffer.isBuffer(parent)) {
  3434. child = new Buffer(parent.length);
  3435. parent.copy(child);
  3436. return child;
  3437. } else if (_instanceof(parent, Error)) {
  3438. child = Object.create(parent);
  3439. } else {
  3440. if (typeof prototype == 'undefined') {
  3441. proto = Object.getPrototypeOf(parent);
  3442. child = Object.create(proto);
  3443. }
  3444. else {
  3445. child = Object.create(prototype);
  3446. proto = prototype;
  3447. }
  3448. }
  3449. if (circular) {
  3450. var index = allParents.indexOf(parent);
  3451. if (index != -1) {
  3452. return allChildren[index];
  3453. }
  3454. allParents.push(parent);
  3455. allChildren.push(child);
  3456. }
  3457. if (_instanceof(parent, nativeMap)) {
  3458. parent.forEach(function(value, key) {
  3459. var keyChild = _clone(key, depth - 1);
  3460. var valueChild = _clone(value, depth - 1);
  3461. child.set(keyChild, valueChild);
  3462. });
  3463. }
  3464. if (_instanceof(parent, nativeSet)) {
  3465. parent.forEach(function(value) {
  3466. var entryChild = _clone(value, depth - 1);
  3467. child.add(entryChild);
  3468. });
  3469. }
  3470. for (var i in parent) {
  3471. var attrs;
  3472. if (proto) {
  3473. attrs = Object.getOwnPropertyDescriptor(proto, i);
  3474. }
  3475. if (attrs && attrs.set == null) {
  3476. continue;
  3477. }
  3478. child[i] = _clone(parent[i], depth - 1);
  3479. }
  3480. if (Object.getOwnPropertySymbols) {
  3481. var symbols = Object.getOwnPropertySymbols(parent);
  3482. for (var i = 0; i < symbols.length; i++) {
  3483. // Don't need to worry about cloning a symbol because it is a primitive,
  3484. // like a number or string.
  3485. var symbol = symbols[i];
  3486. var descriptor = Object.getOwnPropertyDescriptor(parent, symbol);
  3487. if (descriptor && !descriptor.enumerable && !includeNonEnumerable) {
  3488. continue;
  3489. }
  3490. child[symbol] = _clone(parent[symbol], depth - 1);
  3491. if (!descriptor.enumerable) {
  3492. Object.defineProperty(child, symbol, {
  3493. enumerable: false
  3494. });
  3495. }
  3496. }
  3497. }
  3498. if (includeNonEnumerable) {
  3499. var allPropertyNames = Object.getOwnPropertyNames(parent);
  3500. for (var i = 0; i < allPropertyNames.length; i++) {
  3501. var propertyName = allPropertyNames[i];
  3502. var descriptor = Object.getOwnPropertyDescriptor(parent, propertyName);
  3503. if (descriptor && descriptor.enumerable) {
  3504. continue;
  3505. }
  3506. child[propertyName] = _clone(parent[propertyName], depth - 1);
  3507. Object.defineProperty(child, propertyName, {
  3508. enumerable: false
  3509. });
  3510. }
  3511. }
  3512. return child;
  3513. }
  3514. return _clone(parent, depth);
  3515. }
  3516. /**
  3517. * Simple flat clone using prototype, accepts only objects, usefull for property
  3518. * override on FLAT configuration object (no nested props).
  3519. *
  3520. * USE WITH CAUTION! This may not behave as you wish if you do not know how this
  3521. * works.
  3522. */
  3523. clone.clonePrototype = function clonePrototype(parent) {
  3524. if (parent === null)
  3525. return null;
  3526. var c = function () {};
  3527. c.prototype = parent;
  3528. return new c();
  3529. };
  3530. // private utility functions
  3531. function __objToStr(o) {
  3532. return Object.prototype.toString.call(o);
  3533. }
  3534. clone.__objToStr = __objToStr;
  3535. function __isDate(o) {
  3536. return typeof o === 'object' && __objToStr(o) === '[object Date]';
  3537. }
  3538. clone.__isDate = __isDate;
  3539. function __isArray(o) {
  3540. return typeof o === 'object' && __objToStr(o) === '[object Array]';
  3541. }
  3542. clone.__isArray = __isArray;
  3543. function __isRegExp(o) {
  3544. return typeof o === 'object' && __objToStr(o) === '[object RegExp]';
  3545. }
  3546. clone.__isRegExp = __isRegExp;
  3547. function __getRegExpFlags(re) {
  3548. var flags = '';
  3549. if (re.global) flags += 'g';
  3550. if (re.ignoreCase) flags += 'i';
  3551. if (re.multiline) flags += 'm';
  3552. return flags;
  3553. }
  3554. clone.__getRegExpFlags = __getRegExpFlags;
  3555. return clone;
  3556. })();
  3557. if (typeof module === 'object' && module.exports) {
  3558. module.exports = clone;
  3559. }
  3560. /***/ }),
  3561. /* 22 */
  3562. /***/ (function(module, exports, __webpack_require__) {
  3563. "use strict";
  3564. Object.defineProperty(exports, "__esModule", {
  3565. value: true
  3566. });
  3567. var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
  3568. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3569. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  3570. var _parchment = __webpack_require__(0);
  3571. var _parchment2 = _interopRequireDefault(_parchment);
  3572. var _emitter = __webpack_require__(8);
  3573. var _emitter2 = _interopRequireDefault(_emitter);
  3574. var _block = __webpack_require__(4);
  3575. var _block2 = _interopRequireDefault(_block);
  3576. var _break = __webpack_require__(16);
  3577. var _break2 = _interopRequireDefault(_break);
  3578. var _code = __webpack_require__(13);
  3579. var _code2 = _interopRequireDefault(_code);
  3580. var _container = __webpack_require__(25);
  3581. var _container2 = _interopRequireDefault(_container);
  3582. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3583. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3584. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3585. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3586. function isLine(blot) {
  3587. return blot instanceof _block2.default || blot instanceof _block.BlockEmbed;
  3588. }
  3589. var Scroll = function (_Parchment$Scroll) {
  3590. _inherits(Scroll, _Parchment$Scroll);
  3591. function Scroll(domNode, config) {
  3592. _classCallCheck(this, Scroll);
  3593. var _this = _possibleConstructorReturn(this, (Scroll.__proto__ || Object.getPrototypeOf(Scroll)).call(this, domNode));
  3594. _this.emitter = config.emitter;
  3595. if (Array.isArray(config.whitelist)) {
  3596. _this.whitelist = config.whitelist.reduce(function (whitelist, format) {
  3597. whitelist[format] = true;
  3598. return whitelist;
  3599. }, {});
  3600. }
  3601. // Some reason fixes composition issues with character languages in Windows/Chrome, Safari
  3602. _this.domNode.addEventListener('DOMNodeInserted', function () {});
  3603. _this.optimize();
  3604. _this.enable();
  3605. return _this;
  3606. }
  3607. _createClass(Scroll, [{
  3608. key: 'batchStart',
  3609. value: function batchStart() {
  3610. this.batch = true;
  3611. }
  3612. }, {
  3613. key: 'batchEnd',
  3614. value: function batchEnd() {
  3615. this.batch = false;
  3616. this.optimize();
  3617. }
  3618. }, {
  3619. key: 'deleteAt',
  3620. value: function deleteAt(index, length) {
  3621. var _line = this.line(index),
  3622. _line2 = _slicedToArray(_line, 2),
  3623. first = _line2[0],
  3624. offset = _line2[1];
  3625. var _line3 = this.line(index + length),
  3626. _line4 = _slicedToArray(_line3, 1),
  3627. last = _line4[0];
  3628. _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'deleteAt', this).call(this, index, length);
  3629. if (last != null && first !== last && offset > 0) {
  3630. if (first instanceof _block.BlockEmbed || last instanceof _block.BlockEmbed) {
  3631. this.optimize();
  3632. return;
  3633. }
  3634. if (first instanceof _code2.default) {
  3635. var newlineIndex = first.newlineIndex(first.length(), true);
  3636. if (newlineIndex > -1) {
  3637. first = first.split(newlineIndex + 1);
  3638. if (first === last) {
  3639. this.optimize();
  3640. return;
  3641. }
  3642. }
  3643. } else if (last instanceof _code2.default) {
  3644. var _newlineIndex = last.newlineIndex(0);
  3645. if (_newlineIndex > -1) {
  3646. last.split(_newlineIndex + 1);
  3647. }
  3648. }
  3649. var ref = last.children.head instanceof _break2.default ? null : last.children.head;
  3650. first.moveChildren(last, ref);
  3651. first.remove();
  3652. }
  3653. this.optimize();
  3654. }
  3655. }, {
  3656. key: 'enable',
  3657. value: function enable() {
  3658. var enabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
  3659. this.domNode.setAttribute('contenteditable', enabled);
  3660. }
  3661. }, {
  3662. key: 'formatAt',
  3663. value: function formatAt(index, length, format, value) {
  3664. if (this.whitelist != null && !this.whitelist[format]) return;
  3665. _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'formatAt', this).call(this, index, length, format, value);
  3666. this.optimize();
  3667. }
  3668. }, {
  3669. key: 'insertAt',
  3670. value: function insertAt(index, value, def) {
  3671. if (def != null && this.whitelist != null && !this.whitelist[value]) return;
  3672. if (index >= this.length()) {
  3673. if (def == null || _parchment2.default.query(value, _parchment2.default.Scope.BLOCK) == null) {
  3674. var blot = _parchment2.default.create(this.statics.defaultChild);
  3675. this.appendChild(blot);
  3676. if (def == null && value.endsWith('\n')) {
  3677. value = value.slice(0, -1);
  3678. }
  3679. blot.insertAt(0, value, def);
  3680. } else {
  3681. var embed = _parchment2.default.create(value, def);
  3682. this.appendChild(embed);
  3683. }
  3684. } else {
  3685. _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'insertAt', this).call(this, index, value, def);
  3686. }
  3687. this.optimize();
  3688. }
  3689. }, {
  3690. key: 'insertBefore',
  3691. value: function insertBefore(blot, ref) {
  3692. if (blot.statics.scope === _parchment2.default.Scope.INLINE_BLOT) {
  3693. var wrapper = _parchment2.default.create(this.statics.defaultChild);
  3694. wrapper.appendChild(blot);
  3695. blot = wrapper;
  3696. }
  3697. _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'insertBefore', this).call(this, blot, ref);
  3698. }
  3699. }, {
  3700. key: 'leaf',
  3701. value: function leaf(index) {
  3702. return this.path(index).pop() || [null, -1];
  3703. }
  3704. }, {
  3705. key: 'line',
  3706. value: function line(index) {
  3707. if (index === this.length()) {
  3708. return this.line(index - 1);
  3709. }
  3710. return this.descendant(isLine, index);
  3711. }
  3712. }, {
  3713. key: 'lines',
  3714. value: function lines() {
  3715. var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
  3716. var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Number.MAX_VALUE;
  3717. var getLines = function getLines(blot, index, length) {
  3718. var lines = [],
  3719. lengthLeft = length;
  3720. blot.children.forEachAt(index, length, function (child, index, length) {
  3721. if (isLine(child)) {
  3722. lines.push(child);
  3723. } else if (child instanceof _parchment2.default.Container) {
  3724. lines = lines.concat(getLines(child, index, lengthLeft));
  3725. }
  3726. lengthLeft -= length;
  3727. });
  3728. return lines;
  3729. };
  3730. return getLines(this, index, length);
  3731. }
  3732. }, {
  3733. key: 'optimize',
  3734. value: function optimize() {
  3735. var mutations = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  3736. var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  3737. if (this.batch === true) return;
  3738. _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'optimize', this).call(this, mutations, context);
  3739. if (mutations.length > 0) {
  3740. this.emitter.emit(_emitter2.default.events.SCROLL_OPTIMIZE, mutations, context);
  3741. }
  3742. }
  3743. }, {
  3744. key: 'path',
  3745. value: function path(index) {
  3746. return _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'path', this).call(this, index).slice(1); // Exclude self
  3747. }
  3748. }, {
  3749. key: 'update',
  3750. value: function update(mutations) {
  3751. if (this.batch === true) return;
  3752. var source = _emitter2.default.sources.USER;
  3753. if (typeof mutations === 'string') {
  3754. source = mutations;
  3755. }
  3756. if (!Array.isArray(mutations)) {
  3757. mutations = this.observer.takeRecords();
  3758. }
  3759. if (mutations.length > 0) {
  3760. this.emitter.emit(_emitter2.default.events.SCROLL_BEFORE_UPDATE, source, mutations);
  3761. }
  3762. _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'update', this).call(this, mutations.concat([])); // pass copy
  3763. if (mutations.length > 0) {
  3764. this.emitter.emit(_emitter2.default.events.SCROLL_UPDATE, source, mutations);
  3765. }
  3766. }
  3767. }]);
  3768. return Scroll;
  3769. }(_parchment2.default.Scroll);
  3770. Scroll.blotName = 'scroll';
  3771. Scroll.className = 'ql-editor';
  3772. Scroll.tagName = 'DIV';
  3773. Scroll.defaultChild = 'block';
  3774. Scroll.allowedChildren = [_block2.default, _block.BlockEmbed, _container2.default];
  3775. exports.default = Scroll;
  3776. /***/ }),
  3777. /* 23 */
  3778. /***/ (function(module, exports, __webpack_require__) {
  3779. "use strict";
  3780. Object.defineProperty(exports, "__esModule", {
  3781. value: true
  3782. });
  3783. exports.SHORTKEY = exports.default = undefined;
  3784. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  3785. var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
  3786. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3787. var _clone = __webpack_require__(21);
  3788. var _clone2 = _interopRequireDefault(_clone);
  3789. var _deepEqual = __webpack_require__(11);
  3790. var _deepEqual2 = _interopRequireDefault(_deepEqual);
  3791. var _extend = __webpack_require__(3);
  3792. var _extend2 = _interopRequireDefault(_extend);
  3793. var _quillDelta = __webpack_require__(2);
  3794. var _quillDelta2 = _interopRequireDefault(_quillDelta);
  3795. var _op = __webpack_require__(20);
  3796. var _op2 = _interopRequireDefault(_op);
  3797. var _parchment = __webpack_require__(0);
  3798. var _parchment2 = _interopRequireDefault(_parchment);
  3799. var _quill = __webpack_require__(5);
  3800. var _quill2 = _interopRequireDefault(_quill);
  3801. var _logger = __webpack_require__(10);
  3802. var _logger2 = _interopRequireDefault(_logger);
  3803. var _module = __webpack_require__(9);
  3804. var _module2 = _interopRequireDefault(_module);
  3805. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3806. 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; }
  3807. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3808. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3809. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3810. var debug = (0, _logger2.default)('quill:keyboard');
  3811. var SHORTKEY = /Mac/i.test(navigator.platform) ? 'metaKey' : 'ctrlKey';
  3812. var Keyboard = function (_Module) {
  3813. _inherits(Keyboard, _Module);
  3814. _createClass(Keyboard, null, [{
  3815. key: 'match',
  3816. value: function match(evt, binding) {
  3817. binding = normalize(binding);
  3818. if (['altKey', 'ctrlKey', 'metaKey', 'shiftKey'].some(function (key) {
  3819. return !!binding[key] !== evt[key] && binding[key] !== null;
  3820. })) {
  3821. return false;
  3822. }
  3823. return binding.key === (evt.which || evt.keyCode);
  3824. }
  3825. }]);
  3826. function Keyboard(quill, options) {
  3827. _classCallCheck(this, Keyboard);
  3828. var _this = _possibleConstructorReturn(this, (Keyboard.__proto__ || Object.getPrototypeOf(Keyboard)).call(this, quill, options));
  3829. _this.bindings = {};
  3830. Object.keys(_this.options.bindings).forEach(function (name) {
  3831. if (name === 'list autofill' && quill.scroll.whitelist != null && !quill.scroll.whitelist['list']) {
  3832. return;
  3833. }
  3834. if (_this.options.bindings[name]) {
  3835. _this.addBinding(_this.options.bindings[name]);
  3836. }
  3837. });
  3838. _this.addBinding({ key: Keyboard.keys.ENTER, shiftKey: null }, handleEnter);
  3839. _this.addBinding({ key: Keyboard.keys.ENTER, metaKey: null, ctrlKey: null, altKey: null }, function () {});
  3840. if (/Firefox/i.test(navigator.userAgent)) {
  3841. // Need to handle delete and backspace for Firefox in the general case #1171
  3842. _this.addBinding({ key: Keyboard.keys.BACKSPACE }, { collapsed: true }, handleBackspace);
  3843. _this.addBinding({ key: Keyboard.keys.DELETE }, { collapsed: true }, handleDelete);
  3844. } else {
  3845. _this.addBinding({ key: Keyboard.keys.BACKSPACE }, { collapsed: true, prefix: /^.?$/ }, handleBackspace);
  3846. _this.addBinding({ key: Keyboard.keys.DELETE }, { collapsed: true, suffix: /^.?$/ }, handleDelete);
  3847. }
  3848. _this.addBinding({ key: Keyboard.keys.BACKSPACE }, { collapsed: false }, handleDeleteRange);
  3849. _this.addBinding({ key: Keyboard.keys.DELETE }, { collapsed: false }, handleDeleteRange);
  3850. _this.addBinding({ key: Keyboard.keys.BACKSPACE, altKey: null, ctrlKey: null, metaKey: null, shiftKey: null }, { collapsed: true, offset: 0 }, handleBackspace);
  3851. _this.listen();
  3852. return _this;
  3853. }
  3854. _createClass(Keyboard, [{
  3855. key: 'addBinding',
  3856. value: function addBinding(key) {
  3857. var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  3858. var handler = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  3859. var binding = normalize(key);
  3860. if (binding == null || binding.key == null) {
  3861. return debug.warn('Attempted to add invalid keyboard binding', binding);
  3862. }
  3863. if (typeof context === 'function') {
  3864. context = { handler: context };
  3865. }
  3866. if (typeof handler === 'function') {
  3867. handler = { handler: handler };
  3868. }
  3869. binding = (0, _extend2.default)(binding, context, handler);
  3870. this.bindings[binding.key] = this.bindings[binding.key] || [];
  3871. this.bindings[binding.key].push(binding);
  3872. }
  3873. }, {
  3874. key: 'listen',
  3875. value: function listen() {
  3876. var _this2 = this;
  3877. this.quill.root.addEventListener('keydown', function (evt) {
  3878. if (evt.defaultPrevented) return;
  3879. var which = evt.which || evt.keyCode;
  3880. var bindings = (_this2.bindings[which] || []).filter(function (binding) {
  3881. return Keyboard.match(evt, binding);
  3882. });
  3883. if (bindings.length === 0) return;
  3884. var range = _this2.quill.getSelection();
  3885. if (range == null || !_this2.quill.hasFocus()) return;
  3886. var _quill$getLine = _this2.quill.getLine(range.index),
  3887. _quill$getLine2 = _slicedToArray(_quill$getLine, 2),
  3888. line = _quill$getLine2[0],
  3889. offset = _quill$getLine2[1];
  3890. var _quill$getLeaf = _this2.quill.getLeaf(range.index),
  3891. _quill$getLeaf2 = _slicedToArray(_quill$getLeaf, 2),
  3892. leafStart = _quill$getLeaf2[0],
  3893. offsetStart = _quill$getLeaf2[1];
  3894. var _ref = range.length === 0 ? [leafStart, offsetStart] : _this2.quill.getLeaf(range.index + range.length),
  3895. _ref2 = _slicedToArray(_ref, 2),
  3896. leafEnd = _ref2[0],
  3897. offsetEnd = _ref2[1];
  3898. var prefixText = leafStart instanceof _parchment2.default.Text ? leafStart.value().slice(0, offsetStart) : '';
  3899. var suffixText = leafEnd instanceof _parchment2.default.Text ? leafEnd.value().slice(offsetEnd) : '';
  3900. var curContext = {
  3901. collapsed: range.length === 0,
  3902. empty: range.length === 0 && line.length() <= 1,
  3903. format: _this2.quill.getFormat(range),
  3904. offset: offset,
  3905. prefix: prefixText,
  3906. suffix: suffixText
  3907. };
  3908. var prevented = bindings.some(function (binding) {
  3909. if (binding.collapsed != null && binding.collapsed !== curContext.collapsed) return false;
  3910. if (binding.empty != null && binding.empty !== curContext.empty) return false;
  3911. if (binding.offset != null && binding.offset !== curContext.offset) return false;
  3912. if (Array.isArray(binding.format)) {
  3913. // any format is present
  3914. if (binding.format.every(function (name) {
  3915. return curContext.format[name] == null;
  3916. })) {
  3917. return false;
  3918. }
  3919. } else if (_typeof(binding.format) === 'object') {
  3920. // all formats must match
  3921. if (!Object.keys(binding.format).every(function (name) {
  3922. if (binding.format[name] === true) return curContext.format[name] != null;
  3923. if (binding.format[name] === false) return curContext.format[name] == null;
  3924. return (0, _deepEqual2.default)(binding.format[name], curContext.format[name]);
  3925. })) {
  3926. return false;
  3927. }
  3928. }
  3929. if (binding.prefix != null && !binding.prefix.test(curContext.prefix)) return false;
  3930. if (binding.suffix != null && !binding.suffix.test(curContext.suffix)) return false;
  3931. return binding.handler.call(_this2, range, curContext) !== true;
  3932. });
  3933. if (prevented) {
  3934. evt.preventDefault();
  3935. }
  3936. });
  3937. }
  3938. }]);
  3939. return Keyboard;
  3940. }(_module2.default);
  3941. Keyboard.keys = {
  3942. BACKSPACE: 8,
  3943. TAB: 9,
  3944. ENTER: 13,
  3945. ESCAPE: 27,
  3946. LEFT: 37,
  3947. UP: 38,
  3948. RIGHT: 39,
  3949. DOWN: 40,
  3950. DELETE: 46
  3951. };
  3952. Keyboard.DEFAULTS = {
  3953. bindings: {
  3954. 'bold': makeFormatHandler('bold'),
  3955. 'italic': makeFormatHandler('italic'),
  3956. 'underline': makeFormatHandler('underline'),
  3957. 'indent': {
  3958. // highlight tab or tab at beginning of list, indent or blockquote
  3959. key: Keyboard.keys.TAB,
  3960. format: ['blockquote', 'indent', 'list'],
  3961. handler: function handler(range, context) {
  3962. if (context.collapsed && context.offset !== 0) return true;
  3963. this.quill.format('indent', '+1', _quill2.default.sources.USER);
  3964. }
  3965. },
  3966. 'outdent': {
  3967. key: Keyboard.keys.TAB,
  3968. shiftKey: true,
  3969. format: ['blockquote', 'indent', 'list'],
  3970. // highlight tab or tab at beginning of list, indent or blockquote
  3971. handler: function handler(range, context) {
  3972. if (context.collapsed && context.offset !== 0) return true;
  3973. this.quill.format('indent', '-1', _quill2.default.sources.USER);
  3974. }
  3975. },
  3976. 'outdent backspace': {
  3977. key: Keyboard.keys.BACKSPACE,
  3978. collapsed: true,
  3979. shiftKey: null,
  3980. metaKey: null,
  3981. ctrlKey: null,
  3982. altKey: null,
  3983. format: ['indent', 'list'],
  3984. offset: 0,
  3985. handler: function handler(range, context) {
  3986. if (context.format.indent != null) {
  3987. this.quill.format('indent', '-1', _quill2.default.sources.USER);
  3988. } else if (context.format.list != null) {
  3989. this.quill.format('list', false, _quill2.default.sources.USER);
  3990. }
  3991. }
  3992. },
  3993. 'indent code-block': makeCodeBlockHandler(true),
  3994. 'outdent code-block': makeCodeBlockHandler(false),
  3995. 'remove tab': {
  3996. key: Keyboard.keys.TAB,
  3997. shiftKey: true,
  3998. collapsed: true,
  3999. prefix: /\t$/,
  4000. handler: function handler(range) {
  4001. this.quill.deleteText(range.index - 1, 1, _quill2.default.sources.USER);
  4002. }
  4003. },
  4004. 'tab': {
  4005. key: Keyboard.keys.TAB,
  4006. handler: function handler(range) {
  4007. this.quill.history.cutoff();
  4008. var delta = new _quillDelta2.default().retain(range.index).delete(range.length).insert('\t');
  4009. this.quill.updateContents(delta, _quill2.default.sources.USER);
  4010. this.quill.history.cutoff();
  4011. this.quill.setSelection(range.index + 1, _quill2.default.sources.SILENT);
  4012. }
  4013. },
  4014. 'list empty enter': {
  4015. key: Keyboard.keys.ENTER,
  4016. collapsed: true,
  4017. format: ['list'],
  4018. empty: true,
  4019. handler: function handler(range, context) {
  4020. this.quill.format('list', false, _quill2.default.sources.USER);
  4021. if (context.format.indent) {
  4022. this.quill.format('indent', false, _quill2.default.sources.USER);
  4023. }
  4024. }
  4025. },
  4026. 'checklist enter': {
  4027. key: Keyboard.keys.ENTER,
  4028. collapsed: true,
  4029. format: { list: 'checked' },
  4030. handler: function handler(range) {
  4031. var _quill$getLine3 = this.quill.getLine(range.index),
  4032. _quill$getLine4 = _slicedToArray(_quill$getLine3, 2),
  4033. line = _quill$getLine4[0],
  4034. offset = _quill$getLine4[1];
  4035. var formats = (0, _extend2.default)({}, line.formats(), { list: 'checked' });
  4036. var delta = new _quillDelta2.default().retain(range.index).insert('\n', formats).retain(line.length() - offset - 1).retain(1, { list: 'unchecked' });
  4037. this.quill.updateContents(delta, _quill2.default.sources.USER);
  4038. this.quill.setSelection(range.index + 1, _quill2.default.sources.SILENT);
  4039. this.quill.scrollIntoView();
  4040. }
  4041. },
  4042. 'header enter': {
  4043. key: Keyboard.keys.ENTER,
  4044. collapsed: true,
  4045. format: ['header'],
  4046. suffix: /^$/,
  4047. handler: function handler(range, context) {
  4048. var _quill$getLine5 = this.quill.getLine(range.index),
  4049. _quill$getLine6 = _slicedToArray(_quill$getLine5, 2),
  4050. line = _quill$getLine6[0],
  4051. offset = _quill$getLine6[1];
  4052. var delta = new _quillDelta2.default().retain(range.index).insert('\n', context.format).retain(line.length() - offset - 1).retain(1, { header: null });
  4053. this.quill.updateContents(delta, _quill2.default.sources.USER);
  4054. this.quill.setSelection(range.index + 1, _quill2.default.sources.SILENT);
  4055. this.quill.scrollIntoView();
  4056. }
  4057. },
  4058. 'list autofill': {
  4059. key: ' ',
  4060. collapsed: true,
  4061. format: { list: false },
  4062. prefix: /^\s*?(\d+\.|-|\*|\[ ?\]|\[x\])$/,
  4063. handler: function handler(range, context) {
  4064. var length = context.prefix.length;
  4065. var _quill$getLine7 = this.quill.getLine(range.index),
  4066. _quill$getLine8 = _slicedToArray(_quill$getLine7, 2),
  4067. line = _quill$getLine8[0],
  4068. offset = _quill$getLine8[1];
  4069. if (offset > length) return true;
  4070. var value = void 0;
  4071. switch (context.prefix.trim()) {
  4072. case '[]':case '[ ]':
  4073. value = 'unchecked';
  4074. break;
  4075. case '[x]':
  4076. value = 'checked';
  4077. break;
  4078. case '-':case '*':
  4079. value = 'bullet';
  4080. break;
  4081. default:
  4082. value = 'ordered';
  4083. }
  4084. this.quill.insertText(range.index, ' ', _quill2.default.sources.USER);
  4085. this.quill.history.cutoff();
  4086. var delta = new _quillDelta2.default().retain(range.index - offset).delete(length + 1).retain(line.length() - 2 - offset).retain(1, { list: value });
  4087. this.quill.updateContents(delta, _quill2.default.sources.USER);
  4088. this.quill.history.cutoff();
  4089. this.quill.setSelection(range.index - length, _quill2.default.sources.SILENT);
  4090. }
  4091. },
  4092. 'code exit': {
  4093. key: Keyboard.keys.ENTER,
  4094. collapsed: true,
  4095. format: ['code-block'],
  4096. prefix: /\n\n$/,
  4097. suffix: /^\s+$/,
  4098. handler: function handler(range) {
  4099. var _quill$getLine9 = this.quill.getLine(range.index),
  4100. _quill$getLine10 = _slicedToArray(_quill$getLine9, 2),
  4101. line = _quill$getLine10[0],
  4102. offset = _quill$getLine10[1];
  4103. var delta = new _quillDelta2.default().retain(range.index + line.length() - offset - 2).retain(1, { 'code-block': null }).delete(1);
  4104. this.quill.updateContents(delta, _quill2.default.sources.USER);
  4105. }
  4106. },
  4107. 'embed left': makeEmbedArrowHandler(Keyboard.keys.LEFT, false),
  4108. 'embed left shift': makeEmbedArrowHandler(Keyboard.keys.LEFT, true),
  4109. 'embed right': makeEmbedArrowHandler(Keyboard.keys.RIGHT, false),
  4110. 'embed right shift': makeEmbedArrowHandler(Keyboard.keys.RIGHT, true)
  4111. }
  4112. };
  4113. function makeEmbedArrowHandler(key, shiftKey) {
  4114. var _ref3;
  4115. var where = key === Keyboard.keys.LEFT ? 'prefix' : 'suffix';
  4116. return _ref3 = {
  4117. key: key,
  4118. shiftKey: shiftKey,
  4119. altKey: null
  4120. }, _defineProperty(_ref3, where, /^$/), _defineProperty(_ref3, 'handler', function handler(range) {
  4121. var index = range.index;
  4122. if (key === Keyboard.keys.RIGHT) {
  4123. index += range.length + 1;
  4124. }
  4125. var _quill$getLeaf3 = this.quill.getLeaf(index),
  4126. _quill$getLeaf4 = _slicedToArray(_quill$getLeaf3, 1),
  4127. leaf = _quill$getLeaf4[0];
  4128. if (!(leaf instanceof _parchment2.default.Embed)) return true;
  4129. if (key === Keyboard.keys.LEFT) {
  4130. if (shiftKey) {
  4131. this.quill.setSelection(range.index - 1, range.length + 1, _quill2.default.sources.USER);
  4132. } else {
  4133. this.quill.setSelection(range.index - 1, _quill2.default.sources.USER);
  4134. }
  4135. } else {
  4136. if (shiftKey) {
  4137. this.quill.setSelection(range.index, range.length + 1, _quill2.default.sources.USER);
  4138. } else {
  4139. this.quill.setSelection(range.index + range.length + 1, _quill2.default.sources.USER);
  4140. }
  4141. }
  4142. return false;
  4143. }), _ref3;
  4144. }
  4145. function handleBackspace(range, context) {
  4146. if (range.index === 0 || this.quill.getLength() <= 1) return;
  4147. var _quill$getLine11 = this.quill.getLine(range.index),
  4148. _quill$getLine12 = _slicedToArray(_quill$getLine11, 1),
  4149. line = _quill$getLine12[0];
  4150. var formats = {};
  4151. if (context.offset === 0) {
  4152. var _quill$getLine13 = this.quill.getLine(range.index - 1),
  4153. _quill$getLine14 = _slicedToArray(_quill$getLine13, 1),
  4154. prev = _quill$getLine14[0];
  4155. if (prev != null && prev.length() > 1) {
  4156. var curFormats = line.formats();
  4157. var prevFormats = this.quill.getFormat(range.index - 1, 1);
  4158. formats = _op2.default.attributes.diff(curFormats, prevFormats) || {};
  4159. }
  4160. }
  4161. // Check for astral symbols
  4162. var length = /[\uD800-\uDBFF][\uDC00-\uDFFF]$/.test(context.prefix) ? 2 : 1;
  4163. this.quill.deleteText(range.index - length, length, _quill2.default.sources.USER);
  4164. if (Object.keys(formats).length > 0) {
  4165. this.quill.formatLine(range.index - length, length, formats, _quill2.default.sources.USER);
  4166. }
  4167. this.quill.focus();
  4168. }
  4169. function handleDelete(range, context) {
  4170. // Check for astral symbols
  4171. var length = /^[\uD800-\uDBFF][\uDC00-\uDFFF]/.test(context.suffix) ? 2 : 1;
  4172. if (range.index >= this.quill.getLength() - length) return;
  4173. var formats = {},
  4174. nextLength = 0;
  4175. var _quill$getLine15 = this.quill.getLine(range.index),
  4176. _quill$getLine16 = _slicedToArray(_quill$getLine15, 1),
  4177. line = _quill$getLine16[0];
  4178. if (context.offset >= line.length() - 1) {
  4179. var _quill$getLine17 = this.quill.getLine(range.index + 1),
  4180. _quill$getLine18 = _slicedToArray(_quill$getLine17, 1),
  4181. next = _quill$getLine18[0];
  4182. if (next) {
  4183. var curFormats = line.formats();
  4184. var nextFormats = this.quill.getFormat(range.index, 1);
  4185. formats = _op2.default.attributes.diff(curFormats, nextFormats) || {};
  4186. nextLength = next.length();
  4187. }
  4188. }
  4189. this.quill.deleteText(range.index, length, _quill2.default.sources.USER);
  4190. if (Object.keys(formats).length > 0) {
  4191. this.quill.formatLine(range.index + nextLength - 1, length, formats, _quill2.default.sources.USER);
  4192. }
  4193. }
  4194. function handleDeleteRange(range) {
  4195. var lines = this.quill.getLines(range);
  4196. var formats = {};
  4197. if (lines.length > 1) {
  4198. var firstFormats = lines[0].formats();
  4199. var lastFormats = lines[lines.length - 1].formats();
  4200. formats = _op2.default.attributes.diff(lastFormats, firstFormats) || {};
  4201. }
  4202. this.quill.deleteText(range, _quill2.default.sources.USER);
  4203. if (Object.keys(formats).length > 0) {
  4204. this.quill.formatLine(range.index, 1, formats, _quill2.default.sources.USER);
  4205. }
  4206. this.quill.setSelection(range.index, _quill2.default.sources.SILENT);
  4207. this.quill.focus();
  4208. }
  4209. function handleEnter(range, context) {
  4210. var _this3 = this;
  4211. if (range.length > 0) {
  4212. this.quill.scroll.deleteAt(range.index, range.length); // So we do not trigger text-change
  4213. }
  4214. var lineFormats = Object.keys(context.format).reduce(function (lineFormats, format) {
  4215. if (_parchment2.default.query(format, _parchment2.default.Scope.BLOCK) && !Array.isArray(context.format[format])) {
  4216. lineFormats[format] = context.format[format];
  4217. }
  4218. return lineFormats;
  4219. }, {});
  4220. this.quill.insertText(range.index, '\n', lineFormats, _quill2.default.sources.USER);
  4221. // Earlier scroll.deleteAt might have messed up our selection,
  4222. // so insertText's built in selection preservation is not reliable
  4223. this.quill.setSelection(range.index + 1, _quill2.default.sources.SILENT);
  4224. this.quill.focus();
  4225. Object.keys(context.format).forEach(function (name) {
  4226. if (lineFormats[name] != null) return;
  4227. if (Array.isArray(context.format[name])) return;
  4228. if (name === 'link') return;
  4229. _this3.quill.format(name, context.format[name], _quill2.default.sources.USER);
  4230. });
  4231. }
  4232. function makeCodeBlockHandler(indent) {
  4233. return {
  4234. key: Keyboard.keys.TAB,
  4235. shiftKey: !indent,
  4236. format: { 'code-block': true },
  4237. handler: function handler(range) {
  4238. var CodeBlock = _parchment2.default.query('code-block');
  4239. var index = range.index,
  4240. length = range.length;
  4241. var _quill$scroll$descend = this.quill.scroll.descendant(CodeBlock, index),
  4242. _quill$scroll$descend2 = _slicedToArray(_quill$scroll$descend, 2),
  4243. block = _quill$scroll$descend2[0],
  4244. offset = _quill$scroll$descend2[1];
  4245. if (block == null) return;
  4246. var scrollIndex = this.quill.getIndex(block);
  4247. var start = block.newlineIndex(offset, true) + 1;
  4248. var end = block.newlineIndex(scrollIndex + offset + length);
  4249. var lines = block.domNode.textContent.slice(start, end).split('\n');
  4250. offset = 0;
  4251. lines.forEach(function (line, i) {
  4252. if (indent) {
  4253. block.insertAt(start + offset, CodeBlock.TAB);
  4254. offset += CodeBlock.TAB.length;
  4255. if (i === 0) {
  4256. index += CodeBlock.TAB.length;
  4257. } else {
  4258. length += CodeBlock.TAB.length;
  4259. }
  4260. } else if (line.startsWith(CodeBlock.TAB)) {
  4261. block.deleteAt(start + offset, CodeBlock.TAB.length);
  4262. offset -= CodeBlock.TAB.length;
  4263. if (i === 0) {
  4264. index -= CodeBlock.TAB.length;
  4265. } else {
  4266. length -= CodeBlock.TAB.length;
  4267. }
  4268. }
  4269. offset += line.length + 1;
  4270. });
  4271. this.quill.update(_quill2.default.sources.USER);
  4272. this.quill.setSelection(index, length, _quill2.default.sources.SILENT);
  4273. }
  4274. };
  4275. }
  4276. function makeFormatHandler(format) {
  4277. return {
  4278. key: format[0].toUpperCase(),
  4279. shortKey: true,
  4280. handler: function handler(range, context) {
  4281. this.quill.format(format, !context.format[format], _quill2.default.sources.USER);
  4282. }
  4283. };
  4284. }
  4285. function normalize(binding) {
  4286. if (typeof binding === 'string' || typeof binding === 'number') {
  4287. return normalize({ key: binding });
  4288. }
  4289. if ((typeof binding === 'undefined' ? 'undefined' : _typeof(binding)) === 'object') {
  4290. binding = (0, _clone2.default)(binding, false);
  4291. }
  4292. if (typeof binding.key === 'string') {
  4293. if (Keyboard.keys[binding.key.toUpperCase()] != null) {
  4294. binding.key = Keyboard.keys[binding.key.toUpperCase()];
  4295. } else if (binding.key.length === 1) {
  4296. binding.key = binding.key.toUpperCase().charCodeAt(0);
  4297. } else {
  4298. return null;
  4299. }
  4300. }
  4301. if (binding.shortKey) {
  4302. binding[SHORTKEY] = binding.shortKey;
  4303. delete binding.shortKey;
  4304. }
  4305. return binding;
  4306. }
  4307. exports.default = Keyboard;
  4308. exports.SHORTKEY = SHORTKEY;
  4309. /***/ }),
  4310. /* 24 */
  4311. /***/ (function(module, exports, __webpack_require__) {
  4312. "use strict";
  4313. Object.defineProperty(exports, "__esModule", {
  4314. value: true
  4315. });
  4316. var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
  4317. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  4318. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4319. var _parchment = __webpack_require__(0);
  4320. var _parchment2 = _interopRequireDefault(_parchment);
  4321. var _text = __webpack_require__(7);
  4322. var _text2 = _interopRequireDefault(_text);
  4323. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  4324. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4325. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4326. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4327. var Cursor = function (_Parchment$Embed) {
  4328. _inherits(Cursor, _Parchment$Embed);
  4329. _createClass(Cursor, null, [{
  4330. key: 'value',
  4331. value: function value() {
  4332. return undefined;
  4333. }
  4334. }]);
  4335. function Cursor(domNode, selection) {
  4336. _classCallCheck(this, Cursor);
  4337. var _this = _possibleConstructorReturn(this, (Cursor.__proto__ || Object.getPrototypeOf(Cursor)).call(this, domNode));
  4338. _this.selection = selection;
  4339. _this.textNode = document.createTextNode(Cursor.CONTENTS);
  4340. _this.domNode.appendChild(_this.textNode);
  4341. _this._length = 0;
  4342. return _this;
  4343. }
  4344. _createClass(Cursor, [{
  4345. key: 'detach',
  4346. value: function detach() {
  4347. // super.detach() will also clear domNode.__blot
  4348. if (this.parent != null) this.parent.removeChild(this);
  4349. }
  4350. }, {
  4351. key: 'format',
  4352. value: function format(name, value) {
  4353. if (this._length !== 0) {
  4354. return _get(Cursor.prototype.__proto__ || Object.getPrototypeOf(Cursor.prototype), 'format', this).call(this, name, value);
  4355. }
  4356. var target = this,
  4357. index = 0;
  4358. while (target != null && target.statics.scope !== _parchment2.default.Scope.BLOCK_BLOT) {
  4359. index += target.offset(target.parent);
  4360. target = target.parent;
  4361. }
  4362. if (target != null) {
  4363. this._length = Cursor.CONTENTS.length;
  4364. target.optimize();
  4365. target.formatAt(index, Cursor.CONTENTS.length, name, value);
  4366. this._length = 0;
  4367. }
  4368. }
  4369. }, {
  4370. key: 'index',
  4371. value: function index(node, offset) {
  4372. if (node === this.textNode) return 0;
  4373. return _get(Cursor.prototype.__proto__ || Object.getPrototypeOf(Cursor.prototype), 'index', this).call(this, node, offset);
  4374. }
  4375. }, {
  4376. key: 'length',
  4377. value: function length() {
  4378. return this._length;
  4379. }
  4380. }, {
  4381. key: 'position',
  4382. value: function position() {
  4383. return [this.textNode, this.textNode.data.length];
  4384. }
  4385. }, {
  4386. key: 'remove',
  4387. value: function remove() {
  4388. _get(Cursor.prototype.__proto__ || Object.getPrototypeOf(Cursor.prototype), 'remove', this).call(this);
  4389. this.parent = null;
  4390. }
  4391. }, {
  4392. key: 'restore',
  4393. value: function restore() {
  4394. if (this.selection.composing || this.parent == null) return;
  4395. var textNode = this.textNode;
  4396. var range = this.selection.getNativeRange();
  4397. var restoreText = void 0,
  4398. start = void 0,
  4399. end = void 0;
  4400. if (range != null && range.start.node === textNode && range.end.node === textNode) {
  4401. var _ref = [textNode, range.start.offset, range.end.offset];
  4402. restoreText = _ref[0];
  4403. start = _ref[1];
  4404. end = _ref[2];
  4405. }
  4406. // Link format will insert text outside of anchor tag
  4407. while (this.domNode.lastChild != null && this.domNode.lastChild !== this.textNode) {
  4408. this.domNode.parentNode.insertBefore(this.domNode.lastChild, this.domNode);
  4409. }
  4410. if (this.textNode.data !== Cursor.CONTENTS) {
  4411. var text = this.textNode.data.split(Cursor.CONTENTS).join('');
  4412. if (this.next instanceof _text2.default) {
  4413. restoreText = this.next.domNode;
  4414. this.next.insertAt(0, text);
  4415. this.textNode.data = Cursor.CONTENTS;
  4416. } else {
  4417. this.textNode.data = text;
  4418. this.parent.insertBefore(_parchment2.default.create(this.textNode), this);
  4419. this.textNode = document.createTextNode(Cursor.CONTENTS);
  4420. this.domNode.appendChild(this.textNode);
  4421. }
  4422. }
  4423. this.remove();
  4424. if (start != null) {
  4425. var _map = [start, end].map(function (offset) {
  4426. return Math.max(0, Math.min(restoreText.data.length, offset - 1));
  4427. });
  4428. var _map2 = _slicedToArray(_map, 2);
  4429. start = _map2[0];
  4430. end = _map2[1];
  4431. return {
  4432. startNode: restoreText,
  4433. startOffset: start,
  4434. endNode: restoreText,
  4435. endOffset: end
  4436. };
  4437. }
  4438. }
  4439. }, {
  4440. key: 'update',
  4441. value: function update(mutations, context) {
  4442. var _this2 = this;
  4443. if (mutations.some(function (mutation) {
  4444. return mutation.type === 'characterData' && mutation.target === _this2.textNode;
  4445. })) {
  4446. var range = this.restore();
  4447. if (range) context.range = range;
  4448. }
  4449. }
  4450. }, {
  4451. key: 'value',
  4452. value: function value() {
  4453. return '';
  4454. }
  4455. }]);
  4456. return Cursor;
  4457. }(_parchment2.default.Embed);
  4458. Cursor.blotName = 'cursor';
  4459. Cursor.className = 'ql-cursor';
  4460. Cursor.tagName = 'span';
  4461. Cursor.CONTENTS = '\uFEFF'; // Zero width no break space
  4462. exports.default = Cursor;
  4463. /***/ }),
  4464. /* 25 */
  4465. /***/ (function(module, exports, __webpack_require__) {
  4466. "use strict";
  4467. Object.defineProperty(exports, "__esModule", {
  4468. value: true
  4469. });
  4470. var _parchment = __webpack_require__(0);
  4471. var _parchment2 = _interopRequireDefault(_parchment);
  4472. var _block = __webpack_require__(4);
  4473. var _block2 = _interopRequireDefault(_block);
  4474. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  4475. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4476. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4477. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4478. var Container = function (_Parchment$Container) {
  4479. _inherits(Container, _Parchment$Container);
  4480. function Container() {
  4481. _classCallCheck(this, Container);
  4482. return _possibleConstructorReturn(this, (Container.__proto__ || Object.getPrototypeOf(Container)).apply(this, arguments));
  4483. }
  4484. return Container;
  4485. }(_parchment2.default.Container);
  4486. Container.allowedChildren = [_block2.default, _block.BlockEmbed, Container];
  4487. exports.default = Container;
  4488. /***/ }),
  4489. /* 26 */
  4490. /***/ (function(module, exports, __webpack_require__) {
  4491. "use strict";
  4492. Object.defineProperty(exports, "__esModule", {
  4493. value: true
  4494. });
  4495. exports.ColorStyle = exports.ColorClass = exports.ColorAttributor = undefined;
  4496. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4497. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  4498. var _parchment = __webpack_require__(0);
  4499. var _parchment2 = _interopRequireDefault(_parchment);
  4500. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  4501. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4502. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4503. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4504. var ColorAttributor = function (_Parchment$Attributor) {
  4505. _inherits(ColorAttributor, _Parchment$Attributor);
  4506. function ColorAttributor() {
  4507. _classCallCheck(this, ColorAttributor);
  4508. return _possibleConstructorReturn(this, (ColorAttributor.__proto__ || Object.getPrototypeOf(ColorAttributor)).apply(this, arguments));
  4509. }
  4510. _createClass(ColorAttributor, [{
  4511. key: 'value',
  4512. value: function value(domNode) {
  4513. var value = _get(ColorAttributor.prototype.__proto__ || Object.getPrototypeOf(ColorAttributor.prototype), 'value', this).call(this, domNode);
  4514. if (!value.startsWith('rgb(')) return value;
  4515. value = value.replace(/^[^\d]+/, '').replace(/[^\d]+$/, '');
  4516. return '#' + value.split(',').map(function (component) {
  4517. return ('00' + parseInt(component).toString(16)).slice(-2);
  4518. }).join('');
  4519. }
  4520. }]);
  4521. return ColorAttributor;
  4522. }(_parchment2.default.Attributor.Style);
  4523. var ColorClass = new _parchment2.default.Attributor.Class('color', 'ql-color', {
  4524. scope: _parchment2.default.Scope.INLINE
  4525. });
  4526. var ColorStyle = new ColorAttributor('color', 'color', {
  4527. scope: _parchment2.default.Scope.INLINE
  4528. });
  4529. exports.ColorAttributor = ColorAttributor;
  4530. exports.ColorClass = ColorClass;
  4531. exports.ColorStyle = ColorStyle;
  4532. /***/ }),
  4533. /* 27 */
  4534. /***/ (function(module, exports, __webpack_require__) {
  4535. "use strict";
  4536. Object.defineProperty(exports, "__esModule", {
  4537. value: true
  4538. });
  4539. exports.sanitize = exports.default = undefined;
  4540. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4541. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  4542. var _inline = __webpack_require__(6);
  4543. var _inline2 = _interopRequireDefault(_inline);
  4544. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  4545. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4546. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4547. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4548. var Link = function (_Inline) {
  4549. _inherits(Link, _Inline);
  4550. function Link() {
  4551. _classCallCheck(this, Link);
  4552. return _possibleConstructorReturn(this, (Link.__proto__ || Object.getPrototypeOf(Link)).apply(this, arguments));
  4553. }
  4554. _createClass(Link, [{
  4555. key: 'format',
  4556. value: function format(name, value) {
  4557. if (name !== this.statics.blotName || !value) return _get(Link.prototype.__proto__ || Object.getPrototypeOf(Link.prototype), 'format', this).call(this, name, value);
  4558. value = this.constructor.sanitize(value);
  4559. this.domNode.setAttribute('href', value);
  4560. }
  4561. }], [{
  4562. key: 'create',
  4563. value: function create(value) {
  4564. var node = _get(Link.__proto__ || Object.getPrototypeOf(Link), 'create', this).call(this, value);
  4565. value = this.sanitize(value);
  4566. node.setAttribute('href', value);
  4567. node.setAttribute('target', '_blank');
  4568. return node;
  4569. }
  4570. }, {
  4571. key: 'formats',
  4572. value: function formats(domNode) {
  4573. return domNode.getAttribute('href');
  4574. }
  4575. }, {
  4576. key: 'sanitize',
  4577. value: function sanitize(url) {
  4578. return _sanitize(url, this.PROTOCOL_WHITELIST) ? url : this.SANITIZED_URL;
  4579. }
  4580. }]);
  4581. return Link;
  4582. }(_inline2.default);
  4583. Link.blotName = 'link';
  4584. Link.tagName = 'A';
  4585. Link.SANITIZED_URL = 'about:blank';
  4586. Link.PROTOCOL_WHITELIST = ['http', 'https', 'mailto', 'tel'];
  4587. function _sanitize(url, protocols) {
  4588. var anchor = document.createElement('a');
  4589. anchor.href = url;
  4590. var protocol = anchor.href.slice(0, anchor.href.indexOf(':'));
  4591. return protocols.indexOf(protocol) > -1;
  4592. }
  4593. exports.default = Link;
  4594. exports.sanitize = _sanitize;
  4595. /***/ }),
  4596. /* 28 */
  4597. /***/ (function(module, exports, __webpack_require__) {
  4598. "use strict";
  4599. Object.defineProperty(exports, "__esModule", {
  4600. value: true
  4601. });
  4602. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  4603. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4604. var _keyboard = __webpack_require__(23);
  4605. var _keyboard2 = _interopRequireDefault(_keyboard);
  4606. var _dropdown = __webpack_require__(107);
  4607. var _dropdown2 = _interopRequireDefault(_dropdown);
  4608. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  4609. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4610. var optionsCounter = 0;
  4611. function toggleAriaAttribute(element, attribute) {
  4612. element.setAttribute(attribute, !(element.getAttribute(attribute) === 'true'));
  4613. }
  4614. var Picker = function () {
  4615. function Picker(select) {
  4616. var _this = this;
  4617. _classCallCheck(this, Picker);
  4618. this.select = select;
  4619. this.container = document.createElement('span');
  4620. this.buildPicker();
  4621. this.select.style.display = 'none';
  4622. this.select.parentNode.insertBefore(this.container, this.select);
  4623. this.label.addEventListener('mousedown', function () {
  4624. _this.togglePicker();
  4625. });
  4626. this.label.addEventListener('keydown', function (event) {
  4627. switch (event.keyCode) {
  4628. // Allows the "Enter" key to open the picker
  4629. case _keyboard2.default.keys.ENTER:
  4630. _this.togglePicker();
  4631. break;
  4632. // Allows the "Escape" key to close the picker
  4633. case _keyboard2.default.keys.ESCAPE:
  4634. _this.escape();
  4635. event.preventDefault();
  4636. break;
  4637. default:
  4638. }
  4639. });
  4640. this.select.addEventListener('change', this.update.bind(this));
  4641. }
  4642. _createClass(Picker, [{
  4643. key: 'togglePicker',
  4644. value: function togglePicker() {
  4645. this.container.classList.toggle('ql-expanded');
  4646. // Toggle aria-expanded and aria-hidden to make the picker accessible
  4647. toggleAriaAttribute(this.label, 'aria-expanded');
  4648. toggleAriaAttribute(this.options, 'aria-hidden');
  4649. }
  4650. }, {
  4651. key: 'buildItem',
  4652. value: function buildItem(option) {
  4653. var _this2 = this;
  4654. var item = document.createElement('span');
  4655. item.tabIndex = '0';
  4656. item.setAttribute('role', 'button');
  4657. item.classList.add('ql-picker-item');
  4658. if (option.hasAttribute('value')) {
  4659. item.setAttribute('data-value', option.getAttribute('value'));
  4660. }
  4661. if (option.textContent) {
  4662. item.setAttribute('data-label', option.textContent);
  4663. }
  4664. item.addEventListener('click', function () {
  4665. _this2.selectItem(item, true);
  4666. });
  4667. item.addEventListener('keydown', function (event) {
  4668. switch (event.keyCode) {
  4669. // Allows the "Enter" key to select an item
  4670. case _keyboard2.default.keys.ENTER:
  4671. _this2.selectItem(item, true);
  4672. event.preventDefault();
  4673. break;
  4674. // Allows the "Escape" key to close the picker
  4675. case _keyboard2.default.keys.ESCAPE:
  4676. _this2.escape();
  4677. event.preventDefault();
  4678. break;
  4679. default:
  4680. }
  4681. });
  4682. return item;
  4683. }
  4684. }, {
  4685. key: 'buildLabel',
  4686. value: function buildLabel() {
  4687. var label = document.createElement('span');
  4688. label.classList.add('ql-picker-label');
  4689. label.innerHTML = _dropdown2.default;
  4690. label.tabIndex = '0';
  4691. label.setAttribute('role', 'button');
  4692. label.setAttribute('aria-expanded', 'false');
  4693. this.container.appendChild(label);
  4694. return label;
  4695. }
  4696. }, {
  4697. key: 'buildOptions',
  4698. value: function buildOptions() {
  4699. var _this3 = this;
  4700. var options = document.createElement('span');
  4701. options.classList.add('ql-picker-options');
  4702. // Don't want screen readers to read this until options are visible
  4703. options.setAttribute('aria-hidden', 'true');
  4704. options.tabIndex = '-1';
  4705. // Need a unique id for aria-controls
  4706. options.id = 'ql-picker-options-' + optionsCounter;
  4707. optionsCounter += 1;
  4708. this.label.setAttribute('aria-controls', options.id);
  4709. this.options = options;
  4710. [].slice.call(this.select.options).forEach(function (option) {
  4711. var item = _this3.buildItem(option);
  4712. options.appendChild(item);
  4713. if (option.selected === true) {
  4714. _this3.selectItem(item);
  4715. }
  4716. });
  4717. this.container.appendChild(options);
  4718. }
  4719. }, {
  4720. key: 'buildPicker',
  4721. value: function buildPicker() {
  4722. var _this4 = this;
  4723. [].slice.call(this.select.attributes).forEach(function (item) {
  4724. _this4.container.setAttribute(item.name, item.value);
  4725. });
  4726. this.container.classList.add('ql-picker');
  4727. this.label = this.buildLabel();
  4728. this.buildOptions();
  4729. }
  4730. }, {
  4731. key: 'escape',
  4732. value: function escape() {
  4733. var _this5 = this;
  4734. // Close menu and return focus to trigger label
  4735. this.close();
  4736. // Need setTimeout for accessibility to ensure that the browser executes
  4737. // focus on the next process thread and after any DOM content changes
  4738. setTimeout(function () {
  4739. return _this5.label.focus();
  4740. }, 1);
  4741. }
  4742. }, {
  4743. key: 'close',
  4744. value: function close() {
  4745. this.container.classList.remove('ql-expanded');
  4746. this.label.setAttribute('aria-expanded', 'false');
  4747. this.options.setAttribute('aria-hidden', 'true');
  4748. }
  4749. }, {
  4750. key: 'selectItem',
  4751. value: function selectItem(item) {
  4752. var trigger = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  4753. var selected = this.container.querySelector('.ql-selected');
  4754. if (item === selected) return;
  4755. if (selected != null) {
  4756. selected.classList.remove('ql-selected');
  4757. }
  4758. if (item == null) return;
  4759. item.classList.add('ql-selected');
  4760. this.select.selectedIndex = [].indexOf.call(item.parentNode.children, item);
  4761. if (item.hasAttribute('data-value')) {
  4762. this.label.setAttribute('data-value', item.getAttribute('data-value'));
  4763. } else {
  4764. this.label.removeAttribute('data-value');
  4765. }
  4766. if (item.hasAttribute('data-label')) {
  4767. this.label.setAttribute('data-label', item.getAttribute('data-label'));
  4768. } else {
  4769. this.label.removeAttribute('data-label');
  4770. }
  4771. if (trigger) {
  4772. if (typeof Event === 'function') {
  4773. this.select.dispatchEvent(new Event('change'));
  4774. } else if ((typeof Event === 'undefined' ? 'undefined' : _typeof(Event)) === 'object') {
  4775. // IE11
  4776. var event = document.createEvent('Event');
  4777. event.initEvent('change', true, true);
  4778. this.select.dispatchEvent(event);
  4779. }
  4780. this.close();
  4781. }
  4782. }
  4783. }, {
  4784. key: 'update',
  4785. value: function update() {
  4786. var option = void 0;
  4787. if (this.select.selectedIndex > -1) {
  4788. var item = this.container.querySelector('.ql-picker-options').children[this.select.selectedIndex];
  4789. option = this.select.options[this.select.selectedIndex];
  4790. this.selectItem(item);
  4791. } else {
  4792. this.selectItem(null);
  4793. }
  4794. var isActive = option != null && option !== this.select.querySelector('option[selected]');
  4795. this.label.classList.toggle('ql-active', isActive);
  4796. }
  4797. }]);
  4798. return Picker;
  4799. }();
  4800. exports.default = Picker;
  4801. /***/ }),
  4802. /* 29 */
  4803. /***/ (function(module, exports, __webpack_require__) {
  4804. "use strict";
  4805. Object.defineProperty(exports, "__esModule", {
  4806. value: true
  4807. });
  4808. var _parchment = __webpack_require__(0);
  4809. var _parchment2 = _interopRequireDefault(_parchment);
  4810. var _quill = __webpack_require__(5);
  4811. var _quill2 = _interopRequireDefault(_quill);
  4812. var _block = __webpack_require__(4);
  4813. var _block2 = _interopRequireDefault(_block);
  4814. var _break = __webpack_require__(16);
  4815. var _break2 = _interopRequireDefault(_break);
  4816. var _container = __webpack_require__(25);
  4817. var _container2 = _interopRequireDefault(_container);
  4818. var _cursor = __webpack_require__(24);
  4819. var _cursor2 = _interopRequireDefault(_cursor);
  4820. var _embed = __webpack_require__(35);
  4821. var _embed2 = _interopRequireDefault(_embed);
  4822. var _inline = __webpack_require__(6);
  4823. var _inline2 = _interopRequireDefault(_inline);
  4824. var _scroll = __webpack_require__(22);
  4825. var _scroll2 = _interopRequireDefault(_scroll);
  4826. var _text = __webpack_require__(7);
  4827. var _text2 = _interopRequireDefault(_text);
  4828. var _clipboard = __webpack_require__(55);
  4829. var _clipboard2 = _interopRequireDefault(_clipboard);
  4830. var _history = __webpack_require__(42);
  4831. var _history2 = _interopRequireDefault(_history);
  4832. var _keyboard = __webpack_require__(23);
  4833. var _keyboard2 = _interopRequireDefault(_keyboard);
  4834. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  4835. _quill2.default.register({
  4836. 'blots/block': _block2.default,
  4837. 'blots/block/embed': _block.BlockEmbed,
  4838. 'blots/break': _break2.default,
  4839. 'blots/container': _container2.default,
  4840. 'blots/cursor': _cursor2.default,
  4841. 'blots/embed': _embed2.default,
  4842. 'blots/inline': _inline2.default,
  4843. 'blots/scroll': _scroll2.default,
  4844. 'blots/text': _text2.default,
  4845. 'modules/clipboard': _clipboard2.default,
  4846. 'modules/history': _history2.default,
  4847. 'modules/keyboard': _keyboard2.default
  4848. });
  4849. _parchment2.default.register(_block2.default, _break2.default, _cursor2.default, _inline2.default, _scroll2.default, _text2.default);
  4850. exports.default = _quill2.default;
  4851. /***/ }),
  4852. /* 30 */
  4853. /***/ (function(module, exports, __webpack_require__) {
  4854. "use strict";
  4855. Object.defineProperty(exports, "__esModule", { value: true });
  4856. var Registry = __webpack_require__(1);
  4857. var ShadowBlot = /** @class */ (function () {
  4858. function ShadowBlot(domNode) {
  4859. this.domNode = domNode;
  4860. // @ts-ignore
  4861. this.domNode[Registry.DATA_KEY] = { blot: this };
  4862. }
  4863. Object.defineProperty(ShadowBlot.prototype, "statics", {
  4864. // Hack for accessing inherited static methods
  4865. get: function () {
  4866. return this.constructor;
  4867. },
  4868. enumerable: true,
  4869. configurable: true
  4870. });
  4871. ShadowBlot.create = function (value) {
  4872. if (this.tagName == null) {
  4873. throw new Registry.ParchmentError('Blot definition missing tagName');
  4874. }
  4875. var node;
  4876. if (Array.isArray(this.tagName)) {
  4877. if (typeof value === 'string') {
  4878. value = value.toUpperCase();
  4879. if (parseInt(value).toString() === value) {
  4880. value = parseInt(value);
  4881. }
  4882. }
  4883. if (typeof value === 'number') {
  4884. node = document.createElement(this.tagName[value - 1]);
  4885. }
  4886. else if (this.tagName.indexOf(value) > -1) {
  4887. node = document.createElement(value);
  4888. }
  4889. else {
  4890. node = document.createElement(this.tagName[0]);
  4891. }
  4892. }
  4893. else {
  4894. node = document.createElement(this.tagName);
  4895. }
  4896. if (this.className) {
  4897. node.classList.add(this.className);
  4898. }
  4899. return node;
  4900. };
  4901. ShadowBlot.prototype.attach = function () {
  4902. if (this.parent != null) {
  4903. this.scroll = this.parent.scroll;
  4904. }
  4905. };
  4906. ShadowBlot.prototype.clone = function () {
  4907. var domNode = this.domNode.cloneNode(false);
  4908. return Registry.create(domNode);
  4909. };
  4910. ShadowBlot.prototype.detach = function () {
  4911. if (this.parent != null)
  4912. this.parent.removeChild(this);
  4913. // @ts-ignore
  4914. delete this.domNode[Registry.DATA_KEY];
  4915. };
  4916. ShadowBlot.prototype.deleteAt = function (index, length) {
  4917. var blot = this.isolate(index, length);
  4918. blot.remove();
  4919. };
  4920. ShadowBlot.prototype.formatAt = function (index, length, name, value) {
  4921. var blot = this.isolate(index, length);
  4922. if (Registry.query(name, Registry.Scope.BLOT) != null && value) {
  4923. blot.wrap(name, value);
  4924. }
  4925. else if (Registry.query(name, Registry.Scope.ATTRIBUTE) != null) {
  4926. var parent = Registry.create(this.statics.scope);
  4927. blot.wrap(parent);
  4928. parent.format(name, value);
  4929. }
  4930. };
  4931. ShadowBlot.prototype.insertAt = function (index, value, def) {
  4932. var blot = def == null ? Registry.create('text', value) : Registry.create(value, def);
  4933. var ref = this.split(index);
  4934. this.parent.insertBefore(blot, ref);
  4935. };
  4936. ShadowBlot.prototype.insertInto = function (parentBlot, refBlot) {
  4937. if (refBlot === void 0) { refBlot = null; }
  4938. if (this.parent != null) {
  4939. this.parent.children.remove(this);
  4940. }
  4941. var refDomNode = null;
  4942. parentBlot.children.insertBefore(this, refBlot);
  4943. if (refBlot != null) {
  4944. refDomNode = refBlot.domNode;
  4945. }
  4946. if (this.domNode.parentNode != parentBlot.domNode ||
  4947. this.domNode.nextSibling != refDomNode) {
  4948. parentBlot.domNode.insertBefore(this.domNode, refDomNode);
  4949. }
  4950. this.parent = parentBlot;
  4951. this.attach();
  4952. };
  4953. ShadowBlot.prototype.isolate = function (index, length) {
  4954. var target = this.split(index);
  4955. target.split(length);
  4956. return target;
  4957. };
  4958. ShadowBlot.prototype.length = function () {
  4959. return 1;
  4960. };
  4961. ShadowBlot.prototype.offset = function (root) {
  4962. if (root === void 0) { root = this.parent; }
  4963. if (this.parent == null || this == root)
  4964. return 0;
  4965. return this.parent.children.offset(this) + this.parent.offset(root);
  4966. };
  4967. ShadowBlot.prototype.optimize = function (context) {
  4968. // TODO clean up once we use WeakMap
  4969. // @ts-ignore
  4970. if (this.domNode[Registry.DATA_KEY] != null) {
  4971. // @ts-ignore
  4972. delete this.domNode[Registry.DATA_KEY].mutations;
  4973. }
  4974. };
  4975. ShadowBlot.prototype.remove = function () {
  4976. if (this.domNode.parentNode != null) {
  4977. this.domNode.parentNode.removeChild(this.domNode);
  4978. }
  4979. this.detach();
  4980. };
  4981. ShadowBlot.prototype.replace = function (target) {
  4982. if (target.parent == null)
  4983. return;
  4984. target.parent.insertBefore(this, target.next);
  4985. target.remove();
  4986. };
  4987. ShadowBlot.prototype.replaceWith = function (name, value) {
  4988. var replacement = typeof name === 'string' ? Registry.create(name, value) : name;
  4989. replacement.replace(this);
  4990. return replacement;
  4991. };
  4992. ShadowBlot.prototype.split = function (index, force) {
  4993. return index === 0 ? this : this.next;
  4994. };
  4995. ShadowBlot.prototype.update = function (mutations, context) {
  4996. // Nothing to do by default
  4997. };
  4998. ShadowBlot.prototype.wrap = function (name, value) {
  4999. var wrapper = typeof name === 'string' ? Registry.create(name, value) : name;
  5000. if (this.parent != null) {
  5001. this.parent.insertBefore(wrapper, this.next);
  5002. }
  5003. wrapper.appendChild(this);
  5004. return wrapper;
  5005. };
  5006. ShadowBlot.blotName = 'abstract';
  5007. return ShadowBlot;
  5008. }());
  5009. exports.default = ShadowBlot;
  5010. /***/ }),
  5011. /* 31 */
  5012. /***/ (function(module, exports, __webpack_require__) {
  5013. "use strict";
  5014. Object.defineProperty(exports, "__esModule", { value: true });
  5015. var attributor_1 = __webpack_require__(12);
  5016. var class_1 = __webpack_require__(32);
  5017. var style_1 = __webpack_require__(33);
  5018. var Registry = __webpack_require__(1);
  5019. var AttributorStore = /** @class */ (function () {
  5020. function AttributorStore(domNode) {
  5021. this.attributes = {};
  5022. this.domNode = domNode;
  5023. this.build();
  5024. }
  5025. AttributorStore.prototype.attribute = function (attribute, value) {
  5026. // verb
  5027. if (value) {
  5028. if (attribute.add(this.domNode, value)) {
  5029. if (attribute.value(this.domNode) != null) {
  5030. this.attributes[attribute.attrName] = attribute;
  5031. }
  5032. else {
  5033. delete this.attributes[attribute.attrName];
  5034. }
  5035. }
  5036. }
  5037. else {
  5038. attribute.remove(this.domNode);
  5039. delete this.attributes[attribute.attrName];
  5040. }
  5041. };
  5042. AttributorStore.prototype.build = function () {
  5043. var _this = this;
  5044. this.attributes = {};
  5045. var attributes = attributor_1.default.keys(this.domNode);
  5046. var classes = class_1.default.keys(this.domNode);
  5047. var styles = style_1.default.keys(this.domNode);
  5048. attributes
  5049. .concat(classes)
  5050. .concat(styles)
  5051. .forEach(function (name) {
  5052. var attr = Registry.query(name, Registry.Scope.ATTRIBUTE);
  5053. if (attr instanceof attributor_1.default) {
  5054. _this.attributes[attr.attrName] = attr;
  5055. }
  5056. });
  5057. };
  5058. AttributorStore.prototype.copy = function (target) {
  5059. var _this = this;
  5060. Object.keys(this.attributes).forEach(function (key) {
  5061. var value = _this.attributes[key].value(_this.domNode);
  5062. target.format(key, value);
  5063. });
  5064. };
  5065. AttributorStore.prototype.move = function (target) {
  5066. var _this = this;
  5067. this.copy(target);
  5068. Object.keys(this.attributes).forEach(function (key) {
  5069. _this.attributes[key].remove(_this.domNode);
  5070. });
  5071. this.attributes = {};
  5072. };
  5073. AttributorStore.prototype.values = function () {
  5074. var _this = this;
  5075. return Object.keys(this.attributes).reduce(function (attributes, name) {
  5076. attributes[name] = _this.attributes[name].value(_this.domNode);
  5077. return attributes;
  5078. }, {});
  5079. };
  5080. return AttributorStore;
  5081. }());
  5082. exports.default = AttributorStore;
  5083. /***/ }),
  5084. /* 32 */
  5085. /***/ (function(module, exports, __webpack_require__) {
  5086. "use strict";
  5087. var __extends = (this && this.__extends) || (function () {
  5088. var extendStatics = Object.setPrototypeOf ||
  5089. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  5090. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  5091. return function (d, b) {
  5092. extendStatics(d, b);
  5093. function __() { this.constructor = d; }
  5094. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  5095. };
  5096. })();
  5097. Object.defineProperty(exports, "__esModule", { value: true });
  5098. var attributor_1 = __webpack_require__(12);
  5099. function match(node, prefix) {
  5100. var className = node.getAttribute('class') || '';
  5101. return className.split(/\s+/).filter(function (name) {
  5102. return name.indexOf(prefix + "-") === 0;
  5103. });
  5104. }
  5105. var ClassAttributor = /** @class */ (function (_super) {
  5106. __extends(ClassAttributor, _super);
  5107. function ClassAttributor() {
  5108. return _super !== null && _super.apply(this, arguments) || this;
  5109. }
  5110. ClassAttributor.keys = function (node) {
  5111. return (node.getAttribute('class') || '').split(/\s+/).map(function (name) {
  5112. return name
  5113. .split('-')
  5114. .slice(0, -1)
  5115. .join('-');
  5116. });
  5117. };
  5118. ClassAttributor.prototype.add = function (node, value) {
  5119. if (!this.canAdd(node, value))
  5120. return false;
  5121. this.remove(node);
  5122. node.classList.add(this.keyName + "-" + value);
  5123. return true;
  5124. };
  5125. ClassAttributor.prototype.remove = function (node) {
  5126. var matches = match(node, this.keyName);
  5127. matches.forEach(function (name) {
  5128. node.classList.remove(name);
  5129. });
  5130. if (node.classList.length === 0) {
  5131. node.removeAttribute('class');
  5132. }
  5133. };
  5134. ClassAttributor.prototype.value = function (node) {
  5135. var result = match(node, this.keyName)[0] || '';
  5136. var value = result.slice(this.keyName.length + 1); // +1 for hyphen
  5137. return this.canAdd(node, value) ? value : '';
  5138. };
  5139. return ClassAttributor;
  5140. }(attributor_1.default));
  5141. exports.default = ClassAttributor;
  5142. /***/ }),
  5143. /* 33 */
  5144. /***/ (function(module, exports, __webpack_require__) {
  5145. "use strict";
  5146. var __extends = (this && this.__extends) || (function () {
  5147. var extendStatics = Object.setPrototypeOf ||
  5148. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  5149. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  5150. return function (d, b) {
  5151. extendStatics(d, b);
  5152. function __() { this.constructor = d; }
  5153. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  5154. };
  5155. })();
  5156. Object.defineProperty(exports, "__esModule", { value: true });
  5157. var attributor_1 = __webpack_require__(12);
  5158. function camelize(name) {
  5159. var parts = name.split('-');
  5160. var rest = parts
  5161. .slice(1)
  5162. .map(function (part) {
  5163. return part[0].toUpperCase() + part.slice(1);
  5164. })
  5165. .join('');
  5166. return parts[0] + rest;
  5167. }
  5168. var StyleAttributor = /** @class */ (function (_super) {
  5169. __extends(StyleAttributor, _super);
  5170. function StyleAttributor() {
  5171. return _super !== null && _super.apply(this, arguments) || this;
  5172. }
  5173. StyleAttributor.keys = function (node) {
  5174. return (node.getAttribute('style') || '').split(';').map(function (value) {
  5175. var arr = value.split(':');
  5176. return arr[0].trim();
  5177. });
  5178. };
  5179. StyleAttributor.prototype.add = function (node, value) {
  5180. if (!this.canAdd(node, value))
  5181. return false;
  5182. // @ts-ignore
  5183. node.style[camelize(this.keyName)] = value;
  5184. return true;
  5185. };
  5186. StyleAttributor.prototype.remove = function (node) {
  5187. // @ts-ignore
  5188. node.style[camelize(this.keyName)] = '';
  5189. if (!node.getAttribute('style')) {
  5190. node.removeAttribute('style');
  5191. }
  5192. };
  5193. StyleAttributor.prototype.value = function (node) {
  5194. // @ts-ignore
  5195. var value = node.style[camelize(this.keyName)];
  5196. return this.canAdd(node, value) ? value : '';
  5197. };
  5198. return StyleAttributor;
  5199. }(attributor_1.default));
  5200. exports.default = StyleAttributor;
  5201. /***/ }),
  5202. /* 34 */
  5203. /***/ (function(module, exports, __webpack_require__) {
  5204. "use strict";
  5205. Object.defineProperty(exports, "__esModule", {
  5206. value: true
  5207. });
  5208. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  5209. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5210. var Theme = function () {
  5211. function Theme(quill, options) {
  5212. _classCallCheck(this, Theme);
  5213. this.quill = quill;
  5214. this.options = options;
  5215. this.modules = {};
  5216. }
  5217. _createClass(Theme, [{
  5218. key: 'init',
  5219. value: function init() {
  5220. var _this = this;
  5221. Object.keys(this.options.modules).forEach(function (name) {
  5222. if (_this.modules[name] == null) {
  5223. _this.addModule(name);
  5224. }
  5225. });
  5226. }
  5227. }, {
  5228. key: 'addModule',
  5229. value: function addModule(name) {
  5230. var moduleClass = this.quill.constructor.import('modules/' + name);
  5231. this.modules[name] = new moduleClass(this.quill, this.options.modules[name] || {});
  5232. return this.modules[name];
  5233. }
  5234. }]);
  5235. return Theme;
  5236. }();
  5237. Theme.DEFAULTS = {
  5238. modules: {}
  5239. };
  5240. Theme.themes = {
  5241. 'default': Theme
  5242. };
  5243. exports.default = Theme;
  5244. /***/ }),
  5245. /* 35 */
  5246. /***/ (function(module, exports, __webpack_require__) {
  5247. "use strict";
  5248. Object.defineProperty(exports, "__esModule", {
  5249. value: true
  5250. });
  5251. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  5252. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  5253. var _parchment = __webpack_require__(0);
  5254. var _parchment2 = _interopRequireDefault(_parchment);
  5255. var _text = __webpack_require__(7);
  5256. var _text2 = _interopRequireDefault(_text);
  5257. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5258. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5259. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  5260. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  5261. var GUARD_TEXT = '\uFEFF';
  5262. var Embed = function (_Parchment$Embed) {
  5263. _inherits(Embed, _Parchment$Embed);
  5264. function Embed(node) {
  5265. _classCallCheck(this, Embed);
  5266. var _this = _possibleConstructorReturn(this, (Embed.__proto__ || Object.getPrototypeOf(Embed)).call(this, node));
  5267. _this.contentNode = document.createElement('span');
  5268. _this.contentNode.setAttribute('contenteditable', false);
  5269. [].slice.call(_this.domNode.childNodes).forEach(function (childNode) {
  5270. _this.contentNode.appendChild(childNode);
  5271. });
  5272. _this.leftGuard = document.createTextNode(GUARD_TEXT);
  5273. _this.rightGuard = document.createTextNode(GUARD_TEXT);
  5274. _this.domNode.appendChild(_this.leftGuard);
  5275. _this.domNode.appendChild(_this.contentNode);
  5276. _this.domNode.appendChild(_this.rightGuard);
  5277. return _this;
  5278. }
  5279. _createClass(Embed, [{
  5280. key: 'index',
  5281. value: function index(node, offset) {
  5282. if (node === this.leftGuard) return 0;
  5283. if (node === this.rightGuard) return 1;
  5284. return _get(Embed.prototype.__proto__ || Object.getPrototypeOf(Embed.prototype), 'index', this).call(this, node, offset);
  5285. }
  5286. }, {
  5287. key: 'restore',
  5288. value: function restore(node) {
  5289. var range = void 0,
  5290. textNode = void 0;
  5291. var text = node.data.split(GUARD_TEXT).join('');
  5292. if (node === this.leftGuard) {
  5293. if (this.prev instanceof _text2.default) {
  5294. var prevLength = this.prev.length();
  5295. this.prev.insertAt(prevLength, text);
  5296. range = {
  5297. startNode: this.prev.domNode,
  5298. startOffset: prevLength + text.length
  5299. };
  5300. } else {
  5301. textNode = document.createTextNode(text);
  5302. this.parent.insertBefore(_parchment2.default.create(textNode), this);
  5303. range = {
  5304. startNode: textNode,
  5305. startOffset: text.length
  5306. };
  5307. }
  5308. } else if (node === this.rightGuard) {
  5309. if (this.next instanceof _text2.default) {
  5310. this.next.insertAt(0, text);
  5311. range = {
  5312. startNode: this.next.domNode,
  5313. startOffset: text.length
  5314. };
  5315. } else {
  5316. textNode = document.createTextNode(text);
  5317. this.parent.insertBefore(_parchment2.default.create(textNode), this.next);
  5318. range = {
  5319. startNode: textNode,
  5320. startOffset: text.length
  5321. };
  5322. }
  5323. }
  5324. node.data = GUARD_TEXT;
  5325. return range;
  5326. }
  5327. }, {
  5328. key: 'update',
  5329. value: function update(mutations, context) {
  5330. var _this2 = this;
  5331. mutations.forEach(function (mutation) {
  5332. if (mutation.type === 'characterData' && (mutation.target === _this2.leftGuard || mutation.target === _this2.rightGuard)) {
  5333. var range = _this2.restore(mutation.target);
  5334. if (range) context.range = range;
  5335. }
  5336. });
  5337. }
  5338. }]);
  5339. return Embed;
  5340. }(_parchment2.default.Embed);
  5341. exports.default = Embed;
  5342. /***/ }),
  5343. /* 36 */
  5344. /***/ (function(module, exports, __webpack_require__) {
  5345. "use strict";
  5346. Object.defineProperty(exports, "__esModule", {
  5347. value: true
  5348. });
  5349. exports.AlignStyle = exports.AlignClass = exports.AlignAttribute = undefined;
  5350. var _parchment = __webpack_require__(0);
  5351. var _parchment2 = _interopRequireDefault(_parchment);
  5352. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5353. var config = {
  5354. scope: _parchment2.default.Scope.BLOCK,
  5355. whitelist: ['right', 'center', 'justify']
  5356. };
  5357. var AlignAttribute = new _parchment2.default.Attributor.Attribute('align', 'align', config);
  5358. var AlignClass = new _parchment2.default.Attributor.Class('align', 'ql-align', config);
  5359. var AlignStyle = new _parchment2.default.Attributor.Style('align', 'text-align', config);
  5360. exports.AlignAttribute = AlignAttribute;
  5361. exports.AlignClass = AlignClass;
  5362. exports.AlignStyle = AlignStyle;
  5363. /***/ }),
  5364. /* 37 */
  5365. /***/ (function(module, exports, __webpack_require__) {
  5366. "use strict";
  5367. Object.defineProperty(exports, "__esModule", {
  5368. value: true
  5369. });
  5370. exports.BackgroundStyle = exports.BackgroundClass = undefined;
  5371. var _parchment = __webpack_require__(0);
  5372. var _parchment2 = _interopRequireDefault(_parchment);
  5373. var _color = __webpack_require__(26);
  5374. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5375. var BackgroundClass = new _parchment2.default.Attributor.Class('background', 'ql-bg', {
  5376. scope: _parchment2.default.Scope.INLINE
  5377. });
  5378. var BackgroundStyle = new _color.ColorAttributor('background', 'background-color', {
  5379. scope: _parchment2.default.Scope.INLINE
  5380. });
  5381. exports.BackgroundClass = BackgroundClass;
  5382. exports.BackgroundStyle = BackgroundStyle;
  5383. /***/ }),
  5384. /* 38 */
  5385. /***/ (function(module, exports, __webpack_require__) {
  5386. "use strict";
  5387. Object.defineProperty(exports, "__esModule", {
  5388. value: true
  5389. });
  5390. exports.DirectionStyle = exports.DirectionClass = exports.DirectionAttribute = undefined;
  5391. var _parchment = __webpack_require__(0);
  5392. var _parchment2 = _interopRequireDefault(_parchment);
  5393. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5394. var config = {
  5395. scope: _parchment2.default.Scope.BLOCK,
  5396. whitelist: ['rtl']
  5397. };
  5398. var DirectionAttribute = new _parchment2.default.Attributor.Attribute('direction', 'dir', config);
  5399. var DirectionClass = new _parchment2.default.Attributor.Class('direction', 'ql-direction', config);
  5400. var DirectionStyle = new _parchment2.default.Attributor.Style('direction', 'direction', config);
  5401. exports.DirectionAttribute = DirectionAttribute;
  5402. exports.DirectionClass = DirectionClass;
  5403. exports.DirectionStyle = DirectionStyle;
  5404. /***/ }),
  5405. /* 39 */
  5406. /***/ (function(module, exports, __webpack_require__) {
  5407. "use strict";
  5408. Object.defineProperty(exports, "__esModule", {
  5409. value: true
  5410. });
  5411. exports.FontClass = exports.FontStyle = undefined;
  5412. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  5413. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  5414. var _parchment = __webpack_require__(0);
  5415. var _parchment2 = _interopRequireDefault(_parchment);
  5416. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5417. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5418. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  5419. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  5420. var config = {
  5421. scope: _parchment2.default.Scope.INLINE,
  5422. whitelist: ['serif', 'monospace']
  5423. };
  5424. var FontClass = new _parchment2.default.Attributor.Class('font', 'ql-font', config);
  5425. var FontStyleAttributor = function (_Parchment$Attributor) {
  5426. _inherits(FontStyleAttributor, _Parchment$Attributor);
  5427. function FontStyleAttributor() {
  5428. _classCallCheck(this, FontStyleAttributor);
  5429. return _possibleConstructorReturn(this, (FontStyleAttributor.__proto__ || Object.getPrototypeOf(FontStyleAttributor)).apply(this, arguments));
  5430. }
  5431. _createClass(FontStyleAttributor, [{
  5432. key: 'value',
  5433. value: function value(node) {
  5434. return _get(FontStyleAttributor.prototype.__proto__ || Object.getPrototypeOf(FontStyleAttributor.prototype), 'value', this).call(this, node).replace(/["']/g, '');
  5435. }
  5436. }]);
  5437. return FontStyleAttributor;
  5438. }(_parchment2.default.Attributor.Style);
  5439. var FontStyle = new FontStyleAttributor('font', 'font-family', config);
  5440. exports.FontStyle = FontStyle;
  5441. exports.FontClass = FontClass;
  5442. /***/ }),
  5443. /* 40 */
  5444. /***/ (function(module, exports, __webpack_require__) {
  5445. "use strict";
  5446. Object.defineProperty(exports, "__esModule", {
  5447. value: true
  5448. });
  5449. exports.SizeStyle = exports.SizeClass = undefined;
  5450. var _parchment = __webpack_require__(0);
  5451. var _parchment2 = _interopRequireDefault(_parchment);
  5452. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5453. var SizeClass = new _parchment2.default.Attributor.Class('size', 'ql-size', {
  5454. scope: _parchment2.default.Scope.INLINE,
  5455. whitelist: ['small', 'large', 'huge']
  5456. });
  5457. var SizeStyle = new _parchment2.default.Attributor.Style('size', 'font-size', {
  5458. scope: _parchment2.default.Scope.INLINE,
  5459. whitelist: ['10px', '18px', '32px']
  5460. });
  5461. exports.SizeClass = SizeClass;
  5462. exports.SizeStyle = SizeStyle;
  5463. /***/ }),
  5464. /* 41 */
  5465. /***/ (function(module, exports, __webpack_require__) {
  5466. "use strict";
  5467. module.exports = {
  5468. 'align': {
  5469. '': __webpack_require__(76),
  5470. 'center': __webpack_require__(77),
  5471. 'right': __webpack_require__(78),
  5472. 'justify': __webpack_require__(79)
  5473. },
  5474. 'background': __webpack_require__(80),
  5475. 'blockquote': __webpack_require__(81),
  5476. 'bold': __webpack_require__(82),
  5477. 'clean': __webpack_require__(83),
  5478. 'code': __webpack_require__(58),
  5479. 'code-block': __webpack_require__(58),
  5480. 'color': __webpack_require__(84),
  5481. 'direction': {
  5482. '': __webpack_require__(85),
  5483. 'rtl': __webpack_require__(86)
  5484. },
  5485. 'float': {
  5486. 'center': __webpack_require__(87),
  5487. 'full': __webpack_require__(88),
  5488. 'left': __webpack_require__(89),
  5489. 'right': __webpack_require__(90)
  5490. },
  5491. 'formula': __webpack_require__(91),
  5492. 'header': {
  5493. '1': __webpack_require__(92),
  5494. '2': __webpack_require__(93)
  5495. },
  5496. 'italic': __webpack_require__(94),
  5497. 'image': __webpack_require__(95),
  5498. 'indent': {
  5499. '+1': __webpack_require__(96),
  5500. '-1': __webpack_require__(97)
  5501. },
  5502. 'link': __webpack_require__(98),
  5503. 'list': {
  5504. 'ordered': __webpack_require__(99),
  5505. 'bullet': __webpack_require__(100),
  5506. 'check': __webpack_require__(101)
  5507. },
  5508. 'script': {
  5509. 'sub': __webpack_require__(102),
  5510. 'super': __webpack_require__(103)
  5511. },
  5512. 'strike': __webpack_require__(104),
  5513. 'underline': __webpack_require__(105),
  5514. 'video': __webpack_require__(106)
  5515. };
  5516. /***/ }),
  5517. /* 42 */
  5518. /***/ (function(module, exports, __webpack_require__) {
  5519. "use strict";
  5520. Object.defineProperty(exports, "__esModule", {
  5521. value: true
  5522. });
  5523. exports.getLastChangeIndex = exports.default = undefined;
  5524. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  5525. var _parchment = __webpack_require__(0);
  5526. var _parchment2 = _interopRequireDefault(_parchment);
  5527. var _quill = __webpack_require__(5);
  5528. var _quill2 = _interopRequireDefault(_quill);
  5529. var _module = __webpack_require__(9);
  5530. var _module2 = _interopRequireDefault(_module);
  5531. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5532. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5533. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  5534. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  5535. var History = function (_Module) {
  5536. _inherits(History, _Module);
  5537. function History(quill, options) {
  5538. _classCallCheck(this, History);
  5539. var _this = _possibleConstructorReturn(this, (History.__proto__ || Object.getPrototypeOf(History)).call(this, quill, options));
  5540. _this.lastRecorded = 0;
  5541. _this.ignoreChange = false;
  5542. _this.clear();
  5543. _this.quill.on(_quill2.default.events.EDITOR_CHANGE, function (eventName, delta, oldDelta, source) {
  5544. if (eventName !== _quill2.default.events.TEXT_CHANGE || _this.ignoreChange) return;
  5545. if (!_this.options.userOnly || source === _quill2.default.sources.USER) {
  5546. _this.record(delta, oldDelta);
  5547. } else {
  5548. _this.transform(delta);
  5549. }
  5550. });
  5551. _this.quill.keyboard.addBinding({ key: 'Z', shortKey: true }, _this.undo.bind(_this));
  5552. _this.quill.keyboard.addBinding({ key: 'Z', shortKey: true, shiftKey: true }, _this.redo.bind(_this));
  5553. if (/Win/i.test(navigator.platform)) {
  5554. _this.quill.keyboard.addBinding({ key: 'Y', shortKey: true }, _this.redo.bind(_this));
  5555. }
  5556. return _this;
  5557. }
  5558. _createClass(History, [{
  5559. key: 'change',
  5560. value: function change(source, dest) {
  5561. if (this.stack[source].length === 0) return;
  5562. var delta = this.stack[source].pop();
  5563. this.stack[dest].push(delta);
  5564. this.lastRecorded = 0;
  5565. this.ignoreChange = true;
  5566. this.quill.updateContents(delta[source], _quill2.default.sources.USER);
  5567. this.ignoreChange = false;
  5568. var index = getLastChangeIndex(delta[source]);
  5569. this.quill.setSelection(index);
  5570. }
  5571. }, {
  5572. key: 'clear',
  5573. value: function clear() {
  5574. this.stack = { undo: [], redo: [] };
  5575. }
  5576. }, {
  5577. key: 'cutoff',
  5578. value: function cutoff() {
  5579. this.lastRecorded = 0;
  5580. }
  5581. }, {
  5582. key: 'record',
  5583. value: function record(changeDelta, oldDelta) {
  5584. if (changeDelta.ops.length === 0) return;
  5585. this.stack.redo = [];
  5586. var undoDelta = this.quill.getContents().diff(oldDelta);
  5587. var timestamp = Date.now();
  5588. if (this.lastRecorded + this.options.delay > timestamp && this.stack.undo.length > 0) {
  5589. var delta = this.stack.undo.pop();
  5590. undoDelta = undoDelta.compose(delta.undo);
  5591. changeDelta = delta.redo.compose(changeDelta);
  5592. } else {
  5593. this.lastRecorded = timestamp;
  5594. }
  5595. this.stack.undo.push({
  5596. redo: changeDelta,
  5597. undo: undoDelta
  5598. });
  5599. if (this.stack.undo.length > this.options.maxStack) {
  5600. this.stack.undo.shift();
  5601. }
  5602. }
  5603. }, {
  5604. key: 'redo',
  5605. value: function redo() {
  5606. this.change('redo', 'undo');
  5607. }
  5608. }, {
  5609. key: 'transform',
  5610. value: function transform(delta) {
  5611. this.stack.undo.forEach(function (change) {
  5612. change.undo = delta.transform(change.undo, true);
  5613. change.redo = delta.transform(change.redo, true);
  5614. });
  5615. this.stack.redo.forEach(function (change) {
  5616. change.undo = delta.transform(change.undo, true);
  5617. change.redo = delta.transform(change.redo, true);
  5618. });
  5619. }
  5620. }, {
  5621. key: 'undo',
  5622. value: function undo() {
  5623. this.change('undo', 'redo');
  5624. }
  5625. }]);
  5626. return History;
  5627. }(_module2.default);
  5628. History.DEFAULTS = {
  5629. delay: 1000,
  5630. maxStack: 100,
  5631. userOnly: false
  5632. };
  5633. function endsWithNewlineChange(delta) {
  5634. var lastOp = delta.ops[delta.ops.length - 1];
  5635. if (lastOp == null) return false;
  5636. if (lastOp.insert != null) {
  5637. return typeof lastOp.insert === 'string' && lastOp.insert.endsWith('\n');
  5638. }
  5639. if (lastOp.attributes != null) {
  5640. return Object.keys(lastOp.attributes).some(function (attr) {
  5641. return _parchment2.default.query(attr, _parchment2.default.Scope.BLOCK) != null;
  5642. });
  5643. }
  5644. return false;
  5645. }
  5646. function getLastChangeIndex(delta) {
  5647. var deleteLength = delta.reduce(function (length, op) {
  5648. length += op.delete || 0;
  5649. return length;
  5650. }, 0);
  5651. var changeIndex = delta.length() - deleteLength;
  5652. if (endsWithNewlineChange(delta)) {
  5653. changeIndex -= 1;
  5654. }
  5655. return changeIndex;
  5656. }
  5657. exports.default = History;
  5658. exports.getLastChangeIndex = getLastChangeIndex;
  5659. /***/ }),
  5660. /* 43 */
  5661. /***/ (function(module, exports, __webpack_require__) {
  5662. "use strict";
  5663. Object.defineProperty(exports, "__esModule", {
  5664. value: true
  5665. });
  5666. exports.default = exports.BaseTooltip = undefined;
  5667. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  5668. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  5669. var _extend = __webpack_require__(3);
  5670. var _extend2 = _interopRequireDefault(_extend);
  5671. var _quillDelta = __webpack_require__(2);
  5672. var _quillDelta2 = _interopRequireDefault(_quillDelta);
  5673. var _emitter = __webpack_require__(8);
  5674. var _emitter2 = _interopRequireDefault(_emitter);
  5675. var _keyboard = __webpack_require__(23);
  5676. var _keyboard2 = _interopRequireDefault(_keyboard);
  5677. var _theme = __webpack_require__(34);
  5678. var _theme2 = _interopRequireDefault(_theme);
  5679. var _colorPicker = __webpack_require__(59);
  5680. var _colorPicker2 = _interopRequireDefault(_colorPicker);
  5681. var _iconPicker = __webpack_require__(60);
  5682. var _iconPicker2 = _interopRequireDefault(_iconPicker);
  5683. var _picker = __webpack_require__(28);
  5684. var _picker2 = _interopRequireDefault(_picker);
  5685. var _tooltip = __webpack_require__(61);
  5686. var _tooltip2 = _interopRequireDefault(_tooltip);
  5687. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5688. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5689. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  5690. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  5691. var ALIGNS = [false, 'center', 'right', 'justify'];
  5692. var COLORS = ["#000000", "#e60000", "#ff9900", "#ffff00", "#008a00", "#0066cc", "#9933ff", "#ffffff", "#facccc", "#ffebcc", "#ffffcc", "#cce8cc", "#cce0f5", "#ebd6ff", "#bbbbbb", "#f06666", "#ffc266", "#ffff66", "#66b966", "#66a3e0", "#c285ff", "#888888", "#a10000", "#b26b00", "#b2b200", "#006100", "#0047b2", "#6b24b2", "#444444", "#5c0000", "#663d00", "#666600", "#003700", "#002966", "#3d1466"];
  5693. var FONTS = [false, 'serif', 'monospace'];
  5694. var HEADERS = ['1', '2', '3', false];
  5695. var SIZES = ['small', false, 'large', 'huge'];
  5696. var BaseTheme = function (_Theme) {
  5697. _inherits(BaseTheme, _Theme);
  5698. function BaseTheme(quill, options) {
  5699. _classCallCheck(this, BaseTheme);
  5700. var _this = _possibleConstructorReturn(this, (BaseTheme.__proto__ || Object.getPrototypeOf(BaseTheme)).call(this, quill, options));
  5701. var listener = function listener(e) {
  5702. if (!document.body.contains(quill.root)) {
  5703. return document.body.removeEventListener('click', listener);
  5704. }
  5705. if (_this.tooltip != null && !_this.tooltip.root.contains(e.target) && document.activeElement !== _this.tooltip.textbox && !_this.quill.hasFocus()) {
  5706. _this.tooltip.hide();
  5707. }
  5708. if (_this.pickers != null) {
  5709. _this.pickers.forEach(function (picker) {
  5710. if (!picker.container.contains(e.target)) {
  5711. picker.close();
  5712. }
  5713. });
  5714. }
  5715. };
  5716. quill.emitter.listenDOM('click', document.body, listener);
  5717. return _this;
  5718. }
  5719. _createClass(BaseTheme, [{
  5720. key: 'addModule',
  5721. value: function addModule(name) {
  5722. var module = _get(BaseTheme.prototype.__proto__ || Object.getPrototypeOf(BaseTheme.prototype), 'addModule', this).call(this, name);
  5723. if (name === 'toolbar') {
  5724. this.extendToolbar(module);
  5725. }
  5726. return module;
  5727. }
  5728. }, {
  5729. key: 'buildButtons',
  5730. value: function buildButtons(buttons, icons) {
  5731. buttons.forEach(function (button) {
  5732. var className = button.getAttribute('class') || '';
  5733. className.split(/\s+/).forEach(function (name) {
  5734. if (!name.startsWith('ql-')) return;
  5735. name = name.slice('ql-'.length);
  5736. if (icons[name] == null) return;
  5737. if (name === 'direction') {
  5738. button.innerHTML = icons[name][''] + icons[name]['rtl'];
  5739. } else if (typeof icons[name] === 'string') {
  5740. button.innerHTML = icons[name];
  5741. } else {
  5742. var value = button.value || '';
  5743. if (value != null && icons[name][value]) {
  5744. button.innerHTML = icons[name][value];
  5745. }
  5746. }
  5747. });
  5748. });
  5749. }
  5750. }, {
  5751. key: 'buildPickers',
  5752. value: function buildPickers(selects, icons) {
  5753. var _this2 = this;
  5754. this.pickers = selects.map(function (select) {
  5755. if (select.classList.contains('ql-align')) {
  5756. if (select.querySelector('option') == null) {
  5757. fillSelect(select, ALIGNS);
  5758. }
  5759. return new _iconPicker2.default(select, icons.align);
  5760. } else if (select.classList.contains('ql-background') || select.classList.contains('ql-color')) {
  5761. var format = select.classList.contains('ql-background') ? 'background' : 'color';
  5762. if (select.querySelector('option') == null) {
  5763. fillSelect(select, COLORS, format === 'background' ? '#ffffff' : '#000000');
  5764. }
  5765. return new _colorPicker2.default(select, icons[format]);
  5766. } else {
  5767. if (select.querySelector('option') == null) {
  5768. if (select.classList.contains('ql-font')) {
  5769. fillSelect(select, FONTS);
  5770. } else if (select.classList.contains('ql-header')) {
  5771. fillSelect(select, HEADERS);
  5772. } else if (select.classList.contains('ql-size')) {
  5773. fillSelect(select, SIZES);
  5774. }
  5775. }
  5776. return new _picker2.default(select);
  5777. }
  5778. });
  5779. var update = function update() {
  5780. _this2.pickers.forEach(function (picker) {
  5781. picker.update();
  5782. });
  5783. };
  5784. this.quill.on(_emitter2.default.events.EDITOR_CHANGE, update);
  5785. }
  5786. }]);
  5787. return BaseTheme;
  5788. }(_theme2.default);
  5789. BaseTheme.DEFAULTS = (0, _extend2.default)(true, {}, _theme2.default.DEFAULTS, {
  5790. modules: {
  5791. toolbar: {
  5792. handlers: {
  5793. formula: function formula() {
  5794. this.quill.theme.tooltip.edit('formula');
  5795. },
  5796. image: function image() {
  5797. var _this3 = this;
  5798. var fileInput = this.container.querySelector('input.ql-image[type=file]');
  5799. if (fileInput == null) {
  5800. fileInput = document.createElement('input');
  5801. fileInput.setAttribute('type', 'file');
  5802. fileInput.setAttribute('accept', 'image/png, image/gif, image/jpeg, image/bmp, image/x-icon');
  5803. fileInput.classList.add('ql-image');
  5804. fileInput.addEventListener('change', function () {
  5805. if (fileInput.files != null && fileInput.files[0] != null) {
  5806. var reader = new FileReader();
  5807. reader.onload = function (e) {
  5808. var range = _this3.quill.getSelection(true);
  5809. _this3.quill.updateContents(new _quillDelta2.default().retain(range.index).delete(range.length).insert({ image: e.target.result }), _emitter2.default.sources.USER);
  5810. _this3.quill.setSelection(range.index + 1, _emitter2.default.sources.SILENT);
  5811. fileInput.value = "";
  5812. };
  5813. reader.readAsDataURL(fileInput.files[0]);
  5814. }
  5815. });
  5816. this.container.appendChild(fileInput);
  5817. }
  5818. fileInput.click();
  5819. },
  5820. video: function video() {
  5821. this.quill.theme.tooltip.edit('video');
  5822. }
  5823. }
  5824. }
  5825. }
  5826. });
  5827. var BaseTooltip = function (_Tooltip) {
  5828. _inherits(BaseTooltip, _Tooltip);
  5829. function BaseTooltip(quill, boundsContainer) {
  5830. _classCallCheck(this, BaseTooltip);
  5831. var _this4 = _possibleConstructorReturn(this, (BaseTooltip.__proto__ || Object.getPrototypeOf(BaseTooltip)).call(this, quill, boundsContainer));
  5832. _this4.textbox = _this4.root.querySelector('input[type="text"]');
  5833. _this4.listen();
  5834. return _this4;
  5835. }
  5836. _createClass(BaseTooltip, [{
  5837. key: 'listen',
  5838. value: function listen() {
  5839. var _this5 = this;
  5840. this.textbox.addEventListener('keydown', function (event) {
  5841. if (_keyboard2.default.match(event, 'enter')) {
  5842. _this5.save();
  5843. event.preventDefault();
  5844. } else if (_keyboard2.default.match(event, 'escape')) {
  5845. _this5.cancel();
  5846. event.preventDefault();
  5847. }
  5848. });
  5849. }
  5850. }, {
  5851. key: 'cancel',
  5852. value: function cancel() {
  5853. this.hide();
  5854. }
  5855. }, {
  5856. key: 'edit',
  5857. value: function edit() {
  5858. var mode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'link';
  5859. var preview = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  5860. this.root.classList.remove('ql-hidden');
  5861. this.root.classList.add('ql-editing');
  5862. if (preview != null) {
  5863. this.textbox.value = preview;
  5864. } else if (mode !== this.root.getAttribute('data-mode')) {
  5865. this.textbox.value = '';
  5866. }
  5867. this.position(this.quill.getBounds(this.quill.selection.savedRange));
  5868. this.textbox.select();
  5869. this.textbox.setAttribute('placeholder', this.textbox.getAttribute('data-' + mode) || '');
  5870. this.root.setAttribute('data-mode', mode);
  5871. }
  5872. }, {
  5873. key: 'restoreFocus',
  5874. value: function restoreFocus() {
  5875. var scrollTop = this.quill.scrollingContainer.scrollTop;
  5876. this.quill.focus();
  5877. this.quill.scrollingContainer.scrollTop = scrollTop;
  5878. }
  5879. }, {
  5880. key: 'save',
  5881. value: function save() {
  5882. var value = this.textbox.value;
  5883. switch (this.root.getAttribute('data-mode')) {
  5884. case 'link':
  5885. {
  5886. var scrollTop = this.quill.root.scrollTop;
  5887. if (this.linkRange) {
  5888. this.quill.formatText(this.linkRange, 'link', value, _emitter2.default.sources.USER);
  5889. delete this.linkRange;
  5890. } else {
  5891. this.restoreFocus();
  5892. this.quill.format('link', value, _emitter2.default.sources.USER);
  5893. }
  5894. this.quill.root.scrollTop = scrollTop;
  5895. break;
  5896. }
  5897. case 'video':
  5898. {
  5899. value = extractVideoUrl(value);
  5900. } // eslint-disable-next-line no-fallthrough
  5901. case 'formula':
  5902. {
  5903. if (!value) break;
  5904. var range = this.quill.getSelection(true);
  5905. if (range != null) {
  5906. var index = range.index + range.length;
  5907. this.quill.insertEmbed(index, this.root.getAttribute('data-mode'), value, _emitter2.default.sources.USER);
  5908. if (this.root.getAttribute('data-mode') === 'formula') {
  5909. this.quill.insertText(index + 1, ' ', _emitter2.default.sources.USER);
  5910. }
  5911. this.quill.setSelection(index + 2, _emitter2.default.sources.USER);
  5912. }
  5913. break;
  5914. }
  5915. default:
  5916. }
  5917. this.textbox.value = '';
  5918. this.hide();
  5919. }
  5920. }]);
  5921. return BaseTooltip;
  5922. }(_tooltip2.default);
  5923. function extractVideoUrl(url) {
  5924. var match = url.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtube\.com\/watch.*v=([a-zA-Z0-9_-]+)/) || url.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtu\.be\/([a-zA-Z0-9_-]+)/);
  5925. if (match) {
  5926. return (match[1] || 'https') + '://www.youtube.com/embed/' + match[2] + '?showinfo=0';
  5927. }
  5928. if (match = url.match(/^(?:(https?):\/\/)?(?:www\.)?vimeo\.com\/(\d+)/)) {
  5929. // eslint-disable-line no-cond-assign
  5930. return (match[1] || 'https') + '://player.vimeo.com/video/' + match[2] + '/';
  5931. }
  5932. return url;
  5933. }
  5934. function fillSelect(select, values) {
  5935. var defaultValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  5936. values.forEach(function (value) {
  5937. var option = document.createElement('option');
  5938. if (value === defaultValue) {
  5939. option.setAttribute('selected', 'selected');
  5940. } else {
  5941. option.setAttribute('value', value);
  5942. }
  5943. select.appendChild(option);
  5944. });
  5945. }
  5946. exports.BaseTooltip = BaseTooltip;
  5947. exports.default = BaseTheme;
  5948. /***/ }),
  5949. /* 44 */
  5950. /***/ (function(module, exports, __webpack_require__) {
  5951. "use strict";
  5952. Object.defineProperty(exports, "__esModule", { value: true });
  5953. var LinkedList = /** @class */ (function () {
  5954. function LinkedList() {
  5955. this.head = this.tail = null;
  5956. this.length = 0;
  5957. }
  5958. LinkedList.prototype.append = function () {
  5959. var nodes = [];
  5960. for (var _i = 0; _i < arguments.length; _i++) {
  5961. nodes[_i] = arguments[_i];
  5962. }
  5963. this.insertBefore(nodes[0], null);
  5964. if (nodes.length > 1) {
  5965. this.append.apply(this, nodes.slice(1));
  5966. }
  5967. };
  5968. LinkedList.prototype.contains = function (node) {
  5969. var cur, next = this.iterator();
  5970. while ((cur = next())) {
  5971. if (cur === node)
  5972. return true;
  5973. }
  5974. return false;
  5975. };
  5976. LinkedList.prototype.insertBefore = function (node, refNode) {
  5977. if (!node)
  5978. return;
  5979. node.next = refNode;
  5980. if (refNode != null) {
  5981. node.prev = refNode.prev;
  5982. if (refNode.prev != null) {
  5983. refNode.prev.next = node;
  5984. }
  5985. refNode.prev = node;
  5986. if (refNode === this.head) {
  5987. this.head = node;
  5988. }
  5989. }
  5990. else if (this.tail != null) {
  5991. this.tail.next = node;
  5992. node.prev = this.tail;
  5993. this.tail = node;
  5994. }
  5995. else {
  5996. node.prev = null;
  5997. this.head = this.tail = node;
  5998. }
  5999. this.length += 1;
  6000. };
  6001. LinkedList.prototype.offset = function (target) {
  6002. var index = 0, cur = this.head;
  6003. while (cur != null) {
  6004. if (cur === target)
  6005. return index;
  6006. index += cur.length();
  6007. cur = cur.next;
  6008. }
  6009. return -1;
  6010. };
  6011. LinkedList.prototype.remove = function (node) {
  6012. if (!this.contains(node))
  6013. return;
  6014. if (node.prev != null)
  6015. node.prev.next = node.next;
  6016. if (node.next != null)
  6017. node.next.prev = node.prev;
  6018. if (node === this.head)
  6019. this.head = node.next;
  6020. if (node === this.tail)
  6021. this.tail = node.prev;
  6022. this.length -= 1;
  6023. };
  6024. LinkedList.prototype.iterator = function (curNode) {
  6025. if (curNode === void 0) { curNode = this.head; }
  6026. // TODO use yield when we can
  6027. return function () {
  6028. var ret = curNode;
  6029. if (curNode != null)
  6030. curNode = curNode.next;
  6031. return ret;
  6032. };
  6033. };
  6034. LinkedList.prototype.find = function (index, inclusive) {
  6035. if (inclusive === void 0) { inclusive = false; }
  6036. var cur, next = this.iterator();
  6037. while ((cur = next())) {
  6038. var length = cur.length();
  6039. if (index < length ||
  6040. (inclusive && index === length && (cur.next == null || cur.next.length() !== 0))) {
  6041. return [cur, index];
  6042. }
  6043. index -= length;
  6044. }
  6045. return [null, 0];
  6046. };
  6047. LinkedList.prototype.forEach = function (callback) {
  6048. var cur, next = this.iterator();
  6049. while ((cur = next())) {
  6050. callback(cur);
  6051. }
  6052. };
  6053. LinkedList.prototype.forEachAt = function (index, length, callback) {
  6054. if (length <= 0)
  6055. return;
  6056. var _a = this.find(index), startNode = _a[0], offset = _a[1];
  6057. var cur, curIndex = index - offset, next = this.iterator(startNode);
  6058. while ((cur = next()) && curIndex < index + length) {
  6059. var curLength = cur.length();
  6060. if (index > curIndex) {
  6061. callback(cur, index - curIndex, Math.min(length, curIndex + curLength - index));
  6062. }
  6063. else {
  6064. callback(cur, 0, Math.min(curLength, index + length - curIndex));
  6065. }
  6066. curIndex += curLength;
  6067. }
  6068. };
  6069. LinkedList.prototype.map = function (callback) {
  6070. return this.reduce(function (memo, cur) {
  6071. memo.push(callback(cur));
  6072. return memo;
  6073. }, []);
  6074. };
  6075. LinkedList.prototype.reduce = function (callback, memo) {
  6076. var cur, next = this.iterator();
  6077. while ((cur = next())) {
  6078. memo = callback(memo, cur);
  6079. }
  6080. return memo;
  6081. };
  6082. return LinkedList;
  6083. }());
  6084. exports.default = LinkedList;
  6085. /***/ }),
  6086. /* 45 */
  6087. /***/ (function(module, exports, __webpack_require__) {
  6088. "use strict";
  6089. var __extends = (this && this.__extends) || (function () {
  6090. var extendStatics = Object.setPrototypeOf ||
  6091. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  6092. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  6093. return function (d, b) {
  6094. extendStatics(d, b);
  6095. function __() { this.constructor = d; }
  6096. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  6097. };
  6098. })();
  6099. Object.defineProperty(exports, "__esModule", { value: true });
  6100. var container_1 = __webpack_require__(17);
  6101. var Registry = __webpack_require__(1);
  6102. var OBSERVER_CONFIG = {
  6103. attributes: true,
  6104. characterData: true,
  6105. characterDataOldValue: true,
  6106. childList: true,
  6107. subtree: true,
  6108. };
  6109. var MAX_OPTIMIZE_ITERATIONS = 100;
  6110. var ScrollBlot = /** @class */ (function (_super) {
  6111. __extends(ScrollBlot, _super);
  6112. function ScrollBlot(node) {
  6113. var _this = _super.call(this, node) || this;
  6114. _this.scroll = _this;
  6115. _this.observer = new MutationObserver(function (mutations) {
  6116. _this.update(mutations);
  6117. });
  6118. _this.observer.observe(_this.domNode, OBSERVER_CONFIG);
  6119. _this.attach();
  6120. return _this;
  6121. }
  6122. ScrollBlot.prototype.detach = function () {
  6123. _super.prototype.detach.call(this);
  6124. this.observer.disconnect();
  6125. };
  6126. ScrollBlot.prototype.deleteAt = function (index, length) {
  6127. this.update();
  6128. if (index === 0 && length === this.length()) {
  6129. this.children.forEach(function (child) {
  6130. child.remove();
  6131. });
  6132. }
  6133. else {
  6134. _super.prototype.deleteAt.call(this, index, length);
  6135. }
  6136. };
  6137. ScrollBlot.prototype.formatAt = function (index, length, name, value) {
  6138. this.update();
  6139. _super.prototype.formatAt.call(this, index, length, name, value);
  6140. };
  6141. ScrollBlot.prototype.insertAt = function (index, value, def) {
  6142. this.update();
  6143. _super.prototype.insertAt.call(this, index, value, def);
  6144. };
  6145. ScrollBlot.prototype.optimize = function (mutations, context) {
  6146. var _this = this;
  6147. if (mutations === void 0) { mutations = []; }
  6148. if (context === void 0) { context = {}; }
  6149. _super.prototype.optimize.call(this, context);
  6150. // We must modify mutations directly, cannot make copy and then modify
  6151. var records = [].slice.call(this.observer.takeRecords());
  6152. // Array.push currently seems to be implemented by a non-tail recursive function
  6153. // so we cannot just mutations.push.apply(mutations, this.observer.takeRecords());
  6154. while (records.length > 0)
  6155. mutations.push(records.pop());
  6156. // TODO use WeakMap
  6157. var mark = function (blot, markParent) {
  6158. if (markParent === void 0) { markParent = true; }
  6159. if (blot == null || blot === _this)
  6160. return;
  6161. if (blot.domNode.parentNode == null)
  6162. return;
  6163. // @ts-ignore
  6164. if (blot.domNode[Registry.DATA_KEY].mutations == null) {
  6165. // @ts-ignore
  6166. blot.domNode[Registry.DATA_KEY].mutations = [];
  6167. }
  6168. if (markParent)
  6169. mark(blot.parent);
  6170. };
  6171. var optimize = function (blot) {
  6172. // Post-order traversal
  6173. if (
  6174. // @ts-ignore
  6175. blot.domNode[Registry.DATA_KEY] == null ||
  6176. // @ts-ignore
  6177. blot.domNode[Registry.DATA_KEY].mutations == null) {
  6178. return;
  6179. }
  6180. if (blot instanceof container_1.default) {
  6181. blot.children.forEach(optimize);
  6182. }
  6183. blot.optimize(context);
  6184. };
  6185. var remaining = mutations;
  6186. for (var i = 0; remaining.length > 0; i += 1) {
  6187. if (i >= MAX_OPTIMIZE_ITERATIONS) {
  6188. throw new Error('[Parchment] Maximum optimize iterations reached');
  6189. }
  6190. remaining.forEach(function (mutation) {
  6191. var blot = Registry.find(mutation.target, true);
  6192. if (blot == null)
  6193. return;
  6194. if (blot.domNode === mutation.target) {
  6195. if (mutation.type === 'childList') {
  6196. mark(Registry.find(mutation.previousSibling, false));
  6197. [].forEach.call(mutation.addedNodes, function (node) {
  6198. var child = Registry.find(node, false);
  6199. mark(child, false);
  6200. if (child instanceof container_1.default) {
  6201. child.children.forEach(function (grandChild) {
  6202. mark(grandChild, false);
  6203. });
  6204. }
  6205. });
  6206. }
  6207. else if (mutation.type === 'attributes') {
  6208. mark(blot.prev);
  6209. }
  6210. }
  6211. mark(blot);
  6212. });
  6213. this.children.forEach(optimize);
  6214. remaining = [].slice.call(this.observer.takeRecords());
  6215. records = remaining.slice();
  6216. while (records.length > 0)
  6217. mutations.push(records.pop());
  6218. }
  6219. };
  6220. ScrollBlot.prototype.update = function (mutations, context) {
  6221. var _this = this;
  6222. if (context === void 0) { context = {}; }
  6223. mutations = mutations || this.observer.takeRecords();
  6224. // TODO use WeakMap
  6225. mutations
  6226. .map(function (mutation) {
  6227. var blot = Registry.find(mutation.target, true);
  6228. if (blot == null)
  6229. return null;
  6230. // @ts-ignore
  6231. if (blot.domNode[Registry.DATA_KEY].mutations == null) {
  6232. // @ts-ignore
  6233. blot.domNode[Registry.DATA_KEY].mutations = [mutation];
  6234. return blot;
  6235. }
  6236. else {
  6237. // @ts-ignore
  6238. blot.domNode[Registry.DATA_KEY].mutations.push(mutation);
  6239. return null;
  6240. }
  6241. })
  6242. .forEach(function (blot) {
  6243. if (blot == null ||
  6244. blot === _this ||
  6245. //@ts-ignore
  6246. blot.domNode[Registry.DATA_KEY] == null)
  6247. return;
  6248. // @ts-ignore
  6249. blot.update(blot.domNode[Registry.DATA_KEY].mutations || [], context);
  6250. });
  6251. // @ts-ignore
  6252. if (this.domNode[Registry.DATA_KEY].mutations != null) {
  6253. // @ts-ignore
  6254. _super.prototype.update.call(this, this.domNode[Registry.DATA_KEY].mutations, context);
  6255. }
  6256. this.optimize(mutations, context);
  6257. };
  6258. ScrollBlot.blotName = 'scroll';
  6259. ScrollBlot.defaultChild = 'block';
  6260. ScrollBlot.scope = Registry.Scope.BLOCK_BLOT;
  6261. ScrollBlot.tagName = 'DIV';
  6262. return ScrollBlot;
  6263. }(container_1.default));
  6264. exports.default = ScrollBlot;
  6265. /***/ }),
  6266. /* 46 */
  6267. /***/ (function(module, exports, __webpack_require__) {
  6268. "use strict";
  6269. var __extends = (this && this.__extends) || (function () {
  6270. var extendStatics = Object.setPrototypeOf ||
  6271. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  6272. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  6273. return function (d, b) {
  6274. extendStatics(d, b);
  6275. function __() { this.constructor = d; }
  6276. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  6277. };
  6278. })();
  6279. Object.defineProperty(exports, "__esModule", { value: true });
  6280. var format_1 = __webpack_require__(18);
  6281. var Registry = __webpack_require__(1);
  6282. // Shallow object comparison
  6283. function isEqual(obj1, obj2) {
  6284. if (Object.keys(obj1).length !== Object.keys(obj2).length)
  6285. return false;
  6286. // @ts-ignore
  6287. for (var prop in obj1) {
  6288. // @ts-ignore
  6289. if (obj1[prop] !== obj2[prop])
  6290. return false;
  6291. }
  6292. return true;
  6293. }
  6294. var InlineBlot = /** @class */ (function (_super) {
  6295. __extends(InlineBlot, _super);
  6296. function InlineBlot() {
  6297. return _super !== null && _super.apply(this, arguments) || this;
  6298. }
  6299. InlineBlot.formats = function (domNode) {
  6300. if (domNode.tagName === InlineBlot.tagName)
  6301. return undefined;
  6302. return _super.formats.call(this, domNode);
  6303. };
  6304. InlineBlot.prototype.format = function (name, value) {
  6305. var _this = this;
  6306. if (name === this.statics.blotName && !value) {
  6307. this.children.forEach(function (child) {
  6308. if (!(child instanceof format_1.default)) {
  6309. child = child.wrap(InlineBlot.blotName, true);
  6310. }
  6311. _this.attributes.copy(child);
  6312. });
  6313. this.unwrap();
  6314. }
  6315. else {
  6316. _super.prototype.format.call(this, name, value);
  6317. }
  6318. };
  6319. InlineBlot.prototype.formatAt = function (index, length, name, value) {
  6320. if (this.formats()[name] != null || Registry.query(name, Registry.Scope.ATTRIBUTE)) {
  6321. var blot = this.isolate(index, length);
  6322. blot.format(name, value);
  6323. }
  6324. else {
  6325. _super.prototype.formatAt.call(this, index, length, name, value);
  6326. }
  6327. };
  6328. InlineBlot.prototype.optimize = function (context) {
  6329. _super.prototype.optimize.call(this, context);
  6330. var formats = this.formats();
  6331. if (Object.keys(formats).length === 0) {
  6332. return this.unwrap(); // unformatted span
  6333. }
  6334. var next = this.next;
  6335. if (next instanceof InlineBlot && next.prev === this && isEqual(formats, next.formats())) {
  6336. next.moveChildren(this);
  6337. next.remove();
  6338. }
  6339. };
  6340. InlineBlot.blotName = 'inline';
  6341. InlineBlot.scope = Registry.Scope.INLINE_BLOT;
  6342. InlineBlot.tagName = 'SPAN';
  6343. return InlineBlot;
  6344. }(format_1.default));
  6345. exports.default = InlineBlot;
  6346. /***/ }),
  6347. /* 47 */
  6348. /***/ (function(module, exports, __webpack_require__) {
  6349. "use strict";
  6350. var __extends = (this && this.__extends) || (function () {
  6351. var extendStatics = Object.setPrototypeOf ||
  6352. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  6353. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  6354. return function (d, b) {
  6355. extendStatics(d, b);
  6356. function __() { this.constructor = d; }
  6357. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  6358. };
  6359. })();
  6360. Object.defineProperty(exports, "__esModule", { value: true });
  6361. var format_1 = __webpack_require__(18);
  6362. var Registry = __webpack_require__(1);
  6363. var BlockBlot = /** @class */ (function (_super) {
  6364. __extends(BlockBlot, _super);
  6365. function BlockBlot() {
  6366. return _super !== null && _super.apply(this, arguments) || this;
  6367. }
  6368. BlockBlot.formats = function (domNode) {
  6369. var tagName = Registry.query(BlockBlot.blotName).tagName;
  6370. if (domNode.tagName === tagName)
  6371. return undefined;
  6372. return _super.formats.call(this, domNode);
  6373. };
  6374. BlockBlot.prototype.format = function (name, value) {
  6375. if (Registry.query(name, Registry.Scope.BLOCK) == null) {
  6376. return;
  6377. }
  6378. else if (name === this.statics.blotName && !value) {
  6379. this.replaceWith(BlockBlot.blotName);
  6380. }
  6381. else {
  6382. _super.prototype.format.call(this, name, value);
  6383. }
  6384. };
  6385. BlockBlot.prototype.formatAt = function (index, length, name, value) {
  6386. if (Registry.query(name, Registry.Scope.BLOCK) != null) {
  6387. this.format(name, value);
  6388. }
  6389. else {
  6390. _super.prototype.formatAt.call(this, index, length, name, value);
  6391. }
  6392. };
  6393. BlockBlot.prototype.insertAt = function (index, value, def) {
  6394. if (def == null || Registry.query(value, Registry.Scope.INLINE) != null) {
  6395. // Insert text or inline
  6396. _super.prototype.insertAt.call(this, index, value, def);
  6397. }
  6398. else {
  6399. var after = this.split(index);
  6400. var blot = Registry.create(value, def);
  6401. after.parent.insertBefore(blot, after);
  6402. }
  6403. };
  6404. BlockBlot.prototype.update = function (mutations, context) {
  6405. if (navigator.userAgent.match(/Trident/)) {
  6406. this.build();
  6407. }
  6408. else {
  6409. _super.prototype.update.call(this, mutations, context);
  6410. }
  6411. };
  6412. BlockBlot.blotName = 'block';
  6413. BlockBlot.scope = Registry.Scope.BLOCK_BLOT;
  6414. BlockBlot.tagName = 'P';
  6415. return BlockBlot;
  6416. }(format_1.default));
  6417. exports.default = BlockBlot;
  6418. /***/ }),
  6419. /* 48 */
  6420. /***/ (function(module, exports, __webpack_require__) {
  6421. "use strict";
  6422. var __extends = (this && this.__extends) || (function () {
  6423. var extendStatics = Object.setPrototypeOf ||
  6424. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  6425. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  6426. return function (d, b) {
  6427. extendStatics(d, b);
  6428. function __() { this.constructor = d; }
  6429. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  6430. };
  6431. })();
  6432. Object.defineProperty(exports, "__esModule", { value: true });
  6433. var leaf_1 = __webpack_require__(19);
  6434. var EmbedBlot = /** @class */ (function (_super) {
  6435. __extends(EmbedBlot, _super);
  6436. function EmbedBlot() {
  6437. return _super !== null && _super.apply(this, arguments) || this;
  6438. }
  6439. EmbedBlot.formats = function (domNode) {
  6440. return undefined;
  6441. };
  6442. EmbedBlot.prototype.format = function (name, value) {
  6443. // super.formatAt wraps, which is what we want in general,
  6444. // but this allows subclasses to overwrite for formats
  6445. // that just apply to particular embeds
  6446. _super.prototype.formatAt.call(this, 0, this.length(), name, value);
  6447. };
  6448. EmbedBlot.prototype.formatAt = function (index, length, name, value) {
  6449. if (index === 0 && length === this.length()) {
  6450. this.format(name, value);
  6451. }
  6452. else {
  6453. _super.prototype.formatAt.call(this, index, length, name, value);
  6454. }
  6455. };
  6456. EmbedBlot.prototype.formats = function () {
  6457. return this.statics.formats(this.domNode);
  6458. };
  6459. return EmbedBlot;
  6460. }(leaf_1.default));
  6461. exports.default = EmbedBlot;
  6462. /***/ }),
  6463. /* 49 */
  6464. /***/ (function(module, exports, __webpack_require__) {
  6465. "use strict";
  6466. var __extends = (this && this.__extends) || (function () {
  6467. var extendStatics = Object.setPrototypeOf ||
  6468. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  6469. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  6470. return function (d, b) {
  6471. extendStatics(d, b);
  6472. function __() { this.constructor = d; }
  6473. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  6474. };
  6475. })();
  6476. Object.defineProperty(exports, "__esModule", { value: true });
  6477. var leaf_1 = __webpack_require__(19);
  6478. var Registry = __webpack_require__(1);
  6479. var TextBlot = /** @class */ (function (_super) {
  6480. __extends(TextBlot, _super);
  6481. function TextBlot(node) {
  6482. var _this = _super.call(this, node) || this;
  6483. _this.text = _this.statics.value(_this.domNode);
  6484. return _this;
  6485. }
  6486. TextBlot.create = function (value) {
  6487. return document.createTextNode(value);
  6488. };
  6489. TextBlot.value = function (domNode) {
  6490. var text = domNode.data;
  6491. // @ts-ignore
  6492. if (text['normalize'])
  6493. text = text['normalize']();
  6494. return text;
  6495. };
  6496. TextBlot.prototype.deleteAt = function (index, length) {
  6497. this.domNode.data = this.text = this.text.slice(0, index) + this.text.slice(index + length);
  6498. };
  6499. TextBlot.prototype.index = function (node, offset) {
  6500. if (this.domNode === node) {
  6501. return offset;
  6502. }
  6503. return -1;
  6504. };
  6505. TextBlot.prototype.insertAt = function (index, value, def) {
  6506. if (def == null) {
  6507. this.text = this.text.slice(0, index) + value + this.text.slice(index);
  6508. this.domNode.data = this.text;
  6509. }
  6510. else {
  6511. _super.prototype.insertAt.call(this, index, value, def);
  6512. }
  6513. };
  6514. TextBlot.prototype.length = function () {
  6515. return this.text.length;
  6516. };
  6517. TextBlot.prototype.optimize = function (context) {
  6518. _super.prototype.optimize.call(this, context);
  6519. this.text = this.statics.value(this.domNode);
  6520. if (this.text.length === 0) {
  6521. this.remove();
  6522. }
  6523. else if (this.next instanceof TextBlot && this.next.prev === this) {
  6524. this.insertAt(this.length(), this.next.value());
  6525. this.next.remove();
  6526. }
  6527. };
  6528. TextBlot.prototype.position = function (index, inclusive) {
  6529. if (inclusive === void 0) { inclusive = false; }
  6530. return [this.domNode, index];
  6531. };
  6532. TextBlot.prototype.split = function (index, force) {
  6533. if (force === void 0) { force = false; }
  6534. if (!force) {
  6535. if (index === 0)
  6536. return this;
  6537. if (index === this.length())
  6538. return this.next;
  6539. }
  6540. var after = Registry.create(this.domNode.splitText(index));
  6541. this.parent.insertBefore(after, this.next);
  6542. this.text = this.statics.value(this.domNode);
  6543. return after;
  6544. };
  6545. TextBlot.prototype.update = function (mutations, context) {
  6546. var _this = this;
  6547. if (mutations.some(function (mutation) {
  6548. return mutation.type === 'characterData' && mutation.target === _this.domNode;
  6549. })) {
  6550. this.text = this.statics.value(this.domNode);
  6551. }
  6552. };
  6553. TextBlot.prototype.value = function () {
  6554. return this.text;
  6555. };
  6556. TextBlot.blotName = 'text';
  6557. TextBlot.scope = Registry.Scope.INLINE_BLOT;
  6558. return TextBlot;
  6559. }(leaf_1.default));
  6560. exports.default = TextBlot;
  6561. /***/ }),
  6562. /* 50 */
  6563. /***/ (function(module, exports, __webpack_require__) {
  6564. "use strict";
  6565. var elem = document.createElement('div');
  6566. elem.classList.toggle('test-class', false);
  6567. if (elem.classList.contains('test-class')) {
  6568. var _toggle = DOMTokenList.prototype.toggle;
  6569. DOMTokenList.prototype.toggle = function (token, force) {
  6570. if (arguments.length > 1 && !this.contains(token) === !force) {
  6571. return force;
  6572. } else {
  6573. return _toggle.call(this, token);
  6574. }
  6575. };
  6576. }
  6577. if (!String.prototype.startsWith) {
  6578. String.prototype.startsWith = function (searchString, position) {
  6579. position = position || 0;
  6580. return this.substr(position, searchString.length) === searchString;
  6581. };
  6582. }
  6583. if (!String.prototype.endsWith) {
  6584. String.prototype.endsWith = function (searchString, position) {
  6585. var subjectString = this.toString();
  6586. if (typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > subjectString.length) {
  6587. position = subjectString.length;
  6588. }
  6589. position -= searchString.length;
  6590. var lastIndex = subjectString.indexOf(searchString, position);
  6591. return lastIndex !== -1 && lastIndex === position;
  6592. };
  6593. }
  6594. if (!Array.prototype.find) {
  6595. Object.defineProperty(Array.prototype, "find", {
  6596. value: function value(predicate) {
  6597. if (this === null) {
  6598. throw new TypeError('Array.prototype.find called on null or undefined');
  6599. }
  6600. if (typeof predicate !== 'function') {
  6601. throw new TypeError('predicate must be a function');
  6602. }
  6603. var list = Object(this);
  6604. var length = list.length >>> 0;
  6605. var thisArg = arguments[1];
  6606. var value;
  6607. for (var i = 0; i < length; i++) {
  6608. value = list[i];
  6609. if (predicate.call(thisArg, value, i, list)) {
  6610. return value;
  6611. }
  6612. }
  6613. return undefined;
  6614. }
  6615. });
  6616. }
  6617. document.addEventListener("DOMContentLoaded", function () {
  6618. // Disable resizing in Firefox
  6619. document.execCommand("enableObjectResizing", false, false);
  6620. // Disable automatic linkifying in IE11
  6621. document.execCommand("autoUrlDetect", false, false);
  6622. });
  6623. /***/ }),
  6624. /* 51 */
  6625. /***/ (function(module, exports) {
  6626. /**
  6627. * This library modifies the diff-patch-match library by Neil Fraser
  6628. * by removing the patch and match functionality and certain advanced
  6629. * options in the diff function. The original license is as follows:
  6630. *
  6631. * ===
  6632. *
  6633. * Diff Match and Patch
  6634. *
  6635. * Copyright 2006 Google Inc.
  6636. * http://code.google.com/p/google-diff-match-patch/
  6637. *
  6638. * Licensed under the Apache License, Version 2.0 (the "License");
  6639. * you may not use this file except in compliance with the License.
  6640. * You may obtain a copy of the License at
  6641. *
  6642. * http://www.apache.org/licenses/LICENSE-2.0
  6643. *
  6644. * Unless required by applicable law or agreed to in writing, software
  6645. * distributed under the License is distributed on an "AS IS" BASIS,
  6646. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  6647. * See the License for the specific language governing permissions and
  6648. * limitations under the License.
  6649. */
  6650. /**
  6651. * The data structure representing a diff is an array of tuples:
  6652. * [[DIFF_DELETE, 'Hello'], [DIFF_INSERT, 'Goodbye'], [DIFF_EQUAL, ' world.']]
  6653. * which means: delete 'Hello', add 'Goodbye' and keep ' world.'
  6654. */
  6655. var DIFF_DELETE = -1;
  6656. var DIFF_INSERT = 1;
  6657. var DIFF_EQUAL = 0;
  6658. /**
  6659. * Find the differences between two texts. Simplifies the problem by stripping
  6660. * any common prefix or suffix off the texts before diffing.
  6661. * @param {string} text1 Old string to be diffed.
  6662. * @param {string} text2 New string to be diffed.
  6663. * @param {Int} cursor_pos Expected edit position in text1 (optional)
  6664. * @return {Array} Array of diff tuples.
  6665. */
  6666. function diff_main(text1, text2, cursor_pos) {
  6667. // Check for equality (speedup).
  6668. if (text1 == text2) {
  6669. if (text1) {
  6670. return [[DIFF_EQUAL, text1]];
  6671. }
  6672. return [];
  6673. }
  6674. // Check cursor_pos within bounds
  6675. if (cursor_pos < 0 || text1.length < cursor_pos) {
  6676. cursor_pos = null;
  6677. }
  6678. // Trim off common prefix (speedup).
  6679. var commonlength = diff_commonPrefix(text1, text2);
  6680. var commonprefix = text1.substring(0, commonlength);
  6681. text1 = text1.substring(commonlength);
  6682. text2 = text2.substring(commonlength);
  6683. // Trim off common suffix (speedup).
  6684. commonlength = diff_commonSuffix(text1, text2);
  6685. var commonsuffix = text1.substring(text1.length - commonlength);
  6686. text1 = text1.substring(0, text1.length - commonlength);
  6687. text2 = text2.substring(0, text2.length - commonlength);
  6688. // Compute the diff on the middle block.
  6689. var diffs = diff_compute_(text1, text2);
  6690. // Restore the prefix and suffix.
  6691. if (commonprefix) {
  6692. diffs.unshift([DIFF_EQUAL, commonprefix]);
  6693. }
  6694. if (commonsuffix) {
  6695. diffs.push([DIFF_EQUAL, commonsuffix]);
  6696. }
  6697. diff_cleanupMerge(diffs);
  6698. if (cursor_pos != null) {
  6699. diffs = fix_cursor(diffs, cursor_pos);
  6700. }
  6701. diffs = fix_emoji(diffs);
  6702. return diffs;
  6703. };
  6704. /**
  6705. * Find the differences between two texts. Assumes that the texts do not
  6706. * have any common prefix or suffix.
  6707. * @param {string} text1 Old string to be diffed.
  6708. * @param {string} text2 New string to be diffed.
  6709. * @return {Array} Array of diff tuples.
  6710. */
  6711. function diff_compute_(text1, text2) {
  6712. var diffs;
  6713. if (!text1) {
  6714. // Just add some text (speedup).
  6715. return [[DIFF_INSERT, text2]];
  6716. }
  6717. if (!text2) {
  6718. // Just delete some text (speedup).
  6719. return [[DIFF_DELETE, text1]];
  6720. }
  6721. var longtext = text1.length > text2.length ? text1 : text2;
  6722. var shorttext = text1.length > text2.length ? text2 : text1;
  6723. var i = longtext.indexOf(shorttext);
  6724. if (i != -1) {
  6725. // Shorter text is inside the longer text (speedup).
  6726. diffs = [[DIFF_INSERT, longtext.substring(0, i)],
  6727. [DIFF_EQUAL, shorttext],
  6728. [DIFF_INSERT, longtext.substring(i + shorttext.length)]];
  6729. // Swap insertions for deletions if diff is reversed.
  6730. if (text1.length > text2.length) {
  6731. diffs[0][0] = diffs[2][0] = DIFF_DELETE;
  6732. }
  6733. return diffs;
  6734. }
  6735. if (shorttext.length == 1) {
  6736. // Single character string.
  6737. // After the previous speedup, the character can't be an equality.
  6738. return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]];
  6739. }
  6740. // Check to see if the problem can be split in two.
  6741. var hm = diff_halfMatch_(text1, text2);
  6742. if (hm) {
  6743. // A half-match was found, sort out the return data.
  6744. var text1_a = hm[0];
  6745. var text1_b = hm[1];
  6746. var text2_a = hm[2];
  6747. var text2_b = hm[3];
  6748. var mid_common = hm[4];
  6749. // Send both pairs off for separate processing.
  6750. var diffs_a = diff_main(text1_a, text2_a);
  6751. var diffs_b = diff_main(text1_b, text2_b);
  6752. // Merge the results.
  6753. return diffs_a.concat([[DIFF_EQUAL, mid_common]], diffs_b);
  6754. }
  6755. return diff_bisect_(text1, text2);
  6756. };
  6757. /**
  6758. * Find the 'middle snake' of a diff, split the problem in two
  6759. * and return the recursively constructed diff.
  6760. * See Myers 1986 paper: An O(ND) Difference Algorithm and Its Variations.
  6761. * @param {string} text1 Old string to be diffed.
  6762. * @param {string} text2 New string to be diffed.
  6763. * @return {Array} Array of diff tuples.
  6764. * @private
  6765. */
  6766. function diff_bisect_(text1, text2) {
  6767. // Cache the text lengths to prevent multiple calls.
  6768. var text1_length = text1.length;
  6769. var text2_length = text2.length;
  6770. var max_d = Math.ceil((text1_length + text2_length) / 2);
  6771. var v_offset = max_d;
  6772. var v_length = 2 * max_d;
  6773. var v1 = new Array(v_length);
  6774. var v2 = new Array(v_length);
  6775. // Setting all elements to -1 is faster in Chrome & Firefox than mixing
  6776. // integers and undefined.
  6777. for (var x = 0; x < v_length; x++) {
  6778. v1[x] = -1;
  6779. v2[x] = -1;
  6780. }
  6781. v1[v_offset + 1] = 0;
  6782. v2[v_offset + 1] = 0;
  6783. var delta = text1_length - text2_length;
  6784. // If the total number of characters is odd, then the front path will collide
  6785. // with the reverse path.
  6786. var front = (delta % 2 != 0);
  6787. // Offsets for start and end of k loop.
  6788. // Prevents mapping of space beyond the grid.
  6789. var k1start = 0;
  6790. var k1end = 0;
  6791. var k2start = 0;
  6792. var k2end = 0;
  6793. for (var d = 0; d < max_d; d++) {
  6794. // Walk the front path one step.
  6795. for (var k1 = -d + k1start; k1 <= d - k1end; k1 += 2) {
  6796. var k1_offset = v_offset + k1;
  6797. var x1;
  6798. if (k1 == -d || (k1 != d && v1[k1_offset - 1] < v1[k1_offset + 1])) {
  6799. x1 = v1[k1_offset + 1];
  6800. } else {
  6801. x1 = v1[k1_offset - 1] + 1;
  6802. }
  6803. var y1 = x1 - k1;
  6804. while (x1 < text1_length && y1 < text2_length &&
  6805. text1.charAt(x1) == text2.charAt(y1)) {
  6806. x1++;
  6807. y1++;
  6808. }
  6809. v1[k1_offset] = x1;
  6810. if (x1 > text1_length) {
  6811. // Ran off the right of the graph.
  6812. k1end += 2;
  6813. } else if (y1 > text2_length) {
  6814. // Ran off the bottom of the graph.
  6815. k1start += 2;
  6816. } else if (front) {
  6817. var k2_offset = v_offset + delta - k1;
  6818. if (k2_offset >= 0 && k2_offset < v_length && v2[k2_offset] != -1) {
  6819. // Mirror x2 onto top-left coordinate system.
  6820. var x2 = text1_length - v2[k2_offset];
  6821. if (x1 >= x2) {
  6822. // Overlap detected.
  6823. return diff_bisectSplit_(text1, text2, x1, y1);
  6824. }
  6825. }
  6826. }
  6827. }
  6828. // Walk the reverse path one step.
  6829. for (var k2 = -d + k2start; k2 <= d - k2end; k2 += 2) {
  6830. var k2_offset = v_offset + k2;
  6831. var x2;
  6832. if (k2 == -d || (k2 != d && v2[k2_offset - 1] < v2[k2_offset + 1])) {
  6833. x2 = v2[k2_offset + 1];
  6834. } else {
  6835. x2 = v2[k2_offset - 1] + 1;
  6836. }
  6837. var y2 = x2 - k2;
  6838. while (x2 < text1_length && y2 < text2_length &&
  6839. text1.charAt(text1_length - x2 - 1) ==
  6840. text2.charAt(text2_length - y2 - 1)) {
  6841. x2++;
  6842. y2++;
  6843. }
  6844. v2[k2_offset] = x2;
  6845. if (x2 > text1_length) {
  6846. // Ran off the left of the graph.
  6847. k2end += 2;
  6848. } else if (y2 > text2_length) {
  6849. // Ran off the top of the graph.
  6850. k2start += 2;
  6851. } else if (!front) {
  6852. var k1_offset = v_offset + delta - k2;
  6853. if (k1_offset >= 0 && k1_offset < v_length && v1[k1_offset] != -1) {
  6854. var x1 = v1[k1_offset];
  6855. var y1 = v_offset + x1 - k1_offset;
  6856. // Mirror x2 onto top-left coordinate system.
  6857. x2 = text1_length - x2;
  6858. if (x1 >= x2) {
  6859. // Overlap detected.
  6860. return diff_bisectSplit_(text1, text2, x1, y1);
  6861. }
  6862. }
  6863. }
  6864. }
  6865. }
  6866. // Diff took too long and hit the deadline or
  6867. // number of diffs equals number of characters, no commonality at all.
  6868. return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]];
  6869. };
  6870. /**
  6871. * Given the location of the 'middle snake', split the diff in two parts
  6872. * and recurse.
  6873. * @param {string} text1 Old string to be diffed.
  6874. * @param {string} text2 New string to be diffed.
  6875. * @param {number} x Index of split point in text1.
  6876. * @param {number} y Index of split point in text2.
  6877. * @return {Array} Array of diff tuples.
  6878. */
  6879. function diff_bisectSplit_(text1, text2, x, y) {
  6880. var text1a = text1.substring(0, x);
  6881. var text2a = text2.substring(0, y);
  6882. var text1b = text1.substring(x);
  6883. var text2b = text2.substring(y);
  6884. // Compute both diffs serially.
  6885. var diffs = diff_main(text1a, text2a);
  6886. var diffsb = diff_main(text1b, text2b);
  6887. return diffs.concat(diffsb);
  6888. };
  6889. /**
  6890. * Determine the common prefix of two strings.
  6891. * @param {string} text1 First string.
  6892. * @param {string} text2 Second string.
  6893. * @return {number} The number of characters common to the start of each
  6894. * string.
  6895. */
  6896. function diff_commonPrefix(text1, text2) {
  6897. // Quick check for common null cases.
  6898. if (!text1 || !text2 || text1.charAt(0) != text2.charAt(0)) {
  6899. return 0;
  6900. }
  6901. // Binary search.
  6902. // Performance analysis: http://neil.fraser.name/news/2007/10/09/
  6903. var pointermin = 0;
  6904. var pointermax = Math.min(text1.length, text2.length);
  6905. var pointermid = pointermax;
  6906. var pointerstart = 0;
  6907. while (pointermin < pointermid) {
  6908. if (text1.substring(pointerstart, pointermid) ==
  6909. text2.substring(pointerstart, pointermid)) {
  6910. pointermin = pointermid;
  6911. pointerstart = pointermin;
  6912. } else {
  6913. pointermax = pointermid;
  6914. }
  6915. pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
  6916. }
  6917. return pointermid;
  6918. };
  6919. /**
  6920. * Determine the common suffix of two strings.
  6921. * @param {string} text1 First string.
  6922. * @param {string} text2 Second string.
  6923. * @return {number} The number of characters common to the end of each string.
  6924. */
  6925. function diff_commonSuffix(text1, text2) {
  6926. // Quick check for common null cases.
  6927. if (!text1 || !text2 ||
  6928. text1.charAt(text1.length - 1) != text2.charAt(text2.length - 1)) {
  6929. return 0;
  6930. }
  6931. // Binary search.
  6932. // Performance analysis: http://neil.fraser.name/news/2007/10/09/
  6933. var pointermin = 0;
  6934. var pointermax = Math.min(text1.length, text2.length);
  6935. var pointermid = pointermax;
  6936. var pointerend = 0;
  6937. while (pointermin < pointermid) {
  6938. if (text1.substring(text1.length - pointermid, text1.length - pointerend) ==
  6939. text2.substring(text2.length - pointermid, text2.length - pointerend)) {
  6940. pointermin = pointermid;
  6941. pointerend = pointermin;
  6942. } else {
  6943. pointermax = pointermid;
  6944. }
  6945. pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
  6946. }
  6947. return pointermid;
  6948. };
  6949. /**
  6950. * Do the two texts share a substring which is at least half the length of the
  6951. * longer text?
  6952. * This speedup can produce non-minimal diffs.
  6953. * @param {string} text1 First string.
  6954. * @param {string} text2 Second string.
  6955. * @return {Array.<string>} Five element Array, containing the prefix of
  6956. * text1, the suffix of text1, the prefix of text2, the suffix of
  6957. * text2 and the common middle. Or null if there was no match.
  6958. */
  6959. function diff_halfMatch_(text1, text2) {
  6960. var longtext = text1.length > text2.length ? text1 : text2;
  6961. var shorttext = text1.length > text2.length ? text2 : text1;
  6962. if (longtext.length < 4 || shorttext.length * 2 < longtext.length) {
  6963. return null; // Pointless.
  6964. }
  6965. /**
  6966. * Does a substring of shorttext exist within longtext such that the substring
  6967. * is at least half the length of longtext?
  6968. * Closure, but does not reference any external variables.
  6969. * @param {string} longtext Longer string.
  6970. * @param {string} shorttext Shorter string.
  6971. * @param {number} i Start index of quarter length substring within longtext.
  6972. * @return {Array.<string>} Five element Array, containing the prefix of
  6973. * longtext, the suffix of longtext, the prefix of shorttext, the suffix
  6974. * of shorttext and the common middle. Or null if there was no match.
  6975. * @private
  6976. */
  6977. function diff_halfMatchI_(longtext, shorttext, i) {
  6978. // Start with a 1/4 length substring at position i as a seed.
  6979. var seed = longtext.substring(i, i + Math.floor(longtext.length / 4));
  6980. var j = -1;
  6981. var best_common = '';
  6982. var best_longtext_a, best_longtext_b, best_shorttext_a, best_shorttext_b;
  6983. while ((j = shorttext.indexOf(seed, j + 1)) != -1) {
  6984. var prefixLength = diff_commonPrefix(longtext.substring(i),
  6985. shorttext.substring(j));
  6986. var suffixLength = diff_commonSuffix(longtext.substring(0, i),
  6987. shorttext.substring(0, j));
  6988. if (best_common.length < suffixLength + prefixLength) {
  6989. best_common = shorttext.substring(j - suffixLength, j) +
  6990. shorttext.substring(j, j + prefixLength);
  6991. best_longtext_a = longtext.substring(0, i - suffixLength);
  6992. best_longtext_b = longtext.substring(i + prefixLength);
  6993. best_shorttext_a = shorttext.substring(0, j - suffixLength);
  6994. best_shorttext_b = shorttext.substring(j + prefixLength);
  6995. }
  6996. }
  6997. if (best_common.length * 2 >= longtext.length) {
  6998. return [best_longtext_a, best_longtext_b,
  6999. best_shorttext_a, best_shorttext_b, best_common];
  7000. } else {
  7001. return null;
  7002. }
  7003. }
  7004. // First check if the second quarter is the seed for a half-match.
  7005. var hm1 = diff_halfMatchI_(longtext, shorttext,
  7006. Math.ceil(longtext.length / 4));
  7007. // Check again based on the third quarter.
  7008. var hm2 = diff_halfMatchI_(longtext, shorttext,
  7009. Math.ceil(longtext.length / 2));
  7010. var hm;
  7011. if (!hm1 && !hm2) {
  7012. return null;
  7013. } else if (!hm2) {
  7014. hm = hm1;
  7015. } else if (!hm1) {
  7016. hm = hm2;
  7017. } else {
  7018. // Both matched. Select the longest.
  7019. hm = hm1[4].length > hm2[4].length ? hm1 : hm2;
  7020. }
  7021. // A half-match was found, sort out the return data.
  7022. var text1_a, text1_b, text2_a, text2_b;
  7023. if (text1.length > text2.length) {
  7024. text1_a = hm[0];
  7025. text1_b = hm[1];
  7026. text2_a = hm[2];
  7027. text2_b = hm[3];
  7028. } else {
  7029. text2_a = hm[0];
  7030. text2_b = hm[1];
  7031. text1_a = hm[2];
  7032. text1_b = hm[3];
  7033. }
  7034. var mid_common = hm[4];
  7035. return [text1_a, text1_b, text2_a, text2_b, mid_common];
  7036. };
  7037. /**
  7038. * Reorder and merge like edit sections. Merge equalities.
  7039. * Any edit section can move as long as it doesn't cross an equality.
  7040. * @param {Array} diffs Array of diff tuples.
  7041. */
  7042. function diff_cleanupMerge(diffs) {
  7043. diffs.push([DIFF_EQUAL, '']); // Add a dummy entry at the end.
  7044. var pointer = 0;
  7045. var count_delete = 0;
  7046. var count_insert = 0;
  7047. var text_delete = '';
  7048. var text_insert = '';
  7049. var commonlength;
  7050. while (pointer < diffs.length) {
  7051. switch (diffs[pointer][0]) {
  7052. case DIFF_INSERT:
  7053. count_insert++;
  7054. text_insert += diffs[pointer][1];
  7055. pointer++;
  7056. break;
  7057. case DIFF_DELETE:
  7058. count_delete++;
  7059. text_delete += diffs[pointer][1];
  7060. pointer++;
  7061. break;
  7062. case DIFF_EQUAL:
  7063. // Upon reaching an equality, check for prior redundancies.
  7064. if (count_delete + count_insert > 1) {
  7065. if (count_delete !== 0 && count_insert !== 0) {
  7066. // Factor out any common prefixies.
  7067. commonlength = diff_commonPrefix(text_insert, text_delete);
  7068. if (commonlength !== 0) {
  7069. if ((pointer - count_delete - count_insert) > 0 &&
  7070. diffs[pointer - count_delete - count_insert - 1][0] ==
  7071. DIFF_EQUAL) {
  7072. diffs[pointer - count_delete - count_insert - 1][1] +=
  7073. text_insert.substring(0, commonlength);
  7074. } else {
  7075. diffs.splice(0, 0, [DIFF_EQUAL,
  7076. text_insert.substring(0, commonlength)]);
  7077. pointer++;
  7078. }
  7079. text_insert = text_insert.substring(commonlength);
  7080. text_delete = text_delete.substring(commonlength);
  7081. }
  7082. // Factor out any common suffixies.
  7083. commonlength = diff_commonSuffix(text_insert, text_delete);
  7084. if (commonlength !== 0) {
  7085. diffs[pointer][1] = text_insert.substring(text_insert.length -
  7086. commonlength) + diffs[pointer][1];
  7087. text_insert = text_insert.substring(0, text_insert.length -
  7088. commonlength);
  7089. text_delete = text_delete.substring(0, text_delete.length -
  7090. commonlength);
  7091. }
  7092. }
  7093. // Delete the offending records and add the merged ones.
  7094. if (count_delete === 0) {
  7095. diffs.splice(pointer - count_insert,
  7096. count_delete + count_insert, [DIFF_INSERT, text_insert]);
  7097. } else if (count_insert === 0) {
  7098. diffs.splice(pointer - count_delete,
  7099. count_delete + count_insert, [DIFF_DELETE, text_delete]);
  7100. } else {
  7101. diffs.splice(pointer - count_delete - count_insert,
  7102. count_delete + count_insert, [DIFF_DELETE, text_delete],
  7103. [DIFF_INSERT, text_insert]);
  7104. }
  7105. pointer = pointer - count_delete - count_insert +
  7106. (count_delete ? 1 : 0) + (count_insert ? 1 : 0) + 1;
  7107. } else if (pointer !== 0 && diffs[pointer - 1][0] == DIFF_EQUAL) {
  7108. // Merge this equality with the previous one.
  7109. diffs[pointer - 1][1] += diffs[pointer][1];
  7110. diffs.splice(pointer, 1);
  7111. } else {
  7112. pointer++;
  7113. }
  7114. count_insert = 0;
  7115. count_delete = 0;
  7116. text_delete = '';
  7117. text_insert = '';
  7118. break;
  7119. }
  7120. }
  7121. if (diffs[diffs.length - 1][1] === '') {
  7122. diffs.pop(); // Remove the dummy entry at the end.
  7123. }
  7124. // Second pass: look for single edits surrounded on both sides by equalities
  7125. // which can be shifted sideways to eliminate an equality.
  7126. // e.g: A<ins>BA</ins>C -> <ins>AB</ins>AC
  7127. var changes = false;
  7128. pointer = 1;
  7129. // Intentionally ignore the first and last element (don't need checking).
  7130. while (pointer < diffs.length - 1) {
  7131. if (diffs[pointer - 1][0] == DIFF_EQUAL &&
  7132. diffs[pointer + 1][0] == DIFF_EQUAL) {
  7133. // This is a single edit surrounded by equalities.
  7134. if (diffs[pointer][1].substring(diffs[pointer][1].length -
  7135. diffs[pointer - 1][1].length) == diffs[pointer - 1][1]) {
  7136. // Shift the edit over the previous equality.
  7137. diffs[pointer][1] = diffs[pointer - 1][1] +
  7138. diffs[pointer][1].substring(0, diffs[pointer][1].length -
  7139. diffs[pointer - 1][1].length);
  7140. diffs[pointer + 1][1] = diffs[pointer - 1][1] + diffs[pointer + 1][1];
  7141. diffs.splice(pointer - 1, 1);
  7142. changes = true;
  7143. } else if (diffs[pointer][1].substring(0, diffs[pointer + 1][1].length) ==
  7144. diffs[pointer + 1][1]) {
  7145. // Shift the edit over the next equality.
  7146. diffs[pointer - 1][1] += diffs[pointer + 1][1];
  7147. diffs[pointer][1] =
  7148. diffs[pointer][1].substring(diffs[pointer + 1][1].length) +
  7149. diffs[pointer + 1][1];
  7150. diffs.splice(pointer + 1, 1);
  7151. changes = true;
  7152. }
  7153. }
  7154. pointer++;
  7155. }
  7156. // If shifts were made, the diff needs reordering and another shift sweep.
  7157. if (changes) {
  7158. diff_cleanupMerge(diffs);
  7159. }
  7160. };
  7161. var diff = diff_main;
  7162. diff.INSERT = DIFF_INSERT;
  7163. diff.DELETE = DIFF_DELETE;
  7164. diff.EQUAL = DIFF_EQUAL;
  7165. module.exports = diff;
  7166. /*
  7167. * Modify a diff such that the cursor position points to the start of a change:
  7168. * E.g.
  7169. * cursor_normalize_diff([[DIFF_EQUAL, 'abc']], 1)
  7170. * => [1, [[DIFF_EQUAL, 'a'], [DIFF_EQUAL, 'bc']]]
  7171. * cursor_normalize_diff([[DIFF_INSERT, 'new'], [DIFF_DELETE, 'xyz']], 2)
  7172. * => [2, [[DIFF_INSERT, 'new'], [DIFF_DELETE, 'xy'], [DIFF_DELETE, 'z']]]
  7173. *
  7174. * @param {Array} diffs Array of diff tuples
  7175. * @param {Int} cursor_pos Suggested edit position. Must not be out of bounds!
  7176. * @return {Array} A tuple [cursor location in the modified diff, modified diff]
  7177. */
  7178. function cursor_normalize_diff (diffs, cursor_pos) {
  7179. if (cursor_pos === 0) {
  7180. return [DIFF_EQUAL, diffs];
  7181. }
  7182. for (var current_pos = 0, i = 0; i < diffs.length; i++) {
  7183. var d = diffs[i];
  7184. if (d[0] === DIFF_DELETE || d[0] === DIFF_EQUAL) {
  7185. var next_pos = current_pos + d[1].length;
  7186. if (cursor_pos === next_pos) {
  7187. return [i + 1, diffs];
  7188. } else if (cursor_pos < next_pos) {
  7189. // copy to prevent side effects
  7190. diffs = diffs.slice();
  7191. // split d into two diff changes
  7192. var split_pos = cursor_pos - current_pos;
  7193. var d_left = [d[0], d[1].slice(0, split_pos)];
  7194. var d_right = [d[0], d[1].slice(split_pos)];
  7195. diffs.splice(i, 1, d_left, d_right);
  7196. return [i + 1, diffs];
  7197. } else {
  7198. current_pos = next_pos;
  7199. }
  7200. }
  7201. }
  7202. throw new Error('cursor_pos is out of bounds!')
  7203. }
  7204. /*
  7205. * Modify a diff such that the edit position is "shifted" to the proposed edit location (cursor_position).
  7206. *
  7207. * Case 1)
  7208. * Check if a naive shift is possible:
  7209. * [0, X], [ 1, Y] -> [ 1, Y], [0, X] (if X + Y === Y + X)
  7210. * [0, X], [-1, Y] -> [-1, Y], [0, X] (if X + Y === Y + X) - holds same result
  7211. * Case 2)
  7212. * Check if the following shifts are possible:
  7213. * [0, 'pre'], [ 1, 'prefix'] -> [ 1, 'pre'], [0, 'pre'], [ 1, 'fix']
  7214. * [0, 'pre'], [-1, 'prefix'] -> [-1, 'pre'], [0, 'pre'], [-1, 'fix']
  7215. * ^ ^
  7216. * d d_next
  7217. *
  7218. * @param {Array} diffs Array of diff tuples
  7219. * @param {Int} cursor_pos Suggested edit position. Must not be out of bounds!
  7220. * @return {Array} Array of diff tuples
  7221. */
  7222. function fix_cursor (diffs, cursor_pos) {
  7223. var norm = cursor_normalize_diff(diffs, cursor_pos);
  7224. var ndiffs = norm[1];
  7225. var cursor_pointer = norm[0];
  7226. var d = ndiffs[cursor_pointer];
  7227. var d_next = ndiffs[cursor_pointer + 1];
  7228. if (d == null) {
  7229. // Text was deleted from end of original string,
  7230. // cursor is now out of bounds in new string
  7231. return diffs;
  7232. } else if (d[0] !== DIFF_EQUAL) {
  7233. // A modification happened at the cursor location.
  7234. // This is the expected outcome, so we can return the original diff.
  7235. return diffs;
  7236. } else {
  7237. if (d_next != null && d[1] + d_next[1] === d_next[1] + d[1]) {
  7238. // Case 1)
  7239. // It is possible to perform a naive shift
  7240. ndiffs.splice(cursor_pointer, 2, d_next, d)
  7241. return merge_tuples(ndiffs, cursor_pointer, 2)
  7242. } else if (d_next != null && d_next[1].indexOf(d[1]) === 0) {
  7243. // Case 2)
  7244. // d[1] is a prefix of d_next[1]
  7245. // We can assume that d_next[0] !== 0, since d[0] === 0
  7246. // Shift edit locations..
  7247. ndiffs.splice(cursor_pointer, 2, [d_next[0], d[1]], [0, d[1]]);
  7248. var suffix = d_next[1].slice(d[1].length);
  7249. if (suffix.length > 0) {
  7250. ndiffs.splice(cursor_pointer + 2, 0, [d_next[0], suffix]);
  7251. }
  7252. return merge_tuples(ndiffs, cursor_pointer, 3)
  7253. } else {
  7254. // Not possible to perform any modification
  7255. return diffs;
  7256. }
  7257. }
  7258. }
  7259. /*
  7260. * Check diff did not split surrogate pairs.
  7261. * Ex. [0, '\uD83D'], [-1, '\uDC36'], [1, '\uDC2F'] -> [-1, '\uD83D\uDC36'], [1, '\uD83D\uDC2F']
  7262. * '\uD83D\uDC36' === '🐶', '\uD83D\uDC2F' === '🐯'
  7263. *
  7264. * @param {Array} diffs Array of diff tuples
  7265. * @return {Array} Array of diff tuples
  7266. */
  7267. function fix_emoji (diffs) {
  7268. var compact = false;
  7269. var starts_with_pair_end = function(str) {
  7270. return str.charCodeAt(0) >= 0xDC00 && str.charCodeAt(0) <= 0xDFFF;
  7271. }
  7272. var ends_with_pair_start = function(str) {
  7273. return str.charCodeAt(str.length-1) >= 0xD800 && str.charCodeAt(str.length-1) <= 0xDBFF;
  7274. }
  7275. for (var i = 2; i < diffs.length; i += 1) {
  7276. if (diffs[i-2][0] === DIFF_EQUAL && ends_with_pair_start(diffs[i-2][1]) &&
  7277. diffs[i-1][0] === DIFF_DELETE && starts_with_pair_end(diffs[i-1][1]) &&
  7278. diffs[i][0] === DIFF_INSERT && starts_with_pair_end(diffs[i][1])) {
  7279. compact = true;
  7280. diffs[i-1][1] = diffs[i-2][1].slice(-1) + diffs[i-1][1];
  7281. diffs[i][1] = diffs[i-2][1].slice(-1) + diffs[i][1];
  7282. diffs[i-2][1] = diffs[i-2][1].slice(0, -1);
  7283. }
  7284. }
  7285. if (!compact) {
  7286. return diffs;
  7287. }
  7288. var fixed_diffs = [];
  7289. for (var i = 0; i < diffs.length; i += 1) {
  7290. if (diffs[i][1].length > 0) {
  7291. fixed_diffs.push(diffs[i]);
  7292. }
  7293. }
  7294. return fixed_diffs;
  7295. }
  7296. /*
  7297. * Try to merge tuples with their neigbors in a given range.
  7298. * E.g. [0, 'a'], [0, 'b'] -> [0, 'ab']
  7299. *
  7300. * @param {Array} diffs Array of diff tuples.
  7301. * @param {Int} start Position of the first element to merge (diffs[start] is also merged with diffs[start - 1]).
  7302. * @param {Int} length Number of consecutive elements to check.
  7303. * @return {Array} Array of merged diff tuples.
  7304. */
  7305. function merge_tuples (diffs, start, length) {
  7306. // Check from (start-1) to (start+length).
  7307. for (var i = start + length - 1; i >= 0 && i >= start - 1; i--) {
  7308. if (i + 1 < diffs.length) {
  7309. var left_d = diffs[i];
  7310. var right_d = diffs[i+1];
  7311. if (left_d[0] === right_d[1]) {
  7312. diffs.splice(i, 2, [left_d[0], left_d[1] + right_d[1]]);
  7313. }
  7314. }
  7315. }
  7316. return diffs;
  7317. }
  7318. /***/ }),
  7319. /* 52 */
  7320. /***/ (function(module, exports) {
  7321. exports = module.exports = typeof Object.keys === 'function'
  7322. ? Object.keys : shim;
  7323. exports.shim = shim;
  7324. function shim (obj) {
  7325. var keys = [];
  7326. for (var key in obj) keys.push(key);
  7327. return keys;
  7328. }
  7329. /***/ }),
  7330. /* 53 */
  7331. /***/ (function(module, exports) {
  7332. var supportsArgumentsClass = (function(){
  7333. return Object.prototype.toString.call(arguments)
  7334. })() == '[object Arguments]';
  7335. exports = module.exports = supportsArgumentsClass ? supported : unsupported;
  7336. exports.supported = supported;
  7337. function supported(object) {
  7338. return Object.prototype.toString.call(object) == '[object Arguments]';
  7339. };
  7340. exports.unsupported = unsupported;
  7341. function unsupported(object){
  7342. return object &&
  7343. typeof object == 'object' &&
  7344. typeof object.length == 'number' &&
  7345. Object.prototype.hasOwnProperty.call(object, 'callee') &&
  7346. !Object.prototype.propertyIsEnumerable.call(object, 'callee') ||
  7347. false;
  7348. };
  7349. /***/ }),
  7350. /* 54 */
  7351. /***/ (function(module, exports) {
  7352. 'use strict';
  7353. var has = Object.prototype.hasOwnProperty
  7354. , prefix = '~';
  7355. /**
  7356. * Constructor to create a storage for our `EE` objects.
  7357. * An `Events` instance is a plain object whose properties are event names.
  7358. *
  7359. * @constructor
  7360. * @api private
  7361. */
  7362. function Events() {}
  7363. //
  7364. // We try to not inherit from `Object.prototype`. In some engines creating an
  7365. // instance in this way is faster than calling `Object.create(null)` directly.
  7366. // If `Object.create(null)` is not supported we prefix the event names with a
  7367. // character to make sure that the built-in object properties are not
  7368. // overridden or used as an attack vector.
  7369. //
  7370. if (Object.create) {
  7371. Events.prototype = Object.create(null);
  7372. //
  7373. // This hack is needed because the `__proto__` property is still inherited in
  7374. // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.
  7375. //
  7376. if (!new Events().__proto__) prefix = false;
  7377. }
  7378. /**
  7379. * Representation of a single event listener.
  7380. *
  7381. * @param {Function} fn The listener function.
  7382. * @param {Mixed} context The context to invoke the listener with.
  7383. * @param {Boolean} [once=false] Specify if the listener is a one-time listener.
  7384. * @constructor
  7385. * @api private
  7386. */
  7387. function EE(fn, context, once) {
  7388. this.fn = fn;
  7389. this.context = context;
  7390. this.once = once || false;
  7391. }
  7392. /**
  7393. * Minimal `EventEmitter` interface that is molded against the Node.js
  7394. * `EventEmitter` interface.
  7395. *
  7396. * @constructor
  7397. * @api public
  7398. */
  7399. function EventEmitter() {
  7400. this._events = new Events();
  7401. this._eventsCount = 0;
  7402. }
  7403. /**
  7404. * Return an array listing the events for which the emitter has registered
  7405. * listeners.
  7406. *
  7407. * @returns {Array}
  7408. * @api public
  7409. */
  7410. EventEmitter.prototype.eventNames = function eventNames() {
  7411. var names = []
  7412. , events
  7413. , name;
  7414. if (this._eventsCount === 0) return names;
  7415. for (name in (events = this._events)) {
  7416. if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
  7417. }
  7418. if (Object.getOwnPropertySymbols) {
  7419. return names.concat(Object.getOwnPropertySymbols(events));
  7420. }
  7421. return names;
  7422. };
  7423. /**
  7424. * Return the listeners registered for a given event.
  7425. *
  7426. * @param {String|Symbol} event The event name.
  7427. * @param {Boolean} exists Only check if there are listeners.
  7428. * @returns {Array|Boolean}
  7429. * @api public
  7430. */
  7431. EventEmitter.prototype.listeners = function listeners(event, exists) {
  7432. var evt = prefix ? prefix + event : event
  7433. , available = this._events[evt];
  7434. if (exists) return !!available;
  7435. if (!available) return [];
  7436. if (available.fn) return [available.fn];
  7437. for (var i = 0, l = available.length, ee = new Array(l); i < l; i++) {
  7438. ee[i] = available[i].fn;
  7439. }
  7440. return ee;
  7441. };
  7442. /**
  7443. * Calls each of the listeners registered for a given event.
  7444. *
  7445. * @param {String|Symbol} event The event name.
  7446. * @returns {Boolean} `true` if the event had listeners, else `false`.
  7447. * @api public
  7448. */
  7449. EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
  7450. var evt = prefix ? prefix + event : event;
  7451. if (!this._events[evt]) return false;
  7452. var listeners = this._events[evt]
  7453. , len = arguments.length
  7454. , args
  7455. , i;
  7456. if (listeners.fn) {
  7457. if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);
  7458. switch (len) {
  7459. case 1: return listeners.fn.call(listeners.context), true;
  7460. case 2: return listeners.fn.call(listeners.context, a1), true;
  7461. case 3: return listeners.fn.call(listeners.context, a1, a2), true;
  7462. case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;
  7463. case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
  7464. case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
  7465. }
  7466. for (i = 1, args = new Array(len -1); i < len; i++) {
  7467. args[i - 1] = arguments[i];
  7468. }
  7469. listeners.fn.apply(listeners.context, args);
  7470. } else {
  7471. var length = listeners.length
  7472. , j;
  7473. for (i = 0; i < length; i++) {
  7474. if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);
  7475. switch (len) {
  7476. case 1: listeners[i].fn.call(listeners[i].context); break;
  7477. case 2: listeners[i].fn.call(listeners[i].context, a1); break;
  7478. case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;
  7479. case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;
  7480. default:
  7481. if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {
  7482. args[j - 1] = arguments[j];
  7483. }
  7484. listeners[i].fn.apply(listeners[i].context, args);
  7485. }
  7486. }
  7487. }
  7488. return true;
  7489. };
  7490. /**
  7491. * Add a listener for a given event.
  7492. *
  7493. * @param {String|Symbol} event The event name.
  7494. * @param {Function} fn The listener function.
  7495. * @param {Mixed} [context=this] The context to invoke the listener with.
  7496. * @returns {EventEmitter} `this`.
  7497. * @api public
  7498. */
  7499. EventEmitter.prototype.on = function on(event, fn, context) {
  7500. var listener = new EE(fn, context || this)
  7501. , evt = prefix ? prefix + event : event;
  7502. if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++;
  7503. else if (!this._events[evt].fn) this._events[evt].push(listener);
  7504. else this._events[evt] = [this._events[evt], listener];
  7505. return this;
  7506. };
  7507. /**
  7508. * Add a one-time listener for a given event.
  7509. *
  7510. * @param {String|Symbol} event The event name.
  7511. * @param {Function} fn The listener function.
  7512. * @param {Mixed} [context=this] The context to invoke the listener with.
  7513. * @returns {EventEmitter} `this`.
  7514. * @api public
  7515. */
  7516. EventEmitter.prototype.once = function once(event, fn, context) {
  7517. var listener = new EE(fn, context || this, true)
  7518. , evt = prefix ? prefix + event : event;
  7519. if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++;
  7520. else if (!this._events[evt].fn) this._events[evt].push(listener);
  7521. else this._events[evt] = [this._events[evt], listener];
  7522. return this;
  7523. };
  7524. /**
  7525. * Remove the listeners of a given event.
  7526. *
  7527. * @param {String|Symbol} event The event name.
  7528. * @param {Function} fn Only remove the listeners that match this function.
  7529. * @param {Mixed} context Only remove the listeners that have this context.
  7530. * @param {Boolean} once Only remove one-time listeners.
  7531. * @returns {EventEmitter} `this`.
  7532. * @api public
  7533. */
  7534. EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
  7535. var evt = prefix ? prefix + event : event;
  7536. if (!this._events[evt]) return this;
  7537. if (!fn) {
  7538. if (--this._eventsCount === 0) this._events = new Events();
  7539. else delete this._events[evt];
  7540. return this;
  7541. }
  7542. var listeners = this._events[evt];
  7543. if (listeners.fn) {
  7544. if (
  7545. listeners.fn === fn
  7546. && (!once || listeners.once)
  7547. && (!context || listeners.context === context)
  7548. ) {
  7549. if (--this._eventsCount === 0) this._events = new Events();
  7550. else delete this._events[evt];
  7551. }
  7552. } else {
  7553. for (var i = 0, events = [], length = listeners.length; i < length; i++) {
  7554. if (
  7555. listeners[i].fn !== fn
  7556. || (once && !listeners[i].once)
  7557. || (context && listeners[i].context !== context)
  7558. ) {
  7559. events.push(listeners[i]);
  7560. }
  7561. }
  7562. //
  7563. // Reset the array, or remove it completely if we have no more listeners.
  7564. //
  7565. if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;
  7566. else if (--this._eventsCount === 0) this._events = new Events();
  7567. else delete this._events[evt];
  7568. }
  7569. return this;
  7570. };
  7571. /**
  7572. * Remove all listeners, or those of the specified event.
  7573. *
  7574. * @param {String|Symbol} [event] The event name.
  7575. * @returns {EventEmitter} `this`.
  7576. * @api public
  7577. */
  7578. EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
  7579. var evt;
  7580. if (event) {
  7581. evt = prefix ? prefix + event : event;
  7582. if (this._events[evt]) {
  7583. if (--this._eventsCount === 0) this._events = new Events();
  7584. else delete this._events[evt];
  7585. }
  7586. } else {
  7587. this._events = new Events();
  7588. this._eventsCount = 0;
  7589. }
  7590. return this;
  7591. };
  7592. //
  7593. // Alias methods names because people roll like that.
  7594. //
  7595. EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
  7596. EventEmitter.prototype.addListener = EventEmitter.prototype.on;
  7597. //
  7598. // This function doesn't apply anymore.
  7599. //
  7600. EventEmitter.prototype.setMaxListeners = function setMaxListeners() {
  7601. return this;
  7602. };
  7603. //
  7604. // Expose the prefix.
  7605. //
  7606. EventEmitter.prefixed = prefix;
  7607. //
  7608. // Allow `EventEmitter` to be imported as module namespace.
  7609. //
  7610. EventEmitter.EventEmitter = EventEmitter;
  7611. //
  7612. // Expose the module.
  7613. //
  7614. if ('undefined' !== typeof module) {
  7615. module.exports = EventEmitter;
  7616. }
  7617. /***/ }),
  7618. /* 55 */
  7619. /***/ (function(module, exports, __webpack_require__) {
  7620. "use strict";
  7621. Object.defineProperty(exports, "__esModule", {
  7622. value: true
  7623. });
  7624. exports.matchText = exports.matchSpacing = exports.matchNewline = exports.matchBlot = exports.matchAttributor = exports.default = undefined;
  7625. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  7626. var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
  7627. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  7628. var _extend2 = __webpack_require__(3);
  7629. var _extend3 = _interopRequireDefault(_extend2);
  7630. var _quillDelta = __webpack_require__(2);
  7631. var _quillDelta2 = _interopRequireDefault(_quillDelta);
  7632. var _parchment = __webpack_require__(0);
  7633. var _parchment2 = _interopRequireDefault(_parchment);
  7634. var _quill = __webpack_require__(5);
  7635. var _quill2 = _interopRequireDefault(_quill);
  7636. var _logger = __webpack_require__(10);
  7637. var _logger2 = _interopRequireDefault(_logger);
  7638. var _module = __webpack_require__(9);
  7639. var _module2 = _interopRequireDefault(_module);
  7640. var _align = __webpack_require__(36);
  7641. var _background = __webpack_require__(37);
  7642. var _code = __webpack_require__(13);
  7643. var _code2 = _interopRequireDefault(_code);
  7644. var _color = __webpack_require__(26);
  7645. var _direction = __webpack_require__(38);
  7646. var _font = __webpack_require__(39);
  7647. var _size = __webpack_require__(40);
  7648. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7649. 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; }
  7650. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7651. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  7652. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  7653. var debug = (0, _logger2.default)('quill:clipboard');
  7654. var DOM_KEY = '__ql-matcher';
  7655. var CLIPBOARD_CONFIG = [[Node.TEXT_NODE, matchText], [Node.TEXT_NODE, matchNewline], ['br', matchBreak], [Node.ELEMENT_NODE, matchNewline], [Node.ELEMENT_NODE, matchBlot], [Node.ELEMENT_NODE, matchSpacing], [Node.ELEMENT_NODE, matchAttributor], [Node.ELEMENT_NODE, matchStyles], ['li', matchIndent], ['b', matchAlias.bind(matchAlias, 'bold')], ['i', matchAlias.bind(matchAlias, 'italic')], ['style', matchIgnore]];
  7656. var ATTRIBUTE_ATTRIBUTORS = [_align.AlignAttribute, _direction.DirectionAttribute].reduce(function (memo, attr) {
  7657. memo[attr.keyName] = attr;
  7658. return memo;
  7659. }, {});
  7660. var STYLE_ATTRIBUTORS = [_align.AlignStyle, _background.BackgroundStyle, _color.ColorStyle, _direction.DirectionStyle, _font.FontStyle, _size.SizeStyle].reduce(function (memo, attr) {
  7661. memo[attr.keyName] = attr;
  7662. return memo;
  7663. }, {});
  7664. var Clipboard = function (_Module) {
  7665. _inherits(Clipboard, _Module);
  7666. function Clipboard(quill, options) {
  7667. _classCallCheck(this, Clipboard);
  7668. var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this, quill, options));
  7669. _this.quill.root.addEventListener('paste', _this.onPaste.bind(_this));
  7670. _this.container = _this.quill.addContainer('ql-clipboard');
  7671. _this.container.setAttribute('contenteditable', true);
  7672. _this.container.setAttribute('tabindex', -1);
  7673. _this.matchers = [];
  7674. CLIPBOARD_CONFIG.concat(_this.options.matchers).forEach(function (_ref) {
  7675. var _ref2 = _slicedToArray(_ref, 2),
  7676. selector = _ref2[0],
  7677. matcher = _ref2[1];
  7678. if (!options.matchVisual && matcher === matchSpacing) return;
  7679. _this.addMatcher(selector, matcher);
  7680. });
  7681. return _this;
  7682. }
  7683. _createClass(Clipboard, [{
  7684. key: 'addMatcher',
  7685. value: function addMatcher(selector, matcher) {
  7686. this.matchers.push([selector, matcher]);
  7687. }
  7688. }, {
  7689. key: 'convert',
  7690. value: function convert(html) {
  7691. if (typeof html === 'string') {
  7692. this.container.innerHTML = html.replace(/\>\r?\n +\</g, '><'); // Remove spaces between tags
  7693. return this.convert();
  7694. }
  7695. var formats = this.quill.getFormat(this.quill.selection.savedRange.index);
  7696. if (formats[_code2.default.blotName]) {
  7697. var text = this.container.innerText;
  7698. this.container.innerHTML = '';
  7699. return new _quillDelta2.default().insert(text, _defineProperty({}, _code2.default.blotName, formats[_code2.default.blotName]));
  7700. }
  7701. var _prepareMatching = this.prepareMatching(),
  7702. _prepareMatching2 = _slicedToArray(_prepareMatching, 2),
  7703. elementMatchers = _prepareMatching2[0],
  7704. textMatchers = _prepareMatching2[1];
  7705. var delta = traverse(this.container, elementMatchers, textMatchers);
  7706. // Remove trailing newline
  7707. if (deltaEndsWith(delta, '\n') && delta.ops[delta.ops.length - 1].attributes == null) {
  7708. delta = delta.compose(new _quillDelta2.default().retain(delta.length() - 1).delete(1));
  7709. }
  7710. debug.log('convert', this.container.innerHTML, delta);
  7711. this.container.innerHTML = '';
  7712. return delta;
  7713. }
  7714. }, {
  7715. key: 'dangerouslyPasteHTML',
  7716. value: function dangerouslyPasteHTML(index, html) {
  7717. var source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _quill2.default.sources.API;
  7718. if (typeof index === 'string') {
  7719. this.quill.setContents(this.convert(index), html);
  7720. this.quill.setSelection(0, _quill2.default.sources.SILENT);
  7721. } else {
  7722. var paste = this.convert(html);
  7723. this.quill.updateContents(new _quillDelta2.default().retain(index).concat(paste), source);
  7724. this.quill.setSelection(index + paste.length(), _quill2.default.sources.SILENT);
  7725. }
  7726. }
  7727. }, {
  7728. key: 'onPaste',
  7729. value: function onPaste(e) {
  7730. var _this2 = this;
  7731. if (e.defaultPrevented || !this.quill.isEnabled()) return;
  7732. var range = this.quill.getSelection();
  7733. var delta = new _quillDelta2.default().retain(range.index);
  7734. var scrollTop = this.quill.scrollingContainer.scrollTop;
  7735. this.container.focus();
  7736. this.quill.selection.update(_quill2.default.sources.SILENT);
  7737. setTimeout(function () {
  7738. delta = delta.concat(_this2.convert()).delete(range.length);
  7739. _this2.quill.updateContents(delta, _quill2.default.sources.USER);
  7740. // range.length contributes to delta.length()
  7741. _this2.quill.setSelection(delta.length() - range.length, _quill2.default.sources.SILENT);
  7742. _this2.quill.scrollingContainer.scrollTop = scrollTop;
  7743. _this2.quill.focus();
  7744. }, 1);
  7745. }
  7746. }, {
  7747. key: 'prepareMatching',
  7748. value: function prepareMatching() {
  7749. var _this3 = this;
  7750. var elementMatchers = [],
  7751. textMatchers = [];
  7752. this.matchers.forEach(function (pair) {
  7753. var _pair = _slicedToArray(pair, 2),
  7754. selector = _pair[0],
  7755. matcher = _pair[1];
  7756. switch (selector) {
  7757. case Node.TEXT_NODE:
  7758. textMatchers.push(matcher);
  7759. break;
  7760. case Node.ELEMENT_NODE:
  7761. elementMatchers.push(matcher);
  7762. break;
  7763. default:
  7764. [].forEach.call(_this3.container.querySelectorAll(selector), function (node) {
  7765. // TODO use weakmap
  7766. node[DOM_KEY] = node[DOM_KEY] || [];
  7767. node[DOM_KEY].push(matcher);
  7768. });
  7769. break;
  7770. }
  7771. });
  7772. return [elementMatchers, textMatchers];
  7773. }
  7774. }]);
  7775. return Clipboard;
  7776. }(_module2.default);
  7777. Clipboard.DEFAULTS = {
  7778. matchers: [],
  7779. matchVisual: true
  7780. };
  7781. function applyFormat(delta, format, value) {
  7782. if ((typeof format === 'undefined' ? 'undefined' : _typeof(format)) === 'object') {
  7783. return Object.keys(format).reduce(function (delta, key) {
  7784. return applyFormat(delta, key, format[key]);
  7785. }, delta);
  7786. } else {
  7787. return delta.reduce(function (delta, op) {
  7788. if (op.attributes && op.attributes[format]) {
  7789. return delta.push(op);
  7790. } else {
  7791. return delta.insert(op.insert, (0, _extend3.default)({}, _defineProperty({}, format, value), op.attributes));
  7792. }
  7793. }, new _quillDelta2.default());
  7794. }
  7795. }
  7796. function computeStyle(node) {
  7797. if (node.nodeType !== Node.ELEMENT_NODE) return {};
  7798. var DOM_KEY = '__ql-computed-style';
  7799. return node[DOM_KEY] || (node[DOM_KEY] = window.getComputedStyle(node));
  7800. }
  7801. function deltaEndsWith(delta, text) {
  7802. var endText = "";
  7803. for (var i = delta.ops.length - 1; i >= 0 && endText.length < text.length; --i) {
  7804. var op = delta.ops[i];
  7805. if (typeof op.insert !== 'string') break;
  7806. endText = op.insert + endText;
  7807. }
  7808. return endText.slice(-1 * text.length) === text;
  7809. }
  7810. function isLine(node) {
  7811. if (node.childNodes.length === 0) return false; // Exclude embed blocks
  7812. var style = computeStyle(node);
  7813. return ['block', 'list-item'].indexOf(style.display) > -1;
  7814. }
  7815. function traverse(node, elementMatchers, textMatchers) {
  7816. // Post-order
  7817. if (node.nodeType === node.TEXT_NODE) {
  7818. return textMatchers.reduce(function (delta, matcher) {
  7819. return matcher(node, delta);
  7820. }, new _quillDelta2.default());
  7821. } else if (node.nodeType === node.ELEMENT_NODE) {
  7822. return [].reduce.call(node.childNodes || [], function (delta, childNode) {
  7823. var childrenDelta = traverse(childNode, elementMatchers, textMatchers);
  7824. if (childNode.nodeType === node.ELEMENT_NODE) {
  7825. childrenDelta = elementMatchers.reduce(function (childrenDelta, matcher) {
  7826. return matcher(childNode, childrenDelta);
  7827. }, childrenDelta);
  7828. childrenDelta = (childNode[DOM_KEY] || []).reduce(function (childrenDelta, matcher) {
  7829. return matcher(childNode, childrenDelta);
  7830. }, childrenDelta);
  7831. }
  7832. return delta.concat(childrenDelta);
  7833. }, new _quillDelta2.default());
  7834. } else {
  7835. return new _quillDelta2.default();
  7836. }
  7837. }
  7838. function matchAlias(format, node, delta) {
  7839. return applyFormat(delta, format, true);
  7840. }
  7841. function matchAttributor(node, delta) {
  7842. var attributes = _parchment2.default.Attributor.Attribute.keys(node);
  7843. var classes = _parchment2.default.Attributor.Class.keys(node);
  7844. var styles = _parchment2.default.Attributor.Style.keys(node);
  7845. var formats = {};
  7846. attributes.concat(classes).concat(styles).forEach(function (name) {
  7847. var attr = _parchment2.default.query(name, _parchment2.default.Scope.ATTRIBUTE);
  7848. if (attr != null) {
  7849. formats[attr.attrName] = attr.value(node);
  7850. if (formats[attr.attrName]) return;
  7851. }
  7852. attr = ATTRIBUTE_ATTRIBUTORS[name];
  7853. if (attr != null && (attr.attrName === name || attr.keyName === name)) {
  7854. formats[attr.attrName] = attr.value(node) || undefined;
  7855. }
  7856. attr = STYLE_ATTRIBUTORS[name];
  7857. if (attr != null && (attr.attrName === name || attr.keyName === name)) {
  7858. attr = STYLE_ATTRIBUTORS[name];
  7859. formats[attr.attrName] = attr.value(node) || undefined;
  7860. }
  7861. });
  7862. if (Object.keys(formats).length > 0) {
  7863. delta = applyFormat(delta, formats);
  7864. }
  7865. return delta;
  7866. }
  7867. function matchBlot(node, delta) {
  7868. var match = _parchment2.default.query(node);
  7869. if (match == null) return delta;
  7870. if (match.prototype instanceof _parchment2.default.Embed) {
  7871. var embed = {};
  7872. var value = match.value(node);
  7873. if (value != null) {
  7874. embed[match.blotName] = value;
  7875. delta = new _quillDelta2.default().insert(embed, match.formats(node));
  7876. }
  7877. } else if (typeof match.formats === 'function') {
  7878. delta = applyFormat(delta, match.blotName, match.formats(node));
  7879. }
  7880. return delta;
  7881. }
  7882. function matchBreak(node, delta) {
  7883. if (!deltaEndsWith(delta, '\n')) {
  7884. delta.insert('\n');
  7885. }
  7886. return delta;
  7887. }
  7888. function matchIgnore() {
  7889. return new _quillDelta2.default();
  7890. }
  7891. function matchIndent(node, delta) {
  7892. var match = _parchment2.default.query(node);
  7893. if (match == null || match.blotName !== 'list-item' || !deltaEndsWith(delta, '\n')) {
  7894. return delta;
  7895. }
  7896. var indent = -1,
  7897. parent = node.parentNode;
  7898. while (!parent.classList.contains('ql-clipboard')) {
  7899. if ((_parchment2.default.query(parent) || {}).blotName === 'list') {
  7900. indent += 1;
  7901. }
  7902. parent = parent.parentNode;
  7903. }
  7904. if (indent <= 0) return delta;
  7905. return delta.compose(new _quillDelta2.default().retain(delta.length() - 1).retain(1, { indent: indent }));
  7906. }
  7907. function matchNewline(node, delta) {
  7908. if (!deltaEndsWith(delta, '\n')) {
  7909. if (isLine(node) || delta.length() > 0 && node.nextSibling && isLine(node.nextSibling)) {
  7910. delta.insert('\n');
  7911. }
  7912. }
  7913. return delta;
  7914. }
  7915. function matchSpacing(node, delta) {
  7916. if (isLine(node) && node.nextElementSibling != null && !deltaEndsWith(delta, '\n\n')) {
  7917. var nodeHeight = node.offsetHeight + parseFloat(computeStyle(node).marginTop) + parseFloat(computeStyle(node).marginBottom);
  7918. if (node.nextElementSibling.offsetTop > node.offsetTop + nodeHeight * 1.5) {
  7919. delta.insert('\n');
  7920. }
  7921. }
  7922. return delta;
  7923. }
  7924. function matchStyles(node, delta) {
  7925. var formats = {};
  7926. var style = node.style || {};
  7927. if (style.fontStyle && computeStyle(node).fontStyle === 'italic') {
  7928. formats.italic = true;
  7929. }
  7930. if (style.fontWeight && (computeStyle(node).fontWeight.startsWith('bold') || parseInt(computeStyle(node).fontWeight) >= 700)) {
  7931. formats.bold = true;
  7932. }
  7933. if (Object.keys(formats).length > 0) {
  7934. delta = applyFormat(delta, formats);
  7935. }
  7936. if (parseFloat(style.textIndent || 0) > 0) {
  7937. // Could be 0.5in
  7938. delta = new _quillDelta2.default().insert('\t').concat(delta);
  7939. }
  7940. return delta;
  7941. }
  7942. function matchText(node, delta) {
  7943. var text = node.data;
  7944. // Word represents empty line with <o:p>&nbsp;</o:p>
  7945. if (node.parentNode.tagName === 'O:P') {
  7946. return delta.insert(text.trim());
  7947. }
  7948. if (text.trim().length === 0 && node.parentNode.classList.contains('ql-clipboard')) {
  7949. return delta;
  7950. }
  7951. if (!computeStyle(node.parentNode).whiteSpace.startsWith('pre')) {
  7952. // eslint-disable-next-line func-style
  7953. var replacer = function replacer(collapse, match) {
  7954. match = match.replace(/[^\u00a0]/g, ''); // \u00a0 is nbsp;
  7955. return match.length < 1 && collapse ? ' ' : match;
  7956. };
  7957. text = text.replace(/\r\n/g, ' ').replace(/\n/g, ' ');
  7958. text = text.replace(/\s\s+/g, replacer.bind(replacer, true)); // collapse whitespace
  7959. if (node.previousSibling == null && isLine(node.parentNode) || node.previousSibling != null && isLine(node.previousSibling)) {
  7960. text = text.replace(/^\s+/, replacer.bind(replacer, false));
  7961. }
  7962. if (node.nextSibling == null && isLine(node.parentNode) || node.nextSibling != null && isLine(node.nextSibling)) {
  7963. text = text.replace(/\s+$/, replacer.bind(replacer, false));
  7964. }
  7965. }
  7966. return delta.insert(text);
  7967. }
  7968. exports.default = Clipboard;
  7969. exports.matchAttributor = matchAttributor;
  7970. exports.matchBlot = matchBlot;
  7971. exports.matchNewline = matchNewline;
  7972. exports.matchSpacing = matchSpacing;
  7973. exports.matchText = matchText;
  7974. /***/ }),
  7975. /* 56 */
  7976. /***/ (function(module, exports, __webpack_require__) {
  7977. "use strict";
  7978. Object.defineProperty(exports, "__esModule", {
  7979. value: true
  7980. });
  7981. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  7982. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  7983. var _inline = __webpack_require__(6);
  7984. var _inline2 = _interopRequireDefault(_inline);
  7985. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7986. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7987. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  7988. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  7989. var Bold = function (_Inline) {
  7990. _inherits(Bold, _Inline);
  7991. function Bold() {
  7992. _classCallCheck(this, Bold);
  7993. return _possibleConstructorReturn(this, (Bold.__proto__ || Object.getPrototypeOf(Bold)).apply(this, arguments));
  7994. }
  7995. _createClass(Bold, [{
  7996. key: 'optimize',
  7997. value: function optimize(context) {
  7998. _get(Bold.prototype.__proto__ || Object.getPrototypeOf(Bold.prototype), 'optimize', this).call(this, context);
  7999. if (this.domNode.tagName !== this.statics.tagName[0]) {
  8000. this.replaceWith(this.statics.blotName);
  8001. }
  8002. }
  8003. }], [{
  8004. key: 'create',
  8005. value: function create() {
  8006. return _get(Bold.__proto__ || Object.getPrototypeOf(Bold), 'create', this).call(this);
  8007. }
  8008. }, {
  8009. key: 'formats',
  8010. value: function formats() {
  8011. return true;
  8012. }
  8013. }]);
  8014. return Bold;
  8015. }(_inline2.default);
  8016. Bold.blotName = 'bold';
  8017. Bold.tagName = ['STRONG', 'B'];
  8018. exports.default = Bold;
  8019. /***/ }),
  8020. /* 57 */
  8021. /***/ (function(module, exports, __webpack_require__) {
  8022. "use strict";
  8023. Object.defineProperty(exports, "__esModule", {
  8024. value: true
  8025. });
  8026. exports.addControls = exports.default = undefined;
  8027. var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
  8028. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8029. var _quillDelta = __webpack_require__(2);
  8030. var _quillDelta2 = _interopRequireDefault(_quillDelta);
  8031. var _parchment = __webpack_require__(0);
  8032. var _parchment2 = _interopRequireDefault(_parchment);
  8033. var _quill = __webpack_require__(5);
  8034. var _quill2 = _interopRequireDefault(_quill);
  8035. var _logger = __webpack_require__(10);
  8036. var _logger2 = _interopRequireDefault(_logger);
  8037. var _module = __webpack_require__(9);
  8038. var _module2 = _interopRequireDefault(_module);
  8039. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8040. 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; }
  8041. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8042. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  8043. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  8044. var debug = (0, _logger2.default)('quill:toolbar');
  8045. var Toolbar = function (_Module) {
  8046. _inherits(Toolbar, _Module);
  8047. function Toolbar(quill, options) {
  8048. _classCallCheck(this, Toolbar);
  8049. var _this = _possibleConstructorReturn(this, (Toolbar.__proto__ || Object.getPrototypeOf(Toolbar)).call(this, quill, options));
  8050. if (Array.isArray(_this.options.container)) {
  8051. var container = document.createElement('div');
  8052. addControls(container, _this.options.container);
  8053. quill.container.parentNode.insertBefore(container, quill.container);
  8054. _this.container = container;
  8055. } else if (typeof _this.options.container === 'string') {
  8056. _this.container = document.querySelector(_this.options.container);
  8057. } else {
  8058. _this.container = _this.options.container;
  8059. }
  8060. if (!(_this.container instanceof HTMLElement)) {
  8061. var _ret;
  8062. return _ret = debug.error('Container required for toolbar', _this.options), _possibleConstructorReturn(_this, _ret);
  8063. }
  8064. _this.container.classList.add('ql-toolbar');
  8065. _this.controls = [];
  8066. _this.handlers = {};
  8067. Object.keys(_this.options.handlers).forEach(function (format) {
  8068. _this.addHandler(format, _this.options.handlers[format]);
  8069. });
  8070. [].forEach.call(_this.container.querySelectorAll('button, select'), function (input) {
  8071. _this.attach(input);
  8072. });
  8073. _this.quill.on(_quill2.default.events.EDITOR_CHANGE, function (type, range) {
  8074. if (type === _quill2.default.events.SELECTION_CHANGE) {
  8075. _this.update(range);
  8076. }
  8077. });
  8078. _this.quill.on(_quill2.default.events.SCROLL_OPTIMIZE, function () {
  8079. var _this$quill$selection = _this.quill.selection.getRange(),
  8080. _this$quill$selection2 = _slicedToArray(_this$quill$selection, 1),
  8081. range = _this$quill$selection2[0]; // quill.getSelection triggers update
  8082. _this.update(range);
  8083. });
  8084. return _this;
  8085. }
  8086. _createClass(Toolbar, [{
  8087. key: 'addHandler',
  8088. value: function addHandler(format, handler) {
  8089. this.handlers[format] = handler;
  8090. }
  8091. }, {
  8092. key: 'attach',
  8093. value: function attach(input) {
  8094. var _this2 = this;
  8095. var format = [].find.call(input.classList, function (className) {
  8096. return className.indexOf('ql-') === 0;
  8097. });
  8098. if (!format) return;
  8099. format = format.slice('ql-'.length);
  8100. if (input.tagName === 'BUTTON') {
  8101. input.setAttribute('type', 'button');
  8102. }
  8103. if (this.handlers[format] == null) {
  8104. if (this.quill.scroll.whitelist != null && this.quill.scroll.whitelist[format] == null) {
  8105. debug.warn('ignoring attaching to disabled format', format, input);
  8106. return;
  8107. }
  8108. if (_parchment2.default.query(format) == null) {
  8109. debug.warn('ignoring attaching to nonexistent format', format, input);
  8110. return;
  8111. }
  8112. }
  8113. var eventName = input.tagName === 'SELECT' ? 'change' : 'click';
  8114. input.addEventListener(eventName, function (e) {
  8115. var value = void 0;
  8116. if (input.tagName === 'SELECT') {
  8117. if (input.selectedIndex < 0) return;
  8118. var selected = input.options[input.selectedIndex];
  8119. if (selected.hasAttribute('selected')) {
  8120. value = false;
  8121. } else {
  8122. value = selected.value || false;
  8123. }
  8124. } else {
  8125. if (input.classList.contains('ql-active')) {
  8126. value = false;
  8127. } else {
  8128. value = input.value || !input.hasAttribute('value');
  8129. }
  8130. e.preventDefault();
  8131. }
  8132. _this2.quill.focus();
  8133. var _quill$selection$getR = _this2.quill.selection.getRange(),
  8134. _quill$selection$getR2 = _slicedToArray(_quill$selection$getR, 1),
  8135. range = _quill$selection$getR2[0];
  8136. if (_this2.handlers[format] != null) {
  8137. _this2.handlers[format].call(_this2, value);
  8138. } else if (_parchment2.default.query(format).prototype instanceof _parchment2.default.Embed) {
  8139. value = prompt('Enter ' + format);
  8140. if (!value) return;
  8141. _this2.quill.updateContents(new _quillDelta2.default().retain(range.index).delete(range.length).insert(_defineProperty({}, format, value)), _quill2.default.sources.USER);
  8142. } else {
  8143. _this2.quill.format(format, value, _quill2.default.sources.USER);
  8144. }
  8145. _this2.update(range);
  8146. });
  8147. // TODO use weakmap
  8148. this.controls.push([format, input]);
  8149. }
  8150. }, {
  8151. key: 'update',
  8152. value: function update(range) {
  8153. var formats = range == null ? {} : this.quill.getFormat(range);
  8154. this.controls.forEach(function (pair) {
  8155. var _pair = _slicedToArray(pair, 2),
  8156. format = _pair[0],
  8157. input = _pair[1];
  8158. if (input.tagName === 'SELECT') {
  8159. var option = void 0;
  8160. if (range == null) {
  8161. option = null;
  8162. } else if (formats[format] == null) {
  8163. option = input.querySelector('option[selected]');
  8164. } else if (!Array.isArray(formats[format])) {
  8165. var value = formats[format];
  8166. if (typeof value === 'string') {
  8167. value = value.replace(/\"/g, '\\"');
  8168. }
  8169. option = input.querySelector('option[value="' + value + '"]');
  8170. }
  8171. if (option == null) {
  8172. input.value = ''; // TODO make configurable?
  8173. input.selectedIndex = -1;
  8174. } else {
  8175. option.selected = true;
  8176. }
  8177. } else {
  8178. if (range == null) {
  8179. input.classList.remove('ql-active');
  8180. } else if (input.hasAttribute('value')) {
  8181. // both being null should match (default values)
  8182. // '1' should match with 1 (headers)
  8183. var isActive = formats[format] === input.getAttribute('value') || formats[format] != null && formats[format].toString() === input.getAttribute('value') || formats[format] == null && !input.getAttribute('value');
  8184. input.classList.toggle('ql-active', isActive);
  8185. } else {
  8186. input.classList.toggle('ql-active', formats[format] != null);
  8187. }
  8188. }
  8189. });
  8190. }
  8191. }]);
  8192. return Toolbar;
  8193. }(_module2.default);
  8194. Toolbar.DEFAULTS = {};
  8195. function addButton(container, format, value) {
  8196. var input = document.createElement('button');
  8197. input.setAttribute('type', 'button');
  8198. input.classList.add('ql-' + format);
  8199. if (value != null) {
  8200. input.value = value;
  8201. }
  8202. container.appendChild(input);
  8203. }
  8204. function addControls(container, groups) {
  8205. if (!Array.isArray(groups[0])) {
  8206. groups = [groups];
  8207. }
  8208. groups.forEach(function (controls) {
  8209. var group = document.createElement('span');
  8210. group.classList.add('ql-formats');
  8211. controls.forEach(function (control) {
  8212. if (typeof control === 'string') {
  8213. addButton(group, control);
  8214. } else {
  8215. var format = Object.keys(control)[0];
  8216. var value = control[format];
  8217. if (Array.isArray(value)) {
  8218. addSelect(group, format, value);
  8219. } else {
  8220. addButton(group, format, value);
  8221. }
  8222. }
  8223. });
  8224. container.appendChild(group);
  8225. });
  8226. }
  8227. function addSelect(container, format, values) {
  8228. var input = document.createElement('select');
  8229. input.classList.add('ql-' + format);
  8230. values.forEach(function (value) {
  8231. var option = document.createElement('option');
  8232. if (value !== false) {
  8233. option.setAttribute('value', value);
  8234. } else {
  8235. option.setAttribute('selected', 'selected');
  8236. }
  8237. input.appendChild(option);
  8238. });
  8239. container.appendChild(input);
  8240. }
  8241. Toolbar.DEFAULTS = {
  8242. container: null,
  8243. handlers: {
  8244. clean: function clean() {
  8245. var _this3 = this;
  8246. var range = this.quill.getSelection();
  8247. if (range == null) return;
  8248. if (range.length == 0) {
  8249. var formats = this.quill.getFormat();
  8250. Object.keys(formats).forEach(function (name) {
  8251. // Clean functionality in existing apps only clean inline formats
  8252. if (_parchment2.default.query(name, _parchment2.default.Scope.INLINE) != null) {
  8253. _this3.quill.format(name, false);
  8254. }
  8255. });
  8256. } else {
  8257. this.quill.removeFormat(range, _quill2.default.sources.USER);
  8258. }
  8259. },
  8260. direction: function direction(value) {
  8261. var align = this.quill.getFormat()['align'];
  8262. if (value === 'rtl' && align == null) {
  8263. this.quill.format('align', 'right', _quill2.default.sources.USER);
  8264. } else if (!value && align === 'right') {
  8265. this.quill.format('align', false, _quill2.default.sources.USER);
  8266. }
  8267. this.quill.format('direction', value, _quill2.default.sources.USER);
  8268. },
  8269. indent: function indent(value) {
  8270. var range = this.quill.getSelection();
  8271. var formats = this.quill.getFormat(range);
  8272. var indent = parseInt(formats.indent || 0);
  8273. if (value === '+1' || value === '-1') {
  8274. var modifier = value === '+1' ? 1 : -1;
  8275. if (formats.direction === 'rtl') modifier *= -1;
  8276. this.quill.format('indent', indent + modifier, _quill2.default.sources.USER);
  8277. }
  8278. },
  8279. link: function link(value) {
  8280. if (value === true) {
  8281. value = prompt('Enter link URL:');
  8282. }
  8283. this.quill.format('link', value, _quill2.default.sources.USER);
  8284. },
  8285. list: function list(value) {
  8286. var range = this.quill.getSelection();
  8287. var formats = this.quill.getFormat(range);
  8288. if (value === 'check') {
  8289. if (formats['list'] === 'checked' || formats['list'] === 'unchecked') {
  8290. this.quill.format('list', false, _quill2.default.sources.USER);
  8291. } else {
  8292. this.quill.format('list', 'unchecked', _quill2.default.sources.USER);
  8293. }
  8294. } else {
  8295. this.quill.format('list', value, _quill2.default.sources.USER);
  8296. }
  8297. }
  8298. }
  8299. };
  8300. exports.default = Toolbar;
  8301. exports.addControls = addControls;
  8302. /***/ }),
  8303. /* 58 */
  8304. /***/ (function(module, exports) {
  8305. module.exports = "<svg viewbox=\"0 0 18 18\"> <polyline class=\"ql-even ql-stroke\" points=\"5 7 3 9 5 11\"></polyline> <polyline class=\"ql-even ql-stroke\" points=\"13 7 15 9 13 11\"></polyline> <line class=ql-stroke x1=10 x2=8 y1=5 y2=13></line> </svg>";
  8306. /***/ }),
  8307. /* 59 */
  8308. /***/ (function(module, exports, __webpack_require__) {
  8309. "use strict";
  8310. Object.defineProperty(exports, "__esModule", {
  8311. value: true
  8312. });
  8313. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8314. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  8315. var _picker = __webpack_require__(28);
  8316. var _picker2 = _interopRequireDefault(_picker);
  8317. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8318. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8319. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  8320. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  8321. var ColorPicker = function (_Picker) {
  8322. _inherits(ColorPicker, _Picker);
  8323. function ColorPicker(select, label) {
  8324. _classCallCheck(this, ColorPicker);
  8325. var _this = _possibleConstructorReturn(this, (ColorPicker.__proto__ || Object.getPrototypeOf(ColorPicker)).call(this, select));
  8326. _this.label.innerHTML = label;
  8327. _this.container.classList.add('ql-color-picker');
  8328. [].slice.call(_this.container.querySelectorAll('.ql-picker-item'), 0, 7).forEach(function (item) {
  8329. item.classList.add('ql-primary');
  8330. });
  8331. return _this;
  8332. }
  8333. _createClass(ColorPicker, [{
  8334. key: 'buildItem',
  8335. value: function buildItem(option) {
  8336. var item = _get(ColorPicker.prototype.__proto__ || Object.getPrototypeOf(ColorPicker.prototype), 'buildItem', this).call(this, option);
  8337. item.style.backgroundColor = option.getAttribute('value') || '';
  8338. return item;
  8339. }
  8340. }, {
  8341. key: 'selectItem',
  8342. value: function selectItem(item, trigger) {
  8343. _get(ColorPicker.prototype.__proto__ || Object.getPrototypeOf(ColorPicker.prototype), 'selectItem', this).call(this, item, trigger);
  8344. var colorLabel = this.label.querySelector('.ql-color-label');
  8345. var value = item ? item.getAttribute('data-value') || '' : '';
  8346. if (colorLabel) {
  8347. if (colorLabel.tagName === 'line') {
  8348. colorLabel.style.stroke = value;
  8349. } else {
  8350. colorLabel.style.fill = value;
  8351. }
  8352. }
  8353. }
  8354. }]);
  8355. return ColorPicker;
  8356. }(_picker2.default);
  8357. exports.default = ColorPicker;
  8358. /***/ }),
  8359. /* 60 */
  8360. /***/ (function(module, exports, __webpack_require__) {
  8361. "use strict";
  8362. Object.defineProperty(exports, "__esModule", {
  8363. value: true
  8364. });
  8365. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8366. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  8367. var _picker = __webpack_require__(28);
  8368. var _picker2 = _interopRequireDefault(_picker);
  8369. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8370. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8371. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  8372. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  8373. var IconPicker = function (_Picker) {
  8374. _inherits(IconPicker, _Picker);
  8375. function IconPicker(select, icons) {
  8376. _classCallCheck(this, IconPicker);
  8377. var _this = _possibleConstructorReturn(this, (IconPicker.__proto__ || Object.getPrototypeOf(IconPicker)).call(this, select));
  8378. _this.container.classList.add('ql-icon-picker');
  8379. [].forEach.call(_this.container.querySelectorAll('.ql-picker-item'), function (item) {
  8380. item.innerHTML = icons[item.getAttribute('data-value') || ''];
  8381. });
  8382. _this.defaultItem = _this.container.querySelector('.ql-selected');
  8383. _this.selectItem(_this.defaultItem);
  8384. return _this;
  8385. }
  8386. _createClass(IconPicker, [{
  8387. key: 'selectItem',
  8388. value: function selectItem(item, trigger) {
  8389. _get(IconPicker.prototype.__proto__ || Object.getPrototypeOf(IconPicker.prototype), 'selectItem', this).call(this, item, trigger);
  8390. item = item || this.defaultItem;
  8391. this.label.innerHTML = item.innerHTML;
  8392. }
  8393. }]);
  8394. return IconPicker;
  8395. }(_picker2.default);
  8396. exports.default = IconPicker;
  8397. /***/ }),
  8398. /* 61 */
  8399. /***/ (function(module, exports, __webpack_require__) {
  8400. "use strict";
  8401. Object.defineProperty(exports, "__esModule", {
  8402. value: true
  8403. });
  8404. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8405. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8406. var Tooltip = function () {
  8407. function Tooltip(quill, boundsContainer) {
  8408. var _this = this;
  8409. _classCallCheck(this, Tooltip);
  8410. this.quill = quill;
  8411. this.boundsContainer = boundsContainer || document.body;
  8412. this.root = quill.addContainer('ql-tooltip');
  8413. this.root.innerHTML = this.constructor.TEMPLATE;
  8414. if (this.quill.root === this.quill.scrollingContainer) {
  8415. this.quill.root.addEventListener('scroll', function () {
  8416. _this.root.style.marginTop = -1 * _this.quill.root.scrollTop + 'px';
  8417. });
  8418. }
  8419. this.hide();
  8420. }
  8421. _createClass(Tooltip, [{
  8422. key: 'hide',
  8423. value: function hide() {
  8424. this.root.classList.add('ql-hidden');
  8425. }
  8426. }, {
  8427. key: 'position',
  8428. value: function position(reference) {
  8429. var left = reference.left + reference.width / 2 - this.root.offsetWidth / 2;
  8430. // root.scrollTop should be 0 if scrollContainer !== root
  8431. var top = reference.bottom + this.quill.root.scrollTop;
  8432. this.root.style.left = left + 'px';
  8433. this.root.style.top = top + 'px';
  8434. this.root.classList.remove('ql-flip');
  8435. var containerBounds = this.boundsContainer.getBoundingClientRect();
  8436. var rootBounds = this.root.getBoundingClientRect();
  8437. var shift = 0;
  8438. if (rootBounds.right > containerBounds.right) {
  8439. shift = containerBounds.right - rootBounds.right;
  8440. this.root.style.left = left + shift + 'px';
  8441. }
  8442. if (rootBounds.left < containerBounds.left) {
  8443. shift = containerBounds.left - rootBounds.left;
  8444. this.root.style.left = left + shift + 'px';
  8445. }
  8446. if (rootBounds.bottom > containerBounds.bottom) {
  8447. var height = rootBounds.bottom - rootBounds.top;
  8448. var verticalShift = reference.bottom - reference.top + height;
  8449. this.root.style.top = top - verticalShift + 'px';
  8450. this.root.classList.add('ql-flip');
  8451. }
  8452. return shift;
  8453. }
  8454. }, {
  8455. key: 'show',
  8456. value: function show() {
  8457. this.root.classList.remove('ql-editing');
  8458. this.root.classList.remove('ql-hidden');
  8459. }
  8460. }]);
  8461. return Tooltip;
  8462. }();
  8463. exports.default = Tooltip;
  8464. /***/ }),
  8465. /* 62 */
  8466. /***/ (function(module, exports, __webpack_require__) {
  8467. "use strict";
  8468. Object.defineProperty(exports, "__esModule", {
  8469. value: true
  8470. });
  8471. var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
  8472. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  8473. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8474. var _extend = __webpack_require__(3);
  8475. var _extend2 = _interopRequireDefault(_extend);
  8476. var _emitter = __webpack_require__(8);
  8477. var _emitter2 = _interopRequireDefault(_emitter);
  8478. var _base = __webpack_require__(43);
  8479. var _base2 = _interopRequireDefault(_base);
  8480. var _link = __webpack_require__(27);
  8481. var _link2 = _interopRequireDefault(_link);
  8482. var _selection = __webpack_require__(15);
  8483. var _icons = __webpack_require__(41);
  8484. var _icons2 = _interopRequireDefault(_icons);
  8485. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8486. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8487. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  8488. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  8489. var TOOLBAR_CONFIG = [[{ header: ['1', '2', '3', false] }], ['bold', 'italic', 'underline', 'link'], [{ list: 'ordered' }, { list: 'bullet' }], ['clean']];
  8490. var SnowTheme = function (_BaseTheme) {
  8491. _inherits(SnowTheme, _BaseTheme);
  8492. function SnowTheme(quill, options) {
  8493. _classCallCheck(this, SnowTheme);
  8494. if (options.modules.toolbar != null && options.modules.toolbar.container == null) {
  8495. options.modules.toolbar.container = TOOLBAR_CONFIG;
  8496. }
  8497. var _this = _possibleConstructorReturn(this, (SnowTheme.__proto__ || Object.getPrototypeOf(SnowTheme)).call(this, quill, options));
  8498. _this.quill.container.classList.add('ql-snow');
  8499. return _this;
  8500. }
  8501. _createClass(SnowTheme, [{
  8502. key: 'extendToolbar',
  8503. value: function extendToolbar(toolbar) {
  8504. toolbar.container.classList.add('ql-snow');
  8505. this.buildButtons([].slice.call(toolbar.container.querySelectorAll('button')), _icons2.default);
  8506. this.buildPickers([].slice.call(toolbar.container.querySelectorAll('select')), _icons2.default);
  8507. this.tooltip = new SnowTooltip(this.quill, this.options.bounds);
  8508. if (toolbar.container.querySelector('.ql-link')) {
  8509. this.quill.keyboard.addBinding({ key: 'K', shortKey: true }, function (range, context) {
  8510. toolbar.handlers['link'].call(toolbar, !context.format.link);
  8511. });
  8512. }
  8513. }
  8514. }]);
  8515. return SnowTheme;
  8516. }(_base2.default);
  8517. SnowTheme.DEFAULTS = (0, _extend2.default)(true, {}, _base2.default.DEFAULTS, {
  8518. modules: {
  8519. toolbar: {
  8520. handlers: {
  8521. link: function link(value) {
  8522. if (value) {
  8523. var range = this.quill.getSelection();
  8524. if (range == null || range.length == 0) return;
  8525. var preview = this.quill.getText(range);
  8526. if (/^\S+@\S+\.\S+$/.test(preview) && preview.indexOf('mailto:') !== 0) {
  8527. preview = 'mailto:' + preview;
  8528. }
  8529. var tooltip = this.quill.theme.tooltip;
  8530. tooltip.edit('link', preview);
  8531. } else {
  8532. this.quill.format('link', false);
  8533. }
  8534. }
  8535. }
  8536. }
  8537. }
  8538. });
  8539. var SnowTooltip = function (_BaseTooltip) {
  8540. _inherits(SnowTooltip, _BaseTooltip);
  8541. function SnowTooltip(quill, bounds) {
  8542. _classCallCheck(this, SnowTooltip);
  8543. var _this2 = _possibleConstructorReturn(this, (SnowTooltip.__proto__ || Object.getPrototypeOf(SnowTooltip)).call(this, quill, bounds));
  8544. _this2.preview = _this2.root.querySelector('a.ql-preview');
  8545. return _this2;
  8546. }
  8547. _createClass(SnowTooltip, [{
  8548. key: 'listen',
  8549. value: function listen() {
  8550. var _this3 = this;
  8551. _get(SnowTooltip.prototype.__proto__ || Object.getPrototypeOf(SnowTooltip.prototype), 'listen', this).call(this);
  8552. this.root.querySelector('a.ql-action').addEventListener('click', function (event) {
  8553. if (_this3.root.classList.contains('ql-editing')) {
  8554. _this3.save();
  8555. } else {
  8556. _this3.edit('link', _this3.preview.textContent);
  8557. }
  8558. event.preventDefault();
  8559. });
  8560. this.root.querySelector('a.ql-remove').addEventListener('click', function (event) {
  8561. if (_this3.linkRange != null) {
  8562. var range = _this3.linkRange;
  8563. _this3.restoreFocus();
  8564. _this3.quill.formatText(range, 'link', false, _emitter2.default.sources.USER);
  8565. delete _this3.linkRange;
  8566. }
  8567. event.preventDefault();
  8568. _this3.hide();
  8569. });
  8570. this.quill.on(_emitter2.default.events.SELECTION_CHANGE, function (range, oldRange, source) {
  8571. if (range == null) return;
  8572. if (range.length === 0 && source === _emitter2.default.sources.USER) {
  8573. var _quill$scroll$descend = _this3.quill.scroll.descendant(_link2.default, range.index),
  8574. _quill$scroll$descend2 = _slicedToArray(_quill$scroll$descend, 2),
  8575. link = _quill$scroll$descend2[0],
  8576. offset = _quill$scroll$descend2[1];
  8577. if (link != null) {
  8578. _this3.linkRange = new _selection.Range(range.index - offset, link.length());
  8579. var preview = _link2.default.formats(link.domNode);
  8580. _this3.preview.textContent = preview;
  8581. _this3.preview.setAttribute('href', preview);
  8582. _this3.show();
  8583. _this3.position(_this3.quill.getBounds(_this3.linkRange));
  8584. return;
  8585. }
  8586. } else {
  8587. delete _this3.linkRange;
  8588. }
  8589. _this3.hide();
  8590. });
  8591. }
  8592. }, {
  8593. key: 'show',
  8594. value: function show() {
  8595. _get(SnowTooltip.prototype.__proto__ || Object.getPrototypeOf(SnowTooltip.prototype), 'show', this).call(this);
  8596. this.root.removeAttribute('data-mode');
  8597. }
  8598. }]);
  8599. return SnowTooltip;
  8600. }(_base.BaseTooltip);
  8601. SnowTooltip.TEMPLATE = ['<a class="ql-preview" target="_blank" href="about:blank"></a>', '<input type="text" data-formula="e=mc^2" data-link="https://quilljs.com" data-video="Embed URL">', '<a class="ql-action"></a>', '<a class="ql-remove"></a>'].join('');
  8602. exports.default = SnowTheme;
  8603. /***/ }),
  8604. /* 63 */
  8605. /***/ (function(module, exports, __webpack_require__) {
  8606. "use strict";
  8607. Object.defineProperty(exports, "__esModule", {
  8608. value: true
  8609. });
  8610. var _core = __webpack_require__(29);
  8611. var _core2 = _interopRequireDefault(_core);
  8612. var _align = __webpack_require__(36);
  8613. var _direction = __webpack_require__(38);
  8614. var _indent = __webpack_require__(64);
  8615. var _blockquote = __webpack_require__(65);
  8616. var _blockquote2 = _interopRequireDefault(_blockquote);
  8617. var _header = __webpack_require__(66);
  8618. var _header2 = _interopRequireDefault(_header);
  8619. var _list = __webpack_require__(67);
  8620. var _list2 = _interopRequireDefault(_list);
  8621. var _background = __webpack_require__(37);
  8622. var _color = __webpack_require__(26);
  8623. var _font = __webpack_require__(39);
  8624. var _size = __webpack_require__(40);
  8625. var _bold = __webpack_require__(56);
  8626. var _bold2 = _interopRequireDefault(_bold);
  8627. var _italic = __webpack_require__(68);
  8628. var _italic2 = _interopRequireDefault(_italic);
  8629. var _link = __webpack_require__(27);
  8630. var _link2 = _interopRequireDefault(_link);
  8631. var _script = __webpack_require__(69);
  8632. var _script2 = _interopRequireDefault(_script);
  8633. var _strike = __webpack_require__(70);
  8634. var _strike2 = _interopRequireDefault(_strike);
  8635. var _underline = __webpack_require__(71);
  8636. var _underline2 = _interopRequireDefault(_underline);
  8637. var _image = __webpack_require__(72);
  8638. var _image2 = _interopRequireDefault(_image);
  8639. var _video = __webpack_require__(73);
  8640. var _video2 = _interopRequireDefault(_video);
  8641. var _code = __webpack_require__(13);
  8642. var _code2 = _interopRequireDefault(_code);
  8643. var _formula = __webpack_require__(74);
  8644. var _formula2 = _interopRequireDefault(_formula);
  8645. var _syntax = __webpack_require__(75);
  8646. var _syntax2 = _interopRequireDefault(_syntax);
  8647. var _toolbar = __webpack_require__(57);
  8648. var _toolbar2 = _interopRequireDefault(_toolbar);
  8649. var _icons = __webpack_require__(41);
  8650. var _icons2 = _interopRequireDefault(_icons);
  8651. var _picker = __webpack_require__(28);
  8652. var _picker2 = _interopRequireDefault(_picker);
  8653. var _colorPicker = __webpack_require__(59);
  8654. var _colorPicker2 = _interopRequireDefault(_colorPicker);
  8655. var _iconPicker = __webpack_require__(60);
  8656. var _iconPicker2 = _interopRequireDefault(_iconPicker);
  8657. var _tooltip = __webpack_require__(61);
  8658. var _tooltip2 = _interopRequireDefault(_tooltip);
  8659. var _bubble = __webpack_require__(108);
  8660. var _bubble2 = _interopRequireDefault(_bubble);
  8661. var _snow = __webpack_require__(62);
  8662. var _snow2 = _interopRequireDefault(_snow);
  8663. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8664. _core2.default.register({
  8665. 'attributors/attribute/direction': _direction.DirectionAttribute,
  8666. 'attributors/class/align': _align.AlignClass,
  8667. 'attributors/class/background': _background.BackgroundClass,
  8668. 'attributors/class/color': _color.ColorClass,
  8669. 'attributors/class/direction': _direction.DirectionClass,
  8670. 'attributors/class/font': _font.FontClass,
  8671. 'attributors/class/size': _size.SizeClass,
  8672. 'attributors/style/align': _align.AlignStyle,
  8673. 'attributors/style/background': _background.BackgroundStyle,
  8674. 'attributors/style/color': _color.ColorStyle,
  8675. 'attributors/style/direction': _direction.DirectionStyle,
  8676. 'attributors/style/font': _font.FontStyle,
  8677. 'attributors/style/size': _size.SizeStyle
  8678. }, true);
  8679. _core2.default.register({
  8680. 'formats/align': _align.AlignClass,
  8681. 'formats/direction': _direction.DirectionClass,
  8682. 'formats/indent': _indent.IndentClass,
  8683. 'formats/background': _background.BackgroundStyle,
  8684. 'formats/color': _color.ColorStyle,
  8685. 'formats/font': _font.FontClass,
  8686. 'formats/size': _size.SizeClass,
  8687. 'formats/blockquote': _blockquote2.default,
  8688. 'formats/code-block': _code2.default,
  8689. 'formats/header': _header2.default,
  8690. 'formats/list': _list2.default,
  8691. 'formats/bold': _bold2.default,
  8692. 'formats/code': _code.Code,
  8693. 'formats/italic': _italic2.default,
  8694. 'formats/link': _link2.default,
  8695. 'formats/script': _script2.default,
  8696. 'formats/strike': _strike2.default,
  8697. 'formats/underline': _underline2.default,
  8698. 'formats/image': _image2.default,
  8699. 'formats/video': _video2.default,
  8700. 'formats/list/item': _list.ListItem,
  8701. 'modules/formula': _formula2.default,
  8702. 'modules/syntax': _syntax2.default,
  8703. 'modules/toolbar': _toolbar2.default,
  8704. 'themes/bubble': _bubble2.default,
  8705. 'themes/snow': _snow2.default,
  8706. 'ui/icons': _icons2.default,
  8707. 'ui/picker': _picker2.default,
  8708. 'ui/icon-picker': _iconPicker2.default,
  8709. 'ui/color-picker': _colorPicker2.default,
  8710. 'ui/tooltip': _tooltip2.default
  8711. }, true);
  8712. exports.default = _core2.default;
  8713. /***/ }),
  8714. /* 64 */
  8715. /***/ (function(module, exports, __webpack_require__) {
  8716. "use strict";
  8717. Object.defineProperty(exports, "__esModule", {
  8718. value: true
  8719. });
  8720. exports.IndentClass = undefined;
  8721. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8722. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  8723. var _parchment = __webpack_require__(0);
  8724. var _parchment2 = _interopRequireDefault(_parchment);
  8725. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8726. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8727. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  8728. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  8729. var IdentAttributor = function (_Parchment$Attributor) {
  8730. _inherits(IdentAttributor, _Parchment$Attributor);
  8731. function IdentAttributor() {
  8732. _classCallCheck(this, IdentAttributor);
  8733. return _possibleConstructorReturn(this, (IdentAttributor.__proto__ || Object.getPrototypeOf(IdentAttributor)).apply(this, arguments));
  8734. }
  8735. _createClass(IdentAttributor, [{
  8736. key: 'add',
  8737. value: function add(node, value) {
  8738. if (value === '+1' || value === '-1') {
  8739. var indent = this.value(node) || 0;
  8740. value = value === '+1' ? indent + 1 : indent - 1;
  8741. }
  8742. if (value === 0) {
  8743. this.remove(node);
  8744. return true;
  8745. } else {
  8746. return _get(IdentAttributor.prototype.__proto__ || Object.getPrototypeOf(IdentAttributor.prototype), 'add', this).call(this, node, value);
  8747. }
  8748. }
  8749. }, {
  8750. key: 'canAdd',
  8751. value: function canAdd(node, value) {
  8752. return _get(IdentAttributor.prototype.__proto__ || Object.getPrototypeOf(IdentAttributor.prototype), 'canAdd', this).call(this, node, value) || _get(IdentAttributor.prototype.__proto__ || Object.getPrototypeOf(IdentAttributor.prototype), 'canAdd', this).call(this, node, parseInt(value));
  8753. }
  8754. }, {
  8755. key: 'value',
  8756. value: function value(node) {
  8757. return parseInt(_get(IdentAttributor.prototype.__proto__ || Object.getPrototypeOf(IdentAttributor.prototype), 'value', this).call(this, node)) || undefined; // Don't return NaN
  8758. }
  8759. }]);
  8760. return IdentAttributor;
  8761. }(_parchment2.default.Attributor.Class);
  8762. var IndentClass = new IdentAttributor('indent', 'ql-indent', {
  8763. scope: _parchment2.default.Scope.BLOCK,
  8764. whitelist: [1, 2, 3, 4, 5, 6, 7, 8]
  8765. });
  8766. exports.IndentClass = IndentClass;
  8767. /***/ }),
  8768. /* 65 */
  8769. /***/ (function(module, exports, __webpack_require__) {
  8770. "use strict";
  8771. Object.defineProperty(exports, "__esModule", {
  8772. value: true
  8773. });
  8774. var _block = __webpack_require__(4);
  8775. var _block2 = _interopRequireDefault(_block);
  8776. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8777. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8778. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  8779. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  8780. var Blockquote = function (_Block) {
  8781. _inherits(Blockquote, _Block);
  8782. function Blockquote() {
  8783. _classCallCheck(this, Blockquote);
  8784. return _possibleConstructorReturn(this, (Blockquote.__proto__ || Object.getPrototypeOf(Blockquote)).apply(this, arguments));
  8785. }
  8786. return Blockquote;
  8787. }(_block2.default);
  8788. Blockquote.blotName = 'blockquote';
  8789. Blockquote.tagName = 'blockquote';
  8790. exports.default = Blockquote;
  8791. /***/ }),
  8792. /* 66 */
  8793. /***/ (function(module, exports, __webpack_require__) {
  8794. "use strict";
  8795. Object.defineProperty(exports, "__esModule", {
  8796. value: true
  8797. });
  8798. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8799. var _block = __webpack_require__(4);
  8800. var _block2 = _interopRequireDefault(_block);
  8801. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8802. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8803. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  8804. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  8805. var Header = function (_Block) {
  8806. _inherits(Header, _Block);
  8807. function Header() {
  8808. _classCallCheck(this, Header);
  8809. return _possibleConstructorReturn(this, (Header.__proto__ || Object.getPrototypeOf(Header)).apply(this, arguments));
  8810. }
  8811. _createClass(Header, null, [{
  8812. key: 'formats',
  8813. value: function formats(domNode) {
  8814. return this.tagName.indexOf(domNode.tagName) + 1;
  8815. }
  8816. }]);
  8817. return Header;
  8818. }(_block2.default);
  8819. Header.blotName = 'header';
  8820. Header.tagName = ['H1', 'H2', 'H3', 'H4', 'H5', 'H6'];
  8821. exports.default = Header;
  8822. /***/ }),
  8823. /* 67 */
  8824. /***/ (function(module, exports, __webpack_require__) {
  8825. "use strict";
  8826. Object.defineProperty(exports, "__esModule", {
  8827. value: true
  8828. });
  8829. exports.default = exports.ListItem = undefined;
  8830. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8831. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  8832. var _parchment = __webpack_require__(0);
  8833. var _parchment2 = _interopRequireDefault(_parchment);
  8834. var _block = __webpack_require__(4);
  8835. var _block2 = _interopRequireDefault(_block);
  8836. var _container = __webpack_require__(25);
  8837. var _container2 = _interopRequireDefault(_container);
  8838. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8839. 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; }
  8840. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8841. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  8842. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  8843. var ListItem = function (_Block) {
  8844. _inherits(ListItem, _Block);
  8845. function ListItem() {
  8846. _classCallCheck(this, ListItem);
  8847. return _possibleConstructorReturn(this, (ListItem.__proto__ || Object.getPrototypeOf(ListItem)).apply(this, arguments));
  8848. }
  8849. _createClass(ListItem, [{
  8850. key: 'format',
  8851. value: function format(name, value) {
  8852. if (name === List.blotName && !value) {
  8853. this.replaceWith(_parchment2.default.create(this.statics.scope));
  8854. } else {
  8855. _get(ListItem.prototype.__proto__ || Object.getPrototypeOf(ListItem.prototype), 'format', this).call(this, name, value);
  8856. }
  8857. }
  8858. }, {
  8859. key: 'remove',
  8860. value: function remove() {
  8861. if (this.prev == null && this.next == null) {
  8862. this.parent.remove();
  8863. } else {
  8864. _get(ListItem.prototype.__proto__ || Object.getPrototypeOf(ListItem.prototype), 'remove', this).call(this);
  8865. }
  8866. }
  8867. }, {
  8868. key: 'replaceWith',
  8869. value: function replaceWith(name, value) {
  8870. this.parent.isolate(this.offset(this.parent), this.length());
  8871. if (name === this.parent.statics.blotName) {
  8872. this.parent.replaceWith(name, value);
  8873. return this;
  8874. } else {
  8875. this.parent.unwrap();
  8876. return _get(ListItem.prototype.__proto__ || Object.getPrototypeOf(ListItem.prototype), 'replaceWith', this).call(this, name, value);
  8877. }
  8878. }
  8879. }], [{
  8880. key: 'formats',
  8881. value: function formats(domNode) {
  8882. return domNode.tagName === this.tagName ? undefined : _get(ListItem.__proto__ || Object.getPrototypeOf(ListItem), 'formats', this).call(this, domNode);
  8883. }
  8884. }]);
  8885. return ListItem;
  8886. }(_block2.default);
  8887. ListItem.blotName = 'list-item';
  8888. ListItem.tagName = 'LI';
  8889. var List = function (_Container) {
  8890. _inherits(List, _Container);
  8891. _createClass(List, null, [{
  8892. key: 'create',
  8893. value: function create(value) {
  8894. var tagName = value === 'ordered' ? 'OL' : 'UL';
  8895. var node = _get(List.__proto__ || Object.getPrototypeOf(List), 'create', this).call(this, tagName);
  8896. if (value === 'checked' || value === 'unchecked') {
  8897. node.setAttribute('data-checked', value === 'checked');
  8898. }
  8899. return node;
  8900. }
  8901. }, {
  8902. key: 'formats',
  8903. value: function formats(domNode) {
  8904. if (domNode.tagName === 'OL') return 'ordered';
  8905. if (domNode.tagName === 'UL') {
  8906. if (domNode.hasAttribute('data-checked')) {
  8907. return domNode.getAttribute('data-checked') === 'true' ? 'checked' : 'unchecked';
  8908. } else {
  8909. return 'bullet';
  8910. }
  8911. }
  8912. return undefined;
  8913. }
  8914. }]);
  8915. function List(domNode) {
  8916. _classCallCheck(this, List);
  8917. var _this2 = _possibleConstructorReturn(this, (List.__proto__ || Object.getPrototypeOf(List)).call(this, domNode));
  8918. var listEventHandler = function listEventHandler(e) {
  8919. if (e.target.parentNode !== domNode) return;
  8920. var format = _this2.statics.formats(domNode);
  8921. var blot = _parchment2.default.find(e.target);
  8922. if (format === 'checked') {
  8923. blot.format('list', 'unchecked');
  8924. } else if (format === 'unchecked') {
  8925. blot.format('list', 'checked');
  8926. }
  8927. };
  8928. domNode.addEventListener('touchstart', listEventHandler);
  8929. domNode.addEventListener('mousedown', listEventHandler);
  8930. return _this2;
  8931. }
  8932. _createClass(List, [{
  8933. key: 'format',
  8934. value: function format(name, value) {
  8935. if (this.children.length > 0) {
  8936. this.children.tail.format(name, value);
  8937. }
  8938. }
  8939. }, {
  8940. key: 'formats',
  8941. value: function formats() {
  8942. // We don't inherit from FormatBlot
  8943. return _defineProperty({}, this.statics.blotName, this.statics.formats(this.domNode));
  8944. }
  8945. }, {
  8946. key: 'insertBefore',
  8947. value: function insertBefore(blot, ref) {
  8948. if (blot instanceof ListItem) {
  8949. _get(List.prototype.__proto__ || Object.getPrototypeOf(List.prototype), 'insertBefore', this).call(this, blot, ref);
  8950. } else {
  8951. var index = ref == null ? this.length() : ref.offset(this);
  8952. var after = this.split(index);
  8953. after.parent.insertBefore(blot, after);
  8954. }
  8955. }
  8956. }, {
  8957. key: 'optimize',
  8958. value: function optimize(context) {
  8959. _get(List.prototype.__proto__ || Object.getPrototypeOf(List.prototype), 'optimize', this).call(this, context);
  8960. var next = this.next;
  8961. if (next != null && next.prev === this && next.statics.blotName === this.statics.blotName && next.domNode.tagName === this.domNode.tagName && next.domNode.getAttribute('data-checked') === this.domNode.getAttribute('data-checked')) {
  8962. next.moveChildren(this);
  8963. next.remove();
  8964. }
  8965. }
  8966. }, {
  8967. key: 'replace',
  8968. value: function replace(target) {
  8969. if (target.statics.blotName !== this.statics.blotName) {
  8970. var item = _parchment2.default.create(this.statics.defaultChild);
  8971. target.moveChildren(item);
  8972. this.appendChild(item);
  8973. }
  8974. _get(List.prototype.__proto__ || Object.getPrototypeOf(List.prototype), 'replace', this).call(this, target);
  8975. }
  8976. }]);
  8977. return List;
  8978. }(_container2.default);
  8979. List.blotName = 'list';
  8980. List.scope = _parchment2.default.Scope.BLOCK_BLOT;
  8981. List.tagName = ['OL', 'UL'];
  8982. List.defaultChild = 'list-item';
  8983. List.allowedChildren = [ListItem];
  8984. exports.ListItem = ListItem;
  8985. exports.default = List;
  8986. /***/ }),
  8987. /* 68 */
  8988. /***/ (function(module, exports, __webpack_require__) {
  8989. "use strict";
  8990. Object.defineProperty(exports, "__esModule", {
  8991. value: true
  8992. });
  8993. var _bold = __webpack_require__(56);
  8994. var _bold2 = _interopRequireDefault(_bold);
  8995. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8996. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8997. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  8998. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  8999. var Italic = function (_Bold) {
  9000. _inherits(Italic, _Bold);
  9001. function Italic() {
  9002. _classCallCheck(this, Italic);
  9003. return _possibleConstructorReturn(this, (Italic.__proto__ || Object.getPrototypeOf(Italic)).apply(this, arguments));
  9004. }
  9005. return Italic;
  9006. }(_bold2.default);
  9007. Italic.blotName = 'italic';
  9008. Italic.tagName = ['EM', 'I'];
  9009. exports.default = Italic;
  9010. /***/ }),
  9011. /* 69 */
  9012. /***/ (function(module, exports, __webpack_require__) {
  9013. "use strict";
  9014. Object.defineProperty(exports, "__esModule", {
  9015. value: true
  9016. });
  9017. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  9018. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  9019. var _inline = __webpack_require__(6);
  9020. var _inline2 = _interopRequireDefault(_inline);
  9021. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9022. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9023. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  9024. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  9025. var Script = function (_Inline) {
  9026. _inherits(Script, _Inline);
  9027. function Script() {
  9028. _classCallCheck(this, Script);
  9029. return _possibleConstructorReturn(this, (Script.__proto__ || Object.getPrototypeOf(Script)).apply(this, arguments));
  9030. }
  9031. _createClass(Script, null, [{
  9032. key: 'create',
  9033. value: function create(value) {
  9034. if (value === 'super') {
  9035. return document.createElement('sup');
  9036. } else if (value === 'sub') {
  9037. return document.createElement('sub');
  9038. } else {
  9039. return _get(Script.__proto__ || Object.getPrototypeOf(Script), 'create', this).call(this, value);
  9040. }
  9041. }
  9042. }, {
  9043. key: 'formats',
  9044. value: function formats(domNode) {
  9045. if (domNode.tagName === 'SUB') return 'sub';
  9046. if (domNode.tagName === 'SUP') return 'super';
  9047. return undefined;
  9048. }
  9049. }]);
  9050. return Script;
  9051. }(_inline2.default);
  9052. Script.blotName = 'script';
  9053. Script.tagName = ['SUB', 'SUP'];
  9054. exports.default = Script;
  9055. /***/ }),
  9056. /* 70 */
  9057. /***/ (function(module, exports, __webpack_require__) {
  9058. "use strict";
  9059. Object.defineProperty(exports, "__esModule", {
  9060. value: true
  9061. });
  9062. var _inline = __webpack_require__(6);
  9063. var _inline2 = _interopRequireDefault(_inline);
  9064. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9065. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9066. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  9067. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  9068. var Strike = function (_Inline) {
  9069. _inherits(Strike, _Inline);
  9070. function Strike() {
  9071. _classCallCheck(this, Strike);
  9072. return _possibleConstructorReturn(this, (Strike.__proto__ || Object.getPrototypeOf(Strike)).apply(this, arguments));
  9073. }
  9074. return Strike;
  9075. }(_inline2.default);
  9076. Strike.blotName = 'strike';
  9077. Strike.tagName = 'S';
  9078. exports.default = Strike;
  9079. /***/ }),
  9080. /* 71 */
  9081. /***/ (function(module, exports, __webpack_require__) {
  9082. "use strict";
  9083. Object.defineProperty(exports, "__esModule", {
  9084. value: true
  9085. });
  9086. var _inline = __webpack_require__(6);
  9087. var _inline2 = _interopRequireDefault(_inline);
  9088. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9089. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9090. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  9091. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  9092. var Underline = function (_Inline) {
  9093. _inherits(Underline, _Inline);
  9094. function Underline() {
  9095. _classCallCheck(this, Underline);
  9096. return _possibleConstructorReturn(this, (Underline.__proto__ || Object.getPrototypeOf(Underline)).apply(this, arguments));
  9097. }
  9098. return Underline;
  9099. }(_inline2.default);
  9100. Underline.blotName = 'underline';
  9101. Underline.tagName = 'U';
  9102. exports.default = Underline;
  9103. /***/ }),
  9104. /* 72 */
  9105. /***/ (function(module, exports, __webpack_require__) {
  9106. "use strict";
  9107. Object.defineProperty(exports, "__esModule", {
  9108. value: true
  9109. });
  9110. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  9111. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  9112. var _parchment = __webpack_require__(0);
  9113. var _parchment2 = _interopRequireDefault(_parchment);
  9114. var _link = __webpack_require__(27);
  9115. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9116. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9117. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  9118. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  9119. var ATTRIBUTES = ['alt', 'height', 'width'];
  9120. var Image = function (_Parchment$Embed) {
  9121. _inherits(Image, _Parchment$Embed);
  9122. function Image() {
  9123. _classCallCheck(this, Image);
  9124. return _possibleConstructorReturn(this, (Image.__proto__ || Object.getPrototypeOf(Image)).apply(this, arguments));
  9125. }
  9126. _createClass(Image, [{
  9127. key: 'format',
  9128. value: function format(name, value) {
  9129. if (ATTRIBUTES.indexOf(name) > -1) {
  9130. if (value) {
  9131. this.domNode.setAttribute(name, value);
  9132. } else {
  9133. this.domNode.removeAttribute(name);
  9134. }
  9135. } else {
  9136. _get(Image.prototype.__proto__ || Object.getPrototypeOf(Image.prototype), 'format', this).call(this, name, value);
  9137. }
  9138. }
  9139. }], [{
  9140. key: 'create',
  9141. value: function create(value) {
  9142. var node = _get(Image.__proto__ || Object.getPrototypeOf(Image), 'create', this).call(this, value);
  9143. if (typeof value === 'string') {
  9144. node.setAttribute('src', this.sanitize(value));
  9145. }
  9146. return node;
  9147. }
  9148. }, {
  9149. key: 'formats',
  9150. value: function formats(domNode) {
  9151. return ATTRIBUTES.reduce(function (formats, attribute) {
  9152. if (domNode.hasAttribute(attribute)) {
  9153. formats[attribute] = domNode.getAttribute(attribute);
  9154. }
  9155. return formats;
  9156. }, {});
  9157. }
  9158. }, {
  9159. key: 'match',
  9160. value: function match(url) {
  9161. return (/\.(jpe?g|gif|png)$/.test(url) || /^data:image\/.+;base64/.test(url)
  9162. );
  9163. }
  9164. }, {
  9165. key: 'sanitize',
  9166. value: function sanitize(url) {
  9167. return (0, _link.sanitize)(url, ['http', 'https', 'data']) ? url : '//:0';
  9168. }
  9169. }, {
  9170. key: 'value',
  9171. value: function value(domNode) {
  9172. return domNode.getAttribute('src');
  9173. }
  9174. }]);
  9175. return Image;
  9176. }(_parchment2.default.Embed);
  9177. Image.blotName = 'image';
  9178. Image.tagName = 'IMG';
  9179. exports.default = Image;
  9180. /***/ }),
  9181. /* 73 */
  9182. /***/ (function(module, exports, __webpack_require__) {
  9183. "use strict";
  9184. Object.defineProperty(exports, "__esModule", {
  9185. value: true
  9186. });
  9187. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  9188. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  9189. var _block = __webpack_require__(4);
  9190. var _link = __webpack_require__(27);
  9191. var _link2 = _interopRequireDefault(_link);
  9192. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9193. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9194. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  9195. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  9196. var ATTRIBUTES = ['height', 'width'];
  9197. var Video = function (_BlockEmbed) {
  9198. _inherits(Video, _BlockEmbed);
  9199. function Video() {
  9200. _classCallCheck(this, Video);
  9201. return _possibleConstructorReturn(this, (Video.__proto__ || Object.getPrototypeOf(Video)).apply(this, arguments));
  9202. }
  9203. _createClass(Video, [{
  9204. key: 'format',
  9205. value: function format(name, value) {
  9206. if (ATTRIBUTES.indexOf(name) > -1) {
  9207. if (value) {
  9208. this.domNode.setAttribute(name, value);
  9209. } else {
  9210. this.domNode.removeAttribute(name);
  9211. }
  9212. } else {
  9213. _get(Video.prototype.__proto__ || Object.getPrototypeOf(Video.prototype), 'format', this).call(this, name, value);
  9214. }
  9215. }
  9216. }], [{
  9217. key: 'create',
  9218. value: function create(value) {
  9219. var node = _get(Video.__proto__ || Object.getPrototypeOf(Video), 'create', this).call(this, value);
  9220. node.setAttribute('frameborder', '0');
  9221. node.setAttribute('allowfullscreen', true);
  9222. node.setAttribute('src', this.sanitize(value));
  9223. return node;
  9224. }
  9225. }, {
  9226. key: 'formats',
  9227. value: function formats(domNode) {
  9228. return ATTRIBUTES.reduce(function (formats, attribute) {
  9229. if (domNode.hasAttribute(attribute)) {
  9230. formats[attribute] = domNode.getAttribute(attribute);
  9231. }
  9232. return formats;
  9233. }, {});
  9234. }
  9235. }, {
  9236. key: 'sanitize',
  9237. value: function sanitize(url) {
  9238. return _link2.default.sanitize(url);
  9239. }
  9240. }, {
  9241. key: 'value',
  9242. value: function value(domNode) {
  9243. return domNode.getAttribute('src');
  9244. }
  9245. }]);
  9246. return Video;
  9247. }(_block.BlockEmbed);
  9248. Video.blotName = 'video';
  9249. Video.className = 'ql-video';
  9250. Video.tagName = 'IFRAME';
  9251. exports.default = Video;
  9252. /***/ }),
  9253. /* 74 */
  9254. /***/ (function(module, exports, __webpack_require__) {
  9255. "use strict";
  9256. Object.defineProperty(exports, "__esModule", {
  9257. value: true
  9258. });
  9259. exports.default = exports.FormulaBlot = undefined;
  9260. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  9261. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  9262. var _embed = __webpack_require__(35);
  9263. var _embed2 = _interopRequireDefault(_embed);
  9264. var _quill = __webpack_require__(5);
  9265. var _quill2 = _interopRequireDefault(_quill);
  9266. var _module = __webpack_require__(9);
  9267. var _module2 = _interopRequireDefault(_module);
  9268. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9269. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9270. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  9271. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  9272. var FormulaBlot = function (_Embed) {
  9273. _inherits(FormulaBlot, _Embed);
  9274. function FormulaBlot() {
  9275. _classCallCheck(this, FormulaBlot);
  9276. return _possibleConstructorReturn(this, (FormulaBlot.__proto__ || Object.getPrototypeOf(FormulaBlot)).apply(this, arguments));
  9277. }
  9278. _createClass(FormulaBlot, null, [{
  9279. key: 'create',
  9280. value: function create(value) {
  9281. var node = _get(FormulaBlot.__proto__ || Object.getPrototypeOf(FormulaBlot), 'create', this).call(this, value);
  9282. if (typeof value === 'string') {
  9283. window.katex.render(value, node, {
  9284. throwOnError: false,
  9285. errorColor: '#f00'
  9286. });
  9287. node.setAttribute('data-value', value);
  9288. }
  9289. return node;
  9290. }
  9291. }, {
  9292. key: 'value',
  9293. value: function value(domNode) {
  9294. return domNode.getAttribute('data-value');
  9295. }
  9296. }]);
  9297. return FormulaBlot;
  9298. }(_embed2.default);
  9299. FormulaBlot.blotName = 'formula';
  9300. FormulaBlot.className = 'ql-formula';
  9301. FormulaBlot.tagName = 'SPAN';
  9302. var Formula = function (_Module) {
  9303. _inherits(Formula, _Module);
  9304. _createClass(Formula, null, [{
  9305. key: 'register',
  9306. value: function register() {
  9307. _quill2.default.register(FormulaBlot, true);
  9308. }
  9309. }]);
  9310. function Formula() {
  9311. _classCallCheck(this, Formula);
  9312. var _this2 = _possibleConstructorReturn(this, (Formula.__proto__ || Object.getPrototypeOf(Formula)).call(this));
  9313. if (window.katex == null) {
  9314. throw new Error('Formula module requires KaTeX.');
  9315. }
  9316. return _this2;
  9317. }
  9318. return Formula;
  9319. }(_module2.default);
  9320. exports.FormulaBlot = FormulaBlot;
  9321. exports.default = Formula;
  9322. /***/ }),
  9323. /* 75 */
  9324. /***/ (function(module, exports, __webpack_require__) {
  9325. "use strict";
  9326. Object.defineProperty(exports, "__esModule", {
  9327. value: true
  9328. });
  9329. exports.default = exports.CodeToken = exports.CodeBlock = undefined;
  9330. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  9331. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  9332. var _parchment = __webpack_require__(0);
  9333. var _parchment2 = _interopRequireDefault(_parchment);
  9334. var _quill = __webpack_require__(5);
  9335. var _quill2 = _interopRequireDefault(_quill);
  9336. var _module = __webpack_require__(9);
  9337. var _module2 = _interopRequireDefault(_module);
  9338. var _code = __webpack_require__(13);
  9339. var _code2 = _interopRequireDefault(_code);
  9340. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9341. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9342. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  9343. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  9344. var SyntaxCodeBlock = function (_CodeBlock) {
  9345. _inherits(SyntaxCodeBlock, _CodeBlock);
  9346. function SyntaxCodeBlock() {
  9347. _classCallCheck(this, SyntaxCodeBlock);
  9348. return _possibleConstructorReturn(this, (SyntaxCodeBlock.__proto__ || Object.getPrototypeOf(SyntaxCodeBlock)).apply(this, arguments));
  9349. }
  9350. _createClass(SyntaxCodeBlock, [{
  9351. key: 'replaceWith',
  9352. value: function replaceWith(block) {
  9353. this.domNode.textContent = this.domNode.textContent;
  9354. this.attach();
  9355. _get(SyntaxCodeBlock.prototype.__proto__ || Object.getPrototypeOf(SyntaxCodeBlock.prototype), 'replaceWith', this).call(this, block);
  9356. }
  9357. }, {
  9358. key: 'highlight',
  9359. value: function highlight(_highlight) {
  9360. var text = this.domNode.textContent;
  9361. if (this.cachedText !== text) {
  9362. if (text.trim().length > 0 || this.cachedText == null) {
  9363. this.domNode.innerHTML = _highlight(text);
  9364. this.domNode.normalize();
  9365. this.attach();
  9366. }
  9367. this.cachedText = text;
  9368. }
  9369. }
  9370. }]);
  9371. return SyntaxCodeBlock;
  9372. }(_code2.default);
  9373. SyntaxCodeBlock.className = 'ql-syntax';
  9374. var CodeToken = new _parchment2.default.Attributor.Class('token', 'hljs', {
  9375. scope: _parchment2.default.Scope.INLINE
  9376. });
  9377. var Syntax = function (_Module) {
  9378. _inherits(Syntax, _Module);
  9379. _createClass(Syntax, null, [{
  9380. key: 'register',
  9381. value: function register() {
  9382. _quill2.default.register(CodeToken, true);
  9383. _quill2.default.register(SyntaxCodeBlock, true);
  9384. }
  9385. }]);
  9386. function Syntax(quill, options) {
  9387. _classCallCheck(this, Syntax);
  9388. var _this2 = _possibleConstructorReturn(this, (Syntax.__proto__ || Object.getPrototypeOf(Syntax)).call(this, quill, options));
  9389. if (typeof _this2.options.highlight !== 'function') {
  9390. throw new Error('Syntax module requires highlight.js. Please include the library on the page before Quill.');
  9391. }
  9392. var timer = null;
  9393. _this2.quill.on(_quill2.default.events.SCROLL_OPTIMIZE, function () {
  9394. clearTimeout(timer);
  9395. timer = setTimeout(function () {
  9396. _this2.highlight();
  9397. timer = null;
  9398. }, _this2.options.interval);
  9399. });
  9400. _this2.highlight();
  9401. return _this2;
  9402. }
  9403. _createClass(Syntax, [{
  9404. key: 'highlight',
  9405. value: function highlight() {
  9406. var _this3 = this;
  9407. if (this.quill.selection.composing) return;
  9408. this.quill.update(_quill2.default.sources.USER);
  9409. var range = this.quill.getSelection();
  9410. this.quill.scroll.descendants(SyntaxCodeBlock).forEach(function (code) {
  9411. code.highlight(_this3.options.highlight);
  9412. });
  9413. this.quill.update(_quill2.default.sources.SILENT);
  9414. if (range != null) {
  9415. this.quill.setSelection(range, _quill2.default.sources.SILENT);
  9416. }
  9417. }
  9418. }]);
  9419. return Syntax;
  9420. }(_module2.default);
  9421. Syntax.DEFAULTS = {
  9422. highlight: function () {
  9423. if (window.hljs == null) return null;
  9424. return function (text) {
  9425. var result = window.hljs.highlightAuto(text);
  9426. return result.value;
  9427. };
  9428. }(),
  9429. interval: 1000
  9430. };
  9431. exports.CodeBlock = SyntaxCodeBlock;
  9432. exports.CodeToken = CodeToken;
  9433. exports.default = Syntax;
  9434. /***/ }),
  9435. /* 76 */
  9436. /***/ (function(module, exports) {
  9437. module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=3 x2=15 y1=9 y2=9></line> <line class=ql-stroke x1=3 x2=13 y1=14 y2=14></line> <line class=ql-stroke x1=3 x2=9 y1=4 y2=4></line> </svg>";
  9438. /***/ }),
  9439. /* 77 */
  9440. /***/ (function(module, exports) {
  9441. module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=15 x2=3 y1=9 y2=9></line> <line class=ql-stroke x1=14 x2=4 y1=14 y2=14></line> <line class=ql-stroke x1=12 x2=6 y1=4 y2=4></line> </svg>";
  9442. /***/ }),
  9443. /* 78 */
  9444. /***/ (function(module, exports) {
  9445. module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=15 x2=3 y1=9 y2=9></line> <line class=ql-stroke x1=15 x2=5 y1=14 y2=14></line> <line class=ql-stroke x1=15 x2=9 y1=4 y2=4></line> </svg>";
  9446. /***/ }),
  9447. /* 79 */
  9448. /***/ (function(module, exports) {
  9449. module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=15 x2=3 y1=9 y2=9></line> <line class=ql-stroke x1=15 x2=3 y1=14 y2=14></line> <line class=ql-stroke x1=15 x2=3 y1=4 y2=4></line> </svg>";
  9450. /***/ }),
  9451. /* 80 */
  9452. /***/ (function(module, exports) {
  9453. module.exports = "<svg viewbox=\"0 0 18 18\"> <g class=\"ql-fill ql-color-label\"> <polygon points=\"6 6.868 6 6 5 6 5 7 5.942 7 6 6.868\"></polygon> <rect height=1 width=1 x=4 y=4></rect> <polygon points=\"6.817 5 6 5 6 6 6.38 6 6.817 5\"></polygon> <rect height=1 width=1 x=2 y=6></rect> <rect height=1 width=1 x=3 y=5></rect> <rect height=1 width=1 x=4 y=7></rect> <polygon points=\"4 11.439 4 11 3 11 3 12 3.755 12 4 11.439\"></polygon> <rect height=1 width=1 x=2 y=12></rect> <rect height=1 width=1 x=2 y=9></rect> <rect height=1 width=1 x=2 y=15></rect> <polygon points=\"4.63 10 4 10 4 11 4.192 11 4.63 10\"></polygon> <rect height=1 width=1 x=3 y=8></rect> <path d=M10.832,4.2L11,4.582V4H10.708A1.948,1.948,0,0,1,10.832,4.2Z></path> <path d=M7,4.582L7.168,4.2A1.929,1.929,0,0,1,7.292,4H7V4.582Z></path> <path d=M8,13H7.683l-0.351.8a1.933,1.933,0,0,1-.124.2H8V13Z></path> <rect height=1 width=1 x=12 y=2></rect> <rect height=1 width=1 x=11 y=3></rect> <path d=M9,3H8V3.282A1.985,1.985,0,0,1,9,3Z></path> <rect height=1 width=1 x=2 y=3></rect> <rect height=1 width=1 x=6 y=2></rect> <rect height=1 width=1 x=3 y=2></rect> <rect height=1 width=1 x=5 y=3></rect> <rect height=1 width=1 x=9 y=2></rect> <rect height=1 width=1 x=15 y=14></rect> <polygon points=\"13.447 10.174 13.469 10.225 13.472 10.232 13.808 11 14 11 14 10 13.37 10 13.447 10.174\"></polygon> <rect height=1 width=1 x=13 y=7></rect> <rect height=1 width=1 x=15 y=5></rect> <rect height=1 width=1 x=14 y=6></rect> <rect height=1 width=1 x=15 y=8></rect> <rect height=1 width=1 x=14 y=9></rect> <path d=M3.775,14H3v1H4V14.314A1.97,1.97,0,0,1,3.775,14Z></path> <rect height=1 width=1 x=14 y=3></rect> <polygon points=\"12 6.868 12 6 11.62 6 12 6.868\"></polygon> <rect height=1 width=1 x=15 y=2></rect> <rect height=1 width=1 x=12 y=5></rect> <rect height=1 width=1 x=13 y=4></rect> <polygon points=\"12.933 9 13 9 13 8 12.495 8 12.933 9\"></polygon> <rect height=1 width=1 x=9 y=14></rect> <rect height=1 width=1 x=8 y=15></rect> <path d=M6,14.926V15H7V14.316A1.993,1.993,0,0,1,6,14.926Z></path> <rect height=1 width=1 x=5 y=15></rect> <path d=M10.668,13.8L10.317,13H10v1h0.792A1.947,1.947,0,0,1,10.668,13.8Z></path> <rect height=1 width=1 x=11 y=15></rect> <path d=M14.332,12.2a1.99,1.99,0,0,1,.166.8H15V12H14.245Z></path> <rect height=1 width=1 x=14 y=15></rect> <rect height=1 width=1 x=15 y=11></rect> </g> <polyline class=ql-stroke points=\"5.5 13 9 5 12.5 13\"></polyline> <line class=ql-stroke x1=11.63 x2=6.38 y1=11 y2=11></line> </svg>";
  9454. /***/ }),
  9455. /* 81 */
  9456. /***/ (function(module, exports) {
  9457. module.exports = "<svg viewbox=\"0 0 18 18\"> <rect class=\"ql-fill ql-stroke\" height=3 width=3 x=4 y=5></rect> <rect class=\"ql-fill ql-stroke\" height=3 width=3 x=11 y=5></rect> <path class=\"ql-even ql-fill ql-stroke\" d=M7,8c0,4.031-3,5-3,5></path> <path class=\"ql-even ql-fill ql-stroke\" d=M14,8c0,4.031-3,5-3,5></path> </svg>";
  9458. /***/ }),
  9459. /* 82 */
  9460. /***/ (function(module, exports) {
  9461. module.exports = "<svg viewbox=\"0 0 18 18\"> <path class=ql-stroke d=M5,4H9.5A2.5,2.5,0,0,1,12,6.5v0A2.5,2.5,0,0,1,9.5,9H5A0,0,0,0,1,5,9V4A0,0,0,0,1,5,4Z></path> <path class=ql-stroke d=M5,9h5.5A2.5,2.5,0,0,1,13,11.5v0A2.5,2.5,0,0,1,10.5,14H5a0,0,0,0,1,0,0V9A0,0,0,0,1,5,9Z></path> </svg>";
  9462. /***/ }),
  9463. /* 83 */
  9464. /***/ (function(module, exports) {
  9465. module.exports = "<svg class=\"\" viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=5 x2=13 y1=3 y2=3></line> <line class=ql-stroke x1=6 x2=9.35 y1=12 y2=3></line> <line class=ql-stroke x1=11 x2=15 y1=11 y2=15></line> <line class=ql-stroke x1=15 x2=11 y1=11 y2=15></line> <rect class=ql-fill height=1 rx=0.5 ry=0.5 width=7 x=2 y=14></rect> </svg>";
  9466. /***/ }),
  9467. /* 84 */
  9468. /***/ (function(module, exports) {
  9469. module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=\"ql-color-label ql-stroke ql-transparent\" x1=3 x2=15 y1=15 y2=15></line> <polyline class=ql-stroke points=\"5.5 11 9 3 12.5 11\"></polyline> <line class=ql-stroke x1=11.63 x2=6.38 y1=9 y2=9></line> </svg>";
  9470. /***/ }),
  9471. /* 85 */
  9472. /***/ (function(module, exports) {
  9473. module.exports = "<svg viewbox=\"0 0 18 18\"> <polygon class=\"ql-stroke ql-fill\" points=\"3 11 5 9 3 7 3 11\"></polygon> <line class=\"ql-stroke ql-fill\" x1=15 x2=11 y1=4 y2=4></line> <path class=ql-fill d=M11,3a3,3,0,0,0,0,6h1V3H11Z></path> <rect class=ql-fill height=11 width=1 x=11 y=4></rect> <rect class=ql-fill height=11 width=1 x=13 y=4></rect> </svg>";
  9474. /***/ }),
  9475. /* 86 */
  9476. /***/ (function(module, exports) {
  9477. module.exports = "<svg viewbox=\"0 0 18 18\"> <polygon class=\"ql-stroke ql-fill\" points=\"15 12 13 10 15 8 15 12\"></polygon> <line class=\"ql-stroke ql-fill\" x1=9 x2=5 y1=4 y2=4></line> <path class=ql-fill d=M5,3A3,3,0,0,0,5,9H6V3H5Z></path> <rect class=ql-fill height=11 width=1 x=5 y=4></rect> <rect class=ql-fill height=11 width=1 x=7 y=4></rect> </svg>";
  9478. /***/ }),
  9479. /* 87 */
  9480. /***/ (function(module, exports) {
  9481. module.exports = "<svg viewbox=\"0 0 18 18\"> <path class=ql-fill d=M14,16H4a1,1,0,0,1,0-2H14A1,1,0,0,1,14,16Z /> <path class=ql-fill d=M14,4H4A1,1,0,0,1,4,2H14A1,1,0,0,1,14,4Z /> <rect class=ql-fill x=3 y=6 width=12 height=6 rx=1 ry=1 /> </svg>";
  9482. /***/ }),
  9483. /* 88 */
  9484. /***/ (function(module, exports) {
  9485. module.exports = "<svg viewbox=\"0 0 18 18\"> <path class=ql-fill d=M13,16H5a1,1,0,0,1,0-2h8A1,1,0,0,1,13,16Z /> <path class=ql-fill d=M13,4H5A1,1,0,0,1,5,2h8A1,1,0,0,1,13,4Z /> <rect class=ql-fill x=2 y=6 width=14 height=6 rx=1 ry=1 /> </svg>";
  9486. /***/ }),
  9487. /* 89 */
  9488. /***/ (function(module, exports) {
  9489. module.exports = "<svg viewbox=\"0 0 18 18\"> <path class=ql-fill d=M15,8H13a1,1,0,0,1,0-2h2A1,1,0,0,1,15,8Z /> <path class=ql-fill d=M15,12H13a1,1,0,0,1,0-2h2A1,1,0,0,1,15,12Z /> <path class=ql-fill d=M15,16H5a1,1,0,0,1,0-2H15A1,1,0,0,1,15,16Z /> <path class=ql-fill d=M15,4H5A1,1,0,0,1,5,2H15A1,1,0,0,1,15,4Z /> <rect class=ql-fill x=2 y=6 width=8 height=6 rx=1 ry=1 /> </svg>";
  9490. /***/ }),
  9491. /* 90 */
  9492. /***/ (function(module, exports) {
  9493. module.exports = "<svg viewbox=\"0 0 18 18\"> <path class=ql-fill d=M5,8H3A1,1,0,0,1,3,6H5A1,1,0,0,1,5,8Z /> <path class=ql-fill d=M5,12H3a1,1,0,0,1,0-2H5A1,1,0,0,1,5,12Z /> <path class=ql-fill d=M13,16H3a1,1,0,0,1,0-2H13A1,1,0,0,1,13,16Z /> <path class=ql-fill d=M13,4H3A1,1,0,0,1,3,2H13A1,1,0,0,1,13,4Z /> <rect class=ql-fill x=8 y=6 width=8 height=6 rx=1 ry=1 transform=\"translate(24 18) rotate(-180)\"/> </svg>";
  9494. /***/ }),
  9495. /* 91 */
  9496. /***/ (function(module, exports) {
  9497. module.exports = "<svg viewbox=\"0 0 18 18\"> <path class=ql-fill d=M11.759,2.482a2.561,2.561,0,0,0-3.53.607A7.656,7.656,0,0,0,6.8,6.2C6.109,9.188,5.275,14.677,4.15,14.927a1.545,1.545,0,0,0-1.3-.933A0.922,0.922,0,0,0,2,15.036S1.954,16,4.119,16s3.091-2.691,3.7-5.553c0.177-.826.36-1.726,0.554-2.6L8.775,6.2c0.381-1.421.807-2.521,1.306-2.676a1.014,1.014,0,0,0,1.02.56A0.966,0.966,0,0,0,11.759,2.482Z></path> <rect class=ql-fill height=1.6 rx=0.8 ry=0.8 width=5 x=5.15 y=6.2></rect> <path class=ql-fill d=M13.663,12.027a1.662,1.662,0,0,1,.266-0.276q0.193,0.069.456,0.138a2.1,2.1,0,0,0,.535.069,1.075,1.075,0,0,0,.767-0.3,1.044,1.044,0,0,0,.314-0.8,0.84,0.84,0,0,0-.238-0.619,0.8,0.8,0,0,0-.594-0.239,1.154,1.154,0,0,0-.781.3,4.607,4.607,0,0,0-.781,1q-0.091.15-.218,0.346l-0.246.38c-0.068-.288-0.137-0.582-0.212-0.885-0.459-1.847-2.494-.984-2.941-0.8-0.482.2-.353,0.647-0.094,0.529a0.869,0.869,0,0,1,1.281.585c0.217,0.751.377,1.436,0.527,2.038a5.688,5.688,0,0,1-.362.467,2.69,2.69,0,0,1-.264.271q-0.221-.08-0.471-0.147a2.029,2.029,0,0,0-.522-0.066,1.079,1.079,0,0,0-.768.3A1.058,1.058,0,0,0,9,15.131a0.82,0.82,0,0,0,.832.852,1.134,1.134,0,0,0,.787-0.3,5.11,5.11,0,0,0,.776-0.993q0.141-.219.215-0.34c0.046-.076.122-0.194,0.223-0.346a2.786,2.786,0,0,0,.918,1.726,2.582,2.582,0,0,0,2.376-.185c0.317-.181.212-0.565,0-0.494A0.807,0.807,0,0,1,14.176,15a5.159,5.159,0,0,1-.913-2.446l0,0Q13.487,12.24,13.663,12.027Z></path> </svg>";
  9498. /***/ }),
  9499. /* 92 */
  9500. /***/ (function(module, exports) {
  9501. module.exports = "<svg viewBox=\"0 0 18 18\"> <path class=ql-fill d=M10,4V14a1,1,0,0,1-2,0V10H3v4a1,1,0,0,1-2,0V4A1,1,0,0,1,3,4V8H8V4a1,1,0,0,1,2,0Zm6.06787,9.209H14.98975V7.59863a.54085.54085,0,0,0-.605-.60547h-.62744a1.01119,1.01119,0,0,0-.748.29688L11.645,8.56641a.5435.5435,0,0,0-.022.8584l.28613.30762a.53861.53861,0,0,0,.84717.0332l.09912-.08789a1.2137,1.2137,0,0,0,.2417-.35254h.02246s-.01123.30859-.01123.60547V13.209H12.041a.54085.54085,0,0,0-.605.60547v.43945a.54085.54085,0,0,0,.605.60547h4.02686a.54085.54085,0,0,0,.605-.60547v-.43945A.54085.54085,0,0,0,16.06787,13.209Z /> </svg>";
  9502. /***/ }),
  9503. /* 93 */
  9504. /***/ (function(module, exports) {
  9505. module.exports = "<svg viewBox=\"0 0 18 18\"> <path class=ql-fill d=M16.73975,13.81445v.43945a.54085.54085,0,0,1-.605.60547H11.855a.58392.58392,0,0,1-.64893-.60547V14.0127c0-2.90527,3.39941-3.42187,3.39941-4.55469a.77675.77675,0,0,0-.84717-.78125,1.17684,1.17684,0,0,0-.83594.38477c-.2749.26367-.561.374-.85791.13184l-.4292-.34082c-.30811-.24219-.38525-.51758-.1543-.81445a2.97155,2.97155,0,0,1,2.45361-1.17676,2.45393,2.45393,0,0,1,2.68408,2.40918c0,2.45312-3.1792,2.92676-3.27832,3.93848h2.79443A.54085.54085,0,0,1,16.73975,13.81445ZM9,3A.99974.99974,0,0,0,8,4V8H3V4A1,1,0,0,0,1,4V14a1,1,0,0,0,2,0V10H8v4a1,1,0,0,0,2,0V4A.99974.99974,0,0,0,9,3Z /> </svg>";
  9506. /***/ }),
  9507. /* 94 */
  9508. /***/ (function(module, exports) {
  9509. module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=7 x2=13 y1=4 y2=4></line> <line class=ql-stroke x1=5 x2=11 y1=14 y2=14></line> <line class=ql-stroke x1=8 x2=10 y1=14 y2=4></line> </svg>";
  9510. /***/ }),
  9511. /* 95 */
  9512. /***/ (function(module, exports) {
  9513. module.exports = "<svg viewbox=\"0 0 18 18\"> <rect class=ql-stroke height=10 width=12 x=3 y=4></rect> <circle class=ql-fill cx=6 cy=7 r=1></circle> <polyline class=\"ql-even ql-fill\" points=\"5 12 5 11 7 9 8 10 11 7 13 9 13 12 5 12\"></polyline> </svg>";
  9514. /***/ }),
  9515. /* 96 */
  9516. /***/ (function(module, exports) {
  9517. module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=3 x2=15 y1=14 y2=14></line> <line class=ql-stroke x1=3 x2=15 y1=4 y2=4></line> <line class=ql-stroke x1=9 x2=15 y1=9 y2=9></line> <polyline class=\"ql-fill ql-stroke\" points=\"3 7 3 11 5 9 3 7\"></polyline> </svg>";
  9518. /***/ }),
  9519. /* 97 */
  9520. /***/ (function(module, exports) {
  9521. module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=3 x2=15 y1=14 y2=14></line> <line class=ql-stroke x1=3 x2=15 y1=4 y2=4></line> <line class=ql-stroke x1=9 x2=15 y1=9 y2=9></line> <polyline class=ql-stroke points=\"5 7 5 11 3 9 5 7\"></polyline> </svg>";
  9522. /***/ }),
  9523. /* 98 */
  9524. /***/ (function(module, exports) {
  9525. module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=7 x2=11 y1=7 y2=11></line> <path class=\"ql-even ql-stroke\" d=M8.9,4.577a3.476,3.476,0,0,1,.36,4.679A3.476,3.476,0,0,1,4.577,8.9C3.185,7.5,2.035,6.4,4.217,4.217S7.5,3.185,8.9,4.577Z></path> <path class=\"ql-even ql-stroke\" d=M13.423,9.1a3.476,3.476,0,0,0-4.679-.36,3.476,3.476,0,0,0,.36,4.679c1.392,1.392,2.5,2.542,4.679.36S14.815,10.5,13.423,9.1Z></path> </svg>";
  9526. /***/ }),
  9527. /* 99 */
  9528. /***/ (function(module, exports) {
  9529. module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=7 x2=15 y1=4 y2=4></line> <line class=ql-stroke x1=7 x2=15 y1=9 y2=9></line> <line class=ql-stroke x1=7 x2=15 y1=14 y2=14></line> <line class=\"ql-stroke ql-thin\" x1=2.5 x2=4.5 y1=5.5 y2=5.5></line> <path class=ql-fill d=M3.5,6A0.5,0.5,0,0,1,3,5.5V3.085l-0.276.138A0.5,0.5,0,0,1,2.053,3c-0.124-.247-0.023-0.324.224-0.447l1-.5A0.5,0.5,0,0,1,4,2.5v3A0.5,0.5,0,0,1,3.5,6Z></path> <path class=\"ql-stroke ql-thin\" d=M4.5,10.5h-2c0-.234,1.85-1.076,1.85-2.234A0.959,0.959,0,0,0,2.5,8.156></path> <path class=\"ql-stroke ql-thin\" d=M2.5,14.846a0.959,0.959,0,0,0,1.85-.109A0.7,0.7,0,0,0,3.75,14a0.688,0.688,0,0,0,.6-0.736,0.959,0.959,0,0,0-1.85-.109></path> </svg>";
  9530. /***/ }),
  9531. /* 100 */
  9532. /***/ (function(module, exports) {
  9533. module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=6 x2=15 y1=4 y2=4></line> <line class=ql-stroke x1=6 x2=15 y1=9 y2=9></line> <line class=ql-stroke x1=6 x2=15 y1=14 y2=14></line> <line class=ql-stroke x1=3 x2=3 y1=4 y2=4></line> <line class=ql-stroke x1=3 x2=3 y1=9 y2=9></line> <line class=ql-stroke x1=3 x2=3 y1=14 y2=14></line> </svg>";
  9534. /***/ }),
  9535. /* 101 */
  9536. /***/ (function(module, exports) {
  9537. module.exports = "<svg class=\"\" viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=9 x2=15 y1=4 y2=4></line> <polyline class=ql-stroke points=\"3 4 4 5 6 3\"></polyline> <line class=ql-stroke x1=9 x2=15 y1=14 y2=14></line> <polyline class=ql-stroke points=\"3 14 4 15 6 13\"></polyline> <line class=ql-stroke x1=9 x2=15 y1=9 y2=9></line> <polyline class=ql-stroke points=\"3 9 4 10 6 8\"></polyline> </svg>";
  9538. /***/ }),
  9539. /* 102 */
  9540. /***/ (function(module, exports) {
  9541. module.exports = "<svg viewbox=\"0 0 18 18\"> <path class=ql-fill d=M15.5,15H13.861a3.858,3.858,0,0,0,1.914-2.975,1.8,1.8,0,0,0-1.6-1.751A1.921,1.921,0,0,0,12.021,11.7a0.50013,0.50013,0,1,0,.957.291h0a0.914,0.914,0,0,1,1.053-.725,0.81,0.81,0,0,1,.744.762c0,1.076-1.16971,1.86982-1.93971,2.43082A1.45639,1.45639,0,0,0,12,15.5a0.5,0.5,0,0,0,.5.5h3A0.5,0.5,0,0,0,15.5,15Z /> <path class=ql-fill d=M9.65,5.241a1,1,0,0,0-1.409.108L6,7.964,3.759,5.349A1,1,0,0,0,2.192,6.59178Q2.21541,6.6213,2.241,6.649L4.684,9.5,2.241,12.35A1,1,0,0,0,3.71,13.70722q0.02557-.02768.049-0.05722L6,11.036,8.241,13.65a1,1,0,1,0,1.567-1.24277Q9.78459,12.3777,9.759,12.35L7.316,9.5,9.759,6.651A1,1,0,0,0,9.65,5.241Z /> </svg>";
  9542. /***/ }),
  9543. /* 103 */
  9544. /***/ (function(module, exports) {
  9545. module.exports = "<svg viewbox=\"0 0 18 18\"> <path class=ql-fill d=M15.5,7H13.861a4.015,4.015,0,0,0,1.914-2.975,1.8,1.8,0,0,0-1.6-1.751A1.922,1.922,0,0,0,12.021,3.7a0.5,0.5,0,1,0,.957.291,0.917,0.917,0,0,1,1.053-.725,0.81,0.81,0,0,1,.744.762c0,1.077-1.164,1.925-1.934,2.486A1.423,1.423,0,0,0,12,7.5a0.5,0.5,0,0,0,.5.5h3A0.5,0.5,0,0,0,15.5,7Z /> <path class=ql-fill d=M9.651,5.241a1,1,0,0,0-1.41.108L6,7.964,3.759,5.349a1,1,0,1,0-1.519,1.3L4.683,9.5,2.241,12.35a1,1,0,1,0,1.519,1.3L6,11.036,8.241,13.65a1,1,0,0,0,1.519-1.3L7.317,9.5,9.759,6.651A1,1,0,0,0,9.651,5.241Z /> </svg>";
  9546. /***/ }),
  9547. /* 104 */
  9548. /***/ (function(module, exports) {
  9549. module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=\"ql-stroke ql-thin\" x1=15.5 x2=2.5 y1=8.5 y2=9.5></line> <path class=ql-fill d=M9.007,8C6.542,7.791,6,7.519,6,6.5,6,5.792,7.283,5,9,5c1.571,0,2.765.679,2.969,1.309a1,1,0,0,0,1.9-.617C13.356,4.106,11.354,3,9,3,6.2,3,4,4.538,4,6.5a3.2,3.2,0,0,0,.5,1.843Z></path> <path class=ql-fill d=M8.984,10C11.457,10.208,12,10.479,12,11.5c0,0.708-1.283,1.5-3,1.5-1.571,0-2.765-.679-2.969-1.309a1,1,0,1,0-1.9.617C4.644,13.894,6.646,15,9,15c2.8,0,5-1.538,5-3.5a3.2,3.2,0,0,0-.5-1.843Z></path> </svg>";
  9550. /***/ }),
  9551. /* 105 */
  9552. /***/ (function(module, exports) {
  9553. module.exports = "<svg viewbox=\"0 0 18 18\"> <path class=ql-stroke d=M5,3V9a4.012,4.012,0,0,0,4,4H9a4.012,4.012,0,0,0,4-4V3></path> <rect class=ql-fill height=1 rx=0.5 ry=0.5 width=12 x=3 y=15></rect> </svg>";
  9554. /***/ }),
  9555. /* 106 */
  9556. /***/ (function(module, exports) {
  9557. module.exports = "<svg viewbox=\"0 0 18 18\"> <rect class=ql-stroke height=12 width=12 x=3 y=3></rect> <rect class=ql-fill height=12 width=1 x=5 y=3></rect> <rect class=ql-fill height=12 width=1 x=12 y=3></rect> <rect class=ql-fill height=2 width=8 x=5 y=8></rect> <rect class=ql-fill height=1 width=3 x=3 y=5></rect> <rect class=ql-fill height=1 width=3 x=3 y=7></rect> <rect class=ql-fill height=1 width=3 x=3 y=10></rect> <rect class=ql-fill height=1 width=3 x=3 y=12></rect> <rect class=ql-fill height=1 width=3 x=12 y=5></rect> <rect class=ql-fill height=1 width=3 x=12 y=7></rect> <rect class=ql-fill height=1 width=3 x=12 y=10></rect> <rect class=ql-fill height=1 width=3 x=12 y=12></rect> </svg>";
  9558. /***/ }),
  9559. /* 107 */
  9560. /***/ (function(module, exports) {
  9561. module.exports = "<svg viewbox=\"0 0 18 18\"> <polygon class=ql-stroke points=\"7 11 9 13 11 11 7 11\"></polygon> <polygon class=ql-stroke points=\"7 7 9 5 11 7 7 7\"></polygon> </svg>";
  9562. /***/ }),
  9563. /* 108 */
  9564. /***/ (function(module, exports, __webpack_require__) {
  9565. "use strict";
  9566. Object.defineProperty(exports, "__esModule", {
  9567. value: true
  9568. });
  9569. exports.default = exports.BubbleTooltip = undefined;
  9570. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  9571. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  9572. var _extend = __webpack_require__(3);
  9573. var _extend2 = _interopRequireDefault(_extend);
  9574. var _emitter = __webpack_require__(8);
  9575. var _emitter2 = _interopRequireDefault(_emitter);
  9576. var _base = __webpack_require__(43);
  9577. var _base2 = _interopRequireDefault(_base);
  9578. var _selection = __webpack_require__(15);
  9579. var _icons = __webpack_require__(41);
  9580. var _icons2 = _interopRequireDefault(_icons);
  9581. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9582. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9583. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  9584. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  9585. var TOOLBAR_CONFIG = [['bold', 'italic', 'link'], [{ header: 1 }, { header: 2 }, 'blockquote']];
  9586. var BubbleTheme = function (_BaseTheme) {
  9587. _inherits(BubbleTheme, _BaseTheme);
  9588. function BubbleTheme(quill, options) {
  9589. _classCallCheck(this, BubbleTheme);
  9590. if (options.modules.toolbar != null && options.modules.toolbar.container == null) {
  9591. options.modules.toolbar.container = TOOLBAR_CONFIG;
  9592. }
  9593. var _this = _possibleConstructorReturn(this, (BubbleTheme.__proto__ || Object.getPrototypeOf(BubbleTheme)).call(this, quill, options));
  9594. _this.quill.container.classList.add('ql-bubble');
  9595. return _this;
  9596. }
  9597. _createClass(BubbleTheme, [{
  9598. key: 'extendToolbar',
  9599. value: function extendToolbar(toolbar) {
  9600. this.tooltip = new BubbleTooltip(this.quill, this.options.bounds);
  9601. this.tooltip.root.appendChild(toolbar.container);
  9602. this.buildButtons([].slice.call(toolbar.container.querySelectorAll('button')), _icons2.default);
  9603. this.buildPickers([].slice.call(toolbar.container.querySelectorAll('select')), _icons2.default);
  9604. }
  9605. }]);
  9606. return BubbleTheme;
  9607. }(_base2.default);
  9608. BubbleTheme.DEFAULTS = (0, _extend2.default)(true, {}, _base2.default.DEFAULTS, {
  9609. modules: {
  9610. toolbar: {
  9611. handlers: {
  9612. link: function link(value) {
  9613. if (!value) {
  9614. this.quill.format('link', false);
  9615. } else {
  9616. this.quill.theme.tooltip.edit();
  9617. }
  9618. }
  9619. }
  9620. }
  9621. }
  9622. });
  9623. var BubbleTooltip = function (_BaseTooltip) {
  9624. _inherits(BubbleTooltip, _BaseTooltip);
  9625. function BubbleTooltip(quill, bounds) {
  9626. _classCallCheck(this, BubbleTooltip);
  9627. var _this2 = _possibleConstructorReturn(this, (BubbleTooltip.__proto__ || Object.getPrototypeOf(BubbleTooltip)).call(this, quill, bounds));
  9628. _this2.quill.on(_emitter2.default.events.EDITOR_CHANGE, function (type, range, oldRange, source) {
  9629. if (type !== _emitter2.default.events.SELECTION_CHANGE) return;
  9630. if (range != null && range.length > 0 && source === _emitter2.default.sources.USER) {
  9631. _this2.show();
  9632. // Lock our width so we will expand beyond our offsetParent boundaries
  9633. _this2.root.style.left = '0px';
  9634. _this2.root.style.width = '';
  9635. _this2.root.style.width = _this2.root.offsetWidth + 'px';
  9636. var lines = _this2.quill.getLines(range.index, range.length);
  9637. if (lines.length === 1) {
  9638. _this2.position(_this2.quill.getBounds(range));
  9639. } else {
  9640. var lastLine = lines[lines.length - 1];
  9641. var index = _this2.quill.getIndex(lastLine);
  9642. var length = Math.min(lastLine.length() - 1, range.index + range.length - index);
  9643. var _bounds = _this2.quill.getBounds(new _selection.Range(index, length));
  9644. _this2.position(_bounds);
  9645. }
  9646. } else if (document.activeElement !== _this2.textbox && _this2.quill.hasFocus()) {
  9647. _this2.hide();
  9648. }
  9649. });
  9650. return _this2;
  9651. }
  9652. _createClass(BubbleTooltip, [{
  9653. key: 'listen',
  9654. value: function listen() {
  9655. var _this3 = this;
  9656. _get(BubbleTooltip.prototype.__proto__ || Object.getPrototypeOf(BubbleTooltip.prototype), 'listen', this).call(this);
  9657. this.root.querySelector('.ql-close').addEventListener('click', function () {
  9658. _this3.root.classList.remove('ql-editing');
  9659. });
  9660. this.quill.on(_emitter2.default.events.SCROLL_OPTIMIZE, function () {
  9661. // Let selection be restored by toolbar handlers before repositioning
  9662. setTimeout(function () {
  9663. if (_this3.root.classList.contains('ql-hidden')) return;
  9664. var range = _this3.quill.getSelection();
  9665. if (range != null) {
  9666. _this3.position(_this3.quill.getBounds(range));
  9667. }
  9668. }, 1);
  9669. });
  9670. }
  9671. }, {
  9672. key: 'cancel',
  9673. value: function cancel() {
  9674. this.show();
  9675. }
  9676. }, {
  9677. key: 'position',
  9678. value: function position(reference) {
  9679. var shift = _get(BubbleTooltip.prototype.__proto__ || Object.getPrototypeOf(BubbleTooltip.prototype), 'position', this).call(this, reference);
  9680. var arrow = this.root.querySelector('.ql-tooltip-arrow');
  9681. arrow.style.marginLeft = '';
  9682. if (shift === 0) return shift;
  9683. arrow.style.marginLeft = -1 * shift - arrow.offsetWidth / 2 + 'px';
  9684. }
  9685. }]);
  9686. return BubbleTooltip;
  9687. }(_base.BaseTooltip);
  9688. BubbleTooltip.TEMPLATE = ['<span class="ql-tooltip-arrow"></span>', '<div class="ql-tooltip-editor">', '<input type="text" data-formula="e=mc^2" data-link="https://quilljs.com" data-video="Embed URL">', '<a class="ql-close"></a>', '</div>'].join('');
  9689. exports.BubbleTooltip = BubbleTooltip;
  9690. exports.default = BubbleTheme;
  9691. /***/ }),
  9692. /* 109 */
  9693. /***/ (function(module, exports, __webpack_require__) {
  9694. module.exports = __webpack_require__(63);
  9695. /***/ })
  9696. /******/ ])["default"];
  9697. });