From aba8635eb99328a4b0c6d6f4c7d777650894f0c6 Mon Sep 17 00:00:00 2001 From: Godwin Date: Mon, 17 Apr 2017 22:16:14 -0700 Subject: [PATCH] Replaced Pen with Quill and removed dead CSS rules --- Gemfile | 10 +- Gemfile.lock | 8 +- app/assets/javascripts/editor.js | 45 +- .../81e17772-eb6a-4fb4-9f70-3b1fa843c198.dmp | Bin 80545 -> 0 bytes app/assets/stylesheets/_admin.scss | 1627 +++ app/assets/stylesheets/_application.scss | 1628 +-- app/assets/stylesheets/_settings.scss | 34 +- app/assets/stylesheets/_translations.scss | 439 - .../stylesheets/bumbleberry-settings.json | 2 +- app/assets/stylesheets/font-awesome.min.css | 4 - app/controllers/application_controller.rb | 4 +- app/helpers/form_helper.rb | 18 +- app/helpers/i18n_helper.rb | 30 +- app/helpers/page_helper.rb | 25 +- .../administration.html.haml | 1 + .../administration_step.html.haml | 1 + app/views/layouts/application.html.haml | 2 + config/initializers/assets.rb | 2 +- config/locales/en.yml | 1095 +- features/contact_us.feature | 4 +- features/step_definitions/interface_steps.rb | 1 + features/support/env.rb | 2 +- features/support/location_cache.yml | 452 + features/workshops.feature | 2 +- vendor/assets/javascripts/quill.js | 10576 ++++++++++++++++ vendor/assets/stylesheets/quill.css | 899 ++ 26 files changed, 14777 insertions(+), 2134 deletions(-) delete mode 100644 app/assets/stylesheets/81e17772-eb6a-4fb4-9f70-3b1fa843c198.dmp create mode 100644 app/assets/stylesheets/_admin.scss delete mode 100644 app/assets/stylesheets/_translations.scss delete mode 100644 app/assets/stylesheets/font-awesome.min.css create mode 100644 vendor/assets/javascripts/quill.js create mode 100644 vendor/assets/stylesheets/quill.css diff --git a/Gemfile b/Gemfile index b2c5aa6..017dbd5 100644 --- a/Gemfile +++ b/Gemfile @@ -10,7 +10,6 @@ gem 'rack-mini-profiler' gem 'haml' gem 'nokogiri' -gem 'tzinfo-data' gem 'sass' gem 'sass-rails' gem 'uglifier', '>= 1.3.0' @@ -53,7 +52,7 @@ group :development do gem 'capistrano-faster-assets', '~> 1.0' gem 'eventmachine', git: 'https://github.com/krzcho/eventmachine', :branch => 'master' - gem 'thin'# , :github => 'krzcho/thin', :branch => 'master' + gem 'thin' gem 'rubocop', require: false gem 'haml-lint', require: false end @@ -69,7 +68,6 @@ group :test do gem 'poltergeist' gem 'capybara-email' - # gem 'capybara-webkit' gem 'guard-rspec' gem 'factory_girl_rails' gem 'coveralls', require: false @@ -80,7 +78,7 @@ group :test do gem 'mocha' end -group :staging, :production, :preview do +group :production, :preview do gem 'rails_12factor' end @@ -91,8 +89,10 @@ group :production, :preview do end platforms 'mswin', 'mingw' do + gem 'tzinfo-data' + group :test do gem 'wdm', '>= 0.1.0' - gem 'win32console', require: false + gem 'win32console', require: false end end diff --git a/Gemfile.lock b/Gemfile.lock index 71c2f44..930ed95 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -63,7 +63,7 @@ GIT GIT remote: https://github.com/lingua-franca/lingua_franca.git - revision: 5f08b59827caf2f3e55152f65a942b92fcb3a601 + revision: 618d704de71f50cc706c1c073a7f702765c931ac branch: 2017 specs: lingua_franca (0.0.1) @@ -258,8 +258,8 @@ GEM glib2 (3.1.1-x86-mingw32) cairo (>= 1.12.8) pkg-config - globalid (0.3.7) - activesupport (>= 4.1.0) + globalid (0.4.0) + activesupport (>= 4.2.0) gobject-introspection (3.1.1-x86-mingw32) glib2 (= 3.1.1) guard (2.14.1) @@ -336,7 +336,7 @@ GEM net-ssh (>= 2.6.5) net-ssh (4.1.0) netrc (0.11.0) - nokogiri (1.6.8.1-x86-mingw32) + nokogiri (1.7.1-x86-mingw32) mini_portile2 (~> 2.1.0) notiffany (0.1.1) nenv (~> 0.1) diff --git a/app/assets/javascripts/editor.js b/app/assets/javascripts/editor.js index c6dd287..72cbdd4 100644 --- a/app/assets/javascripts/editor.js +++ b/app/assets/javascripts/editor.js @@ -1,42 +1,21 @@ (function() { var pens = {}; - Array.prototype.forEach.call(document.querySelectorAll('.textarea'), function(editor) { - var event= editor.dataset.editOn; - if (event == 'load') { - startEditing(editor); - } else { - editor.addEventListener(event, function() { - if (editor.getAttribute('contenteditable') !== 'true') { - startEditing(editor); - // for content editable, we need to refocus to show the caret - editor.blur(); - editor.focus(); - } - }); - } + Array.prototype.forEach.call(document.querySelectorAll('.textarea .editor'), function(editor) { + startEditing(editor); }); function startEditing(editor) { var name = editor.dataset.name; - pens[name] = new Pen({ - editor: editor, - class: 'pen', - textarea: '', - list: ['p', 'h1', 'h2', 'blockquote', 'insertorderedlist', 'insertunorderedlist', 'bold', 'italic', 'underline', 'strikethrough', 'createlink', 'insertimage'], - title: { - 'p': 'Paragraph', - 'h1': 'Major Heading', - 'h2': 'Minor Heading', - 'blockquote': 'Quotation', - 'insertorderedlist': 'Ordered List', - 'insertunorderedlist': 'Unordered List', - 'bold': 'Bold', - 'italic': 'Italic', - 'underline': 'Underline', - 'strikethrough': 'Strikethrough', - 'createlink': 'Link', - 'insertimage': 'Image' + pens[name] = new Quill(editor, { + theme: 'snow', + modules: { + toolbar: [ + [{ 'header': [1, 2, false] }], + ['bold', 'italic', 'underline', 'strike'], + [{ 'script': 'sub'}, { 'script': 'super' }], + [{ 'list': 'ordered'}, { 'list': 'bullet' }, 'blockquote'] + ] } }); return pens[name]; @@ -57,7 +36,7 @@ textarea.style.display = 'none'; form.appendChild(textarea); } - textarea.value = editor.innerHTML; + textarea.value = editor.getElementsByClassName('ql-editor')[0].innerHTML; if (pens[name]) { pens[name].destroy(); } diff --git a/app/assets/stylesheets/81e17772-eb6a-4fb4-9f70-3b1fa843c198.dmp b/app/assets/stylesheets/81e17772-eb6a-4fb4-9f70-3b1fa843c198.dmp deleted file mode 100644 index 6697148cc70f4739e3c8366da43490dca4b11cc9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 80545 zcmeHQ31C!3((WW25jg^KL( zh*w};LB-#ws2qyn*xjh;M!^+UT%)2!MF}bx70h4N)!)pU7cyibL|x}Wre1YdS5;S6 z*Xw?-U%%1Oqn*pw<|dt?lycA?A7N={jh8c}Lg*x!e%9AfivFvZHcGV#RjMwX=L9MB z=ZBT5N9XJ4uMQE^C)khv?x4RW^cO{CcM=Rz(}y)AIE(13I?f{*shKjZ-<4lA)66H;aB9Dwc9)suV7C!h z1%ll?cUDwX^i|zeZ~E)6`l?9!*Io5g7ZdDF(4ivKT;iUgrjnG|q-#7$N+$i8st-~1 zqJKTrh4j~7T}0*0Nta z$)bKyXeG*Tv+$)KZ?dNRI_Jd{S0X5=G$ZlQ)d5vXif0`q9p}A2Y-=i|E$X1u;_s+~ zQ+Fr zQ|uUMqt6xk(xX3X`fv)YgE|WT)R9!Ksf|8C=ocMryp8$KBl;iK3IBdhf>a+q9Qv1j z@?X~VEjoHs)Au9#4__7fP>$M_^bz{djwx`cS%{_HQHlMBJ)WDRojl9Qv1jO19|wt~}OT^r7}@e^~gJ zFQ)vCLg)}c^kUDLpB~o!vyt?f^{mhrEd!CjAsY0|;{K(I$tOyuI;2x{r(wE zB~~u?6iZm(IhV5>i8qC<)uI9Cs3Xpz*f&Ym%XJR@%-7ct8XwddntL9gadjG()Nx-Y z!I8VoCstX5kOR19i;it2XQ_itnyc4how1G2^OjXVT4XWwC5wuw`YXVfx=k#?dDUKGSU1`D!I|6Dt6A2u@8I63Q@hD{^;G?8+K}D!F^jCqHf*$6+c5XaAk`~2 zsA=E*v6r3i-CkkFHyB#$MIp)SVE291r>wE!hxrXuWa^o!Df!0DHd)oJ7nwtSZs5KK?s5gc< zW6vjtvi7g)){FbspDeN}x7T;#8)U-`b}s=b z#QT)>rSz|`_Ueog?bQ#_&e(MpSsX8_TQByFn|;b!AoYr>t2%G3tC9vdV-NlUS&#XY z^{mLstE)c0yRQ0y{4g@2dhKPmA=m3QpR(dbR#iMTa)FTu(UZ|lg_QR(4(vLYR`{8m^uNJD=wic>)n^$6w+GHscHyB#|&|WW= z)!V16b{lkz$`4mvCbd%AqMWgPyHu~e?6SDM#`~1z5}z-i@y8cR{YbuXT{UIdeS^Y{ zn(tFqn#hW*r)F-ir}hnY#%`~sEPK6p`1puLR>>er@H+OrsBP#tQ+-o#rpkJ2TWt6R z-Zl(2?Zwbnd$AwxvdF6J8(~r}8a?cu9IQeq9!|E&@+WQ_@+s@Bjk;ds^98Fz)Q@Dt zhifQ{>vh(B9-~#Z;YCufgkUwLZHW4cWR?5^S$!?CD%()yYJbWP(+Z{0c%uVfh-z@~ zcw>@9ma;pldk!lZlSx)?4P}ibS?hhux>MptKE>VLb=7xd!~G>YcF- z2U%oQZm)ha-iSI|P59f{>g`J?&R4Tu_PD{ZcezDYWgF(0INwk`-?^c3Jhwdds7=;N zGZtm&D{h=evYz)T>%#&Wi*`~;k91P2@BB3OQVMKnFQv{@XH#qf^d*bq{C|APYW$3r zcdLZVhE|y?*v7>ph84VZmw{`9~MJF8{+K%hx!{-c`9?9q*?fb5xE| zi^b=iL2BaNL8>mr-Ui)0HuNRS?i(y?m_=4)-{>n^lyGlRDv5l449Tj=!7*xvMOI~> z50m~?AX-i#S?g;kYXZsI>QmM+eGf|&i>x@3)vQNNYNZtS{He~PwTjm*HC3gG*VX$bjGf)p)BrS zjUS*Nb5w4xSMWvXnaK2^!y#&+o0KEV~VP zym7rxS$DW)1>K<3oiul7-K*v{eAuU~_0nEtZPnx(+o`4foUv1EvWA%JGDE9xoG8w3 z_bF?I$O;QmP3gMgARDf+$*ON;G4v&iZTP8AS*2pbs0M1r>;|ggf=RIlY_f(MSqx7m z>x>6I4qv%{T_R%uXSm9Y3|Fr$`84+Y-k$ctI0Nuxvby<{b(O^Ve0l~O8KgE-j7qi0 z@+Z!-&tKtF)=05oUNdz~|7O%doU#8`Ls=Z7a(v3V`dJ+h3+kyCTGUsgn8PHspG(^eJnO%wY>Ut4+n7Rf9>+*nV_zK#XeO$Neal^|DV{g<`|vdg}Hr_0_hP zKg9OE$Rmr}>wGg`W_YrCedJTtYSX{!suhpdRiD!RjT>yTxL?6XPA029-POcV+2_}o z{uQhi&k0sJDgJj)SLs{&HD}2hjUFKhfbyfN|byXzA z-d#16#eI2`Pgx_SFDC@4j@dz~oaz;Jan0I`?|r@RQ&yJ9$`4YLehN}=k*tX|l*Kj- zd6<68QQ7C0$e7I$s+!LVRVCEF9X$fLDU(C1 zCerC&cLSA*@}v9=l9)wYcohb7^l*vxgUd)Yl;&Pz=y#MFtOim2hgvvIbaVP8Hk(g1 zWm{#Cp1giYYOU0zZtf?y)@-sK*VntIm-)dVn{;4X*{v1j2aiP3eGYkzi(1!PlT%@- znN-I)v;r)PR?EoxDp<-Nzv5L_cJ2JJv_}i}Y-r$*rIVGL%!&+U;!@~2tk`_mfs)mpH^U_bnR z2*rp=6gOi}5F?y^@R_P@IiGBrqoXj}CXLS1$nQD+dMxBm8;w&j6xlPWl~ODm{ILW?P4l5>=IrNXC7RN0}ITe1(ym(CN zq8eCxq(AM%t8nJ;&{rd+Bxoc{AG&Uk|*!iJZ|I`;nv_Y9$jS6KlT9j#1x8Z zY*X%|yxJU|J<1Om*0D6NXLiv)mQ(X9iu5;LX`e&9JX(1?^yD=kMVjzvlcVc2;uA|c zxoCvW^_-)vnxa=-d${}4zC5nrs4J1%!z0QMyA7wScnr-PoHTQAs^L`6Xu{a?{>6Td zOZNEfPhEKQz}Me2s!fK)+WzqHi~+o_LH^W)ZOZMHK_hsNMg8HBtnFZrYyNQH9-B_R z#oH48v?|YwxgN=SykPZSf9yG1&zre#a;)=M!yip9R};vu#?u&J6wOg%E&f$rrI$*- z8b{K{(Jb5ZZbCfi!I6mL26|L?^Uez9>D_g&=kYpQ??R1nl;$$&R4ShO+eP~Qm8rVt z@tZAuh$@NtXHT-%G)>W6zZ>KImW;ds5l>v1Grt|vm&QB%UQ8c)U#TyZwx*wdqdeJtfq@0dU>!S8puY%S~0tc?37UlEe1Mfkn}zk7rD>rajB zd_0!*r)}qwcTLq1*i+u0J5koQ&88a3yG8Ia>h6_})JiFygez2-%0HLZORBE)Z=C)O z4))}`4mE1$!Iau~`{Y9AcdT=mP6r;de!vb+58XRK=L0W@OVRK9lzlDl{edAtL4lhOV0FGauh z?>(paa2;8{>xT6>{K?n{7O&jeNAnGBJzDGiOkJsG*@71|J@Sh$dRFJ>ej)lIALWYv zEqa!ROZkGNv6>#~;1iWN-it5tO?A|V*-f-Q;7_j+Rv?ez(cvw1{>sT>pF*Qo!C>L{Bi-?>lv{DO8f))Rl%Z;U3C2?Zkwdr4RmjmiT6~xx-*%j7V6XiH61?Qv^|1GMM?Fw~;4F)e9&yrdk&b?V{#w3mq^`=| zS2uX|7xedMK5n4>q6589#PxBGKJy<8qv;>RV)LG#JgM-^5zak9JiGivMk5|Rj}m#` zFZb3d62Ct1ZeP5|2p;g)y+|;y;Ct_Kw;5fSo)6dq#qvh?)^YB&Mt|08G7-;^56JP% zJ3=5Q0Bh3%L9V+lQYDpJqC8^J7FAqPQS?dN@mG#kRP24|_TEfa{BFCD+#f3{&MO<% zfZHDJzx%Q~KMF3dsEF(=oU`OQN~>%2^T33t74GMPOdCy4=a^SX%E$Ws z!Z!4J8TXUWX@c)s(@?KJ&i&7AnqTCacX5$iJisnoKA*BZHuR zhHt@7bXt>mmTMcI)g+#!E=$(-hzgc*4{+#+_pFtM{UKk$WFfFSv(XYSX=R|p4(|G!cTHK*-RK7Ey&k# zh~8Gyu;2ozANGMbW?s5UMY@5LOnJWESPzWPCK|fZF2WDjB=BE#j_>i=Z!Ml#>-a}H z55%+6J3hlcEbyt?j%OvNe?q=}d`9Cv_fcE%tR~|#XSvyj#%O!TWik(h^4OJkAer{+3AgE*e449bh_i2vduRg4Q1X6`Sy5L(il0l zH$JOw4Do2@Ig9ApN8is%7%TT1kb`}+fFqtAgu#(fLl}r>VmRJ6ijQ3#y{{*d`s@D& z;@RnqXV}LMEsgGVy5^hqcvjrhcRaiGcNWjWzIj*AGt11Jb>8=~zaRGbgPoD@GWkfa zDQw+1FyE}H?P{}JAfBD(ct$tStw(Lgv)op`_3WqNMUQlvjUTk^qRsz zJgceYYPVb9dH*z zwOs9%3&gY28_)2a7qn_^$Fr#JzT?@}hS2Qy@qE)h-`r@ve-mmTYJ+%IU`t27zc3Kb z{I%GxLm!A|r#GJAJ5*@h+Ky*sy?w{Cq~CcwD>dKe!gso0XT-A-laKV8!azK$spV?7 zTp*sE-gt)Z6$0@Lmi=wRKs-CW@eJSbgcsCyJaZ289nYRR6PnfDeDn5d#t@HY^v<0@>Kk~5 z!j1`&fbX1|Y}zwLj!w4thw_o3{q_5eXBaxi#(jESTkegLUSz(T3Vwn0w6Mf)8wTRp z>5XUj&M>^7w&R%^>N}o|{T1Swb-y6krMl2D`x?CuL2j2k{eC`he1{o)kZy;__ZPkv z7FbW~ug!i9`anE8z3~j+K}Xxxc04N>;X9sv-vFA`-uSF0?>oV6&QVD^oty=JMzvez02EmaiqyUD+QSXL4RFDAfCatzhxMRXQwxwg<~Tj;{@oJ zwe`MJg41_Ad+=9?XSdW~zIn1fwDMSQJ%21&{WWhZN_(`*vB$`YY89dLVSnCHHbps9 z5XTlmi1li3FuFVXG%%DIaT|g+27v`yUKSw z8{}s^D@+o8yq_cL!~0egv|&uCBjyGb=y*TJQ?dVS1JM?~zz*Setx9@*OpRLzN{NHDL?Y|iLrR-0bV4!Co8|gngc6ig{zOGS6 zfiHC*eQnEy zbpG{uBQnnkj(PC4+tLR-`qE1tqN$15DQ>c}%id|zx=z~2$3DA%@b^PUU&PW#_3>Ku znTc6BX&G_7dv{NqnM^vn=I5klX2dy%NS&;SM1u-6KXT2|Hvb(K{aEy{7eYn^-N%yI z6c**4OwGOe`%emDHXna?ar=8_oXI5FsVV8!3f%YAXW92QdnRh}g)clewBDy@Fim3e zoJ3ceh0*9`KkmqSG+TrCSNv$X|hw(=aS}bWug~uIndrpa<8W##m7vl+bh=B?o|%cF0u*!uq5 zCqu?FN!rYr76biUwk5d9m^(&p=oYmvYTs2aGR4g7q?~DP9*4i)`F~Hh$Qrr)zU}w! zzUteJY{KNJ)2TIFZkiTvzp&=~@rh9dEmzFA^}ECo%q1ynzAMM8;#>QUz4Wc*oXa1b z|HcRHR`W;(9uZenWWBv92==yUnx72KpW;g9TJnrM;mqso7{(*608!c?YG+Eh+DH*A5N&o7W z-+lF*@F5HHCtq>pWiRTUAZocu9(dyU$&W=pKCGbQ(UhBazx=WPy&yg{k=i(Is+;B3 zv_UWK{Y&pbx7_>VfWPir+o}dEvon)sqThq4 zPs*9^vNU5+eBBlw44g1x!=Yviw-4?=kR@iOr&x4Kj{PR#t@h^(di2QjGrzv8;s-;K zI6KEebkT-aClt)tJNmJ=OV(aB$$6fxTUth1hNb>P@|J#>ojGs#-7S6?b7N|fZpXBg zten|7X`a})uiG74qn2b}{>Z#mu{$Drq%tE8J}DV<+)d-$kuxv8;N4NnT^C<}-bI(J zWExji<}_;uT{88YE85*WeDGs!yWINpmMccqz*5O6Nog|^J*r**_(zM&?^r%`$*}#y zznmE!3ow-)?+#F^JVKIZ=Tk3YR(;QRCaXX~1uGS8LhakLG` zubudMvnHeOT|M{XC6_IGn(dRFk~G^I!FP9iDkAThMWfdbuM;`pp_KlbCfk*kl9-}W+rAN56R5P7@IjeCnbjBOiGr!ZO)$cZEoLA z{~Y$XSqcl8P{iUKPRcd?Ddb`&7#K7 zi%lg*bkjWer}|y9eux};>#BE}ANhRJ7N(gt*EKsSJ;UQwFRyBF+54AVKXhZ}clUJb z@IZGaqDyB|j`gB{-J(OK|N45$kd=qpmR|fqcU|}Fq}0R=8r-%WUef#x_Qs4Huck;|b8V~R6B-PSt*gbCMr-KW|NZ#>4H{fC`q}6A&ujb6nzdTv^yEaBrP(iN^4$8v$!|p8vit@| z-_%}hm?k+j$(2OInZ9m~4i-E*eM4r~sLe}T&YyO{#=ERkZlV@fEQk;5-8y>9*5rXN zzVJz!7MC(LEz?c$(%bvGJsAJ~(EFRkz1=IL&M{pvUH9y4)A)|I3*7^J-qam0oc1Gb zhaXW24`@qiX3=F0;pRoHQsUKgty0+FZ63|0epp8vuA2!qZ%8)lS^5yQ`M`mb=)1f~ zxOpJUcR1#6RI0VvU{~XtX!6oo9&l)!c3sDUmsHwtW&Re@@2G6V)Q{wS_$qB2Zx$vO z5x=u{D}@b#*M(F59-7n~lZ^pZ(oALXSH#cUfJ`O4{b8l>frmvMDE~X99Bqs}xPEjw z$A;+Zd+4Hk=QfL+tH({I}Uee^#PbK~b$d4xX z-WuQ0QxPmsIho(11n2{P4~qm~zyhbv0)gw}sk7y8nNxUE83!%;&ig}Jc?OT_5vL#I z{A|9^Fr~ZD$CygdaP5>H*hm)}8XsOR8|$8E<6^#Xj&#tkHuO~~budjfOs*=wQQ+2i@SJ0}E=fAjX}I6SE+P zQIzHf@RsNCni30kpik80)Ajfd3l31;`}H_oRR4%J9^8Hwu|w(y9grVx>J7ZQaNc|J z!Of^2<^EuTsVAVD5AHQs?BLG(1D{wIU}15Iw>cucQ9D-h@~oreM<+dObe-%4PL^+{ zuO&RI#r99$xWEr##=kI5M@jp_ID7i)3FPNY;G*GNBdcNN2^_+pRb~NbtgW z<)t;B-~6-Uyix90b@ z;eBlQMK-*z4Zqli_p{;sZTJ8ieu)j=XT$$v!{4*v`)&C9HvGRf`~w?aV#7bQ;UC%X zk8St?8~%w6|I~(mX2VNu_*&`!*7jLv!ymWdPuTD$ZTNZ{{*(>>KO6qE4KEPf-Dh|0 z^7QvzJ0uzX|77^krA5(8w@+KzG-m1WP~FqtxKPUA{u3EPA9z8&aFN_+nz+RKIbGq) zW%^E3jG-qb%>qi3aEig#ugHu0VA}#G2HH0O`1c0+fQ^l;_Rt32FMdEUM<1`_jB3(( z6{;G+{jkalS10K4BgPh3NWZ@IUvxSau5z^VI+{p1Pnytsa5>}l=c6S1Bd-PK-(7`a zu29@9WbWT$Lw}PQ*fP~X`YSdASkQwm*OWy1D+bqJQKxe*KaGA$OnH*OhDnNF620ka z!50h_WaRZQ5al_~dZ0Ygh@LMH?!%ss49GbW9ZFC2t3ImAN4hh}+n%WJfpa9i|Kr{t zv3{8F*Xggl5$Oz)df#Sn)YqetH~)rPD=G%iU&S%u3p;Z`Y;ddrI`t~!Flf8jqx#t+_qb&gr*A#^;dNTomI zgC2ZVe&56E#jdF49~Q9whMig)cE?7>+28m86pVi*Un$WqxY>#6!O!)hM;`0d(J(s6 zsGoLBc}b7^v3>#dF~tdpe7k->)+v;JYRZpm`-;X<9{iwRt3xsm2F{S{k7Hw4v0f(u zIlarUa9{ZLy;30B73Bc;6m4DCahk`z`whKP-)X)>A_StoC4Fm!SzAEq9lL;HnnG4^v7 zS8rY^+-m$Av03E7&TdAvBp>q5aleR#l&&79M3NuSc~HhJCAWI}K}?18_o`S`wsIkYLofJGlo9NSuR@17fqc+M8b0O6eAnMzpI;l_c*}kr zA5kB>KIfVQ57YE#x8JeqRacb_hPdm-|X~{ZBO>SkH2*EgIk# zut2~90Sg2y5U@bN0{^QP2#lNlS6kM*UL8V59pLBOVNJc$G4JtCr441ik_|MJfq$tp zPwsP;d@AoPm7L{OWL>Gymn++QO{P50Q~5qq*ylnA{-q|L_2T=JeGDH9^TIReQ81V1 zd>mQln)`N;N9FZ>Lz`ZyM&2$%Ut;(}F6sxq519=^+D3yva=hUPHOfn$Kc@)|2jWjV32yv>%MPcve1_va%^C|9bX%J8!>d>Palyx<-NUfqnAn6_u9DaIw9eZ zcX`~80bgzxtOe>!W%`zhToeZkSFLru3h%Y&=PGW8ye~u!?mM^)PBqZwfZL(N2mq|i z9~zt*n5)8at(@qUz(S4xN7fUi&c%IHD;1rad|PTI6wkTbd<{hh10zg(mKgsA4o0hX z+c$tgjyIfV+TB{7`vLkH^XC$O`Pw`;G5s6;8v7XoPPO?7-?QcN1qY>Fk^g4KkTD;oq$r^VnyCZXGmPpiTo3WGbx`C8t=8f3^=HurybX?%~N6#FS{@Ysrnhx z=TSYltbTQ#AmfM+YZ?a!+n>9k9OT9P;|ceDwAMu5x^c9Ya>U32Xnc43k7u8!Z`JBs zkG)hM9cPG-?xJ?PqJF9U_IbU3N_t+x{rqv`4=b+1b1sn-Wcpihu-Fsz>1FgpJ)zfA z=0+&$RlHN`^Qh^VUAq=*`KT}SLV5574)|mDwjbWb0m8I9_?H;|-HbkUx(I)yV?(07 z-$*-*GQkFVg|@_V5!pb!=OjDZf5ep!*&lkLZT1$vY}_$MisaF#rOLp)R_u5zs8qktfnN1W$0 z&gw#cT%TMcr;cf;QO3Tsx~MVd$Ek5DM`furm7%7q%L%5_Mv%h^o2D`;HZ`omiQSOGVssyE%R8)Wtu-}>98)dzD zx%dmXfXQO!$qDQGF8TJs_DXdqX*8bWCHM8!v|t5) z?E2dM9ZFHS*DRQ(gc6-9k+wcfBX8#|P#wBAB$7WTQ+gKtI#ev>%p_m0>R^dM?&s@F zW#<`9yyjECN~0c@O1Z`h|-t^a>u8)!Que<80E+**sR@z5>C(wO) zw5i*R=r5!{eULwa4)A3D1iCyU56~t?+5JhEBYDv~U)R?Q-tU2rs^k?L{t-vK{Vuqp z_!Io?mVx4*yjKJtyl(^__I)HA#xA?MN_of!T~s^ckDrM=_~mXRkN2kFBhtu&9O%I~ z#sxwtza~8ESj;J?FUmtM`c-j5(F6U%%8Sn%bP)Z^x5{-xZw^K2pr5x<(!t+e9yt3w z>#O(JAh^(!Thv+jLr?IXSVe!oJWS}JKkVT$^eAu7xATWy%lZpH=Y5@Y94a*N#<&Z} zRKgF^PMogoZs^?OLf{5M50vBUJ|7$}_&|F@FI>m%^^P4c?{%VnQAQ8ukxYw}%JzEZ zGi+myXB^Ae|0R}@#`M3K9Ah4(@i2NN{e{vW6HO!_3%oc%4vs7pm{gfGUS-UO!~CTa zyo3Jw(I3m*Nq==n#yW!Q2_};g3?m5-BVjCqVH^63p-o*GCU>GlIvC>o&kxfI9Mbp7 zM`S;lf>p8)3+L~osrj`8BS`4*X*5@$Ev9D?J@Z~YfC~9Iz#k;AzuoRmW8b^VrM(Ya zD*hp@S5dLZ*ahtdes(_4#%1_84BuP>Q6ByP{@?>T=vnrGyypx){o0W|51DtLKli)? z{phBz&iY#(w4(JdW`7#+M-J+dw{VJ{$AmdH>UA@y|NTbKk(0&$P_8P7a?lU@gP!e? zV0dzxbsr(dT@|t}2$1WCI&*%Inm&x%Inu&|({Z4mL?J&6`xMD~u3RQ8rYn6Rdn+B} z`wo3Vtm!%-r&a&5K72HqXzWoe^KIDAsw>mM-a*E`pqnvT$^&OwK7gCcii$9F)qQRb z`oME@v1i~nV1a-I0v4z(3k04w)t03Lasn2pz6J1}7Qc1KhZ+3|LciVKk#&@1Q)L}) z$&_+Ebc-<*JZ?>OQ~Q5XyvKW8@W!R`VH|uQ2k&Wx?UePOfRKa_=b+r7oA>Jb`=E<^ z$eSPNu+9?@{C3;k3qv{})~)8>CVFF?Dsa%*p=Vgk|6(2mH>`>$ti%4sz1*T?Pi0_+ILPd?;q|(;z*+ zG#OcK_UikNnAd?G_QCyT%;Ad%PIW)G<9j#<${Ohz=c12A506}$xbk5D$FpE1Zy9t@ z2@8^M3#y~@Tgn}qk`izG>pc3weqy0(Z`JD`IzKR9!|U3Pctk%ZyQbaO90>6~6!^dn z&>Q?B&braOFD5C)t)>3Rk23ZH9{V}hlKf$a$iJ%74Z6IWFYakn0ntyZqQ^WK^6c=9 z0cPJ|lacVD*a`dqQSbT-#Xe|1*adtKB;2m`k2HJ=josJT?Z35;ZdcgR&F52*4|^yl z+AT)kpW(Oi`8wpOm)zHYTn|50$aHQ!I*MK0e2pCF9cfN3cE9hpRLisH18+i(mw&FJ zX95kyKYMjm{Gnghg#)!*_G^~^V9P{}M{UdA!8r24=j^N|ro5C}y+m;2t8&!eo#J(Z z>v-`2p)2dyMfV@1dlCCUZZZWP|1wPL)Be5ZwBB4t*893)Jq~{|_JPGKO}mA*9&F&ZqA;DCLni&MTfcn1MN1UYdzV zk^k(k{WIU-uw(I+SL%L!WQzDN=nCSc{%Om`YC9mE?-BEH!~H#V`)tPk?B>1H{Ldv$ zBkqW#lN0JxNoo-jc3QA+TFByW8EcyIjDtGw}q(cZXos5hQt!(STcoxi8E;BqZi zYH;IoR$2G;!SyJi`L$klE_|xL)|>pNknQnFj$FS=N~OPCI7e{KvmUta+3gK~EB*W? z-5zBLtu#dcEHd%e%Bv>lCGShWLfO67Nc*GyEQik{O+5iY1f7TlkUyDq6 z@GCeV^v*cpi}b8p#lMhVFj)GTGW7XIUUlsa|3bOvXM60;evf?EJ9n({J2T!XHS)>~ zgq|pe{to`0{K{t{uW~x4T;aZ+cU4_!6$1bA^&E%mkk}FU#@i?B{swykk6AxJU&liC zPSE+l3*uy-xU#Rs??U&;hZ7?Y3l4kc4d8utC?1)1iP98Z{L5F7=0~fAJ^@x*xi*)!s`fK^Nk-92-U)|s}{zZR(=Hmw1FA9FBs7S3x0y|Aa*{e;csB zj^?+?JcExm1yMiP1<*NF#`%j5Cu{#NOp)=uOx8W^6Z-w@x_v?>G}ipL*OTjgOp(|L z@e}c`#MlpU)*e@B-B}^(#1Q4IX}`uf;`!T3>epw9Xa5n_=iM~9p8$I(AX+%l_ry1G~b0po49OoqLfUPhtFy>ksn#_Yi(TMsCY! z!Ar{|F7z|wF_a(DSMpsQWS{y+Vg!dCuAK+;dc`oq4{}g`o+%eKRMw#*|A~xxdL98B z(5~;q_ho*9{Jlm$=!tZ|FRu5dhdrw*x988^^d;Yj9m?i>rt5Xn4U%7E#sS0A1xNiL z7j~Fu?BVDpbOlCV*SEqq&7?<}bjVrR*{mxuKQ4rz1HnDGbNSrX!rx)=3vCeciw(b3mq~dZm+^HK>99ZO5my{H3BAkMInvYz{Qwa5 zLHr0>DD?#&mzl=`qCR$5dXuz^GWV4?4DqgiKJv|eNO>ks^z0ScZ$S3!sp;|bS;Y9M z*(n*xIv#{KJ@I=>5k@ecSFCi2zRK_oKSSo{3s%YX!K0_dhl5A@>iF`^C!$}GA>ii~ zY}dTo4L?u86Q1oe~sgRJE-n&Zc*DbGzS+JAWe3%Wvcf~9?$Y{*cx*b~8 zA)=izix+D8-fs`uxRP`39M#ED`sc_WDu}IvZ>wyYK*^<7_dZgQCz*=Gd`T=kf*!8p z5fn8(=9Ytwn5AEohEch^m|J!_u7UJjyC^RrX6cooF-y-Fw2^P_m-f2rSViwbB8vc3 z%+jEkTVAbL8uoeLZ_6uWC-YHD_mk?2Siz-rr?;$wc^4(y`-g&*#VKwp#t9p)8J zzUMs;zp6M#N>xpjcTB!>h3`2PnEC^vWO%5YoyZQL`6EL3S=DuqtUBu#RbXAo{I)7J#4?D~?>jMv7E8{IZR{@k#^lQ5q4m9f;3znJt{)P{5 z$U*r|t%N`1-54b}=X1SK&Q<=ielCr27~cV3v_#}BHqegaxkD%0a|e{qz3v))T?Rxt z;uzM4T+C|^>409%jlO_^I0nlFV88+a3j{0>ut2~9{#zjMKD+-m3zP_0AYg%j1%A&K z2*my0bL$0kuc-xoso$5Gg}o7DKKI&(0_mf^k?+fe83;W;#*17gf!72gk0HwAJ_zy( e8XnN^5ll1>P{0>3a32Jg3c!E`0v7nSEb#wq<%lu> diff --git a/app/assets/stylesheets/_admin.scss b/app/assets/stylesheets/_admin.scss new file mode 100644 index 0000000..5da4120 --- /dev/null +++ b/app/assets/stylesheets/_admin.scss @@ -0,0 +1,1627 @@ +$bumbleberry-no-markup: true; + +@import "bumbleberry"; +@import "settings"; + +nav.sub-nav { + text-align: center; + + ul { + margin: 0.85em 0; + list-style: none; + padding: 0; + } + + li { + display: inline-block; + + @include after { + content: '|'; + margin: 0 0.5em; + } + + &:last-child { + @include after { + display: none; + } + } + } +} + +table, .table { + th, td, .table-th, .table-td { + &.center { + text-align: center; + } + + &.big { + font-size: 1.5em; + } + + &.status { + width: 0.1rem; + background-color: transparent; + border: 0; + } + + &.state { + background-size: 1.333em; + background-repeat: no-repeat; + background-position: center; + width: 1.75em; + + &.happy { + background-image: url("data:image/svg+xml;utf8,"); + } + + &.unhappy { + background-image: url('data:image/svg+xml;utf8,'); + } + } + } + + td, .table-td { + &.inner-table { + padding: 0; + + table { + margin: 0; + width: 100%; + } + + tr:first-child { + td, th { + border-top: 0; + } + } + + tr:last-child { + td, th { + border-bottom: 0; + } + } + + td, th { + &:first-child { + border-left: 0 + } + + &:last-child { + border-right: 0 + } + } + } + + &.bold { + @include font-family(secondary); + } + } + + tbody th { + width: 0.1rem; + } + + &.admin-edit { + width: 100%; + } + + tr.hidden { + display: none; + } + + tr[data-key] { + cursor: cell; + + &.editable:hover { + background-color: lighten($colour-2, 33%); + } + + + .editor { + display: none; + background-color: lighten($colour-1, 50%); + + td { + opacity: 0.5; + + &.has-editor { + opacity: 1; + + @include after { + content: ''; + position: absolute; + top: 100%; + right: 0; + left: 0; + height: 0.25em; + background-color: rgba($black, 0.125); + } + } + + .cell-editor { + &[type=number]::-webkit-inner-spin-button, + &[type=number]::-webkit-outer-spin-button { + -webkit-appearance: none; + } + } + + select.cell-editor { + -webkit-appearance: none; + -moz-appearance: none; + -ms-appearance: none; + appearance: none; + cursor: pointer; + } + + &.date .cell-editor { + text-align-last: right; + } + } + } + + + .editor, &.always-edit { + td { + position: relative; + vertical-align: top; + background: inherit; + cursor: default; + + .cell-editor { + top: 0; + right: 0; + bottom: 0; + left: 0; + padding: inherit; + font: inherit; + margin: inherit; + background: inherit; + border: 0; + min-height: 0; + width: 100% !important; + border-radius: 0; + line-height: inherit; + overflow: hidden; + box-shadow: none; + text-align: inherit; + } + } + } + + &.always-edit td .cell-editor { + position: absolute; + } + + &.editing { + display: none; + + + .editor { + display: table-row; + + .cell-editor { + position: absolute; + } + } + } + } + + &.always-editing { + tr { + cursor: default; + + &:hover { + background-color: transparent; + } + } + + .cell-editor { + position: absolute; + } + + td.text { + height: 5em; + } + } + + tr.editable, tr.editor { + td { + white-space: nowrap; + + &.date, &.datetime, &.money, &.number { + font-family: monospace; + font-size: 1.25em; + text-align: right; + } + + &.text { + max-width: 20em; + } + } + } + + tr.editable td.text, + tr.editor td.text .value { + overflow: hidden; + text-overflow: ellipsis; + } + + tr.editor { + td.text .cell-editor { + white-space: normal; + bottom: auto; + height: 10em; + z-index: 1; + background: inherit; + overflow: auto !important; + } + } +} + +.table-scroller { + overflow: auto; + background-color: #F8F8F8; + @include _(box-shadow, inset 0 0 10em 0 rgba(0,0,0,0.125)); + + table { + background-color: $white; + margin: 0 0 8.5em; + } + + body.expanded-element .expanded & { + overflow: visible; + } +} + +.goes-fullscreen { + [data-contracts] { + display: none; + } +} + +body.modal-open { + overflow: hidden; +} + +body.expanded-element { + overflow: hidden; + + .goes-fullscreen.expanded { + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + z-index: 1000; + background-color: $white; + overflow: auto; + padding: 0 1em; + + [data-expands] { + display: none; + } + + [data-contracts] { + display: block; + } + } +} + +#main .columns .modal-edit { + display: none; + position: fixed; + top: 0; + right: 0; + left: 0; + bottom: 0; + z-index: 1001; + margin: 0; + background-color: rgba($black, 0.5); + + &.open { + display: flex; + } + + .modal-edit-overlay { + position: absolute; + top: 0; + right: 0; + left: 0; + bottom: 0; + cursor: pointer; + } + + table { + margin: 0; + background-color: $white; + + td.empty { + background-color: #F8F8F8; + border-bottom-color: #F8F8F8; + } + } + + thead th { + text-align: center; + font-size: 1.125em; + color: $white; + border-color: lighten($colour-1, 12.5%); + background-color: $colour-1; + } + + tbody th { + white-space: nowrap; + } + + .modal-edit-content { + position: relative; + min-width: 50em; + max-width: 75em; + margin: auto; + overflow: auto; + z-index: 1002; + background-color: #F8F8F8; + flex: 1; + } + + .actions { + margin: 1em 1em 0; + } +} + +.table { + display: table; + border-collapse: collapse; +} + +.table-tr { + display: table-row; +} + +.table-th, .table-td { + display: table-cell; +} + +/** Not sure if this is still used **/ +nav.sub-menu { + display: inline-block; + margin: 2rem 0 0; + text-align: center; + + a { + margin: 0 1em 0.5em 0; + background-color: $gray; + color: #888; + display: inline-block; + padding: 0.25em 0.75em 0.333em; + font-size: 0.9em; + border: 1px solid #AAA; + border-bottom-width: 0.2em; + @include _(border-radius, 0.15em); + @include default-box-shadow(top, 2); + @include _(text-shadow, 0 0.05em 0.05em #FFF); + + &:hover, &:active, &:focus { + background-color: #D8D8D8; + } + + &.current { + background-color: #CCC; + color: #666; + padding: 0.333em 0.75em 0.25em; + } + + @include after { + display: none; + } + } + + @include breakpoint(medium) { + border: 1px solid #AAA; + background-color: #AAA; + border-bottom-width: 0.125em; + @include _(border-radius, 0.15em); + @include default-box-shadow(top, 2); + + a { + border: 0; + margin: 0 1px 0 0; + float: left; + @include _(border-radius, 0); + @include _(box-shadow, none); + + &:last-child { + margin: 0; + } + } + } +} + +.single-check-box-field, +.single-radio-button-field { + margin-left: 1em; +} + +.date-span { + margin-left: 1em; + + label, input { + display: block; + height: 1.5em; + margin: 0 0.5em 1em 0; + } + + label { + height: 1.5em; + } + + input { + @include default-box-shadow(top); + background-color: $colour-1; + color: $white; + border: 0; + padding: 0 0.25em; + font-weight: normal; + @include font-family(secondary); + @include _(text-stroke, 0.5px #000); + } + + .date-labels { + float: left; + } + + .date-field { + overflow: auto; + } +} + +#main .columns th form { + display: inline; + vertical-align: super; + margin: 0 0 0 0.5em; + + button { + float: right; + } +} + +#main .columns th.form, +#main .columns .table-th.form { + display: none; +} + +#main .columns td.form, +#main .columns .table-td.form { + border: 0; + width: 1px; + + form { + margin: 0; + } + + button, .button { + display: block; + width: 100%; + white-space: nowrap; + + + button { + margin-top: 0.5em; + } + } +} + +.flex-form, .flex-column { + button, .button { + width: 100%; + text-align: center; + + + button, + .button { + margin-left: 0.75em; + } + } + + &.address-form { + .city { + @include _(align-self, flex-end); + @include font-family(secondary); + text-align: right; + margin-bottom: 2.5em; + } + } +} + +.flex-inputs { + @include _-(display, flex); + @include _(align-items, flex-end); + @include _(flex-wrap, wrap); + @include _(justify-content, flex-end); + margin-bottom: 2em; + + .input-field { + margin: 0 0.5em; + } + + .stretch-item { + @include _(flex, 1); + @include _(flex-basis, 100%); + + select { + width: 100%; + } + } +} + +.actions { + &.right { + .note { + float: left; + color: $colour-1; + font-weight: bold; + font-size: 1.25em; + } + + .left { + float: left; + } + } + + &.small { + margin-top: 0; + } + + &.fill { + @include _-(display, flex); + @include _(flex-wrap, wrap); + + > button, > .button { + flex: 1; + margin-bottom: 0; + } + } + + &.figures { + .figure { + display: block; + margin: 0; + text-align: left; + } + + a { + @include _-(display, flex); + @include _(flex-direction, column); + @include _(align-items, stretch); + color: inherit; + margin: 0.5em 0; + border: 0.1em solid $light-gray; + border-bottom: 0; + @include default-box-shadow(top, 2); + @include _(transition, box-shadow 150ms ease-in-out); + + @include after { + display: none; + } + + &:hover { + @include default-box-shadow(top, 0.75); + } + } + + svg, img { + height: 5em; + width: 100%; + margin: 1em 0 0; + } + + svg { + fill: $black; + stroke: none; + + &.stroked { + fill: none; + stroke: $black; + } + } + + header { + @include font-family(secondary); + background-color: $black; + color: $white; + padding: 0.5em; + font-size: 1.125em; + @include _(text-stroke, 1px rgba(0, 0, 0, 0.25)); + @include _(transition, background-color 150ms ease-in-out); + } + + .description { + overflow: auto; + padding: 1em 0.5em; + } + } +} + +#main article #registration-admin-menu { + margin: 1em 0 0; + padding: 0; + list-style: none; + + a { + display: block; + padding: 0.5em 0.75em; + border: 0.1rem solid $light-gray; + border-top: 0; + border-right: 0; + + @include after { + display: none; + } + + &:hover { + background-color: $light-gray; + } + } + + li { + margin: 0; + + &.current { + a { + color: $white; + background-color: $colour-5; + } + } + } +} + +.data-set { + display: table-row; +} + +.data-set-key, .data-set-value { + display: table-cell; + padding: 0.25em 0.5em; + vertical-align: top; + border-bottom: 0.1rem solid $light-gray; +} + +.data-set-key { + font-size: 1em; + width: 1rem; + white-space: nowrap; +} + +.data-set:last-child { + .data-set-key, .data-set-value { + border: 0; + } +} + + +.space, .address { + .data-set-key, .data-set-value { + white-space: nowrap; + } +} + +.admin-blocks { + @include _-(display, inline-flex); + @include _(flex-wrap, wrap); + @include _(align-items, flex-start); + @include _(justify-content, flex-start); + list-style: none; + padding: 0; + + > li { + max-width: 25em; + border: 0.1rem solid $light-gray; + padding: 1em; + margin: 0.25em; + @include _(flex, 1); + background-color: #F8F8F8; + @include default-box-shadow(top, 2); + } + + .actions { + margin: 0 auto; + } + + .title { + margin: 0 0 1em; + padding: 0 0 0.5em; + border-bottom: 0.1rem solid $light-gray; + } + + .amenities { + list-style: none; + padding: 0; + + > li { + font-weight: bold; + white-space: nowrap; + display: inline-block; + padding: 0 0.5em; + line-height: 1.5em; + font-size: 0.8em; + border: 0.1rem solid #CCC; + background-color: $light-gray; + @include _(border-radius, 0.125rem); + } + } +} + +#admin-housing, #admin-schedule { + .guests-housed { + margin-bottom: 1em; + text-align: right; + + h5 { + display: inline-block; + margin: 0; + padding-right: 0.5em; + } + + .data { + display: inline-block; + font-size: 1.125em; + } + } + + #housing-table { + @include _(transition, opacity 1s ease-in-out); + + &.loading { + @include _(opacity, 0.5); + pointer-events: none; + } + + tr.host { + th { + vertical-align: top; + } + + .address { + margin-top: 1em; + text-align: right; + @include font-family(primary); + } + } + } + + .host-table { + tr.place-guest { + td { + background-color: lighten($colour-1, 40%); + + &:hover { + background-color: $colour-1; + } + + &.full { + background-color: $gray; + + &:hover { + background-color: #CCC; + } + } + } + + a { + display: block; + color: $white; + text-align: center; + @include font-family(secondary); + + @include after { + display: none; + } + } + } + + .remove-guest, + button, .button { + float: right; + } + + td { + vertical-align: top; + } + + .state { + position: relative; + font-family: inherit; + + &.unhappy { + cursor: pointer; + } + + ul { + display: none; + position: absolute; + right: 100%; + top: 0; + background-color: $white; + border: 0.1em solid #CCC; + padding: 0.25em 0.75em 0.25em 1.5em; + margin: 0; + list-style-type: square; + @include default-box-shadow(top, 2); + z-index: 10; + } + + li { + white-space: nowrap; + margin: 0; + } + + &:hover { + ul { + display: block; + } + } + } + } + + #workshop-selector { + td, th { + white-space: nowrap; + } + + td .text { + max-width: 50em; + overflow: hidden; + text-overflow: ellipsis; + } + } + + #guest-selector, #workshop-selector { + display: none; + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + background-color: rgba($black, 0.5); + cursor: pointer; + z-index: 1000; + + &.open { + display: block; + } + + .guest-dlg, .workshop-dlg { + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + background-color: $white; + width: 80%; + margin: auto; + padding: 1em; + height: 80%; + cursor: default; + @include default-box-shadow(top, 2); + + h3 { + margin: 0 0 1em; + } + } + } +} + + +#table { + position: relative; + overflow: auto; + height: 80%; + height: calc(100% - 4em); + background-color: $white; + @include _(transition, background-color 250ms ease-in-out); + + &.loading { + background-color: #CCC; + @include _(animation, whiten ease-in-out 1s infinite alternate both); + + .host-field, table, .legend { + display: none; + } + } + + table { + margin: 0 0 2em; + } + + h4 { + margin: 0; + + &.inline { + display: inline-block; + padding-right: 0.5em; + } + } + + .plain-value { + font-size: 1.2em; + } + + blockquote { + margin-top: 0; + font-size: 0.85em; + + > :first-child { + margin-top: 0; + } + } + + tr.selectable { + cursor: pointer; + + &:hover { + th { + background-color: $colour-2; + } + } + + &.other-host, &.other-space, &.bad-match { + td, th { + opacity: 0.5; + } + } + + &.selected-space, &.other-space { + td { + background-color: lighten($colour-5, 35); + } + + th { + background-color: $colour-5; + } + } + + &.other-host { + td { + background-color: lighten($colour-1, 40%); + } + + th { + background-color: $colour-1; + } + } + + &:hover { + td { + opacity: 1; + background-color: lighten($colour-2, 25%); + } + } + } + + .legend ul { + @include _-(display, flex); + list-style: none; + padding: 0; + + li { + @include _(flex, 1); + text-align: center; + margin-bottom: 0.5em; + padding: 0.125em 0.5em; + margin: 0.1em; + border: 0.1em solid $light-gray; + background-color: #F8F8F8; + @include font-family(secondary); + + &.other-host, &.other-space, &.bad-match { + opacity: 0.5; + } + + &.selected-space, &.other-space { + background-color: $colour-5; + } + + &.other-host { + background-color: $colour-1; + } + } + } + + .p { + max-height: 4em; + overflow: auto; + } +} + +#admin-housing { + #table table { + min-width: 100em; + } + + #hosts { + background-color: $white; + + ul { + list-style: none; + padding: 0; + } + + .host { + padding: 0.5em; + border: 0.1em solid $light-gray; + background-color: #F8F8F8; + + &.status-good { + background-color: rgba($colour-5, 0.1); + } + + &.status-warning { + background-color: rgba($colour-3, 0.1); + } + + &.status-error { + background-color: rgba($colour-2, 0.1); + } + } + + h4 { + margin: 0 0.5em 0 0; + float: left; + } + + h5 { + margin: 1em 0 0; + } + + .email { + color: #888; + + @include before { + content: '('; + } + + @include after { + content: ')'; + } + } + + .guests { + clear: left; + @include _-(display, flex); + } + + .space { + @include _(flex, 1); + } + + .place-guest { + background-color: $colour-5; + + &.booked { + background-color: $colour-4; + } + + &.unwanted { + background-color: #888; + } + + &.overbooked { + background-color: $colour-2; + } + } + + .warning, .error { + display: inline-block; + font-style: italic; + padding: 0 0.5em; + margin-left: 0.5em; + border: 0.1em solid rgba($black, 0.25); + @include _(border-radius, 0.125em); + @include _(transform, skewX(-15deg)); + @include _(transform-origin, 0 100%); + @include _(animation, bend ease-in-out 500ms infinite alternate both); + } + + .warning { + background-color: lighten($colour-3, 25%); + } + + .error { + background-color: lighten($colour-2, 25%); + } + } + + #guests { + .guests { + @include _-(display, flex); + //@include _(align-items, flex-start); + @include _(flex-wrap, wrap); + list-style: none; + padding: 0; + } + + .guest { + flex: 1; + margin: 0.5em; + border: 0.1rem solid $light-gray; + background-color: #F8F8F8; + padding: 0.5em; + } + + h4 { + margin: 0 0 0.5em; + } + + .set-host { + width: 100%; + } + } +} + +#admin-workshop_times { + .workshop-blocks { + margin: 0 auto; + + td, th { + vertical-align: top; + } + } + + .table-tr.new { + .table-th { + background-color: transparent; + border: 0; + } + + .table-td { + background-color: transparent; + border: 0; + } + } +} + +.details.org-members { + padding: 1em; + border: 0.1rem solid $light-gray; + border-bottom: 0; +} + + +#admin-schedule { + .workshops-to-schedule { + @include _-(display, flex); + @include _(flex-wrap, wrap); + list-style: none; + padding: 0; + + li { + @include _(flex, 1); + @include _(flex-basis, 48%); + margin: 1%; + @include _(transition, background-color 250ms ease-in-out); + background-color: $light-gray; + + .title { + @include _(transition, background-color 250ms ease-in-out); + } + + &.booked { + background-color: lighten($colour-1, 40%); + + .not-booked-only { + display: none; + } + + .data-set-key, .data-set-value { + border-bottom-color: #888; + } + } + + &.not-booked { + + .booked-only { + display: none; + } + } + + .field-error { + background-color: lighten($colour-2, 22.5%); + margin: 0; + } + + .already-booked { + overflow: hidden; + max-height: 0; + + &.is-true { + max-height: 3em; + @include _(transition, max-height 150ms ease-in-out); + } + } + + .workshop-description { + max-height: none; + } + + .details { + margin: 0 5% 1em; + width: 90%; + } + + .title { + margin: 0 0 0.5em; + padding: 0.5em; + background-color: $black; + color: $white; + } + + .drop-downs { + padding: 0 1em 1em; + + select { + width: 100%; + } + } + + .actions { + margin: 0; + padding: 0 0.5em; + } + } + + #main .columns & form { + margin: 0; + } + } +} + +.stats { + list-style: none; + + h3 { + display: inline-block; + } + + .stat { + position: relative; + padding: 0 0.25em; + margin: 0.5em; + font-size: 2em; + display: inline-block; + color: $white; + background-color: $colour-1; + @include default-box-shadow(top, 2); + @include _(text-stroke, 1px rgba(0, 0, 0, 0.25)); + + &.important { + width: 2em; + height: 2em; + line-height: 2em; + text-align: center; + @include _(border-radius, 50%); + } + } + + .money .stat { + background-color: $colour-5; + } + + .percent { + font-size: 1.5em; + } + + .value { + position: relative; + z-index: $zindex-base + 2; + } + + .stat-with-label { + display: inline-block; + text-align: center; + vertical-align: middle; + background-color: $colour-3; + margin: 0.5em; + @include default-box-shadow(top, 2); + + .stat { + margin-top: 0.25em; + } + } + + .label { + padding: 0.5em 0.5em 0; + font-weight: bold; + } + + .breakdown { + text-align: center; + } +} + +.email-preview { + max-width: 40rem; + margin: 2em auto 0; + padding: 0.25em 1em; + background-color: #F8F8F8; + @include default-box-shadow(top, 2, true); +} + +.workshop-previews { + position: relative; + list-style: none; + padding: 0; + + p { + padding: 0 1rem 0.5rem; + font-size: 1em; + color: $black; + } + + h4 { + color: $white; + background-color: $colour-1; + padding: 0.5em 1em; + margin: 0; + @include _(text-stroke, 1px rgba(0, 0, 0, 0.25)); + } + + a { + display: block; + max-height: 10em; + overflow: hidden; + margin: 0.5em 0; + @include default-box-shadow(top, 2); + @include _(transition, transform 150ms ease-in-out); + + &:hover, &:focus, &:active { + z-index: $zindex-base + 2; + @include _(transform, scale(1.1)); + } + + @include before { + content: ''; + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + z-index: $zindex-base + 2; + cursor: pointer; + @include _(box-shadow, inset 0em -2em 2em -1em $white); + } + + @include after { + display: none; + } + } +} + + +.conferences-edit_schedule { + #main { + .location { + padding-top: 0.25em; + } + .errors { + padding: 0.25em; + background-color: $colour-2; + color: $white; + @include _(text-stroke, 0.5px #000); + } + .conflict-score { + padding: 0.25em; + background-color: $colour-3; + color: $black; + } + .all-workshops, .all-events { + list-style: none; + padding: 0; + + li { + margin: 0.5em; + padding: 0.5em; + border: 1px solid #CCC; + background-color: lighten($colour-1, 35); + @include default-box-shadow(top, 2); + + &.error { + outline: 0.2em solid $colour-2; + outline-offset: -0.2em; + } + } + + h3 { + margin: 0; + } + + .workshop-interest { + color: #888; + text-align: left; + margin: 0.25em 0; + } + + .error-description { + background-color: $colour-2; + color: $white; + padding: 0.5em; + margin-top: 0.5em; + } + + .warnings { + background-color: $colour-3; + color: $black; + padding: 0.5em; + margin-top: 0.5em; + list-style: none; + + li { + padding: 0; + margin: 0; + background-color: transparent; + @include _(box-shadow, none); + } + } + } + .day_parts { + list-style: none; + + h4 { + display: inline-block; + min-width: 12.5em; + margin: 0.25em 0; + } + + select, .select { + float: right; + min-width: 5em; + } + + .select { + padding-left: 0.25em; + } + } + .actions { + margin: 2em; + } + .unsaved { + @include font-family(secondary); + background-color: lighten($colour-3, 25); + margin: 0 5em 2em; + padding: 0.5em; + } + .all-events { + li { + background-color: lighten($colour-5, 35); + + &.meal { + background-color: lighten($colour-3, 25); + } + } + + h3 { + margin-bottom: 0.5em; + } + } + } +} + +.conferences-schedule { + .actions { + margin: 2em; + } + + ul.events, ul.locations { + list-style: none; + + .button { + float: left; + font-size: 1em; + margin-bottom: 0.5em; + margin-right: 0.5em; + } + + h3 { + display: inline-block; + margin: 0.25em 0 0; + } + + li { + clear: both; + } + } +} + +.on-top-only, .on-top-controls { + display: none !important; +} + +html[data-ontop] { + body { + overflow: hidden; + } + + .on-top-target { + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + padding: 1em; + margin: 0 !important; + z-index: 100; + overflow: auto; + } + + .on-top-control { + position: fixed; + right: 0; + bottom: 0; + left: 0; + z-index: 101; + margin: 0 !important; + padding: 1em; + background-color: #F8F8F8; + @include default-box-shadow(bottom, 2); + } + + .on-top-controls { + overflow: auto; + + .on-top-close { + float: right; + background-color: $colour-4; + } + } + + .on-top-only, .on-top-controls { + display: inherit !important; + + &.space { + display: block !important; + } + } + + .not-on-top { + display: none !important; + } +} + +@include breakpoint(medium) { + nav.sub-nav { + float: right; + } + + #registration-admin-menu { + a { + margin: 0; + } + } + + .admin-blocks { + > li { + @include _(flex, none); + min-width: 12em; + } + } + + .actions { + &.figures { + .figure { + margin: 0 0 1em; + } + + svg, img { + width: 5em; + margin: 0.5em; + float: left; + } + } + } + + .flex-inputs { + .stretch-item { + @include _(flex, 1); + @include _(flex-basis, auto); + } + } + + .flex-form, .flex-column { + button, .button { + width: auto; + } + } +} diff --git a/app/assets/stylesheets/_application.scss b/app/assets/stylesheets/_application.scss index c1e24ef..45289a5 100644 --- a/app/assets/stylesheets/_application.scss +++ b/app/assets/stylesheets/_application.scss @@ -1,4 +1,13 @@ -$bug-list: ("search-element-appearance": ()); +$bug-list: ( + "search-element-appearance": (), + "abbr-title-border-missing": false, + "dfn-not-italic": false, + "small-size-not-80-percent": false, + "hr-height-is-messed": false, + "pre-overflow-not-auto": false, + "code-font-not-ems-and-not-monospace": false +); +$markup-settings: ("audio": false); @import "bumbleberry"; @import "settings"; @@ -31,10 +40,6 @@ h3, legend { margin: 0.75em 0; } -h3.subtitle { - font-size: 1.5em; -} - h4 { font-size: 1.25em; } @@ -87,31 +92,6 @@ a { } } -nav.sub-nav { - text-align: center; - - ul { - margin: 0.85em 0; - list-style: none; - padding: 0; - } - - li { - display: inline-block; - - @include after { - content: '|'; - margin: 0 0.5em; - } - - &:last-child { - @include after { - display: none; - } - } - } -} - .screen-reader-text { clip: rect(1px, 1px, 1px, 1px); height: 1px; @@ -521,10 +501,6 @@ button, background-color: $red; } - #main &.secondary { - background-color: $colour-1; - } - &.subdued, #main &.subdued { background-color: #888; } @@ -610,28 +586,36 @@ nav.sub-menu { textarea, .textarea { display: block; width: 100%; - min-height: 15em; - font-size: 1.25em; - line-height: 1.5em; margin: 1em 0; - padding: 0.75em; border: 0.1rem solid $gray; - outline: 0; @include _(border-radius, 0.25rem); - color: inherit; - background-image: repeating-linear-gradient(135deg, rgba(#000, 0.025), rgba(#000, 0.025) 0.1em, transparent 0.1em, transparent 0.4em); @include _(box-shadow, 0 0 0 0 rgba(0,0,0,0.05)); @include _(transition, box-shadow 200ms ease-in-out); will-change: box-shadow; - &[data-edit-on="click"], - &[data-edit-on="focus"] { - cursor: text; - } - &:hover, &:focus, &:active { @include _(box-shadow, 0 0 0 0.3em rgba(0,0,0,0.05)); } +} + +.ql-toolbar button { + @include _(box-shadow, none); +} + +.textarea { + .ql-editor p, .ql-editor ol, .ql-editor ul, .ql-editor pre, .ql-editor blockquote, .ql-editor h1, .ql-editor h2, .ql-editor h3, .ql-editor h4, .ql-editor h5, .ql-editor h6 { + margin-bottom: 1em; + } +} + +textarea, .textarea .ql-editor { + background-image: repeating-linear-gradient(135deg, rgba(#000, 0.025), rgba(#000, 0.025) 0.1em, transparent 0.1em, transparent 0.4em); + min-height: 15em; + font-size: 1.25em; + line-height: 1.5em; + padding: 0.75em; + outline: 0; + color: inherit; &.short { min-height: 10em; @@ -749,6 +733,7 @@ input { } } } + .number-field, .email-field, .password-field, @@ -1080,50 +1065,6 @@ input { font-size: 1em; } -.radio-button-field { - label { - width: 7em; - height: 5em; - } -} -.single-check-box-field, -.single-radio-button-field { - margin-left: 1em; -} - -.date-span { - margin-left: 1em; - - label, input { - display: block; - height: 1.5em; - margin: 0 0.5em 1em 0; - } - - label { - height: 1.5em; - } - - input { - @include default-box-shadow(top); - background-color: $colour-1; - color: $white; - border: 0; - padding: 0 0.25em; - font-weight: normal; - @include font-family(secondary); - @include _(text-stroke, 0.5px #000); - } - - .date-labels { - float: left; - } - - .date-field { - overflow: auto; - } -} - .requesting { opacity: 0.5; -webkit-filter: blur(5px); @@ -1466,145 +1407,6 @@ fieldset { } } -.actions { - text-align: center; - margin: 0 1em; - - button, .button { - margin: 0 0.25em 1em; - vertical-align: middle; - } - - &.left { - text-align: left; - } - - &.right { - text-align: right; - - .note { - float: left; - color: $colour-1; - font-weight: bold; - font-size: 1.25em; - } - - .left { - float: left; - } - } - - &.small { - margin-top: 0; - } - - &.fill { - @include _-(display, flex); - @include _(flex-wrap, wrap); - - > button, > .button { - flex: 1; - margin-bottom: 0; - } - } - - .conferences-view_workshop & { - margin-bottom: 5em; - } - - &.next-prev { - @include _-(display, flex); - @include _(flex-wrap, wrap); - @include _(flex-direction, row-reverse); - margin: 0; - clear: both; - - button, .button { - margin-bottom: 1em; - } - } - - &.figures { - .figure { - display: block; - margin: 0; - text-align: left; - } - - a { - @include _-(display, flex); - @include _(flex-direction, column); - @include _(align-items, stretch); - color: inherit; - margin: 0.5em 0; - border: 0.1em solid $light-gray; - border-bottom: 0; - @include default-box-shadow(top, 2); - @include _(transition, box-shadow 150ms ease-in-out); - - @include after { - display: none; - } - - &:hover { - @include default-box-shadow(top, 0.75); - } - } - - svg, img { - height: 5em; - width: 100%; - margin: 1em 0 0; - } - - svg { - fill: $black; - stroke: none; - - &.stroked { - fill: none; - stroke: $black; - } - } - - header { - @include font-family(secondary); - background-color: $black; - color: $white; - padding: 0.5em; - font-size: 1.125em; - @include _(text-stroke, 1px rgba(0, 0, 0, 0.25)); - @include _(transition, background-color 150ms ease-in-out); - } - - .description { - overflow: auto; - padding: 1em 0.5em; - } - } -} - -.test-preview { - padding: 0 1em; - border: 0.1em solid #CCC; - background-color: #F8F8F8; - - h4 { - border-bottom: 0.1rem solid #CCC; - padding: 1em 0 0.75em; - font-size: 1.5em; - margin: 0 0 1em 0; - } - - h5 { - font-size: 1.25em; - } - - h6, p { - font-size: 1.125em; - } -} - ul.warnings { list-style: none; padding: 0; @@ -1670,12 +1472,6 @@ ul.warnings { } } -.current-poster { - img { - border: 0.25em solid $colour-1; - } -} - .warning-info { display: inline-block; margin: 0; @@ -1710,37 +1506,24 @@ ul.warnings { a.policy { background-color: $colour-5; - // @include _(order, 1); } a.about { background-color: $colour-3; - // @include _(order, 1); } a.conferences { background-color: $colour-2; - // @include _(order, 1); - } - - form, .register { - background-color: $colour-2; } - a, form { + a { + display: inline-block; width: 33.333%; float: left; @include _(flex, 1); - } - - a, form, button { text-align: center; padding: 0; margin: 0; - } - - a, button { - display: inline-block; font-weight: normal; padding: 0.5em 0; color: #FFF; @@ -1757,34 +1540,6 @@ ul.warnings { } } - button { - background-color: transparent; - border: 0; - font-size: 1em; - width: 100%; - @include _(text-stroke, 0); - - @include before { - display: none; - } - } - - form { - display: inline; - } - - .strlen-12, .strlen-13 { - .title { - font-size: 0.7em; - } - } - - .strlen-14, .strlen-15 { - .title { - font-size: 0.6333em; - } - } - body.error-locale-not-available & { display: none; } @@ -1983,7 +1738,6 @@ ul.warnings { } .current .step { - //top: 1.5em; @include _(transform-origin, 10% 100%); } @@ -2000,62 +1754,6 @@ ul.warnings { } } -#main article #registration-admin-menu { - margin: 1em 0 0; - padding: 0; - list-style: none; - - a { - display: block; - padding: 0.5em 0.75em; - border: 0.1rem solid $light-gray; - border-top: 0; - border-right: 0; - - @include after { - display: none; - } - - &:hover { - background-color: $light-gray; - } - } - - li { - margin: 0; - - &.current { - a { - color: $white; - background-color: $colour-5; - } - } - } -} - -.data-set { - display: table-row; -} - -.data-set-key, .data-set-value { - display: table-cell; - padding: 0.25em 0.5em; - vertical-align: top; - border-bottom: 0.1rem solid $light-gray; -} - -.data-set-key { - font-size: 1em; - width: 1rem; - white-space: nowrap; -} - -.data-set:last-child { - .data-set-key, .data-set-value { - border: 0; - } -} - .details { display: table; width: 100%; @@ -2065,490 +1763,6 @@ ul.warnings { } } -.space, .address { - .data-set-key, .data-set-value { - white-space: nowrap; - } -} - -.admin-blocks { - @include _-(display, inline-flex); - @include _(flex-wrap, wrap); - @include _(align-items, flex-start); - @include _(justify-content, flex-start); - list-style: none; - padding: 0; - - > li { - max-width: 25em; - border: 0.1rem solid $light-gray; - padding: 1em; - margin: 0.25em; - @include _(flex, 1); - background-color: #F8F8F8; - @include default-box-shadow(top, 2); - } - - .actions { - margin: 0 auto; - } - - .title { - margin: 0 0 1em; - padding: 0 0 0.5em; - border-bottom: 0.1rem solid $light-gray; - } - - .amenities { - list-style: none; - padding: 0; - - > li { - font-weight: bold; - white-space: nowrap; - display: inline-block; - padding: 0 0.5em; - line-height: 1.5em; - font-size: 0.8em; - border: 0.1rem solid #CCC; - background-color: $light-gray; - @include _(border-radius, 0.125rem); - } - } -} - -#admin-housing, #admin-schedule { - .guests-housed { - margin-bottom: 1em; - text-align: right; - - h5 { - display: inline-block; - margin: 0; - padding-right: 0.5em; - } - - .data { - display: inline-block; - font-size: 1.125em; - } - } - - #housing-table { - @include _(transition, opacity 1s ease-in-out); - - &.loading { - @include _(opacity, 0.5); - pointer-events: none; - } - - tr.host { - th { - vertical-align: top; - } - - .address { - margin-top: 1em; - text-align: right; - @include font-family(primary); - } - } - } - - .host-table { - tr.place-guest { - td { - background-color: lighten($colour-1, 40%); - - &:hover { - background-color: $colour-1; - } - - &.full { - background-color: $gray; - - &:hover { - background-color: #CCC; - } - } - } - - a { - display: block; - color: $white; - text-align: center; - @include font-family(secondary); - - @include after { - display: none; - } - } - } - - .remove-guest, - button, .button { - float: right; - } - - td { - vertical-align: top; - } - - .state { - position: relative; - font-family: inherit; - - &.unhappy { - cursor: pointer; - } - - ul { - display: none; - position: absolute; - right: 100%; - top: 0; - background-color: $white; - border: 0.1em solid #CCC; - padding: 0.25em 0.75em 0.25em 1.5em; - margin: 0; - list-style-type: square; - @include default-box-shadow(top, 2); - z-index: 10; - } - - li { - white-space: nowrap; - margin: 0; - } - - &:hover { - ul { - display: block; - } - } - } - } - - #workshop-selector { - td, th { - white-space: nowrap; - } - - td .text { - max-width: 50em; - overflow: hidden; - text-overflow: ellipsis; - } - } - - #guest-selector, #workshop-selector { - display: none; - position: fixed; - top: 0; - right: 0; - bottom: 0; - left: 0; - background-color: rgba($black, 0.5); - cursor: pointer; - z-index: 1000; - - &.open { - display: block; - } - - .guest-dlg, .workshop-dlg { - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - background-color: $white; - width: 80%; - margin: auto; - padding: 1em; - height: 80%; - cursor: default; - @include default-box-shadow(top, 2); - - h3 { - margin: 0 0 1em; - } - } - } -} - -@include keyframes(whiten) { - to { background-color: $white; } -} - -#table { - position: relative; - overflow: auto; - height: 80%; - height: calc(100% - 4em); - background-color: $white; - @include _(transition, background-color 250ms ease-in-out); - - &.loading { - background-color: #CCC; - @include _(animation, whiten ease-in-out 1s infinite alternate both); - - .host-field, table, .legend { - display: none; - } - } - - table { - margin: 0 0 2em; - } - - h4 { - margin: 0; - - &.inline { - display: inline-block; - padding-right: 0.5em; - } - } - - .plain-value { - font-size: 1.2em; - } - - blockquote { - margin-top: 0; - font-size: 0.85em; - - > :first-child { - margin-top: 0; - } - } - - tr.selectable { - cursor: pointer; - - &:hover { - th { - background-color: $colour-2; - } - } - - &.other-host, &.other-space, &.bad-match { - td, th { - opacity: 0.5; - } - } - - &.selected-space, &.other-space { - td { - background-color: lighten($colour-5, 35); - } - - th { - background-color: $colour-5; - } - } - - &.other-host { - td { - background-color: lighten($colour-1, 40%); - } - - th { - background-color: $colour-1; - } - } - - &:hover { - td { - opacity: 1; - background-color: lighten($colour-2, 25%); - } - } - } - - .legend ul { - @include _-(display, flex); - list-style: none; - padding: 0; - - li { - @include _(flex, 1); - text-align: center; - margin-bottom: 0.5em; - padding: 0.125em 0.5em; - margin: 0.1em; - border: 0.1em solid $light-gray; - background-color: #F8F8F8; - @include font-family(secondary); - - &.other-host, &.other-space, &.bad-match { - opacity: 0.5; - } - - &.selected-space, &.other-space { - background-color: $colour-5; - } - - &.other-host { - background-color: $colour-1; - } - } - } - - .p { - max-height: 4em; - overflow: auto; - } -} - -#admin-housing { - #table table { - min-width: 100em; - } - - #hosts { - background-color: $white; - - ul { - list-style: none; - padding: 0; - } - - .host { - padding: 0.5em; - border: 0.1em solid $light-gray; - background-color: #F8F8F8; - - &.status-good { - background-color: rgba($colour-5, 0.1); - } - - &.status-warning { - background-color: rgba($colour-3, 0.1); - } - - &.status-error { - background-color: rgba($colour-2, 0.1); - } - } - - h4 { - margin: 0 0.5em 0 0; - float: left; - } - - h5 { - margin: 1em 0 0; - } - - .email { - color: #888; - - @include before { - content: '('; - } - - @include after { - content: ')'; - } - } - - .guests { - clear: left; - @include _-(display, flex); - } - - .space { - @include _(flex, 1); - } - - .place-guest { - background-color: $colour-5; - - &.booked { - background-color: $colour-4; - } - - &.unwanted { - background-color: #888; - } - - &.overbooked { - background-color: $colour-2; - } - } - - .warning, .error { - display: inline-block; - font-style: italic; - padding: 0 0.5em; - margin-left: 0.5em; - border: 0.1em solid rgba($black, 0.25); - @include _(border-radius, 0.125em); - @include _(transform, skewX(-15deg)); - @include _(transform-origin, 0 100%); - @include _(animation, bend ease-in-out 500ms infinite alternate both); - } - - .warning { - background-color: lighten($colour-3, 25%); - } - - .error { - background-color: lighten($colour-2, 25%); - } - } - - #guests { - .guests { - @include _-(display, flex); - //@include _(align-items, flex-start); - @include _(flex-wrap, wrap); - list-style: none; - padding: 0; - } - - .guest { - flex: 1; - margin: 0.5em; - border: 0.1rem solid $light-gray; - background-color: #F8F8F8; - padding: 0.5em; - } - - h4 { - margin: 0 0 0.5em; - } - - .set-host { - width: 100%; - } - } -} - -#admin-workshop_times { - .workshop-blocks { - margin: 0 auto; - - td, th { - vertical-align: top; - } - } - - .table-tr.new { - .table-th { - background-color: transparent; - border: 0; - } - - .table-td { - background-color: transparent; - border: 0; - } - } -} - .details.org-members { padding: 1em; border: 0.1rem solid $light-gray; @@ -2750,94 +1964,6 @@ body.home table.schedule td .event-detail-link:hover { } } -#admin-schedule { - .workshops-to-schedule { - @include _-(display, flex); - @include _(flex-wrap, wrap); - list-style: none; - padding: 0; - - li { - @include _(flex, 1); - @include _(flex-basis, 48%); - margin: 1%; - @include _(transition, background-color 250ms ease-in-out); - background-color: $light-gray; - - .title { - @include _(transition, background-color 250ms ease-in-out); - } - - &.booked { - background-color: lighten($colour-1, 40%); - - .not-booked-only { - display: none; - } - - .data-set-key, .data-set-value { - border-bottom-color: #888; - } - } - - &.not-booked { - - .booked-only { - display: none; - } - } - - .field-error { - background-color: lighten($colour-2, 22.5%); - margin: 0; - } - - .already-booked { - overflow: hidden; - max-height: 0; - - &.is-true { - max-height: 3em; - @include _(transition, max-height 150ms ease-in-out); - } - } - - .workshop-description { - max-height: none; - } - - .details { - margin: 0 5% 1em; - width: 90%; - } - - .title { - margin: 0 0 0.5em; - padding: 0.5em; - background-color: $black; - color: $white; - } - - .drop-downs { - padding: 0 1em 1em; - - select { - width: 100%; - } - } - - .actions { - margin: 0; - padding: 0 0.5em; - } - } - - #main .columns & form { - margin: 0; - } - } -} - #main { position: relative; background-color: $white; @@ -2848,15 +1974,6 @@ body.home table.schedule td .event-detail-link:hover { padding: rems(2.5) 0; margin: 0 1em; - &.supplementary { - margin: rems(1) 7.5%; - overflow: hidden; - @include _(border-radius, 0.33em); - border: 0.1rem solid #DDD; - background-color: #F7F7F7; - @include default-box-shadow(top, 2); - } - ul { font-size: 1.125em; line-height: 1.5em; @@ -2916,10 +2033,6 @@ a.logo { 60% { fill: $colour-2; } } - @include keyframes(banner-load) { - 0% { fill: #888; } - } - svg.bb-icon-logo { fill: $colour-1; } @@ -3482,12 +2595,6 @@ body { } } -@include keyframes(colour-out) { - to { - background-color: transparent; - } -} - @include keyframes(barberpole) { to { background-position: 60px 30px; } } @@ -3506,15 +2613,6 @@ html :focus { @include header-colour(about, $colour-3); @include header-colour(policy, $colour-5); -// @include header-colour(conferences, $colour-2); - -#bike_small + label { - padding: 0.5em 2.5em; -} - -#bike_medium + label { - padding: 0.5em 1.5em; -} #main .graded-options { text-align: center; @@ -3573,124 +2671,6 @@ html :focus { } } -#main ul.workshops { - list-style: none; - padding: 0;// 1em; - text-align: center; - @include default-box-shadow(top, 2, true); - background-color: #F8F8F8; - - li { - display: inline-block; - margin: 0.5em; - vertical-align: middle; - - @include before { - content: ''; - display: none; - position: fixed; - top: 0; - right: 0; - bottom: 0; - left: 0; - background-color: #000; - z-index: 99; - @include _(opacity, 0.5); - } - - &.view { - @include before { - display: block; - } - - .info { - left: 0; - right: 0; - top: 50%; - @include _(transform, translateY(-50%) scale(1)); - - @include breakpoint(large) { - left: 19rem; - } - } - } - } - - h4, h5 { - color: $white; - background-color: $colour-1; - @include _(text-stroke, 1px rgba(0, 0, 0, 0.25)); - } - - h4 { - max-width: 10em; - cursor: pointer; - margin: 0; - padding: 1em; - position: relative; - @include default-box-shadow(top); - @include _(transition, transform 100ms ease-in-out); - - &:hover { - z-index: $zindex-base + 3; - @include _(transform, scale(1.25)); - } - } - - h5 { - font-size: 1.5em; - margin: 0; - padding: 0.5em 1em; - - + p { - margin-top: 0; - } - } - - p { - padding: 1em; - max-height: 50vh; - overflow-y: auto; - } - - form { - text-align: center; - } - - button { - margin: 1em 0.5em; - } - - [contenteditable] { - outline: none; - } - - .info { - position: fixed; - background-color: $white; - color: $black; - left: auto; - right: auto; - top: auto; - z-index: 100; - max-width: 40em; - max-height: 40em; - margin: auto; - text-align: left; - @include _(transition, all 250ms ease-in-out); - @include _(transform, translateY(0) scale(0)); - @include default-box-shadow(top); - } - - [value="delete"] { - background-color: $colour-2; - } - - [value="cancel"] { - background-color: $colour-4; - } -} - .conferences-register .policy-agreement { padding: 0.25em 1em; margin: 0 0 3em; @@ -3703,77 +2683,6 @@ body.policy .policy-agreement ul { padding: 0 1.5em 0; } -.stats { - list-style: none; - - h3 { - display: inline-block; - } - - .stat { - position: relative; - padding: 0 0.25em; - margin: 0.5em; - font-size: 2em; - display: inline-block; - color: $white; - background-color: $colour-1; - @include default-box-shadow(top, 2); - @include _(text-stroke, 1px rgba(0, 0, 0, 0.25)); - - &.important { - width: 2em; - height: 2em; - line-height: 2em; - text-align: center; - @include _(border-radius, 50%); - } - } - - .money .stat { - background-color: $colour-5; - } - - .percent { - font-size: 1.5em; - } - - .value { - position: relative; - z-index: $zindex-base + 2; - } - - .stat-with-label { - display: inline-block; - text-align: center; - vertical-align: middle; - background-color: $colour-3; - margin: 0.5em; - @include default-box-shadow(top, 2); - - .stat { - margin-top: 0.25em; - } - } - - .label { - padding: 0.5em 0.5em 0; - font-weight: bold; - } - - .breakdown { - text-align: center; - } -} - -.email-preview { - max-width: 40rem; - margin: 2em auto 0; - padding: 0.25em 1em; - background-color: #F8F8F8; - @include default-box-shadow(top, 2, true); -} - .facilitators { display: inline-block; @@ -3801,82 +2710,28 @@ body.policy .policy-agreement ul { margin-bottom: 0.5em; } - .name, .role { - display: inline; - } - - .role { - color: #666; - white-space: nowrap; - - @include before { - content: '('; - } - - @include after { - content: ')'; - } - - &:last-child { - @include after { - content: ')'; - } - } - } -} - -.workshop-previews { - position: relative; - list-style: none; - padding: 0; - - p { - padding: 0 1rem 0.5rem; - font-size: 1em; - color: $black; - } - - h4 { - color: $white; - background-color: $colour-1; - padding: 0.5em 1em; - margin: 0; - @include _(text-stroke, 1px rgba(0, 0, 0, 0.25)); - } - - a { - display: block; - max-height: 10em; - overflow: hidden; - margin: 0.5em 0; - @include default-box-shadow(top, 2); - @include _(transition, transform 150ms ease-in-out); + .name, .role { + display: inline; + } - &:hover, &:focus, &:active { - z-index: $zindex-base + 2; - @include _(transform, scale(1.1)); - } + .role { + color: #666; + white-space: nowrap; @include before { - content: ''; - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - z-index: $zindex-base + 2; - cursor: pointer; - @include _(box-shadow, inset 0em -2em 2em -1em $white); + content: '('; } @include after { - display: none; + content: ')'; } - } -} -.translated-content.block { - display: inherit; + &:last-child { + @include after { + content: ')'; + } + } + } } .list-view { @@ -3936,126 +2791,6 @@ body.policy .policy-agreement ul { } } -html[data-lingua-franca-example="html"] { - $caption-height: 4rem; - @include _(transform, translateY($caption-height)); - - #lingua-franca-window-caption { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: $caption-height; - background-color: #CCC; - z-index: 1000; - font-size: 1rem; - @include _(transform, translateY($caption-height * -1)); - - .window-tab { - height: 1.75rem; - position: relative; - background-color: $light-gray; - float: left; - padding: 0.25em 2em 0 1em; - margin: 0.25em 1em; - @include _(border-radius, 0.5em 0.5em 0 0); - color: #444; - @include font-family(secondary); - - @include after { - content: '×'; - position: absolute; - right: 0.5em; - top: 0.25em; - } - } - - i { - font-style: normal; - } - - .window-minimize, - .window-maximize { - @include after { - content: ''; - position: absolute; - top: 0.75em; - right: 2em; - border-style: solid; - border-width: 0 0.5em 0.5em 0.5em; - border-left-color: transparent; - border-right-color: transparent; - } - } - - .window-minimize { - @include after { - right: 3.5em; - border-top-width: 0.5em; - border-bottom-width: 0; - } - } - - .window-close { - @include after { - content: '×'; - position: absolute; - right: 0.25em; - top: 0.1em; - font-size: 1.75em; - line-height: 1em; - } - } - - .window-url-bar { - position: absolute; - top: $caption-height / 2; - left: 0; - width: 100%; - height: $caption-height / 2; - background-color: $light-gray; - - .url-bar { - position: absolute; - top: 0.25rem; - left: 3.5rem; - bottom: 0.25rem; - right: 0.25rem; - background-color: #FFF; - border: 1px solid #CCC; - padding: 0 0.25rem; - font-size: 0.8em; - line-height: 1.75em; - } - } - - .window-back, - .window-forward { - @include after { - content: ''; - position: absolute; - left: 0.5em; - top: 0.5em; - border-style: solid; - border-width: 0.5em 0.75em 0.5em 0; - border-top-color: transparent; - border-bottom-color: transparent; - color: #666; - } - } - - .window-forward { - @include after { - left: 2em; - border-right-width: 0; - border-left-width: 0.75em; - } - } - } - - @include translation-pointer; -} - .workshop-notes { p { font-size: 1em; @@ -4184,10 +2919,6 @@ html[data-lingua-franca-example="html"] { vertical-align: -0.75em; } -#main .facilitators .actions { - margin: 0; -} - #main form.add-facilitator { button { height: 2.4em; @@ -4195,140 +2926,6 @@ html[data-lingua-franca-example="html"] { } } -.conferences-edit_schedule { - #main { - .location { - padding-top: 0.25em; - } - .errors { - padding: 0.25em; - background-color: $colour-2; - color: $white; - @include _(text-stroke, 0.5px #000); - } - .conflict-score { - padding: 0.25em; - background-color: $colour-3; - color: $black; - } - .all-workshops, .all-events { - list-style: none; - padding: 0; - - li { - margin: 0.5em; - padding: 0.5em; - border: 1px solid #CCC; - background-color: lighten($colour-1, 35); - @include default-box-shadow(top, 2); - - &.error { - outline: 0.2em solid $colour-2; - outline-offset: -0.2em; - } - } - - h3 { - margin: 0; - } - - .workshop-interest { - color: #888; - text-align: left; - margin: 0.25em 0; - } - - .error-description { - background-color: $colour-2; - color: $white; - padding: 0.5em; - margin-top: 0.5em; - } - - .warnings { - background-color: $colour-3; - color: $black; - padding: 0.5em; - margin-top: 0.5em; - list-style: none; - - li { - padding: 0; - margin: 0; - background-color: transparent; - @include _(box-shadow, none); - } - } - } - .day_parts { - list-style: none; - - h4 { - display: inline-block; - min-width: 12.5em; - margin: 0.25em 0; - } - - select, .select { - float: right; - min-width: 5em; - } - - .select { - padding-left: 0.25em; - } - } - .actions { - margin: 2em; - } - .unsaved { - @include font-family(secondary); - background-color: lighten($colour-3, 25); - margin: 0 5em 2em; - padding: 0.5em; - } - .all-events { - li { - background-color: lighten($colour-5, 35); - - &.meal { - background-color: lighten($colour-3, 25); - } - } - - h3 { - margin-bottom: 0.5em; - } - } - } -} - -.conferences-schedule { - .actions { - margin: 2em; - } - - ul.events, ul.locations { - list-style: none; - - .button { - float: left; - font-size: 1em; - margin-bottom: 0.5em; - margin-right: 0.5em; - } - - h3 { - display: inline-block; - margin: 0.25em 0 0; - } - - li { - clear: both; - } - } -} - .select-field { line-height: 1.75em; position: relative; @@ -4436,61 +3033,6 @@ html[data-lingua-franca-example="html"] { } } -.on-top-only, .on-top-controls { - display: none !important; -} - -html[data-ontop] { - body { - overflow: hidden; - } - - .on-top-target { - position: fixed; - top: 0; - right: 0; - bottom: 0; - left: 0; - padding: 1em; - margin: 0 !important; - z-index: 100; - overflow: auto; - } - - .on-top-control { - position: fixed; - right: 0; - bottom: 0; - left: 0; - z-index: 101; - margin: 0 !important; - padding: 1em; - background-color: #F8F8F8; - @include default-box-shadow(bottom, 2); - } - - .on-top-controls { - overflow: auto; - - .on-top-close { - float: right; - background-color: $colour-4; - } - } - - .on-top-only, .on-top-controls { - display: inherit !important; - - &.space { - display: block !important; - } - } - - .not-on-top { - display: none !important; - } -} - @include breakpoint(medium) { :focus, input[type="submit"]:focus, @@ -4523,10 +3065,6 @@ html[data-ontop] { h2 { font-size: 2.25em; - - &.floating { - float: left; - } } h3, legend { @@ -4598,17 +3136,6 @@ html[data-ontop] { } } - .flex-inputs { - .stretch-item { - @include _(flex, 1); - @include _(flex-basis, auto); - } - } - - nav.sub-nav { - float: right; - } - #main-nav { .logo { margin-top: 0; @@ -4623,10 +3150,6 @@ html[data-ontop] { text-align: center; background-color: transparent; @include _(box-shadow, none); - - form { - background-color: transparent; - } } .nav a { @@ -4684,15 +3207,6 @@ html[data-ontop] { } } } - - #banner { - margin: 3em auto; - - figure { - min-height: 40em; - margin: rems(-20) auto rems(2); - } - } .conference-banner { margin: 0 auto; @@ -4711,12 +3225,6 @@ html[data-ontop] { } } - #registration-admin-menu { - a { - margin: 0; - } - } - ul.warnings { li { margin: 1em 4em; @@ -4959,13 +3467,6 @@ html[data-ontop] { } } - .admin-blocks { - > li { - @include _(flex, none); - min-width: 12em; - } - } - .flow-steps { ul { margin: 2em 0 1em 0; @@ -4978,44 +3479,9 @@ html[data-ontop] { @include _(transform, none); } } - - .actions { - &.figures { - .figure { - margin: 0 0 1em; - } - - svg, img { - width: 5em; - margin: 0.5em; - float: left; - } - } - } } @include breakpoint(large) { - // #main-nav { - // .nav { - // font-size: 1.9em; - // margin-top: 0; - // } - // } - - #banner { - body.fixed-banner & { - position: fixed; - top: 0; - right: 0; - left: $sidebar-width; - z-index: $zindex-base + 2; - } - - figure { - width: 90%; - } - } - #main { padding-left: $sidebar-width; } diff --git a/app/assets/stylesheets/_settings.scss b/app/assets/stylesheets/_settings.scss index 6db4b46..fc1ea4f 100644 --- a/app/assets/stylesheets/_settings.scss +++ b/app/assets/stylesheets/_settings.scss @@ -1,10 +1,6 @@ $sidebar-width: 0; -// $colour-1: #00ADEF; -// $colour-2: #FF015B; -// $colour-3: #E6C229; -// $colour-4: #F17105; -// $colour-5: #8EA604; +$zindex-base: 0; $colour-1: #00ADEF; // blue $colour-2: #EF57B4; // #DD57EF; // pink @@ -17,7 +13,6 @@ $black: #333; $gray: #E8E8E8; $light-gray: #EEE; $mid-gray: #888; -// $red: #B24C63; $red: #FF5A5F; $blue: $colour-1; @@ -130,34 +125,7 @@ $link-colour: darken($colour-1, 13%); background-color: rgba(0,0,0,0); @include _(transition, background-color 150ms ease-in-out); } - /*@include before-and-after { - content: ''; - position: absolute; - display: block; - top: 0; - right: 100%; - font-size: 1.15em; - background-color: rgba(0, 0, 0, 0); - border-color: transparent; - @include _(transition, all 250ms ease-in-out); - } - @include before { - height: 100%; - width: 100%; - margin-right: 1em; - } - @include after { - border-style: solid; - border-width: 1em 0 1em 1em; - }*/ - /*&:hover, - &:focus { - @include before-and-after { - right: -1em; - border-left-color: rgba(0, 0, 0, 0.15); - } - }*/ &:hover, &:focus { @include before { diff --git a/app/assets/stylesheets/_translations.scss b/app/assets/stylesheets/_translations.scss deleted file mode 100644 index d802c42..0000000 --- a/app/assets/stylesheets/_translations.scss +++ /dev/null @@ -1,439 +0,0 @@ -$bumbleberry-no-markup: true; - -@import "bumbleberry"; -@import "settings"; - -@include monospace-font; - -.translation-list { - list-style: none; - padding: 0; - text-align: center; - @include clearfix; - - li { - display: inline-block; - width: 25%; - padding: 1em; - min-width: 10em; - } - - a { - display: block; - position: relative; - height: 7em; - border: 0.1em solid #DDD; - color: inherit; - overflow: hidden; - @include _(border-radius, 0.25em); - @include default-box-shadow(top, 2); - @include _(transform, scale(1)); - @include _(transition, transform 100ms ease-in-out); - - &:hover, - &:focus { - @include _(transform, scale(1.125)); - } - &:active { - @include _(transform, scale(1.25)); - } - - &:after { - display: none; - } - } - .locale-name { - font-size: 1.25em; - padding: 0.5em 0; - background-color: $colour-2; - color: #EEE; - @include font-family(secondary); - } - - .locale-completion { - font-size: 2em; - @include font-family(monospace); - letter-spacing: -0.15em; - } - - &.enabled-translations { - .locale-name { - background-color: $colour-5; - } - } -} - -#lingua-franca-translation-form { - padding: rems(1) 7.5%; - @include default-box-shadow(bottom, 2); - max-width: 100%; - - /*button[type="submit"] { - position: absolute; - right: 7.5%; - top: 1em; - @include _(opacity, 1); - @include _(transition, opacity 250ms ease-in-out); - - &:disabled { - cursor: default; - @include _(opacity, 0); - } - }*/ -} - -#lingua-franca-translation-form h2, -#translation-value, -.variables button { - @include font-family(monospace); -} - -#translation-value { - border: 1px solid #CCC; - outline: none; - padding: 1em 1.75em; - color: $colour-3; - background-color: #333; - position: relative; - - input { - border: 0; - background-color: transparent; - padding: 0; - margin: 0; - font-weight: bold; - color: $colour-1; - - &.special { - color: $colour-4; - } - } -} - -#translation-control-variables { - background-color: #CCC; - padding: 0.25em; - min-height: 2.9em; - - strong { - float: left; - padding: 0.25em 0.5em; - } - - .variables { - font-weight: bold; - - em { - line-height: 1.75em; - } - - button { - top: auto; - right: auto; - position: relative; - border-radius: 0.25em; - font-size: 0.65em; - margin-bottom: 1em; - vertical-align: sub; - @include _(text-stroke, 0); - - &.special { - background-color: $colour-4; - } - } - } -} - -#lingua-franca-translation-form .enable-translation { - display: none; -} - -#lingua-franca-translation-form.optional .enable-translation { - display: block; -} - -#lingua-franca-translation-form.optional.enabled .uses-default-value { - display: none; -} - -#lingua-franca-translation-form.optional.disabled .uses-custom-value, -#lingua-franca-translation-form.optional.disabled .translation-control { - display: none; -} - -#lingua-franca-keys { - width: 100%; - overflow: hidden; - margin-bottom: 100%; - background-color: transparent; - @include _(box-shadow, none); - - th { - text-align: left; - - &, td { - @include font-family(monospace); - } - } - - td a { - color: inherit; - @include _(opacity, 0.85); - } - - .variable { - color: $colour-1; - font-weight: bold; - - &.special { - color: $colour-4; - } - } - - .parent-keys span { - color: transparent; - width: 1em; - display: inline-block; - } - - a { - display: block; - - &:after { - display: none; - } - } - - tr.selectable-key:hover { - background-color: $colour-1; - - a { - color: $white; - - .variable { - color: inherit; - } - } - } - - .lingua-franca-value { - display: none; - } -} - -@include breakpoint(medium) { - #lingua-franca-keys { - .lingua-franca-value { - display: table-cell; - } - } - - .lingua-franca-navigation { - ul { - padding: 0; - list-style: none; - font-weight: normal; - @include font-family(secondary); - - ul { - margin-left: 1em; - margin-bottom: 1em; - @include font-family(primary); - } - } - - .current { - @include before { - content: ''; - display: block; - position: absolute; - width: 0; - height: 0; - left: -1.5em; - top: 0.6667em; - border-width: 1em 0 1em 1em; - border-color: transparent transparent transparent #333; - border-style: solid; - font-size: 0.25em; - } - } - } -} - -@include breakpoint(large) { - #lingua-franca-keys { - margin-bottom: 0; - } - - #lingua-franca-translation-form { - position: relative; - padding: 1rem 7.5%; - background-color: $white; - @include default-box-shadow(top, 2); - } -} - -.lingua-franca-translations { - position: relative; - @include default-box-shadow(top, 2); -} - -.lingua-franca-translations { - .translation-examples, #lingua-franca-translation-history { - padding: 0 7.5%; - padding-bottom: 0.5vh; - } -} - -html #lingua-franca-translation-form { - @include _(box-shadow, none); -} - -.lingua-franca-translations .translation-examples ul { - list-style: none; - padding: 0; - white-space: nowrap; - overflow-x: auto; - overflow-y: hidden; - width: 100%; - height: 6vh; - padding-top: 0.25em; - z-index: 1; - margin: 0; -} - -.lingua-franca-translations .translation-examples li { - display: inline-block; - position: relative; - width: 5vw; - height: 5vh; - margin: 0 0.5em; - - @include after { - content: ''; - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - cursor: pointer; - outline: 0.25em solid rgba($colour-2, 0.25); - background-color: rgba($colour-2, 0.25); - outline-color: rgba($colour-2, 0.25); - @include _(transition, '#{background-color, outline-color 250ms, 250ms ease-in-out, ease-in-out}'); - } - - iframe { - @include _(transform, scale(0.05) translate(-950vw, -950vh)); - width: 100vw; - height: 100vh; - @include _(transform-origin, 50% 50%); - //@include _(transition, '#{transform, position, z-index 250ms, 250ms, 0 ease-in-out, ease-in-out, linear 0, 250ms, 0}'); - position: fixed; - margin: auto - } - - &:hover { - @include after { - background-color: rgba($colour-3, 0); - outline-color: rgba($colour-3, 0.5); - } - } - - &.open { - iframe { - top: 0; - left: 0; - z-index: 100; - //margin: auto; - @include _(transform, scale(0.75) translate(0, 0)); - @include default-box-shadow(top, 2); - - //@include breakpoint(large) { - // left: 8.75rem; - //} - } - - @include after { - left: 0; - top: 0; - right: 0; - bottom: 0; - background-color: rgba($colour-3, 0.5); - position: fixed; - z-index: 99; - } - } - - @include breakpoint(large) { - &.open { - iframe { - width: 100%; - height: 100%; - @include _(transform, scale(0.9) translate(0, 0)); - } - } - } -} - -.highlight-key { - outline: 3rem solid rgba($colour-2, 0.5); -} - -#lingua-franca-translation-form button[type="submit"] { - margin-right: 0.25em; -} - -#lingua-franca-keys .translation-history { - display: none; -} - -#lingua-franca-translation-history .translation-diff-info, -#lingua-franca-translation-history .diff { - @include clearfix; -} -#lingua-franca-translation-history .diff ul { - list-style: none; - padding: 0; -} - -#lingua-franca-translation-history .translation-diff-info li { - margin-bottom: 0.5em; - font-style: italic; -} - -#lingua-franca-translation-history .translation-diff-info li, -#lingua-franca-translation-history .diff li { - width: 50%; - display: inline-block; - float: left; -} - -#lingua-franca-keys td a .undefined { - font-style: italic; - color: #888; -} - -.lingua-franca-translations { - position: fixed; - z-index: -2; - top: 0; - right: 0; - bottom: 0; - left: 0; - height: 100%; - background-color: $white; - @include _(transform, scale(0)); - $transition-time: 250ms; - @include _(transition, #{transform $transition-time ease-in-out, z-index 0ms linear $transition-time}); - - &.editing { - z-index: 98; - @include _(transform, scale(1)); - @include _(transition, transform $transition-time ease-in-out); - } -} - -.actions { - margin-top: 1em; -} diff --git a/app/assets/stylesheets/bumbleberry-settings.json b/app/assets/stylesheets/bumbleberry-settings.json index 184ef04..5a67c7c 100644 --- a/app/assets/stylesheets/bumbleberry-settings.json +++ b/app/assets/stylesheets/bumbleberry-settings.json @@ -1,5 +1,5 @@ { - "stylesheets": ["application", "editor"], + "stylesheets": ["application", "editor", "admin"], "precompile": { "test": { "safari": ["5"], diff --git a/app/assets/stylesheets/font-awesome.min.css b/app/assets/stylesheets/font-awesome.min.css deleted file mode 100644 index 47f42db..0000000 --- a/app/assets/stylesheets/font-awesome.min.css +++ /dev/null @@ -1,4 +0,0 @@ -/*! - * Font Awesome 4.4.0 by @davegandy - http://fontawesome.io - @fontawesome - * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) - */@font-face{font-family:'FontAwesome';src:url('/assets/fontawesome-webfont.eot?v=4.4.0');src:url('/assets/fontawesome-webfont.eot?#iefix&v=4.4.0') format('embedded-opentype'),url('/assets/fontawesome-webfont.woff2?v=4.4.0') format('woff2'),url('/assets/fontawesome-webfont.woff?v=4.4.0') format('woff'),url('/assets/fontawesome-webfont.ttf?v=4.4.0') format('truetype'),url('/assets/fontawesome-webfont.svg?v=4.4.0#fontawesomeregular') format('svg');font-weight:normal;font-style:normal}.fa{display:inline-block;font:normal normal normal 14px/1 FontAwesome;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.fa-lg{font-size:1.33333333em;line-height:.75em;vertical-align:-15%}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-fw{width:1.28571429em;text-align:center}.fa-ul{padding-left:0;margin-left:2.14285714em;list-style-type:none}.fa-ul>li{position:relative}.fa-li{position:absolute;left:-2.14285714em;width:2.14285714em;top:.14285714em;text-align:center}.fa-li.fa-lg{left:-1.85714286em}.fa-border{padding:.2em .25em .15em;border:solid .08em #eee;border-radius:.1em}.fa-pull-left{float:left}.fa-pull-right{float:right}.fa.fa-pull-left{margin-right:.3em}.fa.fa-pull-right{margin-left:.3em}.pull-right{float:right}.pull-left{float:left}.fa.pull-left{margin-right:.3em}.fa.pull-right{margin-left:.3em}.fa-spin{-webkit-animation:fa-spin 2s infinite linear;animation:fa-spin 2s infinite linear}.fa-pulse{-webkit-animation:fa-spin 1s infinite steps(8);animation:fa-spin 1s infinite steps(8)}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.fa-rotate-90{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=1);-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}.fa-rotate-180{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=2);-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}.fa-rotate-270{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=3);-webkit-transform:rotate(270deg);-ms-transform:rotate(270deg);transform:rotate(270deg)}.fa-flip-horizontal{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1);-webkit-transform:scale(-1, 1);-ms-transform:scale(-1, 1);transform:scale(-1, 1)}.fa-flip-vertical{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1);-webkit-transform:scale(1, -1);-ms-transform:scale(1, -1);transform:scale(1, -1)}:root .fa-rotate-90,:root .fa-rotate-180,:root .fa-rotate-270,:root .fa-flip-horizontal,:root .fa-flip-vertical{filter:none}.fa-stack{position:relative;display:inline-block;width:2em;height:2em;line-height:2em;vertical-align:middle}.fa-stack-1x,.fa-stack-2x{position:absolute;left:0;width:100%;text-align:center}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}.fa-inverse{color:#fff}.fa-glass:before{content:"\f000"}.fa-music:before{content:"\f001"}.fa-search:before{content:"\f002"}.fa-envelope-o:before{content:"\f003"}.fa-heart:before{content:"\f004"}.fa-star:before{content:"\f005"}.fa-star-o:before{content:"\f006"}.fa-user:before{content:"\f007"}.fa-film:before{content:"\f008"}.fa-th-large:before{content:"\f009"}.fa-th:before{content:"\f00a"}.fa-th-list:before{content:"\f00b"}.fa-check:before{content:"\f00c"}.fa-remove:before,.fa-close:before,.fa-times:before{content:"\f00d"}.fa-search-plus:before{content:"\f00e"}.fa-search-minus:before{content:"\f010"}.fa-power-off:before{content:"\f011"}.fa-signal:before{content:"\f012"}.fa-gear:before,.fa-cog:before{content:"\f013"}.fa-trash-o:before{content:"\f014"}.fa-home:before{content:"\f015"}.fa-file-o:before{content:"\f016"}.fa-clock-o:before{content:"\f017"}.fa-road:before{content:"\f018"}.fa-download:before{content:"\f019"}.fa-arrow-circle-o-down:before{content:"\f01a"}.fa-arrow-circle-o-up:before{content:"\f01b"}.fa-inbox:before{content:"\f01c"}.fa-play-circle-o:before{content:"\f01d"}.fa-rotate-right:before,.fa-repeat:before{content:"\f01e"}.fa-refresh:before{content:"\f021"}.fa-list-alt:before{content:"\f022"}.fa-lock:before{content:"\f023"}.fa-flag:before{content:"\f024"}.fa-headphones:before{content:"\f025"}.fa-volume-off:before{content:"\f026"}.fa-volume-down:before{content:"\f027"}.fa-volume-up:before{content:"\f028"}.fa-qrcode:before{content:"\f029"}.fa-barcode:before{content:"\f02a"}.fa-tag:before{content:"\f02b"}.fa-tags:before{content:"\f02c"}.fa-book:before{content:"\f02d"}.fa-bookmark:before{content:"\f02e"}.fa-print:before{content:"\f02f"}.fa-camera:before{content:"\f030"}.fa-font:before{content:"\f031"}.fa-bold:before{content:"\f032"}.fa-italic:before{content:"\f033"}.fa-text-height:before{content:"\f034"}.fa-text-width:before{content:"\f035"}.fa-align-left:before{content:"\f036"}.fa-align-center:before{content:"\f037"}.fa-align-right:before{content:"\f038"}.fa-align-justify:before{content:"\f039"}.fa-list:before{content:"\f03a"}.fa-dedent:before,.fa-outdent:before{content:"\f03b"}.fa-indent:before{content:"\f03c"}.fa-video-camera:before{content:"\f03d"}.fa-photo:before,.fa-image:before,.fa-picture-o:before{content:"\f03e"}.fa-pencil:before{content:"\f040"}.fa-map-marker:before{content:"\f041"}.fa-adjust:before{content:"\f042"}.fa-tint:before{content:"\f043"}.fa-edit:before,.fa-pencil-square-o:before{content:"\f044"}.fa-share-square-o:before{content:"\f045"}.fa-check-square-o:before{content:"\f046"}.fa-arrows:before{content:"\f047"}.fa-step-backward:before{content:"\f048"}.fa-fast-backward:before{content:"\f049"}.fa-backward:before{content:"\f04a"}.fa-play:before{content:"\f04b"}.fa-pause:before{content:"\f04c"}.fa-stop:before{content:"\f04d"}.fa-forward:before{content:"\f04e"}.fa-fast-forward:before{content:"\f050"}.fa-step-forward:before{content:"\f051"}.fa-eject:before{content:"\f052"}.fa-chevron-left:before{content:"\f053"}.fa-chevron-right:before{content:"\f054"}.fa-plus-circle:before{content:"\f055"}.fa-minus-circle:before{content:"\f056"}.fa-times-circle:before{content:"\f057"}.fa-check-circle:before{content:"\f058"}.fa-question-circle:before{content:"\f059"}.fa-info-circle:before{content:"\f05a"}.fa-crosshairs:before{content:"\f05b"}.fa-times-circle-o:before{content:"\f05c"}.fa-check-circle-o:before{content:"\f05d"}.fa-ban:before{content:"\f05e"}.fa-arrow-left:before{content:"\f060"}.fa-arrow-right:before{content:"\f061"}.fa-arrow-up:before{content:"\f062"}.fa-arrow-down:before{content:"\f063"}.fa-mail-forward:before,.fa-share:before{content:"\f064"}.fa-expand:before{content:"\f065"}.fa-compress:before{content:"\f066"}.fa-plus:before{content:"\f067"}.fa-minus:before{content:"\f068"}.fa-asterisk:before{content:"\f069"}.fa-exclamation-circle:before{content:"\f06a"}.fa-gift:before{content:"\f06b"}.fa-leaf:before{content:"\f06c"}.fa-fire:before{content:"\f06d"}.fa-eye:before{content:"\f06e"}.fa-eye-slash:before{content:"\f070"}.fa-warning:before,.fa-exclamation-triangle:before{content:"\f071"}.fa-plane:before{content:"\f072"}.fa-calendar:before{content:"\f073"}.fa-random:before{content:"\f074"}.fa-comment:before{content:"\f075"}.fa-magnet:before{content:"\f076"}.fa-chevron-up:before{content:"\f077"}.fa-chevron-down:before{content:"\f078"}.fa-retweet:before{content:"\f079"}.fa-shopping-cart:before{content:"\f07a"}.fa-folder:before{content:"\f07b"}.fa-folder-open:before{content:"\f07c"}.fa-arrows-v:before{content:"\f07d"}.fa-arrows-h:before{content:"\f07e"}.fa-bar-chart-o:before,.fa-bar-chart:before{content:"\f080"}.fa-twitter-square:before{content:"\f081"}.fa-facebook-square:before{content:"\f082"}.fa-camera-retro:before{content:"\f083"}.fa-key:before{content:"\f084"}.fa-gears:before,.fa-cogs:before{content:"\f085"}.fa-comments:before{content:"\f086"}.fa-thumbs-o-up:before{content:"\f087"}.fa-thumbs-o-down:before{content:"\f088"}.fa-star-half:before{content:"\f089"}.fa-heart-o:before{content:"\f08a"}.fa-sign-out:before{content:"\f08b"}.fa-linkedin-square:before{content:"\f08c"}.fa-thumb-tack:before{content:"\f08d"}.fa-external-link:before{content:"\f08e"}.fa-sign-in:before{content:"\f090"}.fa-trophy:before{content:"\f091"}.fa-github-square:before{content:"\f092"}.fa-upload:before{content:"\f093"}.fa-lemon-o:before{content:"\f094"}.fa-phone:before{content:"\f095"}.fa-square-o:before{content:"\f096"}.fa-bookmark-o:before{content:"\f097"}.fa-phone-square:before{content:"\f098"}.fa-twitter:before{content:"\f099"}.fa-facebook-f:before,.fa-facebook:before{content:"\f09a"}.fa-github:before{content:"\f09b"}.fa-unlock:before{content:"\f09c"}.fa-credit-card:before{content:"\f09d"}.fa-feed:before,.fa-rss:before{content:"\f09e"}.fa-hdd-o:before{content:"\f0a0"}.fa-bullhorn:before{content:"\f0a1"}.fa-bell:before{content:"\f0f3"}.fa-certificate:before{content:"\f0a3"}.fa-hand-o-right:before{content:"\f0a4"}.fa-hand-o-left:before{content:"\f0a5"}.fa-hand-o-up:before{content:"\f0a6"}.fa-hand-o-down:before{content:"\f0a7"}.fa-arrow-circle-left:before{content:"\f0a8"}.fa-arrow-circle-right:before{content:"\f0a9"}.fa-arrow-circle-up:before{content:"\f0aa"}.fa-arrow-circle-down:before{content:"\f0ab"}.fa-globe:before{content:"\f0ac"}.fa-wrench:before{content:"\f0ad"}.fa-tasks:before{content:"\f0ae"}.fa-filter:before{content:"\f0b0"}.fa-briefcase:before{content:"\f0b1"}.fa-arrows-alt:before{content:"\f0b2"}.fa-group:before,.fa-users:before{content:"\f0c0"}.fa-chain:before,.fa-link:before{content:"\f0c1"}.fa-cloud:before{content:"\f0c2"}.fa-flask:before{content:"\f0c3"}.fa-cut:before,.fa-scissors:before{content:"\f0c4"}.fa-copy:before,.fa-files-o:before{content:"\f0c5"}.fa-paperclip:before{content:"\f0c6"}.fa-save:before,.fa-floppy-o:before{content:"\f0c7"}.fa-square:before{content:"\f0c8"}.fa-navicon:before,.fa-reorder:before,.fa-bars:before{content:"\f0c9"}.fa-list-ul:before{content:"\f0ca"}.fa-list-ol:before{content:"\f0cb"}.fa-strikethrough:before{content:"\f0cc"}.fa-underline:before{content:"\f0cd"}.fa-table:before{content:"\f0ce"}.fa-magic:before{content:"\f0d0"}.fa-truck:before{content:"\f0d1"}.fa-pinterest:before{content:"\f0d2"}.fa-pinterest-square:before{content:"\f0d3"}.fa-google-plus-square:before{content:"\f0d4"}.fa-google-plus:before{content:"\f0d5"}.fa-money:before{content:"\f0d6"}.fa-caret-down:before{content:"\f0d7"}.fa-caret-up:before{content:"\f0d8"}.fa-caret-left:before{content:"\f0d9"}.fa-caret-right:before{content:"\f0da"}.fa-columns:before{content:"\f0db"}.fa-unsorted:before,.fa-sort:before{content:"\f0dc"}.fa-sort-down:before,.fa-sort-desc:before{content:"\f0dd"}.fa-sort-up:before,.fa-sort-asc:before{content:"\f0de"}.fa-envelope:before{content:"\f0e0"}.fa-linkedin:before{content:"\f0e1"}.fa-rotate-left:before,.fa-undo:before{content:"\f0e2"}.fa-legal:before,.fa-gavel:before{content:"\f0e3"}.fa-dashboard:before,.fa-tachometer:before{content:"\f0e4"}.fa-comment-o:before{content:"\f0e5"}.fa-comments-o:before{content:"\f0e6"}.fa-flash:before,.fa-bolt:before{content:"\f0e7"}.fa-sitemap:before{content:"\f0e8"}.fa-umbrella:before{content:"\f0e9"}.fa-paste:before,.fa-clipboard:before{content:"\f0ea"}.fa-lightbulb-o:before{content:"\f0eb"}.fa-exchange:before{content:"\f0ec"}.fa-cloud-download:before{content:"\f0ed"}.fa-cloud-upload:before{content:"\f0ee"}.fa-user-md:before{content:"\f0f0"}.fa-stethoscope:before{content:"\f0f1"}.fa-suitcase:before{content:"\f0f2"}.fa-bell-o:before{content:"\f0a2"}.fa-coffee:before{content:"\f0f4"}.fa-cutlery:before{content:"\f0f5"}.fa-file-text-o:before{content:"\f0f6"}.fa-building-o:before{content:"\f0f7"}.fa-hospital-o:before{content:"\f0f8"}.fa-ambulance:before{content:"\f0f9"}.fa-medkit:before{content:"\f0fa"}.fa-fighter-jet:before{content:"\f0fb"}.fa-beer:before{content:"\f0fc"}.fa-h-square:before{content:"\f0fd"}.fa-plus-square:before{content:"\f0fe"}.fa-angle-double-left:before{content:"\f100"}.fa-angle-double-right:before{content:"\f101"}.fa-angle-double-up:before{content:"\f102"}.fa-angle-double-down:before{content:"\f103"}.fa-angle-left:before{content:"\f104"}.fa-angle-right:before{content:"\f105"}.fa-angle-up:before{content:"\f106"}.fa-angle-down:before{content:"\f107"}.fa-desktop:before{content:"\f108"}.fa-laptop:before{content:"\f109"}.fa-tablet:before{content:"\f10a"}.fa-mobile-phone:before,.fa-mobile:before{content:"\f10b"}.fa-circle-o:before{content:"\f10c"}.fa-quote-left:before{content:"\f10d"}.fa-quote-right:before{content:"\f10e"}.fa-spinner:before{content:"\f110"}.fa-circle:before{content:"\f111"}.fa-mail-reply:before,.fa-reply:before{content:"\f112"}.fa-github-alt:before{content:"\f113"}.fa-folder-o:before{content:"\f114"}.fa-folder-open-o:before{content:"\f115"}.fa-smile-o:before{content:"\f118"}.fa-frown-o:before{content:"\f119"}.fa-meh-o:before{content:"\f11a"}.fa-gamepad:before{content:"\f11b"}.fa-keyboard-o:before{content:"\f11c"}.fa-flag-o:before{content:"\f11d"}.fa-flag-checkered:before{content:"\f11e"}.fa-terminal:before{content:"\f120"}.fa-code:before{content:"\f121"}.fa-mail-reply-all:before,.fa-reply-all:before{content:"\f122"}.fa-star-half-empty:before,.fa-star-half-full:before,.fa-star-half-o:before{content:"\f123"}.fa-location-arrow:before{content:"\f124"}.fa-crop:before{content:"\f125"}.fa-code-fork:before{content:"\f126"}.fa-unlink:before,.fa-chain-broken:before{content:"\f127"}.fa-question:before{content:"\f128"}.fa-info:before{content:"\f129"}.fa-exclamation:before{content:"\f12a"}.fa-superscript:before{content:"\f12b"}.fa-subscript:before{content:"\f12c"}.fa-eraser:before{content:"\f12d"}.fa-puzzle-piece:before{content:"\f12e"}.fa-microphone:before{content:"\f130"}.fa-microphone-slash:before{content:"\f131"}.fa-shield:before{content:"\f132"}.fa-calendar-o:before{content:"\f133"}.fa-fire-extinguisher:before{content:"\f134"}.fa-rocket:before{content:"\f135"}.fa-maxcdn:before{content:"\f136"}.fa-chevron-circle-left:before{content:"\f137"}.fa-chevron-circle-right:before{content:"\f138"}.fa-chevron-circle-up:before{content:"\f139"}.fa-chevron-circle-down:before{content:"\f13a"}.fa-html5:before{content:"\f13b"}.fa-css3:before{content:"\f13c"}.fa-anchor:before{content:"\f13d"}.fa-unlock-alt:before{content:"\f13e"}.fa-bullseye:before{content:"\f140"}.fa-ellipsis-h:before{content:"\f141"}.fa-ellipsis-v:before{content:"\f142"}.fa-rss-square:before{content:"\f143"}.fa-play-circle:before{content:"\f144"}.fa-ticket:before{content:"\f145"}.fa-minus-square:before{content:"\f146"}.fa-minus-square-o:before{content:"\f147"}.fa-level-up:before{content:"\f148"}.fa-level-down:before{content:"\f149"}.fa-check-square:before{content:"\f14a"}.fa-pencil-square:before{content:"\f14b"}.fa-external-link-square:before{content:"\f14c"}.fa-share-square:before{content:"\f14d"}.fa-compass:before{content:"\f14e"}.fa-toggle-down:before,.fa-caret-square-o-down:before{content:"\f150"}.fa-toggle-up:before,.fa-caret-square-o-up:before{content:"\f151"}.fa-toggle-right:before,.fa-caret-square-o-right:before{content:"\f152"}.fa-euro:before,.fa-eur:before{content:"\f153"}.fa-gbp:before{content:"\f154"}.fa-dollar:before,.fa-usd:before{content:"\f155"}.fa-rupee:before,.fa-inr:before{content:"\f156"}.fa-cny:before,.fa-rmb:before,.fa-yen:before,.fa-jpy:before{content:"\f157"}.fa-ruble:before,.fa-rouble:before,.fa-rub:before{content:"\f158"}.fa-won:before,.fa-krw:before{content:"\f159"}.fa-bitcoin:before,.fa-btc:before{content:"\f15a"}.fa-file:before{content:"\f15b"}.fa-file-text:before{content:"\f15c"}.fa-sort-alpha-asc:before{content:"\f15d"}.fa-sort-alpha-desc:before{content:"\f15e"}.fa-sort-amount-asc:before{content:"\f160"}.fa-sort-amount-desc:before{content:"\f161"}.fa-sort-numeric-asc:before{content:"\f162"}.fa-sort-numeric-desc:before{content:"\f163"}.fa-thumbs-up:before{content:"\f164"}.fa-thumbs-down:before{content:"\f165"}.fa-youtube-square:before{content:"\f166"}.fa-youtube:before{content:"\f167"}.fa-xing:before{content:"\f168"}.fa-xing-square:before{content:"\f169"}.fa-youtube-play:before{content:"\f16a"}.fa-dropbox:before{content:"\f16b"}.fa-stack-overflow:before{content:"\f16c"}.fa-instagram:before{content:"\f16d"}.fa-flickr:before{content:"\f16e"}.fa-adn:before{content:"\f170"}.fa-bitbucket:before{content:"\f171"}.fa-bitbucket-square:before{content:"\f172"}.fa-tumblr:before{content:"\f173"}.fa-tumblr-square:before{content:"\f174"}.fa-long-arrow-down:before{content:"\f175"}.fa-long-arrow-up:before{content:"\f176"}.fa-long-arrow-left:before{content:"\f177"}.fa-long-arrow-right:before{content:"\f178"}.fa-apple:before{content:"\f179"}.fa-windows:before{content:"\f17a"}.fa-android:before{content:"\f17b"}.fa-linux:before{content:"\f17c"}.fa-dribbble:before{content:"\f17d"}.fa-skype:before{content:"\f17e"}.fa-foursquare:before{content:"\f180"}.fa-trello:before{content:"\f181"}.fa-female:before{content:"\f182"}.fa-male:before{content:"\f183"}.fa-gittip:before,.fa-gratipay:before{content:"\f184"}.fa-sun-o:before{content:"\f185"}.fa-moon-o:before{content:"\f186"}.fa-archive:before{content:"\f187"}.fa-bug:before{content:"\f188"}.fa-vk:before{content:"\f189"}.fa-weibo:before{content:"\f18a"}.fa-renren:before{content:"\f18b"}.fa-pagelines:before{content:"\f18c"}.fa-stack-exchange:before{content:"\f18d"}.fa-arrow-circle-o-right:before{content:"\f18e"}.fa-arrow-circle-o-left:before{content:"\f190"}.fa-toggle-left:before,.fa-caret-square-o-left:before{content:"\f191"}.fa-dot-circle-o:before{content:"\f192"}.fa-wheelchair:before{content:"\f193"}.fa-vimeo-square:before{content:"\f194"}.fa-turkish-lira:before,.fa-try:before{content:"\f195"}.fa-plus-square-o:before{content:"\f196"}.fa-space-shuttle:before{content:"\f197"}.fa-slack:before{content:"\f198"}.fa-envelope-square:before{content:"\f199"}.fa-wordpress:before{content:"\f19a"}.fa-openid:before{content:"\f19b"}.fa-institution:before,.fa-bank:before,.fa-university:before{content:"\f19c"}.fa-mortar-board:before,.fa-graduation-cap:before{content:"\f19d"}.fa-yahoo:before{content:"\f19e"}.fa-google:before{content:"\f1a0"}.fa-reddit:before{content:"\f1a1"}.fa-reddit-square:before{content:"\f1a2"}.fa-stumbleupon-circle:before{content:"\f1a3"}.fa-stumbleupon:before{content:"\f1a4"}.fa-delicious:before{content:"\f1a5"}.fa-digg:before{content:"\f1a6"}.fa-pied-piper:before{content:"\f1a7"}.fa-pied-piper-alt:before{content:"\f1a8"}.fa-drupal:before{content:"\f1a9"}.fa-joomla:before{content:"\f1aa"}.fa-language:before{content:"\f1ab"}.fa-fax:before{content:"\f1ac"}.fa-building:before{content:"\f1ad"}.fa-child:before{content:"\f1ae"}.fa-paw:before{content:"\f1b0"}.fa-spoon:before{content:"\f1b1"}.fa-cube:before{content:"\f1b2"}.fa-cubes:before{content:"\f1b3"}.fa-behance:before{content:"\f1b4"}.fa-behance-square:before{content:"\f1b5"}.fa-steam:before{content:"\f1b6"}.fa-steam-square:before{content:"\f1b7"}.fa-recycle:before{content:"\f1b8"}.fa-automobile:before,.fa-car:before{content:"\f1b9"}.fa-cab:before,.fa-taxi:before{content:"\f1ba"}.fa-tree:before{content:"\f1bb"}.fa-spotify:before{content:"\f1bc"}.fa-deviantart:before{content:"\f1bd"}.fa-soundcloud:before{content:"\f1be"}.fa-database:before{content:"\f1c0"}.fa-file-pdf-o:before{content:"\f1c1"}.fa-file-word-o:before{content:"\f1c2"}.fa-file-excel-o:before{content:"\f1c3"}.fa-file-powerpoint-o:before{content:"\f1c4"}.fa-file-photo-o:before,.fa-file-picture-o:before,.fa-file-image-o:before{content:"\f1c5"}.fa-file-zip-o:before,.fa-file-archive-o:before{content:"\f1c6"}.fa-file-sound-o:before,.fa-file-audio-o:before{content:"\f1c7"}.fa-file-movie-o:before,.fa-file-video-o:before{content:"\f1c8"}.fa-file-code-o:before{content:"\f1c9"}.fa-vine:before{content:"\f1ca"}.fa-codepen:before{content:"\f1cb"}.fa-jsfiddle:before{content:"\f1cc"}.fa-life-bouy:before,.fa-life-buoy:before,.fa-life-saver:before,.fa-support:before,.fa-life-ring:before{content:"\f1cd"}.fa-circle-o-notch:before{content:"\f1ce"}.fa-ra:before,.fa-rebel:before{content:"\f1d0"}.fa-ge:before,.fa-empire:before{content:"\f1d1"}.fa-git-square:before{content:"\f1d2"}.fa-git:before{content:"\f1d3"}.fa-y-combinator-square:before,.fa-yc-square:before,.fa-hacker-news:before{content:"\f1d4"}.fa-tencent-weibo:before{content:"\f1d5"}.fa-qq:before{content:"\f1d6"}.fa-wechat:before,.fa-weixin:before{content:"\f1d7"}.fa-send:before,.fa-paper-plane:before{content:"\f1d8"}.fa-send-o:before,.fa-paper-plane-o:before{content:"\f1d9"}.fa-history:before{content:"\f1da"}.fa-circle-thin:before{content:"\f1db"}.fa-header:before{content:"\f1dc"}.fa-paragraph:before{content:"\f1dd"}.fa-sliders:before{content:"\f1de"}.fa-share-alt:before{content:"\f1e0"}.fa-share-alt-square:before{content:"\f1e1"}.fa-bomb:before{content:"\f1e2"}.fa-soccer-ball-o:before,.fa-futbol-o:before{content:"\f1e3"}.fa-tty:before{content:"\f1e4"}.fa-binoculars:before{content:"\f1e5"}.fa-plug:before{content:"\f1e6"}.fa-slideshare:before{content:"\f1e7"}.fa-twitch:before{content:"\f1e8"}.fa-yelp:before{content:"\f1e9"}.fa-newspaper-o:before{content:"\f1ea"}.fa-wifi:before{content:"\f1eb"}.fa-calculator:before{content:"\f1ec"}.fa-paypal:before{content:"\f1ed"}.fa-google-wallet:before{content:"\f1ee"}.fa-cc-visa:before{content:"\f1f0"}.fa-cc-mastercard:before{content:"\f1f1"}.fa-cc-discover:before{content:"\f1f2"}.fa-cc-amex:before{content:"\f1f3"}.fa-cc-paypal:before{content:"\f1f4"}.fa-cc-stripe:before{content:"\f1f5"}.fa-bell-slash:before{content:"\f1f6"}.fa-bell-slash-o:before{content:"\f1f7"}.fa-trash:before{content:"\f1f8"}.fa-copyright:before{content:"\f1f9"}.fa-at:before{content:"\f1fa"}.fa-eyedropper:before{content:"\f1fb"}.fa-paint-brush:before{content:"\f1fc"}.fa-birthday-cake:before{content:"\f1fd"}.fa-area-chart:before{content:"\f1fe"}.fa-pie-chart:before{content:"\f200"}.fa-line-chart:before{content:"\f201"}.fa-lastfm:before{content:"\f202"}.fa-lastfm-square:before{content:"\f203"}.fa-toggle-off:before{content:"\f204"}.fa-toggle-on:before{content:"\f205"}.fa-bicycle:before{content:"\f206"}.fa-bus:before{content:"\f207"}.fa-ioxhost:before{content:"\f208"}.fa-angellist:before{content:"\f209"}.fa-cc:before{content:"\f20a"}.fa-shekel:before,.fa-sheqel:before,.fa-ils:before{content:"\f20b"}.fa-meanpath:before{content:"\f20c"}.fa-buysellads:before{content:"\f20d"}.fa-connectdevelop:before{content:"\f20e"}.fa-dashcube:before{content:"\f210"}.fa-forumbee:before{content:"\f211"}.fa-leanpub:before{content:"\f212"}.fa-sellsy:before{content:"\f213"}.fa-shirtsinbulk:before{content:"\f214"}.fa-simplybuilt:before{content:"\f215"}.fa-skyatlas:before{content:"\f216"}.fa-cart-plus:before{content:"\f217"}.fa-cart-arrow-down:before{content:"\f218"}.fa-diamond:before{content:"\f219"}.fa-ship:before{content:"\f21a"}.fa-user-secret:before{content:"\f21b"}.fa-motorcycle:before{content:"\f21c"}.fa-street-view:before{content:"\f21d"}.fa-heartbeat:before{content:"\f21e"}.fa-venus:before{content:"\f221"}.fa-mars:before{content:"\f222"}.fa-mercury:before{content:"\f223"}.fa-intersex:before,.fa-transgender:before{content:"\f224"}.fa-transgender-alt:before{content:"\f225"}.fa-venus-double:before{content:"\f226"}.fa-mars-double:before{content:"\f227"}.fa-venus-mars:before{content:"\f228"}.fa-mars-stroke:before{content:"\f229"}.fa-mars-stroke-v:before{content:"\f22a"}.fa-mars-stroke-h:before{content:"\f22b"}.fa-neuter:before{content:"\f22c"}.fa-genderless:before{content:"\f22d"}.fa-facebook-official:before{content:"\f230"}.fa-pinterest-p:before{content:"\f231"}.fa-whatsapp:before{content:"\f232"}.fa-server:before{content:"\f233"}.fa-user-plus:before{content:"\f234"}.fa-user-times:before{content:"\f235"}.fa-hotel:before,.fa-bed:before{content:"\f236"}.fa-viacoin:before{content:"\f237"}.fa-train:before{content:"\f238"}.fa-subway:before{content:"\f239"}.fa-medium:before{content:"\f23a"}.fa-yc:before,.fa-y-combinator:before{content:"\f23b"}.fa-optin-monster:before{content:"\f23c"}.fa-opencart:before{content:"\f23d"}.fa-expeditedssl:before{content:"\f23e"}.fa-battery-4:before,.fa-battery-full:before{content:"\f240"}.fa-battery-3:before,.fa-battery-three-quarters:before{content:"\f241"}.fa-battery-2:before,.fa-battery-half:before{content:"\f242"}.fa-battery-1:before,.fa-battery-quarter:before{content:"\f243"}.fa-battery-0:before,.fa-battery-empty:before{content:"\f244"}.fa-mouse-pointer:before{content:"\f245"}.fa-i-cursor:before{content:"\f246"}.fa-object-group:before{content:"\f247"}.fa-object-ungroup:before{content:"\f248"}.fa-sticky-note:before{content:"\f249"}.fa-sticky-note-o:before{content:"\f24a"}.fa-cc-jcb:before{content:"\f24b"}.fa-cc-diners-club:before{content:"\f24c"}.fa-clone:before{content:"\f24d"}.fa-balance-scale:before{content:"\f24e"}.fa-hourglass-o:before{content:"\f250"}.fa-hourglass-1:before,.fa-hourglass-start:before{content:"\f251"}.fa-hourglass-2:before,.fa-hourglass-half:before{content:"\f252"}.fa-hourglass-3:before,.fa-hourglass-end:before{content:"\f253"}.fa-hourglass:before{content:"\f254"}.fa-hand-grab-o:before,.fa-hand-rock-o:before{content:"\f255"}.fa-hand-stop-o:before,.fa-hand-paper-o:before{content:"\f256"}.fa-hand-scissors-o:before{content:"\f257"}.fa-hand-lizard-o:before{content:"\f258"}.fa-hand-spock-o:before{content:"\f259"}.fa-hand-pointer-o:before{content:"\f25a"}.fa-hand-peace-o:before{content:"\f25b"}.fa-trademark:before{content:"\f25c"}.fa-registered:before{content:"\f25d"}.fa-creative-commons:before{content:"\f25e"}.fa-gg:before{content:"\f260"}.fa-gg-circle:before{content:"\f261"}.fa-tripadvisor:before{content:"\f262"}.fa-odnoklassniki:before{content:"\f263"}.fa-odnoklassniki-square:before{content:"\f264"}.fa-get-pocket:before{content:"\f265"}.fa-wikipedia-w:before{content:"\f266"}.fa-safari:before{content:"\f267"}.fa-chrome:before{content:"\f268"}.fa-firefox:before{content:"\f269"}.fa-opera:before{content:"\f26a"}.fa-internet-explorer:before{content:"\f26b"}.fa-tv:before,.fa-television:before{content:"\f26c"}.fa-contao:before{content:"\f26d"}.fa-500px:before{content:"\f26e"}.fa-amazon:before{content:"\f270"}.fa-calendar-plus-o:before{content:"\f271"}.fa-calendar-minus-o:before{content:"\f272"}.fa-calendar-times-o:before{content:"\f273"}.fa-calendar-check-o:before{content:"\f274"}.fa-industry:before{content:"\f275"}.fa-map-pin:before{content:"\f276"}.fa-map-signs:before{content:"\f277"}.fa-map-o:before{content:"\f278"}.fa-map:before{content:"\f279"}.fa-commenting:before{content:"\f27a"}.fa-commenting-o:before{content:"\f27b"}.fa-houzz:before{content:"\f27c"}.fa-vimeo:before{content:"\f27d"}.fa-black-tie:before{content:"\f27e"}.fa-fonticons:before{content:"\f280"} diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index ae7c2e6..0831da0 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -41,11 +41,11 @@ class ApplicationController < BaseController @conference = @conferences.first # add some style sheets - @stylesheets ||= Array.new + @stylesheets ||= Set.new # add the translations stylesheet if translating @stylesheets << params[:controller] if params[:controller] == 'translations' - @_inline_scripts ||= [] + @_inline_scripts ||= Set.new @_inline_scripts << Rails.application.assets.find_asset('main.js').to_s ActionMailer::Base.default_url_options = { diff --git a/app/helpers/form_helper.rb b/app/helpers/form_helper.rb index 5e1e815..99fda04 100644 --- a/app/helpers/form_helper.rb +++ b/app/helpers/form_helper.rb @@ -150,24 +150,24 @@ module FormHelper html_name = name.to_s + (options[:index] ? "[#{options[:index]}]" : '') if options[:plain] html += (text_area_tag html_name, value, - id: id, - lang: options[:lang], - aria: aria, - class: css_class + id: id, + lang: options[:lang], + aria: aria, + class: css_class ) else - html += content_tag(:div, value.present? ? value.html_safe : '', + html += content_tag(:div, + content_tag(:div, (value || '').html_safe, class: :editor).html_safe, id: id, - data: { name: html_name, 'edit-on': options[:edit_on] || :load }, + data: { name: html_name }, lang: options[:lang], aria: aria, tabindex: 0, class: [:textarea] + css_class ) - add_stylesheet :editor - add_inline_script :pen - add_inline_script :markdown + add_stylesheet 'quill.css' + add_javascript :quill add_inline_script :editor end diff --git a/app/helpers/i18n_helper.rb b/app/helpers/i18n_helper.rb index 1b463dd..62777d5 100644 --- a/app/helpers/i18n_helper.rb +++ b/app/helpers/i18n_helper.rb @@ -2,22 +2,30 @@ module I18nHelper def url_for_locale(locale, url = nil) return url unless locale.present? + url ||= current_path - unless url.present? - new_params = params.merge({action: (params[:_original_action] || params[:action])}) - new_params.delete(:_original_action) + return url if Rails.env.development? || Rails.env.test? + return "https://preview-#{locale.to_s}.bikebike.org#{url}" if Rails.env.preview? + "https://#{locale.to_s}.bikebike.org#{url}" + end - if Rails.env.development? || Rails.env.test? - return url_for(new_params.merge({lang: locale.to_s})) - end - - subdomain = Rails.env.preview? ? "preview-#{locale.to_s}" : locale.to_s - return url_for(new_params.merge(host: "#{subdomain}.bikebike.org")) + def current_path + new_params = params.merge({action: (params[:_original_action] || params[:action])}) + new_params.delete(:_original_action) + + if Rails.env.development? || Rails.env.test? + return url_for(new_params.merge({lang: locale.to_s})) end + + subdomain = Rails.env.preview? ? "preview-#{locale.to_s}" : locale.to_s + url_for(new_params.merge(host: "#{subdomain}.bikebike.org")) + end + def canonical_url + url = current_path return url if Rails.env.development? || Rails.env.test? - return "https://preview-#{locale.to_s}.bikebike.org#{url}" if Rails.env.preview? - "https://#{locale.to_s}.bikebike.org#{url}" + return "https://preview.bikebike.org#{url}" if Rails.env.preview? + "https://bikebike.org#{url}" end def date(date, format = :long) diff --git a/app/helpers/page_helper.rb b/app/helpers/page_helper.rb index a31ebe4..3d53349 100644 --- a/app/helpers/page_helper.rb +++ b/app/helpers/page_helper.rb @@ -24,8 +24,8 @@ module PageHelper end def add_stylesheet(sheet) - @stylesheets ||= [] - @stylesheets << sheet unless @stylesheets.include?(sheet) + @stylesheets ||= Set.new + @stylesheets << sheet end def stylesheets @@ -35,22 +35,35 @@ module PageHelper end (@stylesheets || []).each do |css| Rack::MiniProfiler.step("inject_css #{css}") do - html += inject_css! css.to_s + if css =~ /\.css$/ + html += stylesheet_link_tag css + else + html += inject_css! css.to_s + end end end html += stylesheet_link_tag 'i18n-debug' if request.params['i18nDebug'] return html.html_safe end + def add_javascript(script) + @javascripts ||= Set.new + @javascripts << script + end + + def javascripts + (@javascripts || []).map { |js| javascript_include_tag js.to_s }.join.html_safe + end + def add_inline_script(script) - @_inline_scripts ||= [] + @_inline_scripts ||= Set.new script = Rails.application.assets.find_asset("#{script.to_s}.js").to_s - @_inline_scripts << script unless @_inline_scripts.include?(script) + @_inline_scripts << script end def inline_scripts return '' unless @_inline_scripts.present? - "".html_safe + javascript_tag @_inline_scripts.to_a.join("\n").html_safe end def dom_ready(&block) diff --git a/app/views/conference_administration/administration.html.haml b/app/views/conference_administration/administration.html.haml index e42acf3..4bd44fb 100644 --- a/app/views/conference_administration/administration.html.haml +++ b/app/views/conference_administration/administration.html.haml @@ -1,4 +1,5 @@ - body_class 'banner-bottom' unless @this_conference.poster.present? +- add_stylesheet :admin - content_for :banner do = render :partial => 'application/header', :locals => { page_group: :administration, page_key: 'Administration', image_file: @this_conference.poster_url || 'admin.jpg'} diff --git a/app/views/conference_administration/administration_step.html.haml b/app/views/conference_administration/administration_step.html.haml index b35ea89..dda310c 100644 --- a/app/views/conference_administration/administration_step.html.haml +++ b/app/views/conference_administration/administration_step.html.haml @@ -1,4 +1,5 @@ - body_class 'banner-bottom' unless @this_conference.poster.present? +- add_stylesheet :admin - content_for :banner do = render :partial => 'application/header', :locals => { page_group: :administration, page_key: 'Administration', image_file: @this_conference.poster_url || 'admin.jpg'} diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 451d755..f9f7556 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -12,6 +12,7 @@ %link{ href: asset_path(@favicon), rel: 'icon', type: 'image/x-icon' } - @alt_lang_urls.each do |locale, url| %link{ rel: :alternate, hreflang: locale, href: url } + %link{ href: canonical_url, rel: :canonical } - if content_for?(:og_image) - og_image = yield :og_image - og_image = request.base_url + og_image @@ -80,5 +81,6 @@ %a.more-details.button{href: '#'}=_'articles.workshops.info.read_more' %button.close-btn.subdued=_'forms.actions.generic.close' = yield :footer_scripts if content_for?(:footer_scripts) + = javascripts = inline_scripts = emit_js_translations diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index deb050f..2659406 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -8,4 +8,4 @@ Rails.application.config.assets.version = '1.0' # Precompile additional assets. # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. -Rails.application.config.assets.precompile += %w( topojson.js pen.js *.js user-mailer.css favicon.ico ) +Rails.application.config.assets.precompile += %w( quill.js quill.css topojson.js pen.js *.js user-mailer.css favicon.ico ) diff --git a/config/locales/en.yml b/config/locales/en.yml index d729ca2..1bfade5 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -206,6 +206,473 @@ en: city_country: "%{city}, %{country}" city_region: "%{city}, %{region}" region_country: "%{region}, %{country}" + countries: + AD: Andorra + AE: United Arab Emirates + AF: Afghanistan + AG: Antigua and Barbuda + AI: Anguilla + AL: Albania + AM: Armenia + AO: Angola + AQ: Antarctica + AR: Argentina + AS: American Samoa + AT: Austria + AU: Australia + AW: Aruba + AX: Åland + AZ: Azerbaijan + BA: Bosnia and Herzegovina + BB: Barbados + BD: Bangladesh + BE: Belgium + BF: Burkina Faso + BG: Bulgaria + BH: Bahrain + BI: Burundi + BJ: Benin + BL: Saint Barthélemy + BM: Bermuda + BN: Brunei + BO: Bolivia + BQ: Bonaire + BR: Brazil + BS: Bahamas + BT: Bhutan + BV: Bouvet Island + BW: Botswana + BY: Belarus + BZ: Belize + CA: Canada + CC: Cocos [Keeling] Islands + CD: Democratic Republic of the Congo + CF: Central African Republic + CG: Republic of the Congo + CH: Switzerland + CI: Ivory Coast + CK: Cook Islands + CL: Chile + CM: Cameroon + CN: China + CO: Colombia + CR: Costa Rica + CU: Cuba + CV: Cape Verde + CW: Curacao + CX: Christmas Island + CY: Cyprus + CZ: Czechia + DE: Germany + DJ: Djibouti + DK: Denmark + DM: Dominica + DO: Dominican Republic + DZ: Algeria + EC: Ecuador + EE: Estonia + EG: Egypt + EH: Western Sahara + ER: Eritrea + ES: Spain + ET: Ethiopia + FI: Finland + FJ: Fiji + FK: Falkland Islands + FM: Micronesia + FO: Faroe Islands + FR: France + GA: Gabon + GB: United Kingdom + GD: Grenada + GE: Georgia + GF: French Guiana + GG: Guernsey + GH: Ghana + GI: Gibraltar + GL: Greenland + GM: Gambia + GN: Guinea + GP: Guadeloupe + GQ: Equatorial Guinea + GR: Greece + GS: South Georgia and the South Sandwich Islands + GT: Guatemala + GU: Guam + GW: Guinea-Bissau + GY: Guyana + HK: Hong Kong + HM: Heard Island and McDonald Islands + HN: Honduras + HR: Croatia + HT: Haiti + HU: Hungary + ID: Indonesia + IE: Ireland + IL: Israel + IM: Isle of Man + IN: India + IO: British Indian Ocean Territory + IQ: Iraq + IR: Iran + IS: Iceland + IT: Italy + JE: Jersey + JM: Jamaica + JO: Jordan + JP: Japan + KE: Kenya + KG: Kyrgyzstan + KH: Cambodia + KI: Kiribati + KM: Comoros + KN: Saint Kitts and Nevis + KP: North Korea + KR: South Korea + KW: Kuwait + KY: Cayman Islands + KZ: Kazakhstan + LA: Laos + LB: Lebanon + LC: Saint Lucia + LI: Liechtenstein + LK: Sri Lanka + LR: Liberia + LS: Lesotho + LT: Lithuania + LU: Luxembourg + LV: Latvia + LY: Libya + MA: Morocco + MC: Monaco + MD: Moldova + ME: Montenegro + MF: Saint Martin + MG: Madagascar + MH: Marshall Islands + MK: Macedonia + ML: Mali + MM: Myanmar [Burma] + MN: Mongolia + MO: Macao + MP: Northern Mariana Islands + MQ: Martinique + MR: Mauritania + MS: Montserrat + MT: Malta + MU: Mauritius + MV: Maldives + MW: Malawi + MX: Mexico + MY: Malaysia + MZ: Mozambique + NA: Namibia + NC: New Caledonia + NE: Niger + NF: Norfolk Island + NG: Nigeria + NI: Nicaragua + NL: Netherlands + 'NO': Norway + NP: Nepal + NR: Nauru + NU: Niue + NZ: New Zealand + OM: Oman + PA: Panama + PE: Peru + PF: French Polynesia + PG: Papua New Guinea + PH: Philippines + PK: Pakistan + PL: Poland + PM: Saint Pierre and Miquelon + PN: Pitcairn Islands + PR: Puerto Rico + PS: Palestine + PT: Portugal + PW: Palau + PY: Paraguay + QA: Qatar + RE: Réunion + RO: Romania + RS: Serbia + RU: Russia + RW: Rwanda + SA: Saudi Arabia + SB: Solomon Islands + SC: Seychelles + SD: Sudan + SE: Sweden + SG: Singapore + SH: Saint Helena + SI: Slovenia + SJ: Svalbard and Jan Mayen + SK: Slovakia + SL: Sierra Leone + SM: San Marino + SN: Senegal + SO: Somalia + SR: Suriname + SS: South Sudan + ST: São Tomé and Príncipe + SV: El Salvador + SX: Sint Maarten + SY: Syria + SZ: Swaziland + TC: Turks and Caicos Islands + TD: Chad + TF: French Southern Territories + TG: Togo + TH: Thailand + TJ: Tajikistan + TK: Tokelau + TL: East Timor + TM: Turkmenistan + TN: Tunisia + TO: Tonga + TR: Turkey + TT: Trinidad and Tobago + TV: Tuvalu + TW: Taiwan + TZ: Tanzania + UA: Ukraine + UG: Uganda + UM: U.S. Minor Outlying Islands + US: United States + UY: Uruguay + UZ: Uzbekistan + VA: Vatican City + VC: Saint Vincent and the Grenadines + VE: Venezuela + VG: British Virgin Islands + VI: U.S. Virgin Islands + VN: Vietnam + VU: Vanuatu + WF: Wallis and Futuna + WS: Samoa + XK: Kosovo + YE: Yemen + YT: Mayotte + ZA: South Africa + ZM: Zambia + ZW: Zimbabwe + subregions: + AR: + BA: Buenos Aires + CF: Buenos Aires F.D. + CT: Catamarca + CC: Chaco + CH: Chubut + CD: Cordoba + CR: Corrientes + ER: Entre Rios + FO: Formosa + JY: Jujuy + LP: La Pampa + LR: La Rioja + MZ: Mendoza + MN: Misiones + NQ: Neuquen + RN: Rio Negro + SA: Salta + SJ: San Juan + SL: San Luis + SC: Santa Cruz + SF: Santa Fe + SE: Santiago del Estero + TF: Tierra del Fuego + TM: Tucuman + AT: + Bgld: Burgenland + AU: + ACT: ACT + NSW: New South Wales + NT: Northern Territory + QLD: Queensland + SA: South Australia + TAS: Tasmania + VIC: Victoria + WA: Western Australia + BR: + AC: Acre + AL: Alagoas + AP: Amapá + AM: Amazonas + BA: Bahia + CE: Ceará + ES: Espírito Santo + DF: Federal District + GO: Goiás + MA: Maranhão + MT: Mato Grosso + MS: Mato Grosso do Sul + MG: Minas Gerais + PR: Paraná + PB: Paraíba + PA: Pará + PE: Pernambuco + PI: Piauí + RN: Rio Grande do Norte + RS: Rio Grande do Sul + RJ: Rio de Janeiro + RO: Rondônia + RR: Roraima + SC: Santa Catarina + SE: Sergipe + SP: São Paulo + TO: Tocantins + CA: + AB: Alberta + BC: British Columbia + MB: Manitoba + NB: New Brunswick + NL: Newfoundland and Labrador + NT: Northwest Territories + NS: Nova Scotia + NU: Nunavut + 'ON': Ontario + PE: Prince Edward Island + QC: Quebec + SK: Saskatchewan + YT: Yukon + CH: + TG: Thurgau + VD: Vaud + ZH: Zurich + DE: + HH: Hamburg + NRW: North Rhine-Westphalia + ET: + SNNPR: SNNPR + FR: + ACAL: Grand-Est + IT: + FVG: Friuli Venezia Giulia + MX: + Ags: Aguascalientes + BCS: Baja California Sur + CAM: Campeche + CHP: Chiapas + CH: Chihuahua + COA: Coahuila + COL: Colima + DUR: Durango + BCN: Estado de Baja California + MEX: Estado de México + Gto: Guanajuato + GRO: Guerrero + Hgo: Hidalgo + JAL: Jalisco + MIC: Michoacán + MOR: Morelos + NAY: Nayarit + NLE: Nuevo León + OAX: Oaxaca + PUE: Puebla + Qro: Querétaro + QRoo: Quintana Roo + SLP: San Luis Potosí + SIN: Sinaloa + SON: Sonora + TAB: Tabasco + TAM: Tamaulipas + Tlax: Tlaxcala + VER: Veracruz + YUC: Yucatán + ZAC: Zacatecas + MY: + JHR: Johor + KDH: Kedah + KTN: Kelantan + KUL: Kuala Lumpur + LBN: Labuan + MLK: Melaka + NSN: Negeri Sembilan + PHG: Pahang + PNG: Penang + PRK: Perak + PLS: Perlis + PJY: Putrajaya + SBH: Sabah + SRW: Sarawak + SGR: Selangor + TRG: Terengganu + NG: + FCTA: FCT + NI: + RAAN: North Atlantic Autonomous Region (RAAN) + NL: + fr: Friesland + gr: Groningen + lb: Limburg + nb: North Brabant + nh: North Holland + dr: Provincie Drenthe + fl: Provincie Flevoland + gd: Provincie Gelderland + ov: Provincie Overijssel + ut: Provincie Utrecht + zl: Provincie Zeeland + zh: South Holland + PH: + ARMM: ARMM + PK: + FATA: FATA + RU: + MO: Moscow Oblast + US: + AL: Alabama + AK: Alaska + AZ: Arizona + AR: Arkansas + Calif: California + CO: Colorado + CT: Connecticut + DE: Delaware + FL: Florida + GA: Georgia + HI: Hawaii + ID: Idaho + IL: Illinois + IN: Indiana + IA: Iowa + KS: Kansas + KY: Kentucky + LA: Louisiana + ME: Maine + MD: Maryland + MA: Massachusetts + MI: Michigan + MN: Minnesota + MS: Mississippi + MO: Missouri + MT: Montana + NE: Nebraska + NV: Nevada + NH: New Hampshire + NJ: New Jersey + NM: New Mexico + NY: New York + NC: North Carolina + ND: North Dakota + OH: Ohio + OK: Oklahoma + OR: Oregon + PA: Pennsylvania + RI: Rhode Island + SC: South Carolina + SD: South Dakota + TN: Tennessee + TX: Texas + UT: Utah + VT: Vermont + VA: Virginia + WA: Washington + DC: Washington, D.C. + WV: West Virginia + WI: Wisconsin + WY: Wyoming conference: actions: Register: Register @@ -1231,4 +1698,630 @@ en: view_workshop: 'View the workshop here: ' translate: content: - change_locale: "Read in %{language}" + change_locale: Read in %{language} + Translation_of: Translation of + languages: + aa: Afar + ab: Abkhazian + ace: Achinese + ach: Acoli + ada: Adangme + ady: Adyghe + ae: Avestan + aeb: Tunisian Arabic + af: Afrikaans + afh: Afrihili + agq: Aghem + ain: Ainu + ak: Akan + akk: Akkadian + akz: Alabama + ale: Aleut + aln: Gheg Albanian + alt: Southern Altai + am: Amharic + an: Aragonese + ang: Old English + anp: Angika + ar: Arabic + ar-001: Modern Standard Arabic + arc: Aramaic + arn: Mapuche + aro: Araona + arp: Arapaho + arq: Algerian Arabic + ars: Najdi Arabic + arw: Arawak + ary: Moroccan Arabic + arz: Egyptian Arabic + as: Assamese + asa: Asu + ase: American Sign Language + ast: Asturian + av: Avaric + avk: Kotava + awa: Awadhi + ay: Aymara + az: Azerbaijani + az-alt-short: Azeri + ba: Bashkir + bal: Baluchi + ban: Balinese + bar: Bavarian + bas: Basaa + bax: Bamun + bbc: Batak Toba + bbj: Ghomala + be: Belarusian + bej: Beja + bem: Bemba + bew: Betawi + bez: Bena + bfd: Bafut + bfq: Badaga + bg: Bulgarian + bgn: Western Balochi + bho: Bhojpuri + bi: Bislama + bik: Bikol + bin: Bini + bjn: Banjar + bkm: Kom + bla: Siksika + bm: Bambara + bn: Bangla + bo: Tibetan + bpy: Bishnupriya + bqi: Bakhtiari + br: Breton + bra: Braj + brh: Brahui + brx: Bodo + bs: Bosnian + bss: Akoose + bua: Buriat + bug: Buginese + bum: Bulu + byn: Blin + byv: Medumba + ca: Catalan + cad: Caddo + car: Carib + cay: Cayuga + cch: Atsam + ce: Chechen + ceb: Cebuano + cgg: Chiga + ch: Chamorro + chb: Chibcha + chg: Chagatai + chk: Chuukese + chm: Mari + chn: Chinook Jargon + cho: Choctaw + chp: Chipewyan + chr: Cherokee + chy: Cheyenne + ckb: Central Kurdish + co: Corsican + cop: Coptic + cps: Capiznon + cr: Cree + crh: Crimean Turkish + crs: Seselwa Creole French + cs: Czech + csb: Kashubian + cu: Church Slavic + cv: Chuvash + cy: Welsh + da: Danish + dak: Dakota + dar: Dargwa + dav: Taita + de: German + de-AT: Austrian German + de-CH: Swiss High German + del: Delaware + den: Slave + dgr: Dogrib + din: Dinka + dje: Zarma + doi: Dogri + dsb: Lower Sorbian + dtp: Central Dusun + dua: Duala + dum: Middle Dutch + dv: Divehi + dyo: Jola-Fonyi + dyu: Dyula + dz: Dzongkha + dzg: Dazaga + ebu: Embu + ee: Ewe + efi: Efik + egl: Emilian + egy: Ancient Egyptian + eka: Ekajuk + el: Greek + elx: Elamite + en: English + en-AU: Australian English + en-CA: Canadian English + en-GB: British English + en-GB-alt-short: UK English + en-US: American English + en-US-alt-short: US English + enm: Middle English + eo: Esperanto + es: Spanish + es-419: Latin American Spanish + es-ES: European Spanish + es-MX: Mexican Spanish + esu: Central Yupik + et: Estonian + eu: Basque + ewo: Ewondo + ext: Extremaduran + fa: Persian + fa-AF: Dari + fan: Fang + fat: Fanti + ff: Fulah + fi: Finnish + fil: Filipino + fit: Tornedalen Finnish + fj: Fijian + fo: Faroese + fon: Fon + fr: French + fr-CA: Canadian French + fr-CH: Swiss French + frc: Cajun French + frm: Middle French + fro: Old French + frp: Arpitan + frr: Northern Frisian + frs: Eastern Frisian + fur: Friulian + fy: Western Frisian + ga: Irish + gaa: Ga + gag: Gagauz + gan: Gan Chinese + gay: Gayo + gba: Gbaya + gbz: Zoroastrian Dari + gd: Scottish Gaelic + gez: Geez + gil: Gilbertese + gl: Galician + glk: Gilaki + gmh: Middle High German + gn: Guarani + goh: Old High German + gom: Goan Konkani + gon: Gondi + gor: Gorontalo + got: Gothic + grb: Grebo + grc: Ancient Greek + gsw: Swiss German + gu: Gujarati + guc: Wayuu + gur: Frafra + guz: Gusii + gv: Manx + gwi: Gwichʼin + ha: Hausa + hai: Haida + hak: Hakka Chinese + haw: Hawaiian + he: Hebrew + hi: Hindi + hif: Fiji Hindi + hil: Hiligaynon + hit: Hittite + hmn: Hmong + ho: Hiri Motu + hr: Croatian + hsb: Upper Sorbian + hsn: Xiang Chinese + ht: Haitian Creole + hu: Hungarian + hup: Hupa + hy: Armenian + hz: Herero + ia: Interlingua + iba: Iban + ibb: Ibibio + id: Indonesian + ie: Interlingue + ig: Igbo + ii: Sichuan Yi + ik: Inupiaq + ilo: Iloko + inh: Ingush + io: Ido + is: Icelandic + it: Italian + iu: Inuktitut + izh: Ingrian + ja: Japanese + jam: Jamaican Creole English + jbo: Lojban + jgo: Ngomba + jmc: Machame + jpr: Judeo-Persian + jrb: Judeo-Arabic + jut: Jutish + jv: Javanese + ka: Georgian + kaa: Kara-Kalpak + kab: Kabyle + kac: Kachin + kaj: Jju + kam: Kamba + kaw: Kawi + kbd: Kabardian + kbl: Kanembu + kcg: Tyap + kde: Makonde + kea: Kabuverdianu + ken: Kenyang + kfo: Koro + kg: Kongo + kgp: Kaingang + kha: Khasi + kho: Khotanese + khq: Koyra Chiini + khw: Khowar + ki: Kikuyu + kiu: Kirmanjki + kj: Kuanyama + kk: Kazakh + kkj: Kako + kl: Kalaallisut + kln: Kalenjin + km: Khmer + kmb: Kimbundu + kn: Kannada + ko: Korean + koi: Komi-Permyak + kok: Konkani + kos: Kosraean + kpe: Kpelle + kr: Kanuri + krc: Karachay-Balkar + kri: Krio + krj: Kinaray-a + krl: Karelian + kru: Kurukh + ks: Kashmiri + ksb: Shambala + ksf: Bafia + ksh: Colognian + ku: Kurdish + kum: Kumyk + kut: Kutenai + kv: Komi + kw: Cornish + ky: Kyrgyz + ky-alt-variant: Kirghiz + la: Latin + lad: Ladino + lag: Langi + lah: Lahnda + lam: Lamba + lb: Luxembourgish + lez: Lezghian + lfn: Lingua Franca Nova + lg: Ganda + li: Limburgish + lij: Ligurian + liv: Livonian + lkt: Lakota + lmo: Lombard + ln: Lingala + lo: Lao + lol: Mongo + loz: Lozi + lrc: Northern Luri + lt: Lithuanian + ltg: Latgalian + lu: Luba-Katanga + lua: Luba-Lulua + lui: Luiseno + lun: Lunda + luo: Luo + lus: Mizo + luy: Luyia + lv: Latvian + lzh: Literary Chinese + lzz: Laz + mad: Madurese + maf: Mafa + mag: Magahi + mai: Maithili + mak: Makasar + man: Mandingo + mas: Masai + mde: Maba + mdf: Moksha + mdr: Mandar + men: Mende + mer: Meru + mfe: Morisyen + mg: Malagasy + mga: Middle Irish + mgh: Makhuwa-Meetto + mgo: Metaʼ + mh: Marshallese + mi: Maori + mic: Mi'kmaq + min: Minangkabau + mk: Macedonian + ml: Malayalam + mn: Mongolian + mnc: Manchu + mni: Manipuri + moh: Mohawk + mos: Mossi + mr: Marathi + mrj: Western Mari + ms: Malay + mt: Maltese + mua: Mundang + mul: Multiple languages + mus: Creek + mwl: Mirandese + mwr: Marwari + mwv: Mentawai + my: Burmese + my-alt-variant: Myanmar Language + mye: Myene + myv: Erzya + mzn: Mazanderani + na: Nauru + nan: Min Nan Chinese + nap: Neapolitan + naq: Nama + nb: Norwegian Bokmål + nd: North Ndebele + nds: Low German + nds-NL: Low Saxon + ne: Nepali + new: Newari + ng: Ndonga + nia: Nias + niu: Niuean + njo: Ao Naga + nl: Dutch + nl-BE: Flemish + nmg: Kwasio + nn: Norwegian Nynorsk + nnh: Ngiemboon + 'no': Norwegian + nog: Nogai + non: Old Norse + nov: Novial + nqo: N’Ko + nr: South Ndebele + nso: Northern Sotho + nus: Nuer + nv: Navajo + nwc: Classical Newari + ny: Nyanja + nym: Nyamwezi + nyn: Nyankole + nyo: Nyoro + nzi: Nzima + oc: Occitan + oj: Ojibwa + om: Oromo + or: Odia + os: Ossetic + osa: Osage + ota: Ottoman Turkish + pa: Punjabi + pag: Pangasinan + pal: Pahlavi + pam: Pampanga + pap: Papiamento + pau: Palauan + pcd: Picard + pcm: Nigerian Pidgin + pdc: Pennsylvania German + pdt: Plautdietsch + peo: Old Persian + pfl: Palatine German + phn: Phoenician + pi: Pali + pl: Polish + pms: Piedmontese + pnt: Pontic + pon: Pohnpeian + prg: Prussian + pro: Old Provençal + ps: Pashto + ps-alt-variant: Pushto + pt: Portuguese + pt-BR: Brazilian Portuguese + pt-PT: European Portuguese + qu: Quechua + quc: Kʼicheʼ + qug: Chimborazo Highland Quichua + raj: Rajasthani + rap: Rapanui + rar: Rarotongan + rgn: Romagnol + rif: Riffian + rm: Romansh + rn: Rundi + ro: Romanian + ro-MD: Moldavian + rof: Rombo + rom: Romany + root: Root + rtm: Rotuman + ru: Russian + rue: Rusyn + rug: Roviana + rup: Aromanian + rw: Kinyarwanda + rwk: Rwa + sa: Sanskrit + sad: Sandawe + sah: Sakha + sam: Samaritan Aramaic + saq: Samburu + sas: Sasak + sat: Santali + saz: Saurashtra + sba: Ngambay + sbp: Sangu + sc: Sardinian + scn: Sicilian + sco: Scots + sd: Sindhi + sdc: Sassarese Sardinian + sdh: Southern Kurdish + se: Northern Sami + see: Seneca + seh: Sena + sei: Seri + sel: Selkup + ses: Koyraboro Senni + sg: Sango + sga: Old Irish + sgs: Samogitian + sh: Serbo-Croatian + shi: Tachelhit + shn: Shan + shu: Chadian Arabic + si: Sinhala + sid: Sidamo + sk: Slovak + sl: Slovenian + sli: Lower Silesian + sly: Selayar + sm: Samoan + sma: Southern Sami + smj: Lule Sami + smn: Inari Sami + sms: Skolt Sami + sn: Shona + snk: Soninke + so: Somali + sog: Sogdien + sq: Albanian + sr: Serbian + srn: Sranan Tongo + srr: Serer + ss: Swati + ssy: Saho + st: Southern Sotho + stq: Saterland Frisian + su: Sundanese + suk: Sukuma + sus: Susu + sux: Sumerian + sv: Swedish + sw: Swahili + sw-CD: Congo Swahili + swb: Comorian + syc: Classical Syriac + syr: Syriac + szl: Silesian + ta: Tamil + tcy: Tulu + te: Telugu + tem: Timne + teo: Teso + ter: Tereno + tet: Tetum + tg: Tajik + th: Thai + ti: Tigrinya + tig: Tigre + tiv: Tiv + tk: Turkmen + tkl: Tokelau + tkr: Tsakhur + tl: Tagalog + tlh: Klingon + tli: Tlingit + tly: Talysh + tmh: Tamashek + tn: Tswana + to: Tongan + tog: Nyasa Tonga + tpi: Tok Pisin + tr: Turkish + tru: Turoyo + trv: Taroko + ts: Tsonga + tsd: Tsakonian + tsi: Tsimshian + tt: Tatar + ttt: Muslim Tat + tum: Tumbuka + tvl: Tuvalu + tw: Twi + twq: Tasawaq + ty: Tahitian + tyv: Tuvinian + tzm: Central Atlas Tamazight + udm: Udmurt + ug: Uyghur + ug-alt-variant: Uighur + uga: Ugaritic + uk: Ukrainian + umb: Umbundu + und: Unknown language + ur: Urdu + uz: Uzbek + vai: Vai + ve: Venda + vec: Venetian + vep: Veps + vi: Vietnamese + vls: West Flemish + vmf: Main-Franconian + vo: Volapük + vot: Votic + vro: Võro + vun: Vunjo + wa: Walloon + wae: Walser + wal: Wolaytta + war: Waray + was: Washo + wbp: Warlpiri + wo: Wolof + wuu: Wu Chinese + xal: Kalmyk + xh: Xhosa + xmf: Mingrelian + xog: Soga + yao: Yao + yap: Yapese + yav: Yangben + ybb: Yemba + yi: Yiddish + yo: Yoruba + yrl: Nheengatu + yue: Cantonese + za: Zhuang + zap: Zapotec + zbl: Blissymbols + zea: Zeelandic + zen: Zenaga + zgh: Standard Moroccan Tamazight + zh: Chinese + zh-alt-long: Mandarin Chinese + zh-Hans: Simplified Chinese + zh-Hant: Traditional Chinese + zu: Zulu + zun: Zuni + zxx: No linguistic content + zza: Zaza diff --git a/features/contact_us.feature b/features/contact_us.feature index da16ae8..de6ec6b 100644 --- a/features/contact_us.feature +++ b/features/contact_us.feature @@ -13,7 +13,7 @@ Feature: Contact Us And select 'Something about the website' And enter a subject as 'My Contact Subject' And enter a message as 'My contact message' - And press 'Send' + And press send Then I should be on the contact_sent page And I should see 'Thank you for contacting us' @@ -31,7 +31,7 @@ Feature: Contact Us And select 'Something about the website' And enter a subject as 'My Contact Subject' And enter a message as 'My contact message' - And press 'Send' + And press send Then I should be on the contact_sent page And I should see 'Thank you for contacting us' diff --git a/features/step_definitions/interface_steps.rb b/features/step_definitions/interface_steps.rb index 18f1991..86b86cb 100644 --- a/features/step_definitions/interface_steps.rb +++ b/features/step_definitions/interface_steps.rb @@ -88,6 +88,7 @@ Then /^(?:I )?enter (?:my |an? |some |the )?(.+?)(?: as '(.+)')?$/i do |field, v sel = selector_for(field) element = first(sel, visible: true) || first(sel, visible: false) + element = element.first('[contenteditable]') if element.tag_name.to_s.downcase == 'div' unless value.present? value = case field diff --git a/features/support/env.rb b/features/support/env.rb index 39e1252..8265f30 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -11,7 +11,7 @@ DatabaseCleaner.strategy = :truncation, { except: %w[cities city_cache] } Capybara.register_driver :bb_poltergeist do |app| if ENV['CSS_TEST'] Marmara.options = { - ignore: [/paypal\./], + ignore: [/paypal(?:objects)?/, 'assets.css'], rewrite: { from: /^.*\/(.*?)\/.*?\.css$/, to: '\1.css' diff --git a/features/support/location_cache.yml b/features/support/location_cache.yml index d6e65a6..9badcd9 100644 --- a/features/support/location_cache.yml +++ b/features/support/location_cache.yml @@ -49,3 +49,455 @@ Brooklyn NY: !ruby/object:Geocoder::Result::Google - sublocality - sublocality_level_1 cache_hit: +Yellowknife: !ruby/object:Geocoder::Result::Google + data: + address_components: + - long_name: Yellowknife + short_name: Yellowknife + types: + - locality + - political + - long_name: Fort Smith, Unorganized + short_name: Fort Smith, Unorganized + types: + - administrative_area_level_3 + - political + - long_name: Fort Smith Region + short_name: Fort Smith Region + types: + - administrative_area_level_2 + - political + - long_name: Northwest Territories + short_name: NT + types: + - administrative_area_level_1 + - political + - long_name: Canada + short_name: CA + types: + - country + - political + - long_name: X0E + short_name: X0E + types: + - postal_code + - postal_code_prefix + formatted_address: Yellowknife, NT X0E, Canada + geometry: + bounds: + northeast: + lat: 62.5412576 + lng: -114.299678 + southwest: + lat: 62.4084661 + lng: -114.518312 + location: + lat: 62.4539717 + lng: -114.3717886 + location_type: APPROXIMATE + viewport: + northeast: + lat: 62.5412577 + lng: -114.299678 + southwest: + lat: 62.4084945 + lng: -114.518312 + place_id: ChIJyYJGoyzx0VMRge9xQyQ3wbQ + types: + - locality + - political + cache_hit: +New Orleans: !ruby/object:Geocoder::Result::Google + data: + address_components: + - long_name: New Orleans + short_name: New Orleans + types: + - locality + - political + - long_name: Orleans Parish + short_name: Orleans Parish + types: + - administrative_area_level_2 + - political + - long_name: Louisiana + short_name: LA + types: + - administrative_area_level_1 + - political + - long_name: United States + short_name: US + types: + - country + - political + formatted_address: New Orleans, LA, USA + geometry: + bounds: + northeast: + lat: 30.199332 + lng: -89.625053 + southwest: + lat: 29.8666609 + lng: -90.14007389999999 + location: + lat: 29.95106579999999 + lng: -90.0715323 + location_type: APPROXIMATE + viewport: + northeast: + lat: 30.1748625 + lng: -89.6269311 + southwest: + lat: 29.86842459999999 + lng: -90.1380099 + place_id: ChIJZYIRslSkIIYRtNMiXuhbBts + types: + - locality + - political + cache_hit: +Drumheller AB: !ruby/object:Geocoder::Result::Google + data: + address_components: + - long_name: Drumheller + short_name: Drumheller + types: + - locality + - political + - long_name: Division No. 5 + short_name: Division No. 5 + types: + - administrative_area_level_2 + - political + - long_name: Alberta + short_name: AB + types: + - administrative_area_level_1 + - political + - long_name: Canada + short_name: CA + types: + - country + - political + formatted_address: Drumheller, AB, Canada + geometry: + bounds: + northeast: + lat: 51.488701 + lng: -112.4530051 + southwest: + lat: 51.3208389 + lng: -112.806076 + location: + lat: 51.4651847 + lng: -112.7105343 + location_type: APPROXIMATE + viewport: + northeast: + lat: 51.488701 + lng: -112.4530051 + southwest: + lat: 51.3208389 + lng: -112.806076 + place_id: ChIJHx_0B4ANc1MRWZCRwItZUUw + types: + - locality + - political + cache_hit: +Portland OR: !ruby/object:Geocoder::Result::Google + data: + address_components: + - long_name: Portland + short_name: Portland + types: + - locality + - political + - long_name: Multnomah County + short_name: Multnomah County + types: + - administrative_area_level_2 + - political + - long_name: Oregon + short_name: OR + types: + - administrative_area_level_1 + - political + - long_name: United States + short_name: US + types: + - country + - political + formatted_address: Portland, OR, USA + geometry: + bounds: + northeast: + lat: 45.654424 + lng: -122.4718489 + southwest: + lat: 45.432393 + lng: -122.8369952 + location: + lat: 45.5230622 + lng: -122.6764816 + location_type: APPROXIMATE + viewport: + northeast: + lat: 45.6524799 + lng: -122.4718489 + southwest: + lat: 45.432393 + lng: -122.8369952 + place_id: ChIJJ3SpfQsLlVQRkYXR9ua5Nhw + types: + - locality + - political + cache_hit: +Prince Rupert BC: !ruby/object:Geocoder::Result::Google + data: + address_components: + - long_name: Prince Rupert + short_name: Prince Rupert + types: + - locality + - political + - long_name: Skeena-Queen Charlotte + short_name: Skeena-Queen Charlotte + types: + - administrative_area_level_2 + - political + - long_name: British Columbia + short_name: BC + types: + - administrative_area_level_1 + - political + - long_name: Canada + short_name: CA + types: + - country + - political + formatted_address: Prince Rupert, BC, Canada + geometry: + bounds: + northeast: + lat: 54.338083 + lng: -130.2437961 + southwest: + lat: 54.19392 + lng: -130.3634291 + location: + lat: 54.3150367 + lng: -130.3208187 + location_type: APPROXIMATE + viewport: + northeast: + lat: 54.3343706 + lng: -130.2478032 + southwest: + lat: 54.202669 + lng: -130.3608029 + place_id: ChIJaUV_axPVclQRElbZTQ_jB3E + types: + - locality + - political + cache_hit: +Regina, SK: !ruby/object:Geocoder::Result::Google + data: + address_components: + - long_name: Regina + short_name: Regina + types: + - locality + - political + - long_name: Sherwood No. 159 + short_name: Sherwood No. 159 + types: + - administrative_area_level_3 + - political + - long_name: Division No. 6 + short_name: Division No. 6 + types: + - administrative_area_level_2 + - political + - long_name: Saskatchewan + short_name: SK + types: + - administrative_area_level_1 + - political + - long_name: Canada + short_name: CA + types: + - country + - political + formatted_address: Regina, SK, Canada + geometry: + bounds: + northeast: + lat: 50.5207396 + lng: -104.4924259 + southwest: + lat: 50.3964489 + lng: -104.7783923 + location: + lat: 50.4452112 + lng: -104.6188944 + location_type: APPROXIMATE + viewport: + northeast: + lat: 50.5207396 + lng: -104.4924259 + southwest: + lat: 50.3964489 + lng: -104.7783923 + place_id: ChIJ6z2l-0AeHFMRsVR7t5YySjU + types: + - locality + - political + cache_hit: +Edmundston, NB: !ruby/object:Geocoder::Result::Google + data: + address_components: + - long_name: Edmundston + short_name: Edmundston + types: + - locality + - political + - long_name: Madawaska County + short_name: Madawaska County + types: + - administrative_area_level_2 + - political + - long_name: New Brunswick + short_name: NB + types: + - administrative_area_level_1 + - political + - long_name: Canada + short_name: CA + types: + - country + - political + formatted_address: Edmundston, NB, Canada + geometry: + bounds: + northeast: + lat: 47.456634 + lng: -68.14554509999999 + southwest: + lat: 47.3177789 + lng: -68.44122399999999 + location: + lat: 47.3690127 + lng: -68.32667409999999 + location_type: APPROXIMATE + viewport: + northeast: + lat: 47.456634 + lng: -68.14554509999999 + southwest: + lat: 47.3183866 + lng: -68.44122399999999 + place_id: ChIJuQPKxpipvUwRtNjzmeech34 + types: + - locality + - political + cache_hit: +Souris, MB: !ruby/object:Geocoder::Result::Google + data: + address_components: + - long_name: Souris + short_name: Souris + types: + - locality + - political + - long_name: Glenwood + short_name: Glenwood + types: + - administrative_area_level_3 + - political + - long_name: Division No. 7 + short_name: Division No. 7 + types: + - administrative_area_level_2 + - political + - long_name: Manitoba + short_name: MB + types: + - administrative_area_level_1 + - political + - long_name: Canada + short_name: CA + types: + - country + - political + - long_name: R0K + short_name: R0K + types: + - postal_code + - postal_code_prefix + formatted_address: Souris, MB R0K, Canada + geometry: + bounds: + northeast: + lat: 49.6272052 + lng: -100.2464522 + southwest: + lat: 49.6061908 + lng: -100.2774639 + location: + lat: 49.6207985 + lng: -100.2583026 + location_type: APPROXIMATE + viewport: + northeast: + lat: 49.6272052 + lng: -100.2464522 + southwest: + lat: 49.6061908 + lng: -100.2774639 + place_id: ChIJjVrTVVh851IRLuGKzGdiUj8 + types: + - locality + - political + cache_hit: +Eldorado, MX: !ruby/object:Geocoder::Result::Google + data: + address_components: + - long_name: Eldorado + short_name: Eldorado + types: + - locality + - political + - long_name: Sinaloa + short_name: Sin. + types: + - administrative_area_level_1 + - political + - long_name: Mexico + short_name: MX + types: + - country + - political + formatted_address: Eldorado, Sin., Mexico + geometry: + bounds: + northeast: + lat: 24.3379838 + lng: -107.3476352 + southwest: + lat: 24.3108689 + lng: -107.3831387 + location: + lat: 24.3240714 + lng: -107.3584174 + location_type: APPROXIMATE + viewport: + northeast: + lat: 24.3379838 + lng: -107.3476352 + southwest: + lat: 24.3108689 + lng: -107.3831387 + place_id: ChIJv33Pqm0ho4YRUQ45wKAluZ4 + types: + - locality + - political + cache_hit: diff --git a/features/workshops.feature b/features/workshops.feature index 0a79960..79c91ef 100644 --- a/features/workshops.feature +++ b/features/workshops.feature @@ -320,4 +320,4 @@ Feature: Workshops And click the 'Reply' button Then I should see 'If we can find a Canadian facilitator' - And 'Geronimo' should get a 'replied' email \ No newline at end of file + And 'Geronimo' should get a 'replied' email diff --git a/vendor/assets/javascripts/quill.js b/vendor/assets/javascripts/quill.js new file mode 100644 index 0000000..8d2f87e --- /dev/null +++ b/vendor/assets/javascripts/quill.js @@ -0,0 +1,10576 @@ +/*! + * Quill Editor v1.1.9 + * https://quilljs.com/ + * Copyright (c) 2014, Jason Chen + * Copyright (c) 2013, salesforce.com + */ +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(); + else if(typeof define === 'function' && define.amd) + define([], factory); + else if(typeof exports === 'object') + exports["Quill"] = factory(); + else + root["Quill"] = factory(); +})(this, function() { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; + +/******/ // The require function +/******/ function __webpack_require__(moduleId) { + +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) +/******/ return installedModules[moduleId].exports; + +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; + +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); + +/******/ // Flag the module as loaded +/******/ module.loaded = true; + +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } + + +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; + +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; + +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; + +/******/ // Load entry module and return exports +/******/ return __webpack_require__(0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ function(module, exports, __webpack_require__) { + + module.exports = __webpack_require__(53); + + +/***/ }, +/* 1 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _parchment = __webpack_require__(2); + + var _parchment2 = _interopRequireDefault(_parchment); + + var _quill = __webpack_require__(18); + + var _quill2 = _interopRequireDefault(_quill); + + var _block = __webpack_require__(29); + + var _block2 = _interopRequireDefault(_block); + + var _break = __webpack_require__(30); + + var _break2 = _interopRequireDefault(_break); + + var _container = __webpack_require__(42); + + var _container2 = _interopRequireDefault(_container); + + var _cursor = __webpack_require__(34); + + var _cursor2 = _interopRequireDefault(_cursor); + + var _embed = __webpack_require__(31); + + var _embed2 = _interopRequireDefault(_embed); + + var _inline = __webpack_require__(32); + + var _inline2 = _interopRequireDefault(_inline); + + var _scroll = __webpack_require__(43); + + var _scroll2 = _interopRequireDefault(_scroll); + + var _text = __webpack_require__(33); + + var _text2 = _interopRequireDefault(_text); + + var _clipboard = __webpack_require__(44); + + var _clipboard2 = _interopRequireDefault(_clipboard); + + var _history = __webpack_require__(51); + + var _history2 = _interopRequireDefault(_history); + + var _keyboard = __webpack_require__(52); + + var _keyboard2 = _interopRequireDefault(_keyboard); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + _quill2.default.register({ + 'blots/block': _block2.default, + 'blots/block/embed': _block.BlockEmbed, + 'blots/break': _break2.default, + 'blots/container': _container2.default, + 'blots/cursor': _cursor2.default, + 'blots/embed': _embed2.default, + 'blots/inline': _inline2.default, + 'blots/scroll': _scroll2.default, + 'blots/text': _text2.default, + + 'modules/clipboard': _clipboard2.default, + 'modules/history': _history2.default, + 'modules/keyboard': _keyboard2.default + }); + + _parchment2.default.register(_block2.default, _break2.default, _cursor2.default, _inline2.default, _scroll2.default, _text2.default); + + module.exports = _quill2.default; + +/***/ }, +/* 2 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + var container_1 = __webpack_require__(3); + var format_1 = __webpack_require__(7); + var leaf_1 = __webpack_require__(12); + var scroll_1 = __webpack_require__(13); + var inline_1 = __webpack_require__(14); + var block_1 = __webpack_require__(15); + var embed_1 = __webpack_require__(16); + var text_1 = __webpack_require__(17); + var attributor_1 = __webpack_require__(8); + var class_1 = __webpack_require__(10); + var style_1 = __webpack_require__(11); + var store_1 = __webpack_require__(9); + var Registry = __webpack_require__(6); + var Parchment = { + Scope: Registry.Scope, + create: Registry.create, + find: Registry.find, + query: Registry.query, + register: Registry.register, + Container: container_1.default, + Format: format_1.default, + Leaf: leaf_1.default, + Embed: embed_1.default, + Scroll: scroll_1.default, + Block: block_1.default, + Inline: inline_1.default, + Text: text_1.default, + Attributor: { + Attribute: attributor_1.default, + Class: class_1.default, + Style: style_1.default, + Store: store_1.default + } + }; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.default = Parchment; + + +/***/ }, +/* 3 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + var linked_list_1 = __webpack_require__(4); + var shadow_1 = __webpack_require__(5); + var Registry = __webpack_require__(6); + var ContainerBlot = (function (_super) { + __extends(ContainerBlot, _super); + function ContainerBlot() { + return _super.apply(this, arguments) || this; + } + ContainerBlot.prototype.appendChild = function (other) { + this.insertBefore(other); + }; + ContainerBlot.prototype.attach = function () { + var _this = this; + _super.prototype.attach.call(this); + this.children = new linked_list_1.default(); + // Need to be reversed for if DOM nodes already in order + [].slice.call(this.domNode.childNodes).reverse().forEach(function (node) { + try { + var child = makeBlot(node); + _this.insertBefore(child, _this.children.head); + } + catch (err) { + if (err instanceof Registry.ParchmentError) + return; + else + throw err; + } + }); + }; + ContainerBlot.prototype.deleteAt = function (index, length) { + if (index === 0 && length === this.length()) { + return this.remove(); + } + this.children.forEachAt(index, length, function (child, offset, length) { + child.deleteAt(offset, length); + }); + }; + ContainerBlot.prototype.descendant = function (criteria, index) { + var _a = this.children.find(index), child = _a[0], offset = _a[1]; + if ((criteria.blotName == null && criteria(child)) || + (criteria.blotName != null && child instanceof criteria)) { + return [child, offset]; + } + else if (child instanceof ContainerBlot) { + return child.descendant(criteria, offset); + } + else { + return [null, -1]; + } + }; + ContainerBlot.prototype.descendants = function (criteria, index, length) { + if (index === void 0) { index = 0; } + if (length === void 0) { length = Number.MAX_VALUE; } + var descendants = [], lengthLeft = length; + this.children.forEachAt(index, length, function (child, index, length) { + if ((criteria.blotName == null && criteria(child)) || + (criteria.blotName != null && child instanceof criteria)) { + descendants.push(child); + } + if (child instanceof ContainerBlot) { + descendants = descendants.concat(child.descendants(criteria, index, lengthLeft)); + } + lengthLeft -= length; + }); + return descendants; + }; + ContainerBlot.prototype.detach = function () { + this.children.forEach(function (child) { + child.detach(); + }); + _super.prototype.detach.call(this); + }; + ContainerBlot.prototype.formatAt = function (index, length, name, value) { + this.children.forEachAt(index, length, function (child, offset, length) { + child.formatAt(offset, length, name, value); + }); + }; + ContainerBlot.prototype.insertAt = function (index, value, def) { + var _a = this.children.find(index), child = _a[0], offset = _a[1]; + if (child) { + child.insertAt(offset, value, def); + } + else { + var blot = (def == null) ? Registry.create('text', value) : Registry.create(value, def); + this.appendChild(blot); + } + }; + ContainerBlot.prototype.insertBefore = function (childBlot, refBlot) { + if (this.statics.allowedChildren != null && !this.statics.allowedChildren.some(function (child) { + return childBlot instanceof child; + })) { + throw new Registry.ParchmentError("Cannot insert " + childBlot.statics.blotName + " into " + this.statics.blotName); + } + childBlot.insertInto(this, refBlot); + }; + ContainerBlot.prototype.length = function () { + return this.children.reduce(function (memo, child) { + return memo + child.length(); + }, 0); + }; + ContainerBlot.prototype.moveChildren = function (targetParent, refNode) { + this.children.forEach(function (child) { + targetParent.insertBefore(child, refNode); + }); + }; + ContainerBlot.prototype.optimize = function () { + _super.prototype.optimize.call(this); + if (this.children.length === 0) { + if (this.statics.defaultChild != null) { + var child = Registry.create(this.statics.defaultChild); + this.appendChild(child); + child.optimize(); + } + else { + this.remove(); + } + } + }; + ContainerBlot.prototype.path = function (index, inclusive) { + if (inclusive === void 0) { inclusive = false; } + var _a = this.children.find(index, inclusive), child = _a[0], offset = _a[1]; + var position = [[this, index]]; + if (child instanceof ContainerBlot) { + return position.concat(child.path(offset, inclusive)); + } + else if (child != null) { + position.push([child, offset]); + } + return position; + }; + ContainerBlot.prototype.removeChild = function (child) { + this.children.remove(child); + }; + ContainerBlot.prototype.replace = function (target) { + if (target instanceof ContainerBlot) { + target.moveChildren(this); + } + _super.prototype.replace.call(this, target); + }; + ContainerBlot.prototype.split = function (index, force) { + if (force === void 0) { force = false; } + if (!force) { + if (index === 0) + return this; + if (index === this.length()) + return this.next; + } + var after = this.clone(); + this.parent.insertBefore(after, this.next); + this.children.forEachAt(index, this.length(), function (child, offset, length) { + child = child.split(offset, force); + after.appendChild(child); + }); + return after; + }; + ContainerBlot.prototype.unwrap = function () { + this.moveChildren(this.parent, this.next); + this.remove(); + }; + ContainerBlot.prototype.update = function (mutations) { + var _this = this; + var addedNodes = [], removedNodes = []; + mutations.forEach(function (mutation) { + if (mutation.target === _this.domNode && mutation.type === 'childList') { + addedNodes.push.apply(addedNodes, mutation.addedNodes); + removedNodes.push.apply(removedNodes, mutation.removedNodes); + } + }); + removedNodes.forEach(function (node) { + // Check node has actually been removed + // One exception is Chrome does not immediately remove IFRAMEs + // from DOM but MutationRecord is correct in its reported removal + if (node.parentNode != null && node.tagName !== 'IFRAME' && + (document.body.compareDocumentPosition(node) & Node.DOCUMENT_POSITION_CONTAINED_BY)) { + return; + } + var blot = Registry.find(node); + if (blot == null) + return; + if (blot.domNode.parentNode == null || blot.domNode.parentNode === _this.domNode) { + blot.detach(); + } + }); + addedNodes.filter(function (node) { + return node.parentNode == _this.domNode; + }).sort(function (a, b) { + if (a === b) + return 0; + if (a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING) { + return 1; + } + return -1; + }).forEach(function (node) { + var refBlot = null; + if (node.nextSibling != null) { + refBlot = Registry.find(node.nextSibling); + } + var blot = makeBlot(node); + if (blot.next != refBlot || blot.next == null) { + if (blot.parent != null) { + blot.parent.removeChild(_this); + } + _this.insertBefore(blot, refBlot); + } + }); + }; + return ContainerBlot; + }(shadow_1.default)); + function makeBlot(node) { + var blot = Registry.find(node); + if (blot == null) { + try { + blot = Registry.create(node); + } + catch (e) { + blot = Registry.create(Registry.Scope.INLINE); + [].slice.call(node.childNodes).forEach(function (child) { + blot.domNode.appendChild(child); + }); + node.parentNode.replaceChild(blot.domNode, node); + blot.attach(); + } + } + return blot; + } + Object.defineProperty(exports, "__esModule", { value: true }); + exports.default = ContainerBlot; + + +/***/ }, +/* 4 */ +/***/ function(module, exports) { + + "use strict"; + var LinkedList = (function () { + function LinkedList() { + this.head = this.tail = undefined; + this.length = 0; + } + LinkedList.prototype.append = function () { + var nodes = []; + for (var _i = 0; _i < arguments.length; _i++) { + nodes[_i] = arguments[_i]; + } + this.insertBefore(nodes[0], undefined); + if (nodes.length > 1) { + this.append.apply(this, nodes.slice(1)); + } + }; + LinkedList.prototype.contains = function (node) { + var cur, next = this.iterator(); + while (cur = next()) { + if (cur === node) + return true; + } + return false; + }; + LinkedList.prototype.insertBefore = function (node, refNode) { + node.next = refNode; + if (refNode != null) { + node.prev = refNode.prev; + if (refNode.prev != null) { + refNode.prev.next = node; + } + refNode.prev = node; + if (refNode === this.head) { + this.head = node; + } + } + else if (this.tail != null) { + this.tail.next = node; + node.prev = this.tail; + this.tail = node; + } + else { + node.prev = undefined; + this.head = this.tail = node; + } + this.length += 1; + }; + LinkedList.prototype.offset = function (target) { + var index = 0, cur = this.head; + while (cur != null) { + if (cur === target) + return index; + index += cur.length(); + cur = cur.next; + } + return -1; + }; + LinkedList.prototype.remove = function (node) { + if (!this.contains(node)) + return; + if (node.prev != null) + node.prev.next = node.next; + if (node.next != null) + node.next.prev = node.prev; + if (node === this.head) + this.head = node.next; + if (node === this.tail) + this.tail = node.prev; + this.length -= 1; + }; + LinkedList.prototype.iterator = function (curNode) { + if (curNode === void 0) { curNode = this.head; } + // TODO use yield when we can + return function () { + var ret = curNode; + if (curNode != null) + curNode = curNode.next; + return ret; + }; + }; + LinkedList.prototype.find = function (index, inclusive) { + if (inclusive === void 0) { inclusive = false; } + var cur, next = this.iterator(); + while (cur = next()) { + var length_1 = cur.length(); + if (index < length_1 || (inclusive && index === length_1 && (cur.next == null || cur.next.length() !== 0))) { + return [cur, index]; + } + index -= length_1; + } + return [null, 0]; + }; + LinkedList.prototype.forEach = function (callback) { + var cur, next = this.iterator(); + while (cur = next()) { + callback(cur); + } + }; + LinkedList.prototype.forEachAt = function (index, length, callback) { + if (length <= 0) + return; + var _a = this.find(index), startNode = _a[0], offset = _a[1]; + var cur, curIndex = index - offset, next = this.iterator(startNode); + while ((cur = next()) && curIndex < index + length) { + var curLength = cur.length(); + if (index > curIndex) { + callback(cur, index - curIndex, Math.min(length, curIndex + curLength - index)); + } + else { + callback(cur, 0, Math.min(curLength, index + length - curIndex)); + } + curIndex += curLength; + } + }; + LinkedList.prototype.map = function (callback) { + return this.reduce(function (memo, cur) { + memo.push(callback(cur)); + return memo; + }, []); + }; + LinkedList.prototype.reduce = function (callback, memo) { + var cur, next = this.iterator(); + while (cur = next()) { + memo = callback(memo, cur); + } + return memo; + }; + return LinkedList; + }()); + Object.defineProperty(exports, "__esModule", { value: true }); + exports.default = LinkedList; + + +/***/ }, +/* 5 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + var Registry = __webpack_require__(6); + var ShadowBlot = (function () { + function ShadowBlot(domNode) { + this.domNode = domNode; + this.attach(); + } + Object.defineProperty(ShadowBlot.prototype, "statics", { + // Hack for accessing inherited static methods + get: function () { + return this.constructor; + }, + enumerable: true, + configurable: true + }); + ShadowBlot.create = function (value) { + if (this.tagName == null) { + throw new Registry.ParchmentError('Blot definition missing tagName'); + } + var node; + if (Array.isArray(this.tagName)) { + if (typeof value === 'string') { + value = value.toUpperCase(); + if (parseInt(value).toString() === value) { + value = parseInt(value); + } + } + if (typeof value === 'number') { + node = document.createElement(this.tagName[value - 1]); + } + else if (this.tagName.indexOf(value) > -1) { + node = document.createElement(value); + } + else { + node = document.createElement(this.tagName[0]); + } + } + else { + node = document.createElement(this.tagName); + } + if (this.className) { + node.classList.add(this.className); + } + return node; + }; + ShadowBlot.prototype.attach = function () { + this.domNode[Registry.DATA_KEY] = { blot: this }; + }; + ShadowBlot.prototype.clone = function () { + var domNode = this.domNode.cloneNode(); + return Registry.create(domNode); + }; + ShadowBlot.prototype.detach = function () { + if (this.parent != null) + this.parent.removeChild(this); + delete this.domNode[Registry.DATA_KEY]; + }; + ShadowBlot.prototype.deleteAt = function (index, length) { + var blot = this.isolate(index, length); + blot.remove(); + }; + ShadowBlot.prototype.formatAt = function (index, length, name, value) { + var blot = this.isolate(index, length); + if (Registry.query(name, Registry.Scope.BLOT) != null && value) { + blot.wrap(name, value); + } + else if (Registry.query(name, Registry.Scope.ATTRIBUTE) != null) { + var parent_1 = Registry.create(this.statics.scope); + blot.wrap(parent_1); + parent_1.format(name, value); + } + }; + ShadowBlot.prototype.insertAt = function (index, value, def) { + var blot = (def == null) ? Registry.create('text', value) : Registry.create(value, def); + var ref = this.split(index); + this.parent.insertBefore(blot, ref); + }; + ShadowBlot.prototype.insertInto = function (parentBlot, refBlot) { + if (this.parent != null) { + this.parent.children.remove(this); + } + parentBlot.children.insertBefore(this, refBlot); + if (refBlot != null) { + var refDomNode = refBlot.domNode; + } + if (this.next == null || this.domNode.nextSibling != refDomNode) { + parentBlot.domNode.insertBefore(this.domNode, (typeof refDomNode !== 'undefined') ? refDomNode : null); + } + this.parent = parentBlot; + }; + ShadowBlot.prototype.isolate = function (index, length) { + var target = this.split(index); + target.split(length); + return target; + }; + ShadowBlot.prototype.length = function () { + return 1; + }; + ; + ShadowBlot.prototype.offset = function (root) { + if (root === void 0) { root = this.parent; } + if (this.parent == null || this == root) + return 0; + return this.parent.children.offset(this) + this.parent.offset(root); + }; + ShadowBlot.prototype.optimize = function () { + // TODO clean up once we use WeakMap + if (this.domNode[Registry.DATA_KEY] != null) { + delete this.domNode[Registry.DATA_KEY].mutations; + } + }; + ShadowBlot.prototype.remove = function () { + if (this.domNode.parentNode != null) { + this.domNode.parentNode.removeChild(this.domNode); + } + this.detach(); + }; + ShadowBlot.prototype.replace = function (target) { + if (target.parent == null) + return; + target.parent.insertBefore(this, target.next); + target.remove(); + }; + ShadowBlot.prototype.replaceWith = function (name, value) { + var replacement = typeof name === 'string' ? Registry.create(name, value) : name; + replacement.replace(this); + return replacement; + }; + ShadowBlot.prototype.split = function (index, force) { + return index === 0 ? this : this.next; + }; + ShadowBlot.prototype.update = function (mutations) { + if (mutations === void 0) { mutations = []; } + // Nothing to do by default + }; + ShadowBlot.prototype.wrap = function (name, value) { + var wrapper = typeof name === 'string' ? Registry.create(name, value) : name; + if (this.parent != null) { + this.parent.insertBefore(wrapper, this.next); + } + wrapper.appendChild(this); + return wrapper; + }; + return ShadowBlot; + }()); + ShadowBlot.blotName = 'abstract'; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.default = ShadowBlot; + + +/***/ }, +/* 6 */ +/***/ function(module, exports) { + + "use strict"; + var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + var ParchmentError = (function (_super) { + __extends(ParchmentError, _super); + function ParchmentError(message) { + var _this; + message = '[Parchment] ' + message; + _this = _super.call(this, message) || this; + _this.message = message; + _this.name = _this.constructor.name; + return _this; + } + return ParchmentError; + }(Error)); + exports.ParchmentError = ParchmentError; + var attributes = {}; + var classes = {}; + var tags = {}; + var types = {}; + exports.DATA_KEY = '__blot'; + var Scope; + (function (Scope) { + Scope[Scope["TYPE"] = 3] = "TYPE"; + Scope[Scope["LEVEL"] = 12] = "LEVEL"; + Scope[Scope["ATTRIBUTE"] = 13] = "ATTRIBUTE"; + Scope[Scope["BLOT"] = 14] = "BLOT"; + Scope[Scope["INLINE"] = 7] = "INLINE"; + Scope[Scope["BLOCK"] = 11] = "BLOCK"; + Scope[Scope["BLOCK_BLOT"] = 10] = "BLOCK_BLOT"; + Scope[Scope["INLINE_BLOT"] = 6] = "INLINE_BLOT"; + Scope[Scope["BLOCK_ATTRIBUTE"] = 9] = "BLOCK_ATTRIBUTE"; + Scope[Scope["INLINE_ATTRIBUTE"] = 5] = "INLINE_ATTRIBUTE"; + Scope[Scope["ANY"] = 15] = "ANY"; + })(Scope = exports.Scope || (exports.Scope = {})); + ; + function create(input, value) { + var match = query(input); + if (match == null) { + throw new ParchmentError("Unable to create " + input + " blot"); + } + var BlotClass = match; + var node = input instanceof Node ? input : BlotClass.create(value); + return new BlotClass(node, value); + } + exports.create = create; + function find(node, bubble) { + if (bubble === void 0) { bubble = false; } + if (node == null) + return null; + if (node[exports.DATA_KEY] != null) + return node[exports.DATA_KEY].blot; + if (bubble) + return find(node.parentNode, bubble); + return null; + } + exports.find = find; + function query(query, scope) { + if (scope === void 0) { scope = Scope.ANY; } + var match; + if (typeof query === 'string') { + match = types[query] || attributes[query]; + } + else if (query instanceof Text) { + match = types['text']; + } + else if (typeof query === 'number') { + if (query & Scope.LEVEL & Scope.BLOCK) { + match = types['block']; + } + else if (query & Scope.LEVEL & Scope.INLINE) { + match = types['inline']; + } + } + else if (query instanceof HTMLElement) { + var names = (query.getAttribute('class') || '').split(/\s+/); + for (var i in names) { + match = classes[names[i]]; + if (match) + break; + } + match = match || tags[query.tagName]; + } + if (match == null) + return null; + if ((scope & Scope.LEVEL & match.scope) && (scope & Scope.TYPE & match.scope)) + return match; + return null; + } + exports.query = query; + function register() { + var Definitions = []; + for (var _i = 0; _i < arguments.length; _i++) { + Definitions[_i] = arguments[_i]; + } + if (Definitions.length > 1) { + return Definitions.map(function (d) { + return register(d); + }); + } + var Definition = Definitions[0]; + if (typeof Definition.blotName !== 'string' && typeof Definition.attrName !== 'string') { + throw new ParchmentError('Invalid definition'); + } + else if (Definition.blotName === 'abstract') { + throw new ParchmentError('Cannot register abstract class'); + } + types[Definition.blotName || Definition.attrName] = Definition; + if (typeof Definition.keyName === 'string') { + attributes[Definition.keyName] = Definition; + } + else { + if (Definition.className != null) { + classes[Definition.className] = Definition; + } + if (Definition.tagName != null) { + if (Array.isArray(Definition.tagName)) { + Definition.tagName = Definition.tagName.map(function (tagName) { + return tagName.toUpperCase(); + }); + } + else { + Definition.tagName = Definition.tagName.toUpperCase(); + } + var tagNames = Array.isArray(Definition.tagName) ? Definition.tagName : [Definition.tagName]; + tagNames.forEach(function (tag) { + if (tags[tag] == null || Definition.className == null) { + tags[tag] = Definition; + } + }); + } + } + return Definition; + } + exports.register = register; + + +/***/ }, +/* 7 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + var attributor_1 = __webpack_require__(8); + var store_1 = __webpack_require__(9); + var container_1 = __webpack_require__(3); + var Registry = __webpack_require__(6); + var FormatBlot = (function (_super) { + __extends(FormatBlot, _super); + function FormatBlot() { + return _super.apply(this, arguments) || this; + } + FormatBlot.formats = function (domNode) { + if (typeof this.tagName === 'string') { + return true; + } + else if (Array.isArray(this.tagName)) { + return domNode.tagName.toLowerCase(); + } + return undefined; + }; + FormatBlot.prototype.attach = function () { + _super.prototype.attach.call(this); + this.attributes = new store_1.default(this.domNode); + }; + FormatBlot.prototype.format = function (name, value) { + var format = Registry.query(name); + if (format instanceof attributor_1.default) { + this.attributes.attribute(format, value); + } + else if (value) { + if (format != null && (name !== this.statics.blotName || this.formats()[name] !== value)) { + this.replaceWith(name, value); + } + } + }; + FormatBlot.prototype.formats = function () { + var formats = this.attributes.values(); + var format = this.statics.formats(this.domNode); + if (format != null) { + formats[this.statics.blotName] = format; + } + return formats; + }; + FormatBlot.prototype.replaceWith = function (name, value) { + var replacement = _super.prototype.replaceWith.call(this, name, value); + this.attributes.copy(replacement); + return replacement; + }; + FormatBlot.prototype.update = function (mutations) { + var _this = this; + _super.prototype.update.call(this, mutations); + if (mutations.some(function (mutation) { + return mutation.target === _this.domNode && mutation.type === 'attributes'; + })) { + this.attributes.build(); + } + }; + FormatBlot.prototype.wrap = function (name, value) { + var wrapper = _super.prototype.wrap.call(this, name, value); + if (wrapper instanceof FormatBlot && wrapper.statics.scope === this.statics.scope) { + this.attributes.move(wrapper); + } + return wrapper; + }; + return FormatBlot; + }(container_1.default)); + Object.defineProperty(exports, "__esModule", { value: true }); + exports.default = FormatBlot; + + +/***/ }, +/* 8 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + var Registry = __webpack_require__(6); + var Attributor = (function () { + function Attributor(attrName, keyName, options) { + if (options === void 0) { options = {}; } + this.attrName = attrName; + this.keyName = keyName; + var attributeBit = Registry.Scope.TYPE & Registry.Scope.ATTRIBUTE; + if (options.scope != null) { + // Ignore type bits, force attribute bit + this.scope = (options.scope & Registry.Scope.LEVEL) | attributeBit; + } + else { + this.scope = Registry.Scope.ATTRIBUTE; + } + if (options.whitelist != null) + this.whitelist = options.whitelist; + } + Attributor.keys = function (node) { + return [].map.call(node.attributes, function (item) { + return item.name; + }); + }; + Attributor.prototype.add = function (node, value) { + if (!this.canAdd(node, value)) + return false; + node.setAttribute(this.keyName, value); + return true; + }; + Attributor.prototype.canAdd = function (node, value) { + var match = Registry.query(node, Registry.Scope.BLOT & (this.scope | Registry.Scope.TYPE)); + if (match != null && (this.whitelist == null || this.whitelist.indexOf(value) > -1)) { + return true; + } + return false; + }; + Attributor.prototype.remove = function (node) { + node.removeAttribute(this.keyName); + }; + Attributor.prototype.value = function (node) { + var value = node.getAttribute(this.keyName); + return this.canAdd(node, value) ? value : ''; + }; + return Attributor; + }()); + Object.defineProperty(exports, "__esModule", { value: true }); + exports.default = Attributor; + + +/***/ }, +/* 9 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + var attributor_1 = __webpack_require__(8); + var class_1 = __webpack_require__(10); + var style_1 = __webpack_require__(11); + var Registry = __webpack_require__(6); + var AttributorStore = (function () { + function AttributorStore(domNode) { + this.attributes = {}; + this.domNode = domNode; + this.build(); + } + AttributorStore.prototype.attribute = function (attribute, value) { + if (value) { + if (attribute.add(this.domNode, value)) { + if (attribute.value(this.domNode) != null) { + this.attributes[attribute.attrName] = attribute; + } + else { + delete this.attributes[attribute.attrName]; + } + } + } + else { + attribute.remove(this.domNode); + delete this.attributes[attribute.attrName]; + } + }; + AttributorStore.prototype.build = function () { + var _this = this; + this.attributes = {}; + var attributes = attributor_1.default.keys(this.domNode); + var classes = class_1.default.keys(this.domNode); + var styles = style_1.default.keys(this.domNode); + attributes.concat(classes).concat(styles).forEach(function (name) { + var attr = Registry.query(name, Registry.Scope.ATTRIBUTE); + if (attr instanceof attributor_1.default) { + _this.attributes[attr.attrName] = attr; + } + }); + }; + AttributorStore.prototype.copy = function (target) { + var _this = this; + Object.keys(this.attributes).forEach(function (key) { + var value = _this.attributes[key].value(_this.domNode); + target.format(key, value); + }); + }; + AttributorStore.prototype.move = function (target) { + var _this = this; + this.copy(target); + Object.keys(this.attributes).forEach(function (key) { + _this.attributes[key].remove(_this.domNode); + }); + this.attributes = {}; + }; + AttributorStore.prototype.values = function () { + var _this = this; + return Object.keys(this.attributes).reduce(function (attributes, name) { + attributes[name] = _this.attributes[name].value(_this.domNode); + return attributes; + }, {}); + }; + return AttributorStore; + }()); + Object.defineProperty(exports, "__esModule", { value: true }); + exports.default = AttributorStore; + + +/***/ }, +/* 10 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + var attributor_1 = __webpack_require__(8); + function match(node, prefix) { + var className = node.getAttribute('class') || ''; + return className.split(/\s+/).filter(function (name) { + return name.indexOf(prefix + "-") === 0; + }); + } + var ClassAttributor = (function (_super) { + __extends(ClassAttributor, _super); + function ClassAttributor() { + return _super.apply(this, arguments) || this; + } + ClassAttributor.keys = function (node) { + return (node.getAttribute('class') || '').split(/\s+/).map(function (name) { + return name.split('-').slice(0, -1).join('-'); + }); + }; + ClassAttributor.prototype.add = function (node, value) { + if (!this.canAdd(node, value)) + return false; + this.remove(node); + node.classList.add(this.keyName + "-" + value); + return true; + }; + ClassAttributor.prototype.remove = function (node) { + var matches = match(node, this.keyName); + matches.forEach(function (name) { + node.classList.remove(name); + }); + if (node.classList.length === 0) { + node.removeAttribute('class'); + } + }; + ClassAttributor.prototype.value = function (node) { + var result = match(node, this.keyName)[0] || ''; + var value = result.slice(this.keyName.length + 1); // +1 for hyphen + return this.canAdd(node, value) ? value : ''; + }; + return ClassAttributor; + }(attributor_1.default)); + Object.defineProperty(exports, "__esModule", { value: true }); + exports.default = ClassAttributor; + + +/***/ }, +/* 11 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + var attributor_1 = __webpack_require__(8); + function camelize(name) { + var parts = name.split('-'); + var rest = parts.slice(1).map(function (part) { + return part[0].toUpperCase() + part.slice(1); + }).join(''); + return parts[0] + rest; + } + var StyleAttributor = (function (_super) { + __extends(StyleAttributor, _super); + function StyleAttributor() { + return _super.apply(this, arguments) || this; + } + StyleAttributor.keys = function (node) { + return (node.getAttribute('style') || '').split(';').map(function (value) { + var arr = value.split(':'); + return arr[0].trim(); + }); + }; + StyleAttributor.prototype.add = function (node, value) { + if (!this.canAdd(node, value)) + return false; + node.style[camelize(this.keyName)] = value; + return true; + }; + StyleAttributor.prototype.remove = function (node) { + node.style[camelize(this.keyName)] = ''; + if (!node.getAttribute('style')) { + node.removeAttribute('style'); + } + }; + StyleAttributor.prototype.value = function (node) { + var value = node.style[camelize(this.keyName)]; + return this.canAdd(node, value) ? value : ''; + }; + return StyleAttributor; + }(attributor_1.default)); + Object.defineProperty(exports, "__esModule", { value: true }); + exports.default = StyleAttributor; + + +/***/ }, +/* 12 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + var shadow_1 = __webpack_require__(5); + var Registry = __webpack_require__(6); + var LeafBlot = (function (_super) { + __extends(LeafBlot, _super); + function LeafBlot() { + return _super.apply(this, arguments) || this; + } + LeafBlot.value = function (domNode) { + return true; + }; + LeafBlot.prototype.index = function (node, offset) { + if (node !== this.domNode) + return -1; + return Math.min(offset, 1); + }; + LeafBlot.prototype.position = function (index, inclusive) { + var offset = [].indexOf.call(this.parent.domNode.childNodes, this.domNode); + if (index > 0) + offset += 1; + return [this.parent.domNode, offset]; + }; + LeafBlot.prototype.value = function () { + return _a = {}, _a[this.statics.blotName] = this.statics.value(this.domNode) || true, _a; + var _a; + }; + return LeafBlot; + }(shadow_1.default)); + LeafBlot.scope = Registry.Scope.INLINE_BLOT; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.default = LeafBlot; + + +/***/ }, +/* 13 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + var container_1 = __webpack_require__(3); + var Registry = __webpack_require__(6); + var OBSERVER_CONFIG = { + attributes: true, + characterData: true, + characterDataOldValue: true, + childList: true, + subtree: true + }; + var MAX_OPTIMIZE_ITERATIONS = 100; + var ScrollBlot = (function (_super) { + __extends(ScrollBlot, _super); + function ScrollBlot(node) { + var _this = _super.call(this, node) || this; + _this.parent = null; + _this.observer = new MutationObserver(function (mutations) { + _this.update(mutations); + }); + _this.observer.observe(_this.domNode, OBSERVER_CONFIG); + return _this; + } + ScrollBlot.prototype.detach = function () { + _super.prototype.detach.call(this); + this.observer.disconnect(); + }; + ScrollBlot.prototype.deleteAt = function (index, length) { + this.update(); + if (index === 0 && length === this.length()) { + this.children.forEach(function (child) { + child.remove(); + }); + } + else { + _super.prototype.deleteAt.call(this, index, length); + } + }; + ScrollBlot.prototype.formatAt = function (index, length, name, value) { + this.update(); + _super.prototype.formatAt.call(this, index, length, name, value); + }; + ScrollBlot.prototype.insertAt = function (index, value, def) { + this.update(); + _super.prototype.insertAt.call(this, index, value, def); + }; + ScrollBlot.prototype.optimize = function (mutations) { + var _this = this; + if (mutations === void 0) { mutations = []; } + _super.prototype.optimize.call(this); + // We must modify mutations directly, cannot make copy and then modify + var records = [].slice.call(this.observer.takeRecords()); + // Array.push currently seems to be implemented by a non-tail recursive function + // so we cannot just mutations.push.apply(mutations, this.observer.takeRecords()); + while (records.length > 0) + mutations.push(records.pop()); + // TODO use WeakMap + var mark = function (blot, markParent) { + if (markParent === void 0) { markParent = true; } + if (blot == null || blot === _this) + return; + if (blot.domNode.parentNode == null) + return; + if (blot.domNode[Registry.DATA_KEY].mutations == null) { + blot.domNode[Registry.DATA_KEY].mutations = []; + } + if (markParent) + mark(blot.parent); + }; + var optimize = function (blot) { + if (blot.domNode[Registry.DATA_KEY] == null || blot.domNode[Registry.DATA_KEY].mutations == null) { + return; + } + if (blot instanceof container_1.default) { + blot.children.forEach(optimize); + } + blot.optimize(); + }; + var remaining = mutations; + for (var i = 0; remaining.length > 0; i += 1) { + if (i >= MAX_OPTIMIZE_ITERATIONS) { + throw new Error('[Parchment] Maximum optimize iterations reached'); + } + remaining.forEach(function (mutation) { + var blot = Registry.find(mutation.target, true); + if (blot == null) + return; + if (blot.domNode === mutation.target) { + if (mutation.type === 'childList') { + mark(Registry.find(mutation.previousSibling, false)); + [].forEach.call(mutation.addedNodes, function (node) { + var child = Registry.find(node, false); + mark(child, false); + if (child instanceof container_1.default) { + child.children.forEach(function (grandChild) { + mark(grandChild, false); + }); + } + }); + } + else if (mutation.type === 'attributes') { + mark(blot.prev); + } + } + mark(blot); + }); + this.children.forEach(optimize); + remaining = [].slice.call(this.observer.takeRecords()); + records = remaining.slice(); + while (records.length > 0) + mutations.push(records.pop()); + } + }; + ScrollBlot.prototype.update = function (mutations) { + var _this = this; + mutations = mutations || this.observer.takeRecords(); + // TODO use WeakMap + mutations.map(function (mutation) { + var blot = Registry.find(mutation.target, true); + if (blot == null) + return; + if (blot.domNode[Registry.DATA_KEY].mutations == null) { + blot.domNode[Registry.DATA_KEY].mutations = [mutation]; + return blot; + } + else { + blot.domNode[Registry.DATA_KEY].mutations.push(mutation); + return null; + } + }).forEach(function (blot) { + if (blot == null || blot === _this || blot.domNode[Registry.DATA_KEY] == null) + return; + blot.update(blot.domNode[Registry.DATA_KEY].mutations || []); + }); + if (this.domNode[Registry.DATA_KEY].mutations != null) { + _super.prototype.update.call(this, this.domNode[Registry.DATA_KEY].mutations); + } + this.optimize(mutations); + }; + return ScrollBlot; + }(container_1.default)); + ScrollBlot.blotName = 'scroll'; + ScrollBlot.defaultChild = 'block'; + ScrollBlot.scope = Registry.Scope.BLOCK_BLOT; + ScrollBlot.tagName = 'DIV'; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.default = ScrollBlot; + + +/***/ }, +/* 14 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + var format_1 = __webpack_require__(7); + var Registry = __webpack_require__(6); + // Shallow object comparison + function isEqual(obj1, obj2) { + if (Object.keys(obj1).length !== Object.keys(obj2).length) + return false; + for (var prop in obj1) { + if (obj1[prop] !== obj2[prop]) + return false; + } + return true; + } + var InlineBlot = (function (_super) { + __extends(InlineBlot, _super); + function InlineBlot() { + return _super.apply(this, arguments) || this; + } + InlineBlot.formats = function (domNode) { + if (domNode.tagName === InlineBlot.tagName) + return undefined; + return _super.formats.call(this, domNode); + }; + InlineBlot.prototype.format = function (name, value) { + var _this = this; + if (name === this.statics.blotName && !value) { + this.children.forEach(function (child) { + if (!(child instanceof format_1.default)) { + child = child.wrap(InlineBlot.blotName, true); + } + _this.attributes.copy(child); + }); + this.unwrap(); + } + else { + _super.prototype.format.call(this, name, value); + } + }; + InlineBlot.prototype.formatAt = function (index, length, name, value) { + if (this.formats()[name] != null || Registry.query(name, Registry.Scope.ATTRIBUTE)) { + var blot = this.isolate(index, length); + blot.format(name, value); + } + else { + _super.prototype.formatAt.call(this, index, length, name, value); + } + }; + InlineBlot.prototype.optimize = function () { + _super.prototype.optimize.call(this); + var formats = this.formats(); + if (Object.keys(formats).length === 0) { + return this.unwrap(); // unformatted span + } + var next = this.next; + if (next instanceof InlineBlot && next.prev === this && isEqual(formats, next.formats())) { + next.moveChildren(this); + next.remove(); + } + }; + return InlineBlot; + }(format_1.default)); + InlineBlot.blotName = 'inline'; + InlineBlot.scope = Registry.Scope.INLINE_BLOT; + InlineBlot.tagName = 'SPAN'; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.default = InlineBlot; + + +/***/ }, +/* 15 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + var format_1 = __webpack_require__(7); + var Registry = __webpack_require__(6); + var BlockBlot = (function (_super) { + __extends(BlockBlot, _super); + function BlockBlot() { + return _super.apply(this, arguments) || this; + } + BlockBlot.formats = function (domNode) { + var tagName = Registry.query(BlockBlot.blotName).tagName; + if (domNode.tagName === tagName) + return undefined; + return _super.formats.call(this, domNode); + }; + BlockBlot.prototype.format = function (name, value) { + if (Registry.query(name, Registry.Scope.BLOCK) == null) { + return; + } + else if (name === this.statics.blotName && !value) { + this.replaceWith(BlockBlot.blotName); + } + else { + _super.prototype.format.call(this, name, value); + } + }; + BlockBlot.prototype.formatAt = function (index, length, name, value) { + if (Registry.query(name, Registry.Scope.BLOCK) != null) { + this.format(name, value); + } + else { + _super.prototype.formatAt.call(this, index, length, name, value); + } + }; + BlockBlot.prototype.insertAt = function (index, value, def) { + if (def == null || Registry.query(value, Registry.Scope.INLINE) != null) { + // Insert text or inline + _super.prototype.insertAt.call(this, index, value, def); + } + else { + var after = this.split(index); + var blot = Registry.create(value, def); + after.parent.insertBefore(blot, after); + } + }; + BlockBlot.prototype.update = function (mutations) { + if (navigator.userAgent.match(/Trident/)) { + this.attach(); + } + else { + _super.prototype.update.call(this, mutations); + } + }; + return BlockBlot; + }(format_1.default)); + BlockBlot.blotName = 'block'; + BlockBlot.scope = Registry.Scope.BLOCK_BLOT; + BlockBlot.tagName = 'P'; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.default = BlockBlot; + + +/***/ }, +/* 16 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + var leaf_1 = __webpack_require__(12); + var EmbedBlot = (function (_super) { + __extends(EmbedBlot, _super); + function EmbedBlot() { + return _super.apply(this, arguments) || this; + } + EmbedBlot.formats = function (domNode) { + return undefined; + }; + EmbedBlot.prototype.format = function (name, value) { + // super.formatAt wraps, which is what we want in general, + // but this allows subclasses to overwrite for formats + // that just apply to particular embeds + _super.prototype.formatAt.call(this, 0, this.length(), name, value); + }; + EmbedBlot.prototype.formatAt = function (index, length, name, value) { + if (index === 0 && length === this.length()) { + this.format(name, value); + } + else { + _super.prototype.formatAt.call(this, index, length, name, value); + } + }; + EmbedBlot.prototype.formats = function () { + return this.statics.formats(this.domNode); + }; + return EmbedBlot; + }(leaf_1.default)); + Object.defineProperty(exports, "__esModule", { value: true }); + exports.default = EmbedBlot; + + +/***/ }, +/* 17 */ +/***/ function(module, exports, __webpack_require__) { + + "use strict"; + var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + var leaf_1 = __webpack_require__(12); + var Registry = __webpack_require__(6); + var TextBlot = (function (_super) { + __extends(TextBlot, _super); + function TextBlot(node) { + var _this = _super.call(this, node) || this; + _this.text = _this.statics.value(_this.domNode); + return _this; + } + TextBlot.create = function (value) { + return document.createTextNode(value); + }; + TextBlot.value = function (domNode) { + return domNode.data; + }; + TextBlot.prototype.deleteAt = function (index, length) { + this.domNode.data = this.text = this.text.slice(0, index) + this.text.slice(index + length); + }; + TextBlot.prototype.index = function (node, offset) { + if (this.domNode === node) { + return offset; + } + return -1; + }; + TextBlot.prototype.insertAt = function (index, value, def) { + if (def == null) { + this.text = this.text.slice(0, index) + value + this.text.slice(index); + this.domNode.data = this.text; + } + else { + _super.prototype.insertAt.call(this, index, value, def); + } + }; + TextBlot.prototype.length = function () { + return this.text.length; + }; + TextBlot.prototype.optimize = function () { + _super.prototype.optimize.call(this); + this.text = this.statics.value(this.domNode); + if (this.text.length === 0) { + this.remove(); + } + else if (this.next instanceof TextBlot && this.next.prev === this) { + this.insertAt(this.length(), this.next.value()); + this.next.remove(); + } + }; + TextBlot.prototype.position = function (index, inclusive) { + if (inclusive === void 0) { inclusive = false; } + return [this.domNode, index]; + }; + TextBlot.prototype.split = function (index, force) { + if (force === void 0) { force = false; } + if (!force) { + if (index === 0) + return this; + if (index === this.length()) + return this.next; + } + var after = Registry.create(this.domNode.splitText(index)); + this.parent.insertBefore(after, this.next); + this.text = this.statics.value(this.domNode); + return after; + }; + TextBlot.prototype.update = function (mutations) { + var _this = this; + if (mutations.some(function (mutation) { + return mutation.type === 'characterData' && mutation.target === _this.domNode; + })) { + this.text = this.statics.value(this.domNode); + } + }; + TextBlot.prototype.value = function () { + return this.text; + }; + return TextBlot; + }(leaf_1.default)); + TextBlot.blotName = 'text'; + TextBlot.scope = Registry.Scope.INLINE_BLOT; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.default = TextBlot; + + +/***/ }, +/* 18 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.default = exports.overload = exports.expandConfig = undefined; + + 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; }; + + 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"); } }; }(); + + 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; }; }(); + + __webpack_require__(19); + + var _quillDelta = __webpack_require__(20); + + var _quillDelta2 = _interopRequireDefault(_quillDelta); + + var _editor = __webpack_require__(27); + + var _editor2 = _interopRequireDefault(_editor); + + var _emitter3 = __webpack_require__(35); + + var _emitter4 = _interopRequireDefault(_emitter3); + + var _module = __webpack_require__(39); + + var _module2 = _interopRequireDefault(_module); + + var _parchment = __webpack_require__(2); + + var _parchment2 = _interopRequireDefault(_parchment); + + var _selection = __webpack_require__(40); + + var _selection2 = _interopRequireDefault(_selection); + + var _extend = __webpack_require__(25); + + var _extend2 = _interopRequireDefault(_extend); + + var _logger = __webpack_require__(37); + + var _logger2 = _interopRequireDefault(_logger); + + var _theme = __webpack_require__(41); + + var _theme2 = _interopRequireDefault(_theme); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + 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; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var debug = (0, _logger2.default)('quill'); + + var Quill = function () { + _createClass(Quill, null, [{ + key: 'debug', + value: function debug(limit) { + if (limit === true) { + limit = 'log'; + } + _logger2.default.level(limit); + } + }, { + key: 'import', + value: function _import(name) { + if (this.imports[name] == null) { + debug.error('Cannot import ' + name + '. Are you sure it was registered?'); + } + return this.imports[name]; + } + }, { + key: 'register', + value: function register(path, target) { + var _this = this; + + var overwrite = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + + if (typeof path !== 'string') { + var name = path.attrName || path.blotName; + if (typeof name === 'string') { + // register(Blot | Attributor, overwrite) + this.register('formats/' + name, path, target); + } else { + Object.keys(path).forEach(function (key) { + _this.register(key, path[key], target); + }); + } + } else { + if (this.imports[path] != null && !overwrite) { + debug.warn('Overwriting ' + path + ' with', target); + } + this.imports[path] = target; + if ((path.startsWith('blots/') || path.startsWith('formats/')) && target.blotName !== 'abstract') { + _parchment2.default.register(target); + } + } + } + }]); + + function Quill(container) { + var _this2 = this; + + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + _classCallCheck(this, Quill); + + this.options = expandConfig(container, options); + this.container = this.options.container; + this.scrollingContainer = this.options.scrollingContainer || document.body; + if (this.container == null) { + return debug.error('Invalid Quill container', container); + } + if (this.options.debug) { + Quill.debug(this.options.debug); + } + var html = this.container.innerHTML.trim(); + this.container.classList.add('ql-container'); + this.container.innerHTML = ''; + this.root = this.addContainer('ql-editor'); + this.root.classList.add('ql-blank'); + this.emitter = new _emitter4.default(); + this.scroll = _parchment2.default.create(this.root, { + emitter: this.emitter, + whitelist: this.options.formats + }); + this.editor = new _editor2.default(this.scroll); + this.selection = new _selection2.default(this.scroll, this.emitter); + this.theme = new this.options.theme(this, this.options); + this.keyboard = this.theme.addModule('keyboard'); + this.clipboard = this.theme.addModule('clipboard'); + this.history = this.theme.addModule('history'); + this.theme.init(); + this.emitter.on(_emitter4.default.events.EDITOR_CHANGE, function (type) { + if (type === _emitter4.default.events.TEXT_CHANGE) { + _this2.root.classList.toggle('ql-blank', _this2.editor.isBlank()); + } + }); + this.emitter.on(_emitter4.default.events.SCROLL_UPDATE, function (source, mutations) { + var range = _this2.selection.lastRange; + var index = range && range.length === 0 ? range.index : undefined; + modify.call(_this2, function () { + return _this2.editor.update(null, mutations, index); + }, source); + }); + var contents = this.clipboard.convert('
' + html + '


'); + this.setContents(contents); + this.history.clear(); + if (this.options.placeholder) { + this.root.setAttribute('data-placeholder', this.options.placeholder); + } + if (this.options.readOnly) { + this.disable(); + } + } + + _createClass(Quill, [{ + key: 'addContainer', + value: function addContainer(container) { + var refNode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; + + if (typeof container === 'string') { + var className = container; + container = document.createElement('div'); + container.classList.add(className); + } + this.container.insertBefore(container, refNode); + return container; + } + }, { + key: 'blur', + value: function blur() { + this.selection.setRange(null); + } + }, { + key: 'deleteText', + value: function deleteText(index, length, source) { + var _this3 = this; + + var _overload = overload(index, length, source); + + var _overload2 = _slicedToArray(_overload, 4); + + index = _overload2[0]; + length = _overload2[1]; + source = _overload2[3]; + + return modify.call(this, function () { + return _this3.editor.deleteText(index, length); + }, source, index, -1 * length); + } + }, { + key: 'disable', + value: function disable() { + this.enable(false); + } + }, { + key: 'enable', + value: function enable() { + var enabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; + + this.scroll.enable(enabled); + this.container.classList.toggle('ql-disabled', !enabled); + if (!enabled) { + this.blur(); + } + } + }, { + key: 'focus', + value: function focus() { + var scrollTop = this.scrollingContainer.scrollTop; + this.selection.focus(); + this.scrollingContainer.scrollTop = scrollTop; + this.selection.scrollIntoView(); + } + }, { + key: 'format', + value: function format(name, value) { + var _this4 = this; + + var source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _emitter4.default.sources.API; + + return modify.call(this, function () { + var range = _this4.getSelection(true); + var change = new _quillDelta2.default(); + if (range == null) { + return change; + } else if (_parchment2.default.query(name, _parchment2.default.Scope.BLOCK)) { + change = _this4.editor.formatLine(range.index, range.length, _defineProperty({}, name, value)); + } else if (range.length === 0) { + _this4.selection.format(name, value); + return change; + } else { + change = _this4.editor.formatText(range.index, range.length, _defineProperty({}, name, value)); + } + _this4.setSelection(range, _emitter4.default.sources.SILENT); + return change; + }, source); + } + }, { + key: 'formatLine', + value: function formatLine(index, length, name, value, source) { + var _this5 = this; + + var formats = void 0; + + var _overload3 = overload(index, length, name, value, source); + + var _overload4 = _slicedToArray(_overload3, 4); + + index = _overload4[0]; + length = _overload4[1]; + formats = _overload4[2]; + source = _overload4[3]; + + return modify.call(this, function () { + return _this5.editor.formatLine(index, length, formats); + }, source, index, 0); + } + }, { + key: 'formatText', + value: function formatText(index, length, name, value, source) { + var _this6 = this; + + var formats = void 0; + + var _overload5 = overload(index, length, name, value, source); + + var _overload6 = _slicedToArray(_overload5, 4); + + index = _overload6[0]; + length = _overload6[1]; + formats = _overload6[2]; + source = _overload6[3]; + + return modify.call(this, function () { + return _this6.editor.formatText(index, length, formats); + }, source, index, 0); + } + }, { + key: 'getBounds', + value: function getBounds(index) { + var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + + if (typeof index === 'number') { + return this.selection.getBounds(index, length); + } else { + return this.selection.getBounds(index.index, index.length); + } + } + }, { + key: 'getContents', + value: function getContents() { + var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; + var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.getLength() - index; + + var _overload7 = overload(index, length); + + var _overload8 = _slicedToArray(_overload7, 2); + + index = _overload8[0]; + length = _overload8[1]; + + return this.editor.getContents(index, length); + } + }, { + key: 'getFormat', + value: function getFormat() { + var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.getSelection(); + var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + + if (typeof index === 'number') { + return this.editor.getFormat(index, length); + } else { + return this.editor.getFormat(index.index, index.length); + } + } + }, { + key: 'getLength', + value: function getLength() { + return this.scroll.length(); + } + }, { + key: 'getModule', + value: function getModule(name) { + return this.theme.modules[name]; + } + }, { + key: 'getSelection', + value: function getSelection() { + var focus = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + + if (focus) this.focus(); + this.update(); // Make sure we access getRange with editor in consistent state + return this.selection.getRange()[0]; + } + }, { + key: 'getText', + value: function getText() { + var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; + var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.getLength() - index; + + var _overload9 = overload(index, length); + + var _overload10 = _slicedToArray(_overload9, 2); + + index = _overload10[0]; + length = _overload10[1]; + + return this.editor.getText(index, length); + } + }, { + key: 'hasFocus', + value: function hasFocus() { + return this.selection.hasFocus(); + } + }, { + key: 'insertEmbed', + value: function insertEmbed(index, embed, value) { + var _this7 = this; + + var source = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : Quill.sources.API; + + return modify.call(this, function () { + return _this7.editor.insertEmbed(index, embed, value); + }, source, index); + } + }, { + key: 'insertText', + value: function insertText(index, text, name, value, source) { + var _this8 = this; + + var formats = void 0; + + var _overload11 = overload(index, 0, name, value, source); + + var _overload12 = _slicedToArray(_overload11, 4); + + index = _overload12[0]; + formats = _overload12[2]; + source = _overload12[3]; + + return modify.call(this, function () { + return _this8.editor.insertText(index, text, formats); + }, source, index, text.length); + } + }, { + key: 'isEnabled', + value: function isEnabled() { + return !this.container.classList.contains('ql-disabled'); + } + }, { + key: 'off', + value: function off() { + return this.emitter.off.apply(this.emitter, arguments); + } + }, { + key: 'on', + value: function on() { + return this.emitter.on.apply(this.emitter, arguments); + } + }, { + key: 'once', + value: function once() { + return this.emitter.once.apply(this.emitter, arguments); + } + }, { + key: 'pasteHTML', + value: function pasteHTML(index, html, source) { + this.clipboard.dangerouslyPasteHTML(index, html, source); + } + }, { + key: 'removeFormat', + value: function removeFormat(index, length, source) { + var _this9 = this; + + var _overload13 = overload(index, length, source); + + var _overload14 = _slicedToArray(_overload13, 4); + + index = _overload14[0]; + length = _overload14[1]; + source = _overload14[3]; + + return modify.call(this, function () { + return _this9.editor.removeFormat(index, length); + }, source, index); + } + }, { + key: 'setContents', + value: function setContents(delta) { + var _this10 = this; + + var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _emitter4.default.sources.API; + + return modify.call(this, function () { + delta = new _quillDelta2.default(delta); + var length = _this10.getLength(); + var deleted = _this10.editor.deleteText(0, length); + var applied = _this10.editor.applyDelta(delta); + var lastOp = applied.ops[applied.ops.length - 1]; + if (lastOp != null && typeof lastOp.insert === 'string' && lastOp.insert[lastOp.insert.length - 1] === '\n') { + _this10.editor.deleteText(_this10.getLength() - 1, 1); + applied.delete(1); + } + var ret = deleted.compose(applied); + return ret; + }, source); + } + }, { + key: 'setSelection', + value: function setSelection(index, length, source) { + if (index == null) { + this.selection.setRange(null, length || Quill.sources.API); + } else { + var _overload15 = overload(index, length, source); + + var _overload16 = _slicedToArray(_overload15, 4); + + index = _overload16[0]; + length = _overload16[1]; + source = _overload16[3]; + + this.selection.setRange(new _selection.Range(index, length), source); + } + this.selection.scrollIntoView(); + } + }, { + key: 'setText', + value: function setText(text) { + var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _emitter4.default.sources.API; + + var delta = new _quillDelta2.default().insert(text); + return this.setContents(delta, source); + } + }, { + key: 'update', + value: function update() { + var source = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _emitter4.default.sources.USER; + + var change = this.scroll.update(source); // Will update selection before selection.update() does if text changes + this.selection.update(source); + return change; + } + }, { + key: 'updateContents', + value: function updateContents(delta) { + var _this11 = this; + + var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _emitter4.default.sources.API; + + return modify.call(this, function () { + delta = new _quillDelta2.default(delta); + return _this11.editor.applyDelta(delta, source); + }, source, true); + } + }]); + + return Quill; + }(); + + Quill.DEFAULTS = { + bounds: null, + formats: null, + modules: {}, + placeholder: '', + readOnly: false, + scrollingContainer: null, + strict: true, + theme: 'default' + }; + Quill.events = _emitter4.default.events; + Quill.sources = _emitter4.default.sources; + // eslint-disable-next-line no-undef + Quill.version = false ? 'dev' : ("1.1.9"); + + Quill.imports = { + 'delta': _quillDelta2.default, + 'parchment': _parchment2.default, + 'core/module': _module2.default, + 'core/theme': _theme2.default + }; + + function expandConfig(container, userConfig) { + userConfig = (0, _extend2.default)(true, { + container: container, + modules: { + clipboard: true, + keyboard: true, + history: true + } + }, userConfig); + if (!userConfig.theme || userConfig.theme === Quill.DEFAULTS.theme) { + userConfig.theme = _theme2.default; + } else { + userConfig.theme = Quill.import('themes/' + userConfig.theme); + if (userConfig.theme == null) { + throw new Error('Invalid theme ' + userConfig.theme + '. Did you register it?'); + } + } + var themeConfig = (0, _extend2.default)(true, {}, userConfig.theme.DEFAULTS); + [themeConfig, userConfig].forEach(function (config) { + config.modules = config.modules || {}; + Object.keys(config.modules).forEach(function (module) { + if (config.modules[module] === true) { + config.modules[module] = {}; + } + }); + }); + var moduleNames = Object.keys(themeConfig.modules).concat(Object.keys(userConfig.modules)); + var moduleConfig = moduleNames.reduce(function (config, name) { + var moduleClass = Quill.import('modules/' + name); + if (moduleClass == null) { + debug.error('Cannot load ' + name + ' module. Are you sure you registered it?'); + } else { + config[name] = moduleClass.DEFAULTS || {}; + } + return config; + }, {}); + // Special case toolbar shorthand + if (userConfig.modules != null && userConfig.modules.toolbar && userConfig.modules.toolbar.constructor !== Object) { + userConfig.modules.toolbar = { + container: userConfig.modules.toolbar + }; + } + userConfig = (0, _extend2.default)(true, {}, Quill.DEFAULTS, { modules: moduleConfig }, themeConfig, userConfig); + ['bounds', 'container', 'scrollingContainer'].forEach(function (key) { + if (typeof userConfig[key] === 'string') { + userConfig[key] = document.querySelector(userConfig[key]); + } + }); + userConfig.modules = Object.keys(userConfig.modules).reduce(function (config, name) { + if (userConfig.modules[name]) { + config[name] = userConfig.modules[name]; + } + return config; + }, {}); + return userConfig; + } + + // Handle selection preservation and TEXT_CHANGE emission + // common to modification APIs + function modify(modifier, source, index, shift) { + if (this.options.strict && !this.isEnabled() && source === _emitter4.default.sources.USER) { + return new _quillDelta2.default(); + } + var range = index == null ? null : this.getSelection(); + var oldDelta = this.editor.delta; + var change = modifier(); + if (range != null && source === _emitter4.default.sources.USER) { + if (index === true) index = range.index; + if (shift == null) { + range = shiftRange(range, change, source); + } else if (shift !== 0) { + range = shiftRange(range, index, shift, source); + } + this.setSelection(range, _emitter4.default.sources.SILENT); + } + if (change.length() > 0) { + var _emitter; + + var args = [_emitter4.default.events.TEXT_CHANGE, change, oldDelta, source]; + (_emitter = this.emitter).emit.apply(_emitter, [_emitter4.default.events.EDITOR_CHANGE].concat(args)); + if (source !== _emitter4.default.sources.SILENT) { + var _emitter2; + + (_emitter2 = this.emitter).emit.apply(_emitter2, args); + } + } + return change; + } + + function overload(index, length, name, value, source) { + var formats = {}; + if (typeof index.index === 'number' && typeof index.length === 'number') { + // Allow for throwaway end (used by insertText/insertEmbed) + if (typeof length !== 'number') { + source = value, value = name, name = length, length = index.length, index = index.index; + } else { + length = index.length, index = index.index; + } + } else if (typeof length !== 'number') { + source = value, value = name, name = length, length = 0; + } + // Handle format being object, two format name/value strings or excluded + if ((typeof name === 'undefined' ? 'undefined' : _typeof(name)) === 'object') { + formats = name; + source = value; + } else if (typeof name === 'string') { + if (value != null) { + formats[name] = value; + } else { + source = name; + } + } + // Handle optional source + source = source || _emitter4.default.sources.API; + return [index, length, formats, source]; + } + + function shiftRange(range, index, length, source) { + if (range == null) return null; + var start = void 0, + end = void 0; + if (index instanceof _quillDelta2.default) { + var _map = [range.index, range.index + range.length].map(function (pos) { + return index.transformPosition(pos, source === _emitter4.default.sources.USER); + }); + + var _map2 = _slicedToArray(_map, 2); + + start = _map2[0]; + end = _map2[1]; + } else { + var _map3 = [range.index, range.index + range.length].map(function (pos) { + if (pos < index || pos === index && source !== _emitter4.default.sources.USER) return pos; + if (length >= 0) { + return pos + length; + } else { + return Math.max(index, pos + length); + } + }); + + var _map4 = _slicedToArray(_map3, 2); + + start = _map4[0]; + end = _map4[1]; + } + return new _selection.Range(start, end - start); + } + + exports.expandConfig = expandConfig; + exports.overload = overload; + exports.default = Quill; + +/***/ }, +/* 19 */ +/***/ function(module, exports) { + + 'use strict'; + + var elem = document.createElement('div'); + elem.classList.toggle('test-class', false); + if (elem.classList.contains('test-class')) { + (function () { + var _toggle = DOMTokenList.prototype.toggle; + DOMTokenList.prototype.toggle = function (token, force) { + if (arguments.length > 1 && !this.contains(token) === !force) { + return force; + } else { + return _toggle.call(this, token); + } + }; + })(); + } + + if (!String.prototype.startsWith) { + String.prototype.startsWith = function (searchString, position) { + position = position || 0; + return this.substr(position, searchString.length) === searchString; + }; + } + + if (!String.prototype.endsWith) { + String.prototype.endsWith = function (searchString, position) { + var subjectString = this.toString(); + if (typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > subjectString.length) { + position = subjectString.length; + } + position -= searchString.length; + var lastIndex = subjectString.indexOf(searchString, position); + return lastIndex !== -1 && lastIndex === position; + }; + } + + if (!Array.prototype.find) { + Object.defineProperty(Array.prototype, "find", { + value: function value(predicate) { + if (this === null) { + throw new TypeError('Array.prototype.find called on null or undefined'); + } + if (typeof predicate !== 'function') { + throw new TypeError('predicate must be a function'); + } + var list = Object(this); + var length = list.length >>> 0; + var thisArg = arguments[1]; + var value; + + for (var i = 0; i < length; i++) { + value = list[i]; + if (predicate.call(thisArg, value, i, list)) { + return value; + } + } + return undefined; + } + }); + } + + // Disable resizing in Firefox + document.addEventListener("DOMContentLoaded", function () { + document.execCommand("enableObjectResizing", false, false); + }); + +/***/ }, +/* 20 */ +/***/ function(module, exports, __webpack_require__) { + + var diff = __webpack_require__(21); + var equal = __webpack_require__(22); + var extend = __webpack_require__(25); + var op = __webpack_require__(26); + + + var NULL_CHARACTER = String.fromCharCode(0); // Placeholder char for embed in diff() + + + var Delta = function (ops) { + // Assume we are given a well formed ops + if (Array.isArray(ops)) { + this.ops = ops; + } else if (ops != null && Array.isArray(ops.ops)) { + this.ops = ops.ops; + } else { + this.ops = []; + } + }; + + + Delta.prototype.insert = function (text, attributes) { + var newOp = {}; + if (text.length === 0) return this; + newOp.insert = text; + if (attributes != null && typeof attributes === 'object' && Object.keys(attributes).length > 0) { + newOp.attributes = attributes; + } + return this.push(newOp); + }; + + Delta.prototype['delete'] = function (length) { + if (length <= 0) return this; + return this.push({ 'delete': length }); + }; + + Delta.prototype.retain = function (length, attributes) { + if (length <= 0) return this; + var newOp = { retain: length }; + if (attributes != null && typeof attributes === 'object' && Object.keys(attributes).length > 0) { + newOp.attributes = attributes; + } + return this.push(newOp); + }; + + Delta.prototype.push = function (newOp) { + var index = this.ops.length; + var lastOp = this.ops[index - 1]; + newOp = extend(true, {}, newOp); + if (typeof lastOp === 'object') { + if (typeof newOp['delete'] === 'number' && typeof lastOp['delete'] === 'number') { + this.ops[index - 1] = { 'delete': lastOp['delete'] + newOp['delete'] }; + return this; + } + // Since it does not matter if we insert before or after deleting at the same index, + // always prefer to insert first + if (typeof lastOp['delete'] === 'number' && newOp.insert != null) { + index -= 1; + lastOp = this.ops[index - 1]; + if (typeof lastOp !== 'object') { + this.ops.unshift(newOp); + return this; + } + } + if (equal(newOp.attributes, lastOp.attributes)) { + if (typeof newOp.insert === 'string' && typeof lastOp.insert === 'string') { + this.ops[index - 1] = { insert: lastOp.insert + newOp.insert }; + if (typeof newOp.attributes === 'object') this.ops[index - 1].attributes = newOp.attributes + return this; + } else if (typeof newOp.retain === 'number' && typeof lastOp.retain === 'number') { + this.ops[index - 1] = { retain: lastOp.retain + newOp.retain }; + if (typeof newOp.attributes === 'object') this.ops[index - 1].attributes = newOp.attributes + return this; + } + } + } + if (index === this.ops.length) { + this.ops.push(newOp); + } else { + this.ops.splice(index, 0, newOp); + } + return this; + }; + + Delta.prototype.filter = function (predicate) { + return this.ops.filter(predicate); + }; + + Delta.prototype.forEach = function (predicate) { + this.ops.forEach(predicate); + }; + + Delta.prototype.map = function (predicate) { + return this.ops.map(predicate); + }; + + Delta.prototype.partition = function (predicate) { + var passed = [], failed = []; + this.forEach(function(op) { + var target = predicate(op) ? passed : failed; + target.push(op); + }); + return [passed, failed]; + }; + + Delta.prototype.reduce = function (predicate, initial) { + return this.ops.reduce(predicate, initial); + }; + + Delta.prototype.chop = function () { + var lastOp = this.ops[this.ops.length - 1]; + if (lastOp && lastOp.retain && !lastOp.attributes) { + this.ops.pop(); + } + return this; + }; + + Delta.prototype.length = function () { + return this.reduce(function (length, elem) { + return length + op.length(elem); + }, 0); + }; + + Delta.prototype.slice = function (start, end) { + start = start || 0; + if (typeof end !== 'number') end = Infinity; + var ops = []; + var iter = op.iterator(this.ops); + var index = 0; + while (index < end && iter.hasNext()) { + var nextOp; + if (index < start) { + nextOp = iter.next(start - index); + } else { + nextOp = iter.next(end - index); + ops.push(nextOp); + } + index += op.length(nextOp); + } + return new Delta(ops); + }; + + + Delta.prototype.compose = function (other) { + var thisIter = op.iterator(this.ops); + var otherIter = op.iterator(other.ops); + var delta = new Delta(); + while (thisIter.hasNext() || otherIter.hasNext()) { + if (otherIter.peekType() === 'insert') { + delta.push(otherIter.next()); + } else if (thisIter.peekType() === 'delete') { + delta.push(thisIter.next()); + } else { + var length = Math.min(thisIter.peekLength(), otherIter.peekLength()); + var thisOp = thisIter.next(length); + var otherOp = otherIter.next(length); + if (typeof otherOp.retain === 'number') { + var newOp = {}; + if (typeof thisOp.retain === 'number') { + newOp.retain = length; + } else { + newOp.insert = thisOp.insert; + } + // Preserve null when composing with a retain, otherwise remove it for inserts + var attributes = op.attributes.compose(thisOp.attributes, otherOp.attributes, typeof thisOp.retain === 'number'); + if (attributes) newOp.attributes = attributes; + delta.push(newOp); + // Other op should be delete, we could be an insert or retain + // Insert + delete cancels out + } else if (typeof otherOp['delete'] === 'number' && typeof thisOp.retain === 'number') { + delta.push(otherOp); + } + } + } + return delta.chop(); + }; + + Delta.prototype.concat = function (other) { + var delta = new Delta(this.ops.slice()); + if (other.ops.length > 0) { + delta.push(other.ops[0]); + delta.ops = delta.ops.concat(other.ops.slice(1)); + } + return delta; + }; + + Delta.prototype.diff = function (other, index) { + if (this.ops === other.ops) { + return new Delta(); + } + var strings = [this, other].map(function (delta) { + return delta.map(function (op) { + if (op.insert != null) { + return typeof op.insert === 'string' ? op.insert : NULL_CHARACTER; + } + var prep = (ops === other.ops) ? 'on' : 'with'; + throw new Error('diff() called ' + prep + ' non-document'); + }).join(''); + }); + var delta = new Delta(); + var diffResult = diff(strings[0], strings[1], index); + var thisIter = op.iterator(this.ops); + var otherIter = op.iterator(other.ops); + diffResult.forEach(function (component) { + var length = component[1].length; + while (length > 0) { + var opLength = 0; + switch (component[0]) { + case diff.INSERT: + opLength = Math.min(otherIter.peekLength(), length); + delta.push(otherIter.next(opLength)); + break; + case diff.DELETE: + opLength = Math.min(length, thisIter.peekLength()); + thisIter.next(opLength); + delta['delete'](opLength); + break; + case diff.EQUAL: + opLength = Math.min(thisIter.peekLength(), otherIter.peekLength(), length); + var thisOp = thisIter.next(opLength); + var otherOp = otherIter.next(opLength); + if (equal(thisOp.insert, otherOp.insert)) { + delta.retain(opLength, op.attributes.diff(thisOp.attributes, otherOp.attributes)); + } else { + delta.push(otherOp)['delete'](opLength); + } + break; + } + length -= opLength; + } + }); + return delta.chop(); + }; + + Delta.prototype.eachLine = function (predicate, newline) { + newline = newline || '\n'; + var iter = op.iterator(this.ops); + var line = new Delta(); + while (iter.hasNext()) { + if (iter.peekType() !== 'insert') return; + var thisOp = iter.peek(); + var start = op.length(thisOp) - iter.peekLength(); + var index = typeof thisOp.insert === 'string' ? + thisOp.insert.indexOf(newline, start) - start : -1; + if (index < 0) { + line.push(iter.next()); + } else if (index > 0) { + line.push(iter.next(index)); + } else { + predicate(line, iter.next(1).attributes || {}); + line = new Delta(); + } + } + if (line.length() > 0) { + predicate(line, {}); + } + }; + + Delta.prototype.transform = function (other, priority) { + priority = !!priority; + if (typeof other === 'number') { + return this.transformPosition(other, priority); + } + var thisIter = op.iterator(this.ops); + var otherIter = op.iterator(other.ops); + var delta = new Delta(); + while (thisIter.hasNext() || otherIter.hasNext()) { + if (thisIter.peekType() === 'insert' && (priority || otherIter.peekType() !== 'insert')) { + delta.retain(op.length(thisIter.next())); + } else if (otherIter.peekType() === 'insert') { + delta.push(otherIter.next()); + } else { + var length = Math.min(thisIter.peekLength(), otherIter.peekLength()); + var thisOp = thisIter.next(length); + var otherOp = otherIter.next(length); + if (thisOp['delete']) { + // Our delete either makes their delete redundant or removes their retain + continue; + } else if (otherOp['delete']) { + delta.push(otherOp); + } else { + // We retain either their retain or insert + delta.retain(length, op.attributes.transform(thisOp.attributes, otherOp.attributes, priority)); + } + } + } + return delta.chop(); + }; + + Delta.prototype.transformPosition = function (index, priority) { + priority = !!priority; + var thisIter = op.iterator(this.ops); + var offset = 0; + while (thisIter.hasNext() && offset <= index) { + var length = thisIter.peekLength(); + var nextType = thisIter.peekType(); + thisIter.next(); + if (nextType === 'delete') { + index -= Math.min(length, index - offset); + continue; + } else if (nextType === 'insert' && (offset < index || !priority)) { + index += length; + } + offset += length; + } + return index; + }; + + + module.exports = Delta; + + +/***/ }, +/* 21 */ +/***/ function(module, exports) { + + /** + * This library modifies the diff-patch-match library by Neil Fraser + * by removing the patch and match functionality and certain advanced + * options in the diff function. The original license is as follows: + * + * === + * + * Diff Match and Patch + * + * Copyright 2006 Google Inc. + * http://code.google.com/p/google-diff-match-patch/ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + + /** + * The data structure representing a diff is an array of tuples: + * [[DIFF_DELETE, 'Hello'], [DIFF_INSERT, 'Goodbye'], [DIFF_EQUAL, ' world.']] + * which means: delete 'Hello', add 'Goodbye' and keep ' world.' + */ + var DIFF_DELETE = -1; + var DIFF_INSERT = 1; + var DIFF_EQUAL = 0; + + + /** + * Find the differences between two texts. Simplifies the problem by stripping + * any common prefix or suffix off the texts before diffing. + * @param {string} text1 Old string to be diffed. + * @param {string} text2 New string to be diffed. + * @param {Int} cursor_pos Expected edit position in text1 (optional) + * @return {Array} Array of diff tuples. + */ + function diff_main(text1, text2, cursor_pos) { + // Check for equality (speedup). + if (text1 == text2) { + if (text1) { + return [[DIFF_EQUAL, text1]]; + } + return []; + } + + // Check cursor_pos within bounds + if (cursor_pos < 0 || text1.length < cursor_pos) { + cursor_pos = null; + } + + // Trim off common prefix (speedup). + var commonlength = diff_commonPrefix(text1, text2); + var commonprefix = text1.substring(0, commonlength); + text1 = text1.substring(commonlength); + text2 = text2.substring(commonlength); + + // Trim off common suffix (speedup). + commonlength = diff_commonSuffix(text1, text2); + var commonsuffix = text1.substring(text1.length - commonlength); + text1 = text1.substring(0, text1.length - commonlength); + text2 = text2.substring(0, text2.length - commonlength); + + // Compute the diff on the middle block. + var diffs = diff_compute_(text1, text2); + + // Restore the prefix and suffix. + if (commonprefix) { + diffs.unshift([DIFF_EQUAL, commonprefix]); + } + if (commonsuffix) { + diffs.push([DIFF_EQUAL, commonsuffix]); + } + diff_cleanupMerge(diffs); + if (cursor_pos != null) { + diffs = fix_cursor(diffs, cursor_pos); + } + return diffs; + }; + + + /** + * Find the differences between two texts. Assumes that the texts do not + * have any common prefix or suffix. + * @param {string} text1 Old string to be diffed. + * @param {string} text2 New string to be diffed. + * @return {Array} Array of diff tuples. + */ + function diff_compute_(text1, text2) { + var diffs; + + if (!text1) { + // Just add some text (speedup). + return [[DIFF_INSERT, text2]]; + } + + if (!text2) { + // Just delete some text (speedup). + return [[DIFF_DELETE, text1]]; + } + + var longtext = text1.length > text2.length ? text1 : text2; + var shorttext = text1.length > text2.length ? text2 : text1; + var i = longtext.indexOf(shorttext); + if (i != -1) { + // Shorter text is inside the longer text (speedup). + diffs = [[DIFF_INSERT, longtext.substring(0, i)], + [DIFF_EQUAL, shorttext], + [DIFF_INSERT, longtext.substring(i + shorttext.length)]]; + // Swap insertions for deletions if diff is reversed. + if (text1.length > text2.length) { + diffs[0][0] = diffs[2][0] = DIFF_DELETE; + } + return diffs; + } + + if (shorttext.length == 1) { + // Single character string. + // After the previous speedup, the character can't be an equality. + return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]]; + } + + // Check to see if the problem can be split in two. + var hm = diff_halfMatch_(text1, text2); + if (hm) { + // A half-match was found, sort out the return data. + var text1_a = hm[0]; + var text1_b = hm[1]; + var text2_a = hm[2]; + var text2_b = hm[3]; + var mid_common = hm[4]; + // Send both pairs off for separate processing. + var diffs_a = diff_main(text1_a, text2_a); + var diffs_b = diff_main(text1_b, text2_b); + // Merge the results. + return diffs_a.concat([[DIFF_EQUAL, mid_common]], diffs_b); + } + + return diff_bisect_(text1, text2); + }; + + + /** + * Find the 'middle snake' of a diff, split the problem in two + * and return the recursively constructed diff. + * See Myers 1986 paper: An O(ND) Difference Algorithm and Its Variations. + * @param {string} text1 Old string to be diffed. + * @param {string} text2 New string to be diffed. + * @return {Array} Array of diff tuples. + * @private + */ + function diff_bisect_(text1, text2) { + // Cache the text lengths to prevent multiple calls. + var text1_length = text1.length; + var text2_length = text2.length; + var max_d = Math.ceil((text1_length + text2_length) / 2); + var v_offset = max_d; + var v_length = 2 * max_d; + var v1 = new Array(v_length); + var v2 = new Array(v_length); + // Setting all elements to -1 is faster in Chrome & Firefox than mixing + // integers and undefined. + for (var x = 0; x < v_length; x++) { + v1[x] = -1; + v2[x] = -1; + } + v1[v_offset + 1] = 0; + v2[v_offset + 1] = 0; + var delta = text1_length - text2_length; + // If the total number of characters is odd, then the front path will collide + // with the reverse path. + var front = (delta % 2 != 0); + // Offsets for start and end of k loop. + // Prevents mapping of space beyond the grid. + var k1start = 0; + var k1end = 0; + var k2start = 0; + var k2end = 0; + for (var d = 0; d < max_d; d++) { + // Walk the front path one step. + for (var k1 = -d + k1start; k1 <= d - k1end; k1 += 2) { + var k1_offset = v_offset + k1; + var x1; + if (k1 == -d || (k1 != d && v1[k1_offset - 1] < v1[k1_offset + 1])) { + x1 = v1[k1_offset + 1]; + } else { + x1 = v1[k1_offset - 1] + 1; + } + var y1 = x1 - k1; + while (x1 < text1_length && y1 < text2_length && + text1.charAt(x1) == text2.charAt(y1)) { + x1++; + y1++; + } + v1[k1_offset] = x1; + if (x1 > text1_length) { + // Ran off the right of the graph. + k1end += 2; + } else if (y1 > text2_length) { + // Ran off the bottom of the graph. + k1start += 2; + } else if (front) { + var k2_offset = v_offset + delta - k1; + if (k2_offset >= 0 && k2_offset < v_length && v2[k2_offset] != -1) { + // Mirror x2 onto top-left coordinate system. + var x2 = text1_length - v2[k2_offset]; + if (x1 >= x2) { + // Overlap detected. + return diff_bisectSplit_(text1, text2, x1, y1); + } + } + } + } + + // Walk the reverse path one step. + for (var k2 = -d + k2start; k2 <= d - k2end; k2 += 2) { + var k2_offset = v_offset + k2; + var x2; + if (k2 == -d || (k2 != d && v2[k2_offset - 1] < v2[k2_offset + 1])) { + x2 = v2[k2_offset + 1]; + } else { + x2 = v2[k2_offset - 1] + 1; + } + var y2 = x2 - k2; + while (x2 < text1_length && y2 < text2_length && + text1.charAt(text1_length - x2 - 1) == + text2.charAt(text2_length - y2 - 1)) { + x2++; + y2++; + } + v2[k2_offset] = x2; + if (x2 > text1_length) { + // Ran off the left of the graph. + k2end += 2; + } else if (y2 > text2_length) { + // Ran off the top of the graph. + k2start += 2; + } else if (!front) { + var k1_offset = v_offset + delta - k2; + if (k1_offset >= 0 && k1_offset < v_length && v1[k1_offset] != -1) { + var x1 = v1[k1_offset]; + var y1 = v_offset + x1 - k1_offset; + // Mirror x2 onto top-left coordinate system. + x2 = text1_length - x2; + if (x1 >= x2) { + // Overlap detected. + return diff_bisectSplit_(text1, text2, x1, y1); + } + } + } + } + } + // Diff took too long and hit the deadline or + // number of diffs equals number of characters, no commonality at all. + return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]]; + }; + + + /** + * Given the location of the 'middle snake', split the diff in two parts + * and recurse. + * @param {string} text1 Old string to be diffed. + * @param {string} text2 New string to be diffed. + * @param {number} x Index of split point in text1. + * @param {number} y Index of split point in text2. + * @return {Array} Array of diff tuples. + */ + function diff_bisectSplit_(text1, text2, x, y) { + var text1a = text1.substring(0, x); + var text2a = text2.substring(0, y); + var text1b = text1.substring(x); + var text2b = text2.substring(y); + + // Compute both diffs serially. + var diffs = diff_main(text1a, text2a); + var diffsb = diff_main(text1b, text2b); + + return diffs.concat(diffsb); + }; + + + /** + * Determine the common prefix of two strings. + * @param {string} text1 First string. + * @param {string} text2 Second string. + * @return {number} The number of characters common to the start of each + * string. + */ + function diff_commonPrefix(text1, text2) { + // Quick check for common null cases. + if (!text1 || !text2 || text1.charAt(0) != text2.charAt(0)) { + return 0; + } + // Binary search. + // Performance analysis: http://neil.fraser.name/news/2007/10/09/ + var pointermin = 0; + var pointermax = Math.min(text1.length, text2.length); + var pointermid = pointermax; + var pointerstart = 0; + while (pointermin < pointermid) { + if (text1.substring(pointerstart, pointermid) == + text2.substring(pointerstart, pointermid)) { + pointermin = pointermid; + pointerstart = pointermin; + } else { + pointermax = pointermid; + } + pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin); + } + return pointermid; + }; + + + /** + * Determine the common suffix of two strings. + * @param {string} text1 First string. + * @param {string} text2 Second string. + * @return {number} The number of characters common to the end of each string. + */ + function diff_commonSuffix(text1, text2) { + // Quick check for common null cases. + if (!text1 || !text2 || + text1.charAt(text1.length - 1) != text2.charAt(text2.length - 1)) { + return 0; + } + // Binary search. + // Performance analysis: http://neil.fraser.name/news/2007/10/09/ + var pointermin = 0; + var pointermax = Math.min(text1.length, text2.length); + var pointermid = pointermax; + var pointerend = 0; + while (pointermin < pointermid) { + if (text1.substring(text1.length - pointermid, text1.length - pointerend) == + text2.substring(text2.length - pointermid, text2.length - pointerend)) { + pointermin = pointermid; + pointerend = pointermin; + } else { + pointermax = pointermid; + } + pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin); + } + return pointermid; + }; + + + /** + * Do the two texts share a substring which is at least half the length of the + * longer text? + * This speedup can produce non-minimal diffs. + * @param {string} text1 First string. + * @param {string} text2 Second string. + * @return {Array.} Five element Array, containing the prefix of + * text1, the suffix of text1, the prefix of text2, the suffix of + * text2 and the common middle. Or null if there was no match. + */ + function diff_halfMatch_(text1, text2) { + var longtext = text1.length > text2.length ? text1 : text2; + var shorttext = text1.length > text2.length ? text2 : text1; + if (longtext.length < 4 || shorttext.length * 2 < longtext.length) { + return null; // Pointless. + } + + /** + * Does a substring of shorttext exist within longtext such that the substring + * is at least half the length of longtext? + * Closure, but does not reference any external variables. + * @param {string} longtext Longer string. + * @param {string} shorttext Shorter string. + * @param {number} i Start index of quarter length substring within longtext. + * @return {Array.} Five element Array, containing the prefix of + * longtext, the suffix of longtext, the prefix of shorttext, the suffix + * of shorttext and the common middle. Or null if there was no match. + * @private + */ + function diff_halfMatchI_(longtext, shorttext, i) { + // Start with a 1/4 length substring at position i as a seed. + var seed = longtext.substring(i, i + Math.floor(longtext.length / 4)); + var j = -1; + var best_common = ''; + var best_longtext_a, best_longtext_b, best_shorttext_a, best_shorttext_b; + while ((j = shorttext.indexOf(seed, j + 1)) != -1) { + var prefixLength = diff_commonPrefix(longtext.substring(i), + shorttext.substring(j)); + var suffixLength = diff_commonSuffix(longtext.substring(0, i), + shorttext.substring(0, j)); + if (best_common.length < suffixLength + prefixLength) { + best_common = shorttext.substring(j - suffixLength, j) + + shorttext.substring(j, j + prefixLength); + best_longtext_a = longtext.substring(0, i - suffixLength); + best_longtext_b = longtext.substring(i + prefixLength); + best_shorttext_a = shorttext.substring(0, j - suffixLength); + best_shorttext_b = shorttext.substring(j + prefixLength); + } + } + if (best_common.length * 2 >= longtext.length) { + return [best_longtext_a, best_longtext_b, + best_shorttext_a, best_shorttext_b, best_common]; + } else { + return null; + } + } + + // First check if the second quarter is the seed for a half-match. + var hm1 = diff_halfMatchI_(longtext, shorttext, + Math.ceil(longtext.length / 4)); + // Check again based on the third quarter. + var hm2 = diff_halfMatchI_(longtext, shorttext, + Math.ceil(longtext.length / 2)); + var hm; + if (!hm1 && !hm2) { + return null; + } else if (!hm2) { + hm = hm1; + } else if (!hm1) { + hm = hm2; + } else { + // Both matched. Select the longest. + hm = hm1[4].length > hm2[4].length ? hm1 : hm2; + } + + // A half-match was found, sort out the return data. + var text1_a, text1_b, text2_a, text2_b; + if (text1.length > text2.length) { + text1_a = hm[0]; + text1_b = hm[1]; + text2_a = hm[2]; + text2_b = hm[3]; + } else { + text2_a = hm[0]; + text2_b = hm[1]; + text1_a = hm[2]; + text1_b = hm[3]; + } + var mid_common = hm[4]; + return [text1_a, text1_b, text2_a, text2_b, mid_common]; + }; + + + /** + * Reorder and merge like edit sections. Merge equalities. + * Any edit section can move as long as it doesn't cross an equality. + * @param {Array} diffs Array of diff tuples. + */ + function diff_cleanupMerge(diffs) { + diffs.push([DIFF_EQUAL, '']); // Add a dummy entry at the end. + var pointer = 0; + var count_delete = 0; + var count_insert = 0; + var text_delete = ''; + var text_insert = ''; + var commonlength; + while (pointer < diffs.length) { + switch (diffs[pointer][0]) { + case DIFF_INSERT: + count_insert++; + text_insert += diffs[pointer][1]; + pointer++; + break; + case DIFF_DELETE: + count_delete++; + text_delete += diffs[pointer][1]; + pointer++; + break; + case DIFF_EQUAL: + // Upon reaching an equality, check for prior redundancies. + if (count_delete + count_insert > 1) { + if (count_delete !== 0 && count_insert !== 0) { + // Factor out any common prefixies. + commonlength = diff_commonPrefix(text_insert, text_delete); + if (commonlength !== 0) { + if ((pointer - count_delete - count_insert) > 0 && + diffs[pointer - count_delete - count_insert - 1][0] == + DIFF_EQUAL) { + diffs[pointer - count_delete - count_insert - 1][1] += + text_insert.substring(0, commonlength); + } else { + diffs.splice(0, 0, [DIFF_EQUAL, + text_insert.substring(0, commonlength)]); + pointer++; + } + text_insert = text_insert.substring(commonlength); + text_delete = text_delete.substring(commonlength); + } + // Factor out any common suffixies. + commonlength = diff_commonSuffix(text_insert, text_delete); + if (commonlength !== 0) { + diffs[pointer][1] = text_insert.substring(text_insert.length - + commonlength) + diffs[pointer][1]; + text_insert = text_insert.substring(0, text_insert.length - + commonlength); + text_delete = text_delete.substring(0, text_delete.length - + commonlength); + } + } + // Delete the offending records and add the merged ones. + if (count_delete === 0) { + diffs.splice(pointer - count_insert, + count_delete + count_insert, [DIFF_INSERT, text_insert]); + } else if (count_insert === 0) { + diffs.splice(pointer - count_delete, + count_delete + count_insert, [DIFF_DELETE, text_delete]); + } else { + diffs.splice(pointer - count_delete - count_insert, + count_delete + count_insert, [DIFF_DELETE, text_delete], + [DIFF_INSERT, text_insert]); + } + pointer = pointer - count_delete - count_insert + + (count_delete ? 1 : 0) + (count_insert ? 1 : 0) + 1; + } else if (pointer !== 0 && diffs[pointer - 1][0] == DIFF_EQUAL) { + // Merge this equality with the previous one. + diffs[pointer - 1][1] += diffs[pointer][1]; + diffs.splice(pointer, 1); + } else { + pointer++; + } + count_insert = 0; + count_delete = 0; + text_delete = ''; + text_insert = ''; + break; + } + } + if (diffs[diffs.length - 1][1] === '') { + diffs.pop(); // Remove the dummy entry at the end. + } + + // Second pass: look for single edits surrounded on both sides by equalities + // which can be shifted sideways to eliminate an equality. + // e.g: ABAC -> ABAC + var changes = false; + pointer = 1; + // Intentionally ignore the first and last element (don't need checking). + while (pointer < diffs.length - 1) { + if (diffs[pointer - 1][0] == DIFF_EQUAL && + diffs[pointer + 1][0] == DIFF_EQUAL) { + // This is a single edit surrounded by equalities. + if (diffs[pointer][1].substring(diffs[pointer][1].length - + diffs[pointer - 1][1].length) == diffs[pointer - 1][1]) { + // Shift the edit over the previous equality. + diffs[pointer][1] = diffs[pointer - 1][1] + + diffs[pointer][1].substring(0, diffs[pointer][1].length - + diffs[pointer - 1][1].length); + diffs[pointer + 1][1] = diffs[pointer - 1][1] + diffs[pointer + 1][1]; + diffs.splice(pointer - 1, 1); + changes = true; + } else if (diffs[pointer][1].substring(0, diffs[pointer + 1][1].length) == + diffs[pointer + 1][1]) { + // Shift the edit over the next equality. + diffs[pointer - 1][1] += diffs[pointer + 1][1]; + diffs[pointer][1] = + diffs[pointer][1].substring(diffs[pointer + 1][1].length) + + diffs[pointer + 1][1]; + diffs.splice(pointer + 1, 1); + changes = true; + } + } + pointer++; + } + // If shifts were made, the diff needs reordering and another shift sweep. + if (changes) { + diff_cleanupMerge(diffs); + } + }; + + + var diff = diff_main; + diff.INSERT = DIFF_INSERT; + diff.DELETE = DIFF_DELETE; + diff.EQUAL = DIFF_EQUAL; + + module.exports = diff; + + /* + * Modify a diff such that the cursor position points to the start of a change: + * E.g. + * cursor_normalize_diff([[DIFF_EQUAL, 'abc']], 1) + * => [1, [[DIFF_EQUAL, 'a'], [DIFF_EQUAL, 'bc']]] + * cursor_normalize_diff([[DIFF_INSERT, 'new'], [DIFF_DELETE, 'xyz']], 2) + * => [2, [[DIFF_INSERT, 'new'], [DIFF_DELETE, 'xy'], [DIFF_DELETE, 'z']]] + * + * @param {Array} diffs Array of diff tuples + * @param {Int} cursor_pos Suggested edit position. Must not be out of bounds! + * @return {Array} A tuple [cursor location in the modified diff, modified diff] + */ + function cursor_normalize_diff (diffs, cursor_pos) { + if (cursor_pos === 0) { + return [DIFF_EQUAL, diffs]; + } + for (var current_pos = 0, i = 0; i < diffs.length; i++) { + var d = diffs[i]; + if (d[0] === DIFF_DELETE || d[0] === DIFF_EQUAL) { + var next_pos = current_pos + d[1].length; + if (cursor_pos === next_pos) { + return [i + 1, diffs]; + } else if (cursor_pos < next_pos) { + // copy to prevent side effects + diffs = diffs.slice(); + // split d into two diff changes + var split_pos = cursor_pos - current_pos; + var d_left = [d[0], d[1].slice(0, split_pos)]; + var d_right = [d[0], d[1].slice(split_pos)]; + diffs.splice(i, 1, d_left, d_right); + return [i + 1, diffs]; + } else { + current_pos = next_pos; + } + } + } + throw new Error('cursor_pos is out of bounds!') + } + + /* + * Modify a diff such that the edit position is "shifted" to the proposed edit location (cursor_position). + * + * Case 1) + * Check if a naive shift is possible: + * [0, X], [ 1, Y] -> [ 1, Y], [0, X] (if X + Y === Y + X) + * [0, X], [-1, Y] -> [-1, Y], [0, X] (if X + Y === Y + X) - holds same result + * Case 2) + * Check if the following shifts are possible: + * [0, 'pre'], [ 1, 'prefix'] -> [ 1, 'pre'], [0, 'pre'], [ 1, 'fix'] + * [0, 'pre'], [-1, 'prefix'] -> [-1, 'pre'], [0, 'pre'], [-1, 'fix'] + * ^ ^ + * d d_next + * + * @param {Array} diffs Array of diff tuples + * @param {Int} cursor_pos Suggested edit position. Must not be out of bounds! + * @return {Array} Array of diff tuples + */ + function fix_cursor (diffs, cursor_pos) { + var norm = cursor_normalize_diff(diffs, cursor_pos); + var ndiffs = norm[1]; + var cursor_pointer = norm[0]; + var d = ndiffs[cursor_pointer]; + var d_next = ndiffs[cursor_pointer + 1]; + + if (d == null) { + // Text was deleted from end of original string, + // cursor is now out of bounds in new string + return diffs; + } else if (d[0] !== DIFF_EQUAL) { + // A modification happened at the cursor location. + // This is the expected outcome, so we can return the original diff. + return diffs; + } else { + if (d_next != null && d[1] + d_next[1] === d_next[1] + d[1]) { + // Case 1) + // It is possible to perform a naive shift + ndiffs.splice(cursor_pointer, 2, d_next, d) + return merge_tuples(ndiffs, cursor_pointer, 2) + } else if (d_next != null && d_next[1].indexOf(d[1]) === 0) { + // Case 2) + // d[1] is a prefix of d_next[1] + // We can assume that d_next[0] !== 0, since d[0] === 0 + // Shift edit locations.. + ndiffs.splice(cursor_pointer, 2, [d_next[0], d[1]], [0, d[1]]); + var suffix = d_next[1].slice(d[1].length); + if (suffix.length > 0) { + ndiffs.splice(cursor_pointer + 2, 0, [d_next[0], suffix]); + } + return merge_tuples(ndiffs, cursor_pointer, 3) + } else { + // Not possible to perform any modification + return diffs; + } + } + + } + + /* + * Try to merge tuples with their neigbors in a given range. + * E.g. [0, 'a'], [0, 'b'] -> [0, 'ab'] + * + * @param {Array} diffs Array of diff tuples. + * @param {Int} start Position of the first element to merge (diffs[start] is also merged with diffs[start - 1]). + * @param {Int} length Number of consecutive elements to check. + * @return {Array} Array of merged diff tuples. + */ + function merge_tuples (diffs, start, length) { + // Check from (start-1) to (start+length). + for (var i = start + length - 1; i >= 0 && i >= start - 1; i--) { + if (i + 1 < diffs.length) { + var left_d = diffs[i]; + var right_d = diffs[i+1]; + if (left_d[0] === right_d[1]) { + diffs.splice(i, 2, [left_d[0], left_d[1] + right_d[1]]); + } + } + } + return diffs; + } + + +/***/ }, +/* 22 */ +/***/ function(module, exports, __webpack_require__) { + + var pSlice = Array.prototype.slice; + var objectKeys = __webpack_require__(23); + var isArguments = __webpack_require__(24); + + var deepEqual = module.exports = function (actual, expected, opts) { + if (!opts) opts = {}; + // 7.1. All identical values are equivalent, as determined by ===. + if (actual === expected) { + return true; + + } else if (actual instanceof Date && expected instanceof Date) { + return actual.getTime() === expected.getTime(); + + // 7.3. Other pairs that do not both pass typeof value == 'object', + // equivalence is determined by ==. + } else if (!actual || !expected || typeof actual != 'object' && typeof expected != 'object') { + return opts.strict ? actual === expected : actual == expected; + + // 7.4. For all other Object pairs, including Array objects, equivalence is + // determined by having the same number of owned properties (as verified + // with Object.prototype.hasOwnProperty.call), the same set of keys + // (although not necessarily the same order), equivalent values for every + // corresponding key, and an identical 'prototype' property. Note: this + // accounts for both named and indexed properties on Arrays. + } else { + return objEquiv(actual, expected, opts); + } + } + + function isUndefinedOrNull(value) { + return value === null || value === undefined; + } + + function isBuffer (x) { + if (!x || typeof x !== 'object' || typeof x.length !== 'number') return false; + if (typeof x.copy !== 'function' || typeof x.slice !== 'function') { + return false; + } + if (x.length > 0 && typeof x[0] !== 'number') return false; + return true; + } + + function objEquiv(a, b, opts) { + var i, key; + if (isUndefinedOrNull(a) || isUndefinedOrNull(b)) + return false; + // an identical 'prototype' property. + if (a.prototype !== b.prototype) return false; + //~~~I've managed to break Object.keys through screwy arguments passing. + // Converting to array solves the problem. + if (isArguments(a)) { + if (!isArguments(b)) { + return false; + } + a = pSlice.call(a); + b = pSlice.call(b); + return deepEqual(a, b, opts); + } + if (isBuffer(a)) { + if (!isBuffer(b)) { + return false; + } + if (a.length !== b.length) return false; + for (i = 0; i < a.length; i++) { + if (a[i] !== b[i]) return false; + } + return true; + } + try { + var ka = objectKeys(a), + kb = objectKeys(b); + } catch (e) {//happens when one is a string literal and the other isn't + return false; + } + // having the same number of owned properties (keys incorporates + // hasOwnProperty) + if (ka.length != kb.length) + return false; + //the same set of keys (although not necessarily the same order), + ka.sort(); + kb.sort(); + //~~~cheap key test + for (i = ka.length - 1; i >= 0; i--) { + if (ka[i] != kb[i]) + return false; + } + //equivalent values for every corresponding key, and + //~~~possibly expensive deep test + for (i = ka.length - 1; i >= 0; i--) { + key = ka[i]; + if (!deepEqual(a[key], b[key], opts)) return false; + } + return typeof a === typeof b; + } + + +/***/ }, +/* 23 */ +/***/ function(module, exports) { + + exports = module.exports = typeof Object.keys === 'function' + ? Object.keys : shim; + + exports.shim = shim; + function shim (obj) { + var keys = []; + for (var key in obj) keys.push(key); + return keys; + } + + +/***/ }, +/* 24 */ +/***/ function(module, exports) { + + var supportsArgumentsClass = (function(){ + return Object.prototype.toString.call(arguments) + })() == '[object Arguments]'; + + exports = module.exports = supportsArgumentsClass ? supported : unsupported; + + exports.supported = supported; + function supported(object) { + return Object.prototype.toString.call(object) == '[object Arguments]'; + }; + + exports.unsupported = unsupported; + function unsupported(object){ + return object && + typeof object == 'object' && + typeof object.length == 'number' && + Object.prototype.hasOwnProperty.call(object, 'callee') && + !Object.prototype.propertyIsEnumerable.call(object, 'callee') || + false; + }; + + +/***/ }, +/* 25 */ +/***/ function(module, exports) { + + 'use strict'; + + var hasOwn = Object.prototype.hasOwnProperty; + var toStr = Object.prototype.toString; + + var isArray = function isArray(arr) { + if (typeof Array.isArray === 'function') { + return Array.isArray(arr); + } + + return toStr.call(arr) === '[object Array]'; + }; + + var isPlainObject = function isPlainObject(obj) { + if (!obj || toStr.call(obj) !== '[object Object]') { + return false; + } + + var hasOwnConstructor = hasOwn.call(obj, 'constructor'); + var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf'); + // Not own constructor property must be Object + if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) { + return false; + } + + // Own properties are enumerated firstly, so to speed up, + // if last one is own, then all properties are own. + var key; + for (key in obj) {/**/} + + return typeof key === 'undefined' || hasOwn.call(obj, key); + }; + + module.exports = function extend() { + var options, name, src, copy, copyIsArray, clone, + target = arguments[0], + i = 1, + length = arguments.length, + deep = false; + + // Handle a deep copy situation + if (typeof target === 'boolean') { + deep = target; + target = arguments[1] || {}; + // skip the boolean and the target + i = 2; + } else if ((typeof target !== 'object' && typeof target !== 'function') || target == null) { + target = {}; + } + + for (; i < length; ++i) { + options = arguments[i]; + // Only deal with non-null/undefined values + if (options != null) { + // Extend the base object + for (name in options) { + src = target[name]; + copy = options[name]; + + // Prevent never-ending loop + if (target !== copy) { + // Recurse if we're merging plain objects or arrays + if (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) { + if (copyIsArray) { + copyIsArray = false; + clone = src && isArray(src) ? src : []; + } else { + clone = src && isPlainObject(src) ? src : {}; + } + + // Never move original objects, clone them + target[name] = extend(deep, clone, copy); + + // Don't bring in undefined values + } else if (typeof copy !== 'undefined') { + target[name] = copy; + } + } + } + } + } + + // Return the modified object + return target; + }; + + + +/***/ }, +/* 26 */ +/***/ function(module, exports, __webpack_require__) { + + var equal = __webpack_require__(22); + var extend = __webpack_require__(25); + + + var lib = { + attributes: { + compose: function (a, b, keepNull) { + if (typeof a !== 'object') a = {}; + if (typeof b !== 'object') b = {}; + var attributes = extend(true, {}, b); + if (!keepNull) { + attributes = Object.keys(attributes).reduce(function (copy, key) { + if (attributes[key] != null) { + copy[key] = attributes[key]; + } + return copy; + }, {}); + } + for (var key in a) { + if (a[key] !== undefined && b[key] === undefined) { + attributes[key] = a[key]; + } + } + return Object.keys(attributes).length > 0 ? attributes : undefined; + }, + + diff: function(a, b) { + if (typeof a !== 'object') a = {}; + if (typeof b !== 'object') b = {}; + var attributes = Object.keys(a).concat(Object.keys(b)).reduce(function (attributes, key) { + if (!equal(a[key], b[key])) { + attributes[key] = b[key] === undefined ? null : b[key]; + } + return attributes; + }, {}); + return Object.keys(attributes).length > 0 ? attributes : undefined; + }, + + transform: function (a, b, priority) { + if (typeof a !== 'object') return b; + if (typeof b !== 'object') return undefined; + if (!priority) return b; // b simply overwrites us without priority + var attributes = Object.keys(b).reduce(function (attributes, key) { + if (a[key] === undefined) attributes[key] = b[key]; // null is a valid value + return attributes; + }, {}); + return Object.keys(attributes).length > 0 ? attributes : undefined; + } + }, + + iterator: function (ops) { + return new Iterator(ops); + }, + + length: function (op) { + if (typeof op['delete'] === 'number') { + return op['delete']; + } else if (typeof op.retain === 'number') { + return op.retain; + } else { + return typeof op.insert === 'string' ? op.insert.length : 1; + } + } + }; + + + function Iterator(ops) { + this.ops = ops; + this.index = 0; + this.offset = 0; + }; + + Iterator.prototype.hasNext = function () { + return this.peekLength() < Infinity; + }; + + Iterator.prototype.next = function (length) { + if (!length) length = Infinity; + var nextOp = this.ops[this.index]; + if (nextOp) { + var offset = this.offset; + var opLength = lib.length(nextOp) + if (length >= opLength - offset) { + length = opLength - offset; + this.index += 1; + this.offset = 0; + } else { + this.offset += length; + } + if (typeof nextOp['delete'] === 'number') { + return { 'delete': length }; + } else { + var retOp = {}; + if (nextOp.attributes) { + retOp.attributes = nextOp.attributes; + } + if (typeof nextOp.retain === 'number') { + retOp.retain = length; + } else if (typeof nextOp.insert === 'string') { + retOp.insert = nextOp.insert.substr(offset, length); + } else { + // offset should === 0, length should === 1 + retOp.insert = nextOp.insert; + } + return retOp; + } + } else { + return { retain: Infinity }; + } + }; + + Iterator.prototype.peek = function () { + return this.ops[this.index]; + }; + + Iterator.prototype.peekLength = function () { + if (this.ops[this.index]) { + // Should never return 0 if our index is being managed correctly + return lib.length(this.ops[this.index]) - this.offset; + } else { + return Infinity; + } + }; + + Iterator.prototype.peekType = function () { + if (this.ops[this.index]) { + if (typeof this.ops[this.index]['delete'] === 'number') { + return 'delete'; + } else if (typeof this.ops[this.index].retain === 'number') { + return 'retain'; + } else { + return 'insert'; + } + } + return 'retain'; + }; + + + module.exports = lib; + + +/***/ }, +/* 27 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + 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; }; + + 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"); } }; }(); + + 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; }; }(); + + var _quillDelta = __webpack_require__(20); + + var _quillDelta2 = _interopRequireDefault(_quillDelta); + + var _op = __webpack_require__(26); + + var _op2 = _interopRequireDefault(_op); + + var _parchment = __webpack_require__(2); + + var _parchment2 = _interopRequireDefault(_parchment); + + var _code = __webpack_require__(28); + + var _code2 = _interopRequireDefault(_code); + + var _cursor = __webpack_require__(34); + + var _cursor2 = _interopRequireDefault(_cursor); + + var _block = __webpack_require__(29); + + var _block2 = _interopRequireDefault(_block); + + var _clone = __webpack_require__(38); + + var _clone2 = _interopRequireDefault(_clone); + + var _deepEqual = __webpack_require__(22); + + var _deepEqual2 = _interopRequireDefault(_deepEqual); + + var _extend = __webpack_require__(25); + + var _extend2 = _interopRequireDefault(_extend); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + 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; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var Editor = function () { + function Editor(scroll) { + _classCallCheck(this, Editor); + + this.scroll = scroll; + this.delta = this.getDelta(); + } + + _createClass(Editor, [{ + key: 'applyDelta', + value: function applyDelta(delta) { + var _this = this; + + var consumeNextNewline = false; + this.scroll.update(); + var scrollLength = this.scroll.length(); + this.scroll.batch = true; + delta = normalizeDelta(delta); + delta.reduce(function (index, op) { + var length = op.retain || op.delete || op.insert.length || 1; + var attributes = op.attributes || {}; + if (op.insert != null) { + if (typeof op.insert === 'string') { + var text = op.insert; + if (text.endsWith('\n') && consumeNextNewline) { + consumeNextNewline = false; + text = text.slice(0, -1); + } + if (index >= scrollLength && !text.endsWith('\n')) { + consumeNextNewline = true; + } + _this.scroll.insertAt(index, text); + + var _scroll$line = _this.scroll.line(index), + _scroll$line2 = _slicedToArray(_scroll$line, 2), + line = _scroll$line2[0], + offset = _scroll$line2[1]; + + var formats = (0, _extend2.default)({}, (0, _block.bubbleFormats)(line)); + if (line instanceof _block2.default) { + var _line$descendant = line.descendant(_parchment2.default.Leaf, offset), + _line$descendant2 = _slicedToArray(_line$descendant, 1), + leaf = _line$descendant2[0]; + + formats = (0, _extend2.default)(formats, (0, _block.bubbleFormats)(leaf)); + } + attributes = _op2.default.attributes.diff(formats, attributes) || {}; + } else if (_typeof(op.insert) === 'object') { + var key = Object.keys(op.insert)[0]; // There should only be one key + if (key == null) return index; + _this.scroll.insertAt(index, key, op.insert[key]); + } + scrollLength += length; + } + Object.keys(attributes).forEach(function (name) { + _this.scroll.formatAt(index, length, name, attributes[name]); + }); + return index + length; + }, 0); + delta.reduce(function (index, op) { + if (typeof op.delete === 'number') { + _this.scroll.deleteAt(index, op.delete); + return index; + } + return index + (op.retain || op.insert.length || 1); + }, 0); + this.scroll.batch = false; + this.scroll.optimize(); + return this.update(delta); + } + }, { + key: 'deleteText', + value: function deleteText(index, length) { + this.scroll.deleteAt(index, length); + return this.update(new _quillDelta2.default().retain(index).delete(length)); + } + }, { + key: 'formatLine', + value: function formatLine(index, length) { + var _this2 = this; + + var formats = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + + this.scroll.update(); + Object.keys(formats).forEach(function (format) { + var lines = _this2.scroll.lines(index, Math.max(length, 1)); + var lengthRemaining = length; + lines.forEach(function (line) { + var lineLength = line.length(); + if (!(line instanceof _code2.default)) { + line.format(format, formats[format]); + } else { + var codeIndex = index - line.offset(_this2.scroll); + var codeLength = line.newlineIndex(codeIndex + lengthRemaining) - codeIndex + 1; + line.formatAt(codeIndex, codeLength, format, formats[format]); + } + lengthRemaining -= lineLength; + }); + }); + this.scroll.optimize(); + return this.update(new _quillDelta2.default().retain(index).retain(length, (0, _clone2.default)(formats))); + } + }, { + key: 'formatText', + value: function formatText(index, length) { + var _this3 = this; + + var formats = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + + Object.keys(formats).forEach(function (format) { + _this3.scroll.formatAt(index, length, format, formats[format]); + }); + return this.update(new _quillDelta2.default().retain(index).retain(length, (0, _clone2.default)(formats))); + } + }, { + key: 'getContents', + value: function getContents(index, length) { + return this.delta.slice(index, index + length); + } + }, { + key: 'getDelta', + value: function getDelta() { + return this.scroll.lines().reduce(function (delta, line) { + return delta.concat(line.delta()); + }, new _quillDelta2.default()); + } + }, { + key: 'getFormat', + value: function getFormat(index) { + var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + + var lines = [], + leaves = []; + if (length === 0) { + this.scroll.path(index).forEach(function (path) { + var _path = _slicedToArray(path, 1), + blot = _path[0]; + + if (blot instanceof _block2.default) { + lines.push(blot); + } else if (blot instanceof _parchment2.default.Leaf) { + leaves.push(blot); + } + }); + } else { + lines = this.scroll.lines(index, length); + leaves = this.scroll.descendants(_parchment2.default.Leaf, index, length); + } + var formatsArr = [lines, leaves].map(function (blots) { + if (blots.length === 0) return {}; + var formats = (0, _block.bubbleFormats)(blots.shift()); + while (Object.keys(formats).length > 0) { + var blot = blots.shift(); + if (blot == null) return formats; + formats = combineFormats((0, _block.bubbleFormats)(blot), formats); + } + return formats; + }); + return _extend2.default.apply(_extend2.default, formatsArr); + } + }, { + key: 'getText', + value: function getText(index, length) { + return this.getContents(index, length).filter(function (op) { + return typeof op.insert === 'string'; + }).map(function (op) { + return op.insert; + }).join(''); + } + }, { + key: 'insertEmbed', + value: function insertEmbed(index, embed, value) { + this.scroll.insertAt(index, embed, value); + return this.update(new _quillDelta2.default().retain(index).insert(_defineProperty({}, embed, value))); + } + }, { + key: 'insertText', + value: function insertText(index, text) { + var _this4 = this; + + var formats = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + + text = text.replace(/\r\n/g, '\n').replace(/\r/g, '\n'); + this.scroll.insertAt(index, text); + Object.keys(formats).forEach(function (format) { + _this4.scroll.formatAt(index, text.length, format, formats[format]); + }); + return this.update(new _quillDelta2.default().retain(index).insert(text, (0, _clone2.default)(formats))); + } + }, { + key: 'isBlank', + value: function isBlank() { + if (this.scroll.children.length == 0) return true; + if (this.scroll.children.length > 1) return false; + var child = this.scroll.children.head; + return child.length() <= 1 && Object.keys(child.formats()).length == 0; + } + }, { + key: 'removeFormat', + value: function removeFormat(index, length) { + var text = this.getText(index, length); + + var _scroll$line3 = this.scroll.line(index + length), + _scroll$line4 = _slicedToArray(_scroll$line3, 2), + line = _scroll$line4[0], + offset = _scroll$line4[1]; + + var suffixLength = 0, + suffix = new _quillDelta2.default(); + if (line != null) { + if (!(line instanceof _code2.default)) { + suffixLength = line.length() - offset; + } else { + suffixLength = line.newlineIndex(offset) - offset + 1; + } + suffix = line.delta().slice(offset, offset + suffixLength - 1).insert('\n'); + } + var contents = this.getContents(index, length + suffixLength); + var diff = contents.diff(new _quillDelta2.default().insert(text).concat(suffix)); + var delta = new _quillDelta2.default().retain(index).concat(diff); + return this.applyDelta(delta); + } + }, { + key: 'update', + value: function update(change) { + var _this5 = this; + + var mutations = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; + var cursorIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined; + + var oldDelta = this.delta; + if (mutations.length === 1 && mutations[0].type === 'characterData' && _parchment2.default.find(mutations[0].target)) { + (function () { + // Optimization for character changes + var textBlot = _parchment2.default.find(mutations[0].target); + var formats = (0, _block.bubbleFormats)(textBlot); + var index = textBlot.offset(_this5.scroll); + var oldValue = mutations[0].oldValue.replace(_cursor2.default.CONTENTS, ''); + var oldText = new _quillDelta2.default().insert(oldValue); + var newText = new _quillDelta2.default().insert(textBlot.value()); + var diffDelta = new _quillDelta2.default().retain(index).concat(oldText.diff(newText, cursorIndex)); + change = diffDelta.reduce(function (delta, op) { + if (op.insert) { + return delta.insert(op.insert, formats); + } else { + return delta.push(op); + } + }, new _quillDelta2.default()); + _this5.delta = oldDelta.compose(change); + })(); + } else { + this.delta = this.getDelta(); + if (!change || !(0, _deepEqual2.default)(oldDelta.compose(change), this.delta)) { + change = oldDelta.diff(this.delta, cursorIndex); + } + } + return change; + } + }]); + + return Editor; + }(); + + function combineFormats(formats, combined) { + return Object.keys(combined).reduce(function (merged, name) { + if (formats[name] == null) return merged; + if (combined[name] === formats[name]) { + merged[name] = combined[name]; + } else if (Array.isArray(combined[name])) { + if (combined[name].indexOf(formats[name]) < 0) { + merged[name] = combined[name].concat([formats[name]]); + } + } else { + merged[name] = [combined[name], formats[name]]; + } + return merged; + }, {}); + } + + function normalizeDelta(delta) { + return delta.reduce(function (delta, op) { + if (op.insert === 1) { + var attributes = (0, _clone2.default)(op.attributes); + delete attributes['image']; + return delta.insert({ image: op.attributes.image }, attributes); + } + if (op.attributes != null && (op.attributes.list === true || op.attributes.bullet === true)) { + op = (0, _clone2.default)(op); + if (op.attributes.list) { + op.attributes.list = 'ordered'; + } else { + op.attributes.list = 'bullet'; + delete op.attributes.bullet; + } + } + if (typeof op.insert === 'string') { + var text = op.insert.replace(/\r\n/g, '\n').replace(/\r/g, '\n'); + return delta.insert(text, op.attributes); + } + return delta.push(op); + }, new _quillDelta2.default()); + } + + exports.default = Editor; + +/***/ }, +/* 28 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.default = exports.Code = undefined; + + 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"); } }; }(); + + 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; }; }(); + + 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); } }; + + var _quillDelta = __webpack_require__(20); + + var _quillDelta2 = _interopRequireDefault(_quillDelta); + + var _parchment = __webpack_require__(2); + + var _parchment2 = _interopRequireDefault(_parchment); + + var _block = __webpack_require__(29); + + var _block2 = _interopRequireDefault(_block); + + var _inline = __webpack_require__(32); + + var _inline2 = _interopRequireDefault(_inline); + + var _text = __webpack_require__(33); + + var _text2 = _interopRequireDefault(_text); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + 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; } + + 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; } + + var Code = function (_Inline) { + _inherits(Code, _Inline); + + function Code() { + _classCallCheck(this, Code); + + return _possibleConstructorReturn(this, (Code.__proto__ || Object.getPrototypeOf(Code)).apply(this, arguments)); + } + + return Code; + }(_inline2.default); + + Code.blotName = 'code'; + Code.tagName = 'CODE'; + + var CodeBlock = function (_Block) { + _inherits(CodeBlock, _Block); + + function CodeBlock() { + _classCallCheck(this, CodeBlock); + + return _possibleConstructorReturn(this, (CodeBlock.__proto__ || Object.getPrototypeOf(CodeBlock)).apply(this, arguments)); + } + + _createClass(CodeBlock, [{ + key: 'delta', + value: function delta() { + var _this3 = this; + + var text = this.domNode.textContent; + if (text.endsWith('\n')) { + // Should always be true + text = text.slice(0, -1); + } + return text.split('\n').reduce(function (delta, frag) { + return delta.insert(frag).insert('\n', _this3.formats()); + }, new _quillDelta2.default()); + } + }, { + key: 'format', + value: function format(name, value) { + if (name === this.statics.blotName && value) return; + + var _descendant = this.descendant(_text2.default, this.length() - 1), + _descendant2 = _slicedToArray(_descendant, 1), + text = _descendant2[0]; + + if (text != null) { + text.deleteAt(text.length() - 1, 1); + } + _get(CodeBlock.prototype.__proto__ || Object.getPrototypeOf(CodeBlock.prototype), 'format', this).call(this, name, value); + } + }, { + key: 'formatAt', + value: function formatAt(index, length, name, value) { + if (length === 0) return; + if (_parchment2.default.query(name, _parchment2.default.Scope.BLOCK) == null || name === this.statics.blotName && value === this.statics.formats(this.domNode)) { + return; + } + var nextNewline = this.newlineIndex(index); + if (nextNewline < 0 || nextNewline >= index + length) return; + var prevNewline = this.newlineIndex(index, true) + 1; + var isolateLength = nextNewline - prevNewline + 1; + var blot = this.isolate(prevNewline, isolateLength); + var next = blot.next; + blot.format(name, value); + if (next instanceof CodeBlock) { + next.formatAt(0, index - prevNewline + length - isolateLength, name, value); + } + } + }, { + key: 'insertAt', + value: function insertAt(index, value, def) { + if (def != null) return; + + var _descendant3 = this.descendant(_text2.default, index), + _descendant4 = _slicedToArray(_descendant3, 2), + text = _descendant4[0], + offset = _descendant4[1]; + + text.insertAt(offset, value); + } + }, { + key: 'length', + value: function length() { + var length = this.domNode.textContent.length; + if (!this.domNode.textContent.endsWith('\n')) { + return length + 1; + } + return length; + } + }, { + key: 'newlineIndex', + value: function newlineIndex(searchIndex) { + var reverse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + + if (!reverse) { + var offset = this.domNode.textContent.slice(searchIndex).indexOf('\n'); + return offset > -1 ? searchIndex + offset : -1; + } else { + return this.domNode.textContent.slice(0, searchIndex).lastIndexOf('\n'); + } + } + }, { + key: 'optimize', + value: function optimize() { + if (!this.domNode.textContent.endsWith('\n')) { + this.appendChild(_parchment2.default.create('text', '\n')); + } + _get(CodeBlock.prototype.__proto__ || Object.getPrototypeOf(CodeBlock.prototype), 'optimize', this).call(this); + var next = this.next; + if (next != null && next.prev === this && next.statics.blotName === this.statics.blotName && this.statics.formats(this.domNode) === next.statics.formats(next.domNode)) { + next.optimize(); + next.moveChildren(this); + next.remove(); + } + } + }, { + key: 'replace', + value: function replace(target) { + _get(CodeBlock.prototype.__proto__ || Object.getPrototypeOf(CodeBlock.prototype), 'replace', this).call(this, target); + [].slice.call(this.domNode.querySelectorAll('*')).forEach(function (node) { + var blot = _parchment2.default.find(node); + if (blot == null) { + node.parentNode.removeChild(node); + } else if (blot instanceof _parchment2.default.Embed) { + blot.remove(); + } else { + blot.unwrap(); + } + }); + } + }], [{ + key: 'create', + value: function create(value) { + var domNode = _get(CodeBlock.__proto__ || Object.getPrototypeOf(CodeBlock), 'create', this).call(this, value); + domNode.setAttribute('spellcheck', false); + return domNode; + } + }, { + key: 'formats', + value: function formats() { + return true; + } + }]); + + return CodeBlock; + }(_block2.default); + + CodeBlock.blotName = 'code-block'; + CodeBlock.tagName = 'PRE'; + CodeBlock.TAB = ' '; + + exports.Code = Code; + exports.default = CodeBlock; + +/***/ }, +/* 29 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.default = exports.BlockEmbed = exports.bubbleFormats = undefined; + + 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; }; }(); + + 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); } }; + + var _extend = __webpack_require__(25); + + var _extend2 = _interopRequireDefault(_extend); + + var _quillDelta = __webpack_require__(20); + + var _quillDelta2 = _interopRequireDefault(_quillDelta); + + var _parchment = __webpack_require__(2); + + var _parchment2 = _interopRequireDefault(_parchment); + + var _break = __webpack_require__(30); + + var _break2 = _interopRequireDefault(_break); + + var _embed = __webpack_require__(31); + + var _embed2 = _interopRequireDefault(_embed); + + var _inline = __webpack_require__(32); + + var _inline2 = _interopRequireDefault(_inline); + + var _text = __webpack_require__(33); + + var _text2 = _interopRequireDefault(_text); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + 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; } + + 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; } + + var NEWLINE_LENGTH = 1; + + var BlockEmbed = function (_Embed) { + _inherits(BlockEmbed, _Embed); + + function BlockEmbed() { + _classCallCheck(this, BlockEmbed); + + return _possibleConstructorReturn(this, (BlockEmbed.__proto__ || Object.getPrototypeOf(BlockEmbed)).apply(this, arguments)); + } + + _createClass(BlockEmbed, [{ + key: 'attach', + value: function attach() { + _get(BlockEmbed.prototype.__proto__ || Object.getPrototypeOf(BlockEmbed.prototype), 'attach', this).call(this); + this.attributes = new _parchment2.default.Attributor.Store(this.domNode); + } + }, { + key: 'delta', + value: function delta() { + return new _quillDelta2.default().insert(this.value(), (0, _extend2.default)(this.formats(), this.attributes.values())); + } + }, { + key: 'format', + value: function format(name, value) { + var attribute = _parchment2.default.query(name, _parchment2.default.Scope.BLOCK_ATTRIBUTE); + if (attribute != null) { + this.attributes.attribute(attribute, value); + } + } + }, { + key: 'formatAt', + value: function formatAt(index, length, name, value) { + this.format(name, value); + } + }, { + key: 'insertAt', + value: function insertAt(index, value, def) { + if (typeof value === 'string' && value.endsWith('\n')) { + var block = _parchment2.default.create(Block.blotName); + this.parent.insertBefore(block, index === 0 ? this : this.next); + block.insertAt(0, value.slice(0, -1)); + } else { + _get(BlockEmbed.prototype.__proto__ || Object.getPrototypeOf(BlockEmbed.prototype), 'insertAt', this).call(this, index, value, def); + } + } + }]); + + return BlockEmbed; + }(_embed2.default); + + BlockEmbed.scope = _parchment2.default.Scope.BLOCK_BLOT; + // It is important for cursor behavior BlockEmbeds use tags that are block level elements + + + var Block = function (_Parchment$Block) { + _inherits(Block, _Parchment$Block); + + function Block(domNode) { + _classCallCheck(this, Block); + + var _this2 = _possibleConstructorReturn(this, (Block.__proto__ || Object.getPrototypeOf(Block)).call(this, domNode)); + + _this2.cache = {}; + return _this2; + } + + _createClass(Block, [{ + key: 'delta', + value: function delta() { + if (this.cache.delta == null) { + this.cache.delta = this.descendants(_parchment2.default.Leaf).reduce(function (delta, leaf) { + if (leaf.length() === 0) { + return delta; + } else { + return delta.insert(leaf.value(), bubbleFormats(leaf)); + } + }, new _quillDelta2.default()).insert('\n', bubbleFormats(this)); + } + return this.cache.delta; + } + }, { + key: 'deleteAt', + value: function deleteAt(index, length) { + _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'deleteAt', this).call(this, index, length); + this.cache = {}; + } + }, { + key: 'formatAt', + value: function formatAt(index, length, name, value) { + if (length <= 0) return; + if (_parchment2.default.query(name, _parchment2.default.Scope.BLOCK)) { + if (index + length === this.length()) { + this.format(name, value); + } + } else { + _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'formatAt', this).call(this, index, Math.min(length, this.length() - index - 1), name, value); + } + this.cache = {}; + } + }, { + key: 'insertAt', + value: function insertAt(index, value, def) { + if (def != null) return _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'insertAt', this).call(this, index, value, def); + if (value.length === 0) return; + var lines = value.split('\n'); + var text = lines.shift(); + if (text.length > 0) { + if (index < this.length() - 1 || this.children.tail == null) { + _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'insertAt', this).call(this, Math.min(index, this.length() - 1), text); + } else { + this.children.tail.insertAt(this.children.tail.length(), text); + } + this.cache = {}; + } + var block = this; + lines.reduce(function (index, line) { + block = block.split(index, true); + block.insertAt(0, line); + return line.length; + }, index + text.length); + } + }, { + key: 'insertBefore', + value: function insertBefore(blot, ref) { + var head = this.children.head; + _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'insertBefore', this).call(this, blot, ref); + if (head instanceof _break2.default) { + head.remove(); + } + this.cache = {}; + } + }, { + key: 'length', + value: function length() { + if (this.cache.length == null) { + this.cache.length = _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'length', this).call(this) + NEWLINE_LENGTH; + } + return this.cache.length; + } + }, { + key: 'moveChildren', + value: function moveChildren(target, ref) { + _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'moveChildren', this).call(this, target, ref); + this.cache = {}; + } + }, { + key: 'optimize', + value: function optimize() { + _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'optimize', this).call(this); + this.cache = {}; + } + }, { + key: 'path', + value: function path(index) { + return _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'path', this).call(this, index, true); + } + }, { + key: 'removeChild', + value: function removeChild(child) { + _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'removeChild', this).call(this, child); + this.cache = {}; + } + }, { + key: 'split', + value: function split(index) { + var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + + if (force && (index === 0 || index >= this.length() - NEWLINE_LENGTH)) { + var clone = this.clone(); + if (index === 0) { + this.parent.insertBefore(clone, this); + return this; + } else { + this.parent.insertBefore(clone, this.next); + return clone; + } + } else { + var next = _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'split', this).call(this, index, force); + this.cache = {}; + return next; + } + } + }]); + + return Block; + }(_parchment2.default.Block); + + Block.blotName = 'block'; + Block.tagName = 'P'; + Block.defaultChild = 'break'; + Block.allowedChildren = [_inline2.default, _embed2.default, _text2.default]; + + function bubbleFormats(blot) { + var formats = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + if (blot == null) return formats; + if (typeof blot.formats === 'function') { + formats = (0, _extend2.default)(formats, blot.formats()); + } + if (blot.parent == null || blot.parent.blotName == 'scroll' || blot.parent.statics.scope !== blot.statics.scope) { + return formats; + } + return bubbleFormats(blot.parent, formats); + } + + exports.bubbleFormats = bubbleFormats; + exports.BlockEmbed = BlockEmbed; + exports.default = Block; + +/***/ }, +/* 30 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + 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; }; }(); + + 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); } }; + + var _embed = __webpack_require__(31); + + var _embed2 = _interopRequireDefault(_embed); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + 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; } + + 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; } + + var Break = function (_Embed) { + _inherits(Break, _Embed); + + function Break() { + _classCallCheck(this, Break); + + return _possibleConstructorReturn(this, (Break.__proto__ || Object.getPrototypeOf(Break)).apply(this, arguments)); + } + + _createClass(Break, [{ + key: 'insertInto', + value: function insertInto(parent, ref) { + if (parent.children.length === 0) { + _get(Break.prototype.__proto__ || Object.getPrototypeOf(Break.prototype), 'insertInto', this).call(this, parent, ref); + } else { + this.remove(); + } + } + }, { + key: 'length', + value: function length() { + return 0; + } + }, { + key: 'value', + value: function value() { + return ''; + } + }], [{ + key: 'value', + value: function value() { + return undefined; + } + }]); + + return Break; + }(_embed2.default); + + Break.blotName = 'break'; + Break.tagName = 'BR'; + + exports.default = Break; + +/***/ }, +/* 31 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _parchment = __webpack_require__(2); + + var _parchment2 = _interopRequireDefault(_parchment); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + 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; } + + 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; } + + var Embed = function (_Parchment$Embed) { + _inherits(Embed, _Parchment$Embed); + + function Embed() { + _classCallCheck(this, Embed); + + return _possibleConstructorReturn(this, (Embed.__proto__ || Object.getPrototypeOf(Embed)).apply(this, arguments)); + } + + return Embed; + }(_parchment2.default.Embed); + + exports.default = Embed; + +/***/ }, +/* 32 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + 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; }; }(); + + 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); } }; + + var _embed = __webpack_require__(31); + + var _embed2 = _interopRequireDefault(_embed); + + var _text = __webpack_require__(33); + + var _text2 = _interopRequireDefault(_text); + + var _parchment = __webpack_require__(2); + + var _parchment2 = _interopRequireDefault(_parchment); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + 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; } + + 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; } + + var Inline = function (_Parchment$Inline) { + _inherits(Inline, _Parchment$Inline); + + function Inline() { + _classCallCheck(this, Inline); + + return _possibleConstructorReturn(this, (Inline.__proto__ || Object.getPrototypeOf(Inline)).apply(this, arguments)); + } + + _createClass(Inline, [{ + key: 'formatAt', + value: function formatAt(index, length, name, value) { + if (Inline.compare(this.statics.blotName, name) < 0 && _parchment2.default.query(name, _parchment2.default.Scope.BLOT)) { + var blot = this.isolate(index, length); + if (value) { + blot.wrap(name, value); + } + } else { + _get(Inline.prototype.__proto__ || Object.getPrototypeOf(Inline.prototype), 'formatAt', this).call(this, index, length, name, value); + } + } + }, { + key: 'optimize', + value: function optimize() { + _get(Inline.prototype.__proto__ || Object.getPrototypeOf(Inline.prototype), 'optimize', this).call(this); + if (this.parent instanceof Inline && Inline.compare(this.statics.blotName, this.parent.statics.blotName) > 0) { + var parent = this.parent.isolate(this.offset(), this.length()); + this.moveChildren(parent); + parent.wrap(this); + } + } + }], [{ + key: 'compare', + value: function compare(self, other) { + var selfIndex = Inline.order.indexOf(self); + var otherIndex = Inline.order.indexOf(other); + if (selfIndex >= 0 || otherIndex >= 0) { + return selfIndex - otherIndex; + } else if (self === other) { + return 0; + } else if (self < other) { + return -1; + } else { + return 1; + } + } + }]); + + return Inline; + }(_parchment2.default.Inline); + + Inline.allowedChildren = [Inline, _embed2.default, _text2.default]; + // Lower index means deeper in the DOM tree, since not found (-1) is for embeds + Inline.order = ['cursor', 'inline', // Must be lower + 'code', 'underline', 'strike', 'italic', 'bold', 'script', 'link' // Must be higher + ]; + + exports.default = Inline; + +/***/ }, +/* 33 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _parchment = __webpack_require__(2); + + var _parchment2 = _interopRequireDefault(_parchment); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + 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; } + + 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; } + + var TextBlot = function (_Parchment$Text) { + _inherits(TextBlot, _Parchment$Text); + + function TextBlot() { + _classCallCheck(this, TextBlot); + + return _possibleConstructorReturn(this, (TextBlot.__proto__ || Object.getPrototypeOf(TextBlot)).apply(this, arguments)); + } + + return TextBlot; + }(_parchment2.default.Text); + + exports.default = TextBlot; + +/***/ }, +/* 34 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + 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"); } }; }(); + + 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); } }; + + 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; }; }(); + + var _parchment = __webpack_require__(2); + + var _parchment2 = _interopRequireDefault(_parchment); + + var _embed = __webpack_require__(31); + + var _embed2 = _interopRequireDefault(_embed); + + var _text = __webpack_require__(33); + + var _text2 = _interopRequireDefault(_text); + + var _emitter = __webpack_require__(35); + + var _emitter2 = _interopRequireDefault(_emitter); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + 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; } + + 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; } + + var Cursor = function (_Embed) { + _inherits(Cursor, _Embed); + + _createClass(Cursor, null, [{ + key: 'value', + value: function value() { + return undefined; + } + }]); + + function Cursor(domNode, selection) { + _classCallCheck(this, Cursor); + + var _this = _possibleConstructorReturn(this, (Cursor.__proto__ || Object.getPrototypeOf(Cursor)).call(this, domNode)); + + _this.selection = selection; + _this.textNode = document.createTextNode(Cursor.CONTENTS); + _this.domNode.appendChild(_this.textNode); + _this._length = 0; + return _this; + } + + _createClass(Cursor, [{ + key: 'detach', + value: function detach() { + // super.detach() will also clear domNode.__blot + if (this.parent != null) this.parent.removeChild(this); + } + }, { + key: 'format', + value: function format(name, value) { + if (this._length !== 0) { + return _get(Cursor.prototype.__proto__ || Object.getPrototypeOf(Cursor.prototype), 'format', this).call(this, name, value); + } + var target = this, + index = 0; + while (target != null && target.statics.scope !== _parchment2.default.Scope.BLOCK_BLOT) { + index += target.offset(target.parent); + target = target.parent; + } + if (target != null) { + this._length = Cursor.CONTENTS.length; + target.optimize(); + target.formatAt(index, Cursor.CONTENTS.length, name, value); + this._length = 0; + } + } + }, { + key: 'index', + value: function index(node, offset) { + if (node === this.textNode) return 0; + return _get(Cursor.prototype.__proto__ || Object.getPrototypeOf(Cursor.prototype), 'index', this).call(this, node, offset); + } + }, { + key: 'length', + value: function length() { + return this._length; + } + }, { + key: 'position', + value: function position() { + return [this.textNode, this.textNode.data.length]; + } + }, { + key: 'remove', + value: function remove() { + _get(Cursor.prototype.__proto__ || Object.getPrototypeOf(Cursor.prototype), 'remove', this).call(this); + this.parent = null; + } + }, { + key: 'restore', + value: function restore() { + var _this2 = this; + + if (this.selection.composing) return; + if (this.parent == null) return; + var textNode = this.textNode; + var range = this.selection.getNativeRange(); + var restoreText = void 0, + start = void 0, + end = void 0; + if (range != null && range.start.node === textNode && range.end.node === textNode) { + var _ref = [textNode, range.start.offset, range.end.offset]; + restoreText = _ref[0]; + start = _ref[1]; + end = _ref[2]; + } + // Link format will insert text outside of anchor tag + while (this.domNode.lastChild != null && this.domNode.lastChild !== this.textNode) { + this.domNode.parentNode.insertBefore(this.domNode.lastChild, this.domNode); + } + if (this.textNode.data !== Cursor.CONTENTS) { + var text = this.textNode.data.split(Cursor.CONTENTS).join(''); + if (this.next instanceof _text2.default) { + restoreText = this.next.domNode; + this.next.insertAt(0, text); + this.textNode.data = Cursor.CONTENTS; + } else { + this.textNode.data = text; + this.parent.insertBefore(_parchment2.default.create(this.textNode), this); + this.textNode = document.createTextNode(Cursor.CONTENTS); + this.domNode.appendChild(this.textNode); + } + } + this.remove(); + if (start == null) return; + this.selection.emitter.once(_emitter2.default.events.SCROLL_OPTIMIZE, function () { + var _map = [start, end].map(function (offset) { + return Math.max(0, Math.min(restoreText.data.length, offset - 1)); + }); + + var _map2 = _slicedToArray(_map, 2); + + start = _map2[0]; + end = _map2[1]; + + _this2.selection.setNativeRange(restoreText, start, restoreText, end); + }); + } + }, { + key: 'update', + value: function update(mutations) { + var _this3 = this; + + mutations.forEach(function (mutation) { + if (mutation.type === 'characterData' && mutation.target === _this3.textNode) { + _this3.restore(); + } + }); + } + }, { + key: 'value', + value: function value() { + return ''; + } + }]); + + return Cursor; + }(_embed2.default); + + Cursor.blotName = 'cursor'; + Cursor.className = 'ql-cursor'; + Cursor.tagName = 'span'; + Cursor.CONTENTS = '\uFEFF'; // Zero width no break space + + + exports.default = Cursor; + +/***/ }, +/* 35 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + 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; }; }(); + + 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); } }; + + var _eventemitter = __webpack_require__(36); + + var _eventemitter2 = _interopRequireDefault(_eventemitter); + + var _logger = __webpack_require__(37); + + var _logger2 = _interopRequireDefault(_logger); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + 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; } + + 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; } + + var debug = (0, _logger2.default)('quill:events'); + + var Emitter = function (_EventEmitter) { + _inherits(Emitter, _EventEmitter); + + function Emitter() { + _classCallCheck(this, Emitter); + + var _this = _possibleConstructorReturn(this, (Emitter.__proto__ || Object.getPrototypeOf(Emitter)).call(this)); + + _this.on('error', debug.error); + return _this; + } + + _createClass(Emitter, [{ + key: 'emit', + value: function emit() { + debug.log.apply(debug, arguments); + _get(Emitter.prototype.__proto__ || Object.getPrototypeOf(Emitter.prototype), 'emit', this).apply(this, arguments); + } + }]); + + return Emitter; + }(_eventemitter2.default); + + Emitter.events = { + EDITOR_CHANGE: 'editor-change', + SCROLL_BEFORE_UPDATE: 'scroll-before-update', + SCROLL_OPTIMIZE: 'scroll-optimize', + SCROLL_UPDATE: 'scroll-update', + SELECTION_CHANGE: 'selection-change', + TEXT_CHANGE: 'text-change' + }; + Emitter.sources = { + API: 'api', + SILENT: 'silent', + USER: 'user' + }; + + exports.default = Emitter; + +/***/ }, +/* 36 */ +/***/ function(module, exports) { + + 'use strict'; + + var has = Object.prototype.hasOwnProperty + , prefix = '~'; + + /** + * Constructor to create a storage for our `EE` objects. + * An `Events` instance is a plain object whose properties are event names. + * + * @constructor + * @api private + */ + function Events() {} + + // + // We try to not inherit from `Object.prototype`. In some engines creating an + // instance in this way is faster than calling `Object.create(null)` directly. + // If `Object.create(null)` is not supported we prefix the event names with a + // character to make sure that the built-in object properties are not + // overridden or used as an attack vector. + // + if (Object.create) { + Events.prototype = Object.create(null); + + // + // This hack is needed because the `__proto__` property is still inherited in + // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5. + // + if (!new Events().__proto__) prefix = false; + } + + /** + * Representation of a single event listener. + * + * @param {Function} fn The listener function. + * @param {Mixed} context The context to invoke the listener with. + * @param {Boolean} [once=false] Specify if the listener is a one-time listener. + * @constructor + * @api private + */ + function EE(fn, context, once) { + this.fn = fn; + this.context = context; + this.once = once || false; + } + + /** + * Minimal `EventEmitter` interface that is molded against the Node.js + * `EventEmitter` interface. + * + * @constructor + * @api public + */ + function EventEmitter() { + this._events = new Events(); + this._eventsCount = 0; + } + + /** + * Return an array listing the events for which the emitter has registered + * listeners. + * + * @returns {Array} + * @api public + */ + EventEmitter.prototype.eventNames = function eventNames() { + var names = [] + , events + , name; + + if (this._eventsCount === 0) return names; + + for (name in (events = this._events)) { + if (has.call(events, name)) names.push(prefix ? name.slice(1) : name); + } + + if (Object.getOwnPropertySymbols) { + return names.concat(Object.getOwnPropertySymbols(events)); + } + + return names; + }; + + /** + * Return the listeners registered for a given event. + * + * @param {String|Symbol} event The event name. + * @param {Boolean} exists Only check if there are listeners. + * @returns {Array|Boolean} + * @api public + */ + EventEmitter.prototype.listeners = function listeners(event, exists) { + var evt = prefix ? prefix + event : event + , available = this._events[evt]; + + if (exists) return !!available; + if (!available) return []; + if (available.fn) return [available.fn]; + + for (var i = 0, l = available.length, ee = new Array(l); i < l; i++) { + ee[i] = available[i].fn; + } + + return ee; + }; + + /** + * Calls each of the listeners registered for a given event. + * + * @param {String|Symbol} event The event name. + * @returns {Boolean} `true` if the event had listeners, else `false`. + * @api public + */ + EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) { + var evt = prefix ? prefix + event : event; + + if (!this._events[evt]) return false; + + var listeners = this._events[evt] + , len = arguments.length + , args + , i; + + if (listeners.fn) { + if (listeners.once) this.removeListener(event, listeners.fn, undefined, true); + + switch (len) { + case 1: return listeners.fn.call(listeners.context), true; + case 2: return listeners.fn.call(listeners.context, a1), true; + case 3: return listeners.fn.call(listeners.context, a1, a2), true; + case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true; + case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true; + case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true; + } + + for (i = 1, args = new Array(len -1); i < len; i++) { + args[i - 1] = arguments[i]; + } + + listeners.fn.apply(listeners.context, args); + } else { + var length = listeners.length + , j; + + for (i = 0; i < length; i++) { + if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true); + + switch (len) { + case 1: listeners[i].fn.call(listeners[i].context); break; + case 2: listeners[i].fn.call(listeners[i].context, a1); break; + case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break; + case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break; + default: + if (!args) for (j = 1, args = new Array(len -1); j < len; j++) { + args[j - 1] = arguments[j]; + } + + listeners[i].fn.apply(listeners[i].context, args); + } + } + } + + return true; + }; + + /** + * Add a listener for a given event. + * + * @param {String|Symbol} event The event name. + * @param {Function} fn The listener function. + * @param {Mixed} [context=this] The context to invoke the listener with. + * @returns {EventEmitter} `this`. + * @api public + */ + EventEmitter.prototype.on = function on(event, fn, context) { + var listener = new EE(fn, context || this) + , evt = prefix ? prefix + event : event; + + if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++; + else if (!this._events[evt].fn) this._events[evt].push(listener); + else this._events[evt] = [this._events[evt], listener]; + + return this; + }; + + /** + * Add a one-time listener for a given event. + * + * @param {String|Symbol} event The event name. + * @param {Function} fn The listener function. + * @param {Mixed} [context=this] The context to invoke the listener with. + * @returns {EventEmitter} `this`. + * @api public + */ + EventEmitter.prototype.once = function once(event, fn, context) { + var listener = new EE(fn, context || this, true) + , evt = prefix ? prefix + event : event; + + if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++; + else if (!this._events[evt].fn) this._events[evt].push(listener); + else this._events[evt] = [this._events[evt], listener]; + + return this; + }; + + /** + * Remove the listeners of a given event. + * + * @param {String|Symbol} event The event name. + * @param {Function} fn Only remove the listeners that match this function. + * @param {Mixed} context Only remove the listeners that have this context. + * @param {Boolean} once Only remove one-time listeners. + * @returns {EventEmitter} `this`. + * @api public + */ + EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) { + var evt = prefix ? prefix + event : event; + + if (!this._events[evt]) return this; + if (!fn) { + if (--this._eventsCount === 0) this._events = new Events(); + else delete this._events[evt]; + return this; + } + + var listeners = this._events[evt]; + + if (listeners.fn) { + if ( + listeners.fn === fn + && (!once || listeners.once) + && (!context || listeners.context === context) + ) { + if (--this._eventsCount === 0) this._events = new Events(); + else delete this._events[evt]; + } + } else { + for (var i = 0, events = [], length = listeners.length; i < length; i++) { + if ( + listeners[i].fn !== fn + || (once && !listeners[i].once) + || (context && listeners[i].context !== context) + ) { + events.push(listeners[i]); + } + } + + // + // Reset the array, or remove it completely if we have no more listeners. + // + if (events.length) this._events[evt] = events.length === 1 ? events[0] : events; + else if (--this._eventsCount === 0) this._events = new Events(); + else delete this._events[evt]; + } + + return this; + }; + + /** + * Remove all listeners, or those of the specified event. + * + * @param {String|Symbol} [event] The event name. + * @returns {EventEmitter} `this`. + * @api public + */ + EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) { + var evt; + + if (event) { + evt = prefix ? prefix + event : event; + if (this._events[evt]) { + if (--this._eventsCount === 0) this._events = new Events(); + else delete this._events[evt]; + } + } else { + this._events = new Events(); + this._eventsCount = 0; + } + + return this; + }; + + // + // Alias methods names because people roll like that. + // + EventEmitter.prototype.off = EventEmitter.prototype.removeListener; + EventEmitter.prototype.addListener = EventEmitter.prototype.on; + + // + // This function doesn't apply anymore. + // + EventEmitter.prototype.setMaxListeners = function setMaxListeners() { + return this; + }; + + // + // Expose the prefix. + // + EventEmitter.prefixed = prefix; + + // + // Allow `EventEmitter` to be imported as module namespace. + // + EventEmitter.EventEmitter = EventEmitter; + + // + // Expose the module. + // + if ('undefined' !== typeof module) { + module.exports = EventEmitter; + } + + +/***/ }, +/* 37 */ +/***/ function(module, exports) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + var levels = ['error', 'warn', 'log', 'info']; + var level = 'warn'; + + function debug(method) { + if (levels.indexOf(method) <= levels.indexOf(level)) { + for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + args[_key - 1] = arguments[_key]; + } + + console[method].apply(console, args); // eslint-disable-line no-console + } + } + + function namespace(ns) { + return levels.reduce(function (logger, method) { + logger[method] = debug.bind(console, method, ns); + return logger; + }, {}); + } + + debug.level = namespace.level = function (newLevel) { + level = newLevel; + }; + + exports.default = namespace; + +/***/ }, +/* 38 */ +/***/ function(module, exports) { + + var clone = (function() { + 'use strict'; + + var nativeMap; + try { + nativeMap = Map; + } catch(_) { + // maybe a reference error because no `Map`. Give it a dummy value that no + // value will ever be an instanceof. + nativeMap = function() {}; + } + + var nativeSet; + try { + nativeSet = Set; + } catch(_) { + nativeSet = function() {}; + } + + var nativePromise; + try { + nativePromise = Promise; + } catch(_) { + nativePromise = function() {}; + } + + /** + * Clones (copies) an Object using deep copying. + * + * This function supports circular references by default, but if you are certain + * there are no circular references in your object, you can save some CPU time + * by calling clone(obj, false). + * + * Caution: if `circular` is false and `parent` contains circular references, + * your program may enter an infinite loop and crash. + * + * @param `parent` - the object to be cloned + * @param `circular` - set to true if the object to be cloned may contain + * circular references. (optional - true by default) + * @param `depth` - set to a number if the object is only to be cloned to + * a particular depth. (optional - defaults to Infinity) + * @param `prototype` - sets the prototype to be used when cloning an object. + * (optional - defaults to parent prototype). + * @param `includeNonEnumerable` - set to true if the non-enumerable properties + * should be cloned as well. Non-enumerable properties on the prototype + * chain will be ignored. (optional - false by default) + */ + function clone(parent, circular, depth, prototype, includeNonEnumerable) { + if (typeof circular === 'object') { + depth = circular.depth; + prototype = circular.prototype; + includeNonEnumerable = circular.includeNonEnumerable; + circular = circular.circular; + } + // maintain two arrays for circular references, where corresponding parents + // and children have the same index + var allParents = []; + var allChildren = []; + + var useBuffer = typeof Buffer != 'undefined'; + + if (typeof circular == 'undefined') + circular = true; + + if (typeof depth == 'undefined') + depth = Infinity; + + // recurse this function so we don't reset allParents and allChildren + function _clone(parent, depth) { + // cloning null always returns null + if (parent === null) + return null; + + if (depth === 0) + return parent; + + var child; + var proto; + if (typeof parent != 'object') { + return parent; + } + + if (parent instanceof nativeMap) { + child = new nativeMap(); + } else if (parent instanceof nativeSet) { + child = new nativeSet(); + } else if (parent instanceof nativePromise) { + child = new nativePromise(function (resolve, reject) { + parent.then(function(value) { + resolve(_clone(value, depth - 1)); + }, function(err) { + reject(_clone(err, depth - 1)); + }); + }); + } else if (clone.__isArray(parent)) { + child = []; + } else if (clone.__isRegExp(parent)) { + child = new RegExp(parent.source, __getRegExpFlags(parent)); + if (parent.lastIndex) child.lastIndex = parent.lastIndex; + } else if (clone.__isDate(parent)) { + child = new Date(parent.getTime()); + } else if (useBuffer && Buffer.isBuffer(parent)) { + child = new Buffer(parent.length); + parent.copy(child); + return child; + } else if (parent instanceof Error) { + child = Object.create(parent); + } else { + if (typeof prototype == 'undefined') { + proto = Object.getPrototypeOf(parent); + child = Object.create(proto); + } + else { + child = Object.create(prototype); + proto = prototype; + } + } + + if (circular) { + var index = allParents.indexOf(parent); + + if (index != -1) { + return allChildren[index]; + } + allParents.push(parent); + allChildren.push(child); + } + + if (parent instanceof nativeMap) { + var keyIterator = parent.keys(); + while(true) { + var next = keyIterator.next(); + if (next.done) { + break; + } + var keyChild = _clone(next.value, depth - 1); + var valueChild = _clone(parent.get(next.value), depth - 1); + child.set(keyChild, valueChild); + } + } + if (parent instanceof nativeSet) { + var iterator = parent.keys(); + while(true) { + var next = iterator.next(); + if (next.done) { + break; + } + var entryChild = _clone(next.value, depth - 1); + child.add(entryChild); + } + } + + for (var i in parent) { + var attrs; + if (proto) { + attrs = Object.getOwnPropertyDescriptor(proto, i); + } + + if (attrs && attrs.set == null) { + continue; + } + child[i] = _clone(parent[i], depth - 1); + } + + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(parent); + for (var i = 0; i < symbols.length; i++) { + // Don't need to worry about cloning a symbol because it is a primitive, + // like a number or string. + var symbol = symbols[i]; + var descriptor = Object.getOwnPropertyDescriptor(parent, symbol); + if (descriptor && !descriptor.enumerable && !includeNonEnumerable) { + continue; + } + child[symbol] = _clone(parent[symbol], depth - 1); + if (!descriptor.enumerable) { + Object.defineProperty(child, symbol, { + enumerable: false + }); + } + } + } + + if (includeNonEnumerable) { + var allPropertyNames = Object.getOwnPropertyNames(parent); + for (var i = 0; i < allPropertyNames.length; i++) { + var propertyName = allPropertyNames[i]; + var descriptor = Object.getOwnPropertyDescriptor(parent, propertyName); + if (descriptor && descriptor.enumerable) { + continue; + } + child[propertyName] = _clone(parent[propertyName], depth - 1); + Object.defineProperty(child, propertyName, { + enumerable: false + }); + } + } + + return child; + } + + return _clone(parent, depth); + } + + /** + * Simple flat clone using prototype, accepts only objects, usefull for property + * override on FLAT configuration object (no nested props). + * + * USE WITH CAUTION! This may not behave as you wish if you do not know how this + * works. + */ + clone.clonePrototype = function clonePrototype(parent) { + if (parent === null) + return null; + + var c = function () {}; + c.prototype = parent; + return new c(); + }; + + // private utility functions + + function __objToStr(o) { + return Object.prototype.toString.call(o); + } + clone.__objToStr = __objToStr; + + function __isDate(o) { + return typeof o === 'object' && __objToStr(o) === '[object Date]'; + } + clone.__isDate = __isDate; + + function __isArray(o) { + return typeof o === 'object' && __objToStr(o) === '[object Array]'; + } + clone.__isArray = __isArray; + + function __isRegExp(o) { + return typeof o === 'object' && __objToStr(o) === '[object RegExp]'; + } + clone.__isRegExp = __isRegExp; + + function __getRegExpFlags(re) { + var flags = ''; + if (re.global) flags += 'g'; + if (re.ignoreCase) flags += 'i'; + if (re.multiline) flags += 'm'; + return flags; + } + clone.__getRegExpFlags = __getRegExpFlags; + + return clone; + })(); + + if (typeof module === 'object' && module.exports) { + module.exports = clone; + } + + +/***/ }, +/* 39 */ +/***/ function(module, exports) { + + "use strict"; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var Module = function Module(quill) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + + _classCallCheck(this, Module); + + this.quill = quill; + this.options = options; + }; + + Module.DEFAULTS = {}; + + exports.default = Module; + +/***/ }, +/* 40 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.default = exports.Range = undefined; + + 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"); } }; }(); + + 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; }; }(); + + var _parchment = __webpack_require__(2); + + var _parchment2 = _interopRequireDefault(_parchment); + + var _clone = __webpack_require__(38); + + var _clone2 = _interopRequireDefault(_clone); + + var _deepEqual = __webpack_require__(22); + + var _deepEqual2 = _interopRequireDefault(_deepEqual); + + var _emitter3 = __webpack_require__(35); + + var _emitter4 = _interopRequireDefault(_emitter3); + + var _logger = __webpack_require__(37); + + var _logger2 = _interopRequireDefault(_logger); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + 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); } } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var debug = (0, _logger2.default)('quill:selection'); + + var Range = function Range(index) { + var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + + _classCallCheck(this, Range); + + this.index = index; + this.length = length; + }; + + var Selection = function () { + function Selection(scroll, emitter) { + var _this = this; + + _classCallCheck(this, Selection); + + this.emitter = emitter; + this.scroll = scroll; + this.composing = false; + this.root = this.scroll.domNode; + this.root.addEventListener('compositionstart', function () { + _this.composing = true; + }); + this.root.addEventListener('compositionend', function () { + _this.composing = false; + }); + this.cursor = _parchment2.default.create('cursor', this); + // savedRange is last non-null range + this.lastRange = this.savedRange = new Range(0, 0); + ['keyup', 'mouseup', 'mouseleave', 'touchend', 'touchleave', 'focus', 'blur'].forEach(function (eventName) { + _this.root.addEventListener(eventName, function () { + // When range used to be a selection and user click within the selection, + // the range now being a cursor has not updated yet without setTimeout + setTimeout(_this.update.bind(_this, _emitter4.default.sources.USER), 100); + }); + }); + this.emitter.on(_emitter4.default.events.EDITOR_CHANGE, function (type, delta) { + if (type === _emitter4.default.events.TEXT_CHANGE && delta.length() > 0) { + _this.update(_emitter4.default.sources.SILENT); + } + }); + this.emitter.on(_emitter4.default.events.SCROLL_BEFORE_UPDATE, function () { + var native = _this.getNativeRange(); + if (native == null) return; + if (native.start.node === _this.cursor.textNode) return; // cursor.restore() will handle + // TODO unclear if this has negative side effects + _this.emitter.once(_emitter4.default.events.SCROLL_UPDATE, function () { + try { + _this.setNativeRange(native.start.node, native.start.offset, native.end.node, native.end.offset); + } catch (ignored) {} + }); + }); + this.update(_emitter4.default.sources.SILENT); + } + + _createClass(Selection, [{ + key: 'focus', + value: function focus() { + if (this.hasFocus()) return; + this.root.focus(); + this.setRange(this.savedRange); + } + }, { + key: 'format', + value: function format(_format, value) { + if (this.scroll.whitelist != null && !this.scroll.whitelist[_format]) return; + this.scroll.update(); + var nativeRange = this.getNativeRange(); + if (nativeRange == null || !nativeRange.native.collapsed || _parchment2.default.query(_format, _parchment2.default.Scope.BLOCK)) return; + if (nativeRange.start.node !== this.cursor.textNode) { + var blot = _parchment2.default.find(nativeRange.start.node, false); + if (blot == null) return; + // TODO Give blot ability to not split + if (blot instanceof _parchment2.default.Leaf) { + var after = blot.split(nativeRange.start.offset); + blot.parent.insertBefore(this.cursor, after); + } else { + blot.insertBefore(this.cursor, nativeRange.start.node); // Should never happen + } + this.cursor.attach(); + } + this.cursor.format(_format, value); + this.scroll.optimize(); + this.setNativeRange(this.cursor.textNode, this.cursor.textNode.data.length); + this.update(); + } + }, { + key: 'getBounds', + value: function getBounds(index) { + var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + + var scrollLength = this.scroll.length(); + index = Math.min(index, scrollLength - 1); + length = Math.min(index + length, scrollLength - 1) - index; + var bounds = void 0, + node = void 0, + _scroll$leaf = this.scroll.leaf(index), + _scroll$leaf2 = _slicedToArray(_scroll$leaf, 2), + leaf = _scroll$leaf2[0], + offset = _scroll$leaf2[1]; + if (leaf == null) return null; + + var _leaf$position = leaf.position(offset, true); + + var _leaf$position2 = _slicedToArray(_leaf$position, 2); + + node = _leaf$position2[0]; + offset = _leaf$position2[1]; + + var range = document.createRange(); + if (length > 0) { + range.setStart(node, offset); + + var _scroll$leaf3 = this.scroll.leaf(index + length); + + var _scroll$leaf4 = _slicedToArray(_scroll$leaf3, 2); + + leaf = _scroll$leaf4[0]; + offset = _scroll$leaf4[1]; + + if (leaf == null) return null; + + var _leaf$position3 = leaf.position(offset, true); + + var _leaf$position4 = _slicedToArray(_leaf$position3, 2); + + node = _leaf$position4[0]; + offset = _leaf$position4[1]; + + range.setEnd(node, offset); + bounds = range.getBoundingClientRect(); + } else { + var side = 'left'; + var rect = void 0; + if (node instanceof Text) { + if (offset < node.data.length) { + range.setStart(node, offset); + range.setEnd(node, offset + 1); + } else { + range.setStart(node, offset - 1); + range.setEnd(node, offset); + side = 'right'; + } + rect = range.getBoundingClientRect(); + } else { + rect = leaf.domNode.getBoundingClientRect(); + if (offset > 0) side = 'right'; + } + bounds = { + height: rect.height, + left: rect[side], + width: 0, + top: rect.top + }; + } + var containerBounds = this.root.parentNode.getBoundingClientRect(); + return { + left: bounds.left - containerBounds.left, + right: bounds.left + bounds.width - containerBounds.left, + top: bounds.top - containerBounds.top, + bottom: bounds.top + bounds.height - containerBounds.top, + height: bounds.height, + width: bounds.width + }; + } + }, { + key: 'getNativeRange', + value: function getNativeRange() { + var selection = document.getSelection(); + if (selection == null || selection.rangeCount <= 0) return null; + var nativeRange = selection.getRangeAt(0); + if (nativeRange == null) return null; + if (!contains(this.root, nativeRange.startContainer) || !nativeRange.collapsed && !contains(this.root, nativeRange.endContainer)) { + return null; + } + var range = { + start: { node: nativeRange.startContainer, offset: nativeRange.startOffset }, + end: { node: nativeRange.endContainer, offset: nativeRange.endOffset }, + native: nativeRange + }; + [range.start, range.end].forEach(function (position) { + var node = position.node, + offset = position.offset; + while (!(node instanceof Text) && node.childNodes.length > 0) { + if (node.childNodes.length > offset) { + node = node.childNodes[offset]; + offset = 0; + } else if (node.childNodes.length === offset) { + node = node.lastChild; + offset = node instanceof Text ? node.data.length : node.childNodes.length + 1; + } else { + break; + } + } + position.node = node, position.offset = offset; + }); + debug.info('getNativeRange', range); + return range; + } + }, { + key: 'getRange', + value: function getRange() { + var _this2 = this; + + var range = this.getNativeRange(); + if (range == null) return [null, null]; + var positions = [[range.start.node, range.start.offset]]; + if (!range.native.collapsed) { + positions.push([range.end.node, range.end.offset]); + } + var indexes = positions.map(function (position) { + var _position = _slicedToArray(position, 2), + node = _position[0], + offset = _position[1]; + + var blot = _parchment2.default.find(node, true); + var index = blot.offset(_this2.scroll); + if (offset === 0) { + return index; + } else if (blot instanceof _parchment2.default.Container) { + return index + blot.length(); + } else { + return index + blot.index(node, offset); + } + }); + var start = Math.min.apply(Math, _toConsumableArray(indexes)), + end = Math.max.apply(Math, _toConsumableArray(indexes)); + end = Math.min(end, this.scroll.length() - 1); + return [new Range(start, end - start), range]; + } + }, { + key: 'hasFocus', + value: function hasFocus() { + return document.activeElement === this.root; + } + }, { + key: 'scrollIntoView', + value: function scrollIntoView() { + var range = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.lastRange; + + if (range == null) return; + var bounds = this.getBounds(range.index, range.length); + if (bounds == null) return; + if (this.root.offsetHeight < bounds.bottom) { + var _scroll$line = this.scroll.line(Math.min(range.index + range.length, this.scroll.length() - 1)), + _scroll$line2 = _slicedToArray(_scroll$line, 1), + line = _scroll$line2[0]; + + this.root.scrollTop = line.domNode.offsetTop + line.domNode.offsetHeight - this.root.offsetHeight; + } else if (bounds.top < 0) { + var _scroll$line3 = this.scroll.line(Math.min(range.index, this.scroll.length() - 1)), + _scroll$line4 = _slicedToArray(_scroll$line3, 1), + _line = _scroll$line4[0]; + + this.root.scrollTop = _line.domNode.offsetTop; + } + } + }, { + key: 'setNativeRange', + value: function setNativeRange(startNode, startOffset) { + var endNode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : startNode; + var endOffset = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : startOffset; + var force = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false; + + debug.info('setNativeRange', startNode, startOffset, endNode, endOffset); + if (startNode != null && (this.root.parentNode == null || startNode.parentNode == null || endNode.parentNode == null)) { + return; + } + var selection = document.getSelection(); + if (selection == null) return; + if (startNode != null) { + if (!this.hasFocus()) this.root.focus(); + var native = (this.getNativeRange() || {}).native; + if (native == null || force || startNode !== native.startContainer || startOffset !== native.startOffset || endNode !== native.endContainer || endOffset !== native.endOffset) { + var range = document.createRange(); + range.setStart(startNode, startOffset); + range.setEnd(endNode, endOffset); + selection.removeAllRanges(); + selection.addRange(range); + } + } else { + selection.removeAllRanges(); + this.root.blur(); + document.body.focus(); // root.blur() not enough on IE11+Travis+SauceLabs (but not local VMs) + } + } + }, { + key: 'setRange', + value: function setRange(range) { + var _this3 = this; + + var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + var source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _emitter4.default.sources.API; + + if (typeof force === 'string') { + source = force; + force = false; + } + debug.info('setRange', range); + if (range != null) { + (function () { + var indexes = range.collapsed ? [range.index] : [range.index, range.index + range.length]; + var args = []; + var scrollLength = _this3.scroll.length(); + indexes.forEach(function (index, i) { + index = Math.min(scrollLength - 1, index); + var node = void 0, + _scroll$leaf5 = _this3.scroll.leaf(index), + _scroll$leaf6 = _slicedToArray(_scroll$leaf5, 2), + leaf = _scroll$leaf6[0], + offset = _scroll$leaf6[1]; + var _leaf$position5 = leaf.position(offset, i !== 0); + + var _leaf$position6 = _slicedToArray(_leaf$position5, 2); + + node = _leaf$position6[0]; + offset = _leaf$position6[1]; + + args.push(node, offset); + }); + if (args.length < 2) { + args = args.concat(args); + } + _this3.setNativeRange.apply(_this3, _toConsumableArray(args).concat([force])); + })(); + } else { + this.setNativeRange(null); + } + this.update(source); + } + }, { + key: 'update', + value: function update() { + var source = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _emitter4.default.sources.USER; + + var nativeRange = void 0, + oldRange = this.lastRange; + + var _getRange = this.getRange(); + + var _getRange2 = _slicedToArray(_getRange, 2); + + this.lastRange = _getRange2[0]; + nativeRange = _getRange2[1]; + + if (this.lastRange != null) { + this.savedRange = this.lastRange; + } + if (!(0, _deepEqual2.default)(oldRange, this.lastRange)) { + var _emitter; + + if (!this.composing && nativeRange != null && nativeRange.native.collapsed && nativeRange.start.node !== this.cursor.textNode) { + this.cursor.restore(); + } + var args = [_emitter4.default.events.SELECTION_CHANGE, (0, _clone2.default)(this.lastRange), (0, _clone2.default)(oldRange), source]; + (_emitter = this.emitter).emit.apply(_emitter, [_emitter4.default.events.EDITOR_CHANGE].concat(args)); + if (source !== _emitter4.default.sources.SILENT) { + var _emitter2; + + (_emitter2 = this.emitter).emit.apply(_emitter2, args); + } + } + } + }]); + + return Selection; + }(); + + function contains(parent, descendant) { + try { + // Firefox inserts inaccessible nodes around video elements + descendant.parentNode; + } catch (e) { + return false; + } + // IE11 has bug with Text nodes + // https://connect.microsoft.com/IE/feedback/details/780874/node-contains-is-incorrect + if (descendant instanceof Text) { + descendant = descendant.parentNode; + } + return parent.contains(descendant); + } + + exports.Range = Range; + exports.default = Selection; + +/***/ }, +/* 41 */ +/***/ function(module, exports) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + 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; }; }(); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var Theme = function () { + function Theme(quill, options) { + _classCallCheck(this, Theme); + + this.quill = quill; + this.options = options; + this.modules = {}; + } + + _createClass(Theme, [{ + key: 'init', + value: function init() { + var _this = this; + + Object.keys(this.options.modules).forEach(function (name) { + if (_this.modules[name] == null) { + _this.addModule(name); + } + }); + } + }, { + key: 'addModule', + value: function addModule(name) { + var moduleClass = this.quill.constructor.import('modules/' + name); + this.modules[name] = new moduleClass(this.quill, this.options.modules[name] || {}); + return this.modules[name]; + } + }]); + + return Theme; + }(); + + Theme.DEFAULTS = { + modules: {} + }; + Theme.themes = { + 'default': Theme + }; + + exports.default = Theme; + +/***/ }, +/* 42 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _parchment = __webpack_require__(2); + + var _parchment2 = _interopRequireDefault(_parchment); + + var _block = __webpack_require__(29); + + var _block2 = _interopRequireDefault(_block); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + 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; } + + 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; } + + var Container = function (_Parchment$Container) { + _inherits(Container, _Parchment$Container); + + function Container() { + _classCallCheck(this, Container); + + return _possibleConstructorReturn(this, (Container.__proto__ || Object.getPrototypeOf(Container)).apply(this, arguments)); + } + + return Container; + }(_parchment2.default.Container); + + Container.allowedChildren = [_block2.default, _block.BlockEmbed, Container]; + + exports.default = Container; + +/***/ }, +/* 43 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + 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"); } }; }(); + + 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; }; }(); + + 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); } }; + + var _parchment = __webpack_require__(2); + + var _parchment2 = _interopRequireDefault(_parchment); + + var _emitter = __webpack_require__(35); + + var _emitter2 = _interopRequireDefault(_emitter); + + var _block = __webpack_require__(29); + + var _block2 = _interopRequireDefault(_block); + + var _break = __webpack_require__(30); + + var _break2 = _interopRequireDefault(_break); + + var _container = __webpack_require__(42); + + var _container2 = _interopRequireDefault(_container); + + var _code = __webpack_require__(28); + + var _code2 = _interopRequireDefault(_code); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + 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; } + + 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; } + + function isLine(blot) { + return blot instanceof _block2.default || blot instanceof _block.BlockEmbed; + } + + var Scroll = function (_Parchment$Scroll) { + _inherits(Scroll, _Parchment$Scroll); + + function Scroll(domNode, config) { + _classCallCheck(this, Scroll); + + var _this = _possibleConstructorReturn(this, (Scroll.__proto__ || Object.getPrototypeOf(Scroll)).call(this, domNode)); + + _this.emitter = config.emitter; + if (Array.isArray(config.whitelist)) { + _this.whitelist = config.whitelist.reduce(function (whitelist, format) { + whitelist[format] = true; + return whitelist; + }, {}); + } + _this.optimize(); + _this.enable(); + return _this; + } + + _createClass(Scroll, [{ + key: 'deleteAt', + value: function deleteAt(index, length) { + var _line = this.line(index), + _line2 = _slicedToArray(_line, 2), + first = _line2[0], + offset = _line2[1]; + + var _line3 = this.line(index + length), + _line4 = _slicedToArray(_line3, 1), + last = _line4[0]; + + _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'deleteAt', this).call(this, index, length); + if (last != null && first !== last && offset > 0 && !(first instanceof _block.BlockEmbed) && !(last instanceof _block.BlockEmbed)) { + if (last instanceof _code2.default) { + last.deleteAt(last.length() - 1, 1); + } + var ref = last.children.head instanceof _break2.default ? null : last.children.head; + first.moveChildren(last, ref); + first.remove(); + } + this.optimize(); + } + }, { + key: 'enable', + value: function enable() { + var enabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; + + this.domNode.setAttribute('contenteditable', enabled); + } + }, { + key: 'formatAt', + value: function formatAt(index, length, format, value) { + if (this.whitelist != null && !this.whitelist[format]) return; + _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'formatAt', this).call(this, index, length, format, value); + this.optimize(); + } + }, { + key: 'insertAt', + value: function insertAt(index, value, def) { + if (def != null && this.whitelist != null && !this.whitelist[value]) return; + if (index >= this.length()) { + if (def == null || _parchment2.default.query(value, _parchment2.default.Scope.BLOCK) == null) { + var blot = _parchment2.default.create(this.statics.defaultChild); + this.appendChild(blot); + if (def == null && value.endsWith('\n')) { + value = value.slice(0, -1); + } + blot.insertAt(0, value, def); + } else { + var embed = _parchment2.default.create(value, def); + this.appendChild(embed); + } + } else { + _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'insertAt', this).call(this, index, value, def); + } + this.optimize(); + } + }, { + key: 'insertBefore', + value: function insertBefore(blot, ref) { + if (blot.statics.scope === _parchment2.default.Scope.INLINE_BLOT) { + var wrapper = _parchment2.default.create(this.statics.defaultChild); + wrapper.appendChild(blot); + blot = wrapper; + } + _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'insertBefore', this).call(this, blot, ref); + } + }, { + key: 'leaf', + value: function leaf(index) { + return this.path(index).pop() || [null, -1]; + } + }, { + key: 'line', + value: function line(index) { + if (index === this.length()) { + return this.line(index - 1); + } + return this.descendant(isLine, index); + } + }, { + key: 'lines', + value: function lines() { + var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; + var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Number.MAX_VALUE; + + var getLines = function getLines(blot, index, length) { + var lines = [], + lengthLeft = length; + blot.children.forEachAt(index, length, function (child, index, length) { + if (isLine(child)) { + lines.push(child); + } else if (child instanceof _parchment2.default.Container) { + lines = lines.concat(getLines(child, index, lengthLeft)); + } + lengthLeft -= length; + }); + return lines; + }; + return getLines(this, index, length); + } + }, { + key: 'optimize', + value: function optimize() { + var mutations = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; + + if (this.batch === true) return; + _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'optimize', this).call(this, mutations); + if (mutations.length > 0) { + this.emitter.emit(_emitter2.default.events.SCROLL_OPTIMIZE, mutations); + } + } + }, { + key: 'path', + value: function path(index) { + return _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'path', this).call(this, index).slice(1); // Exclude self + } + }, { + key: 'update', + value: function update(mutations) { + if (this.batch === true) return; + var source = _emitter2.default.sources.USER; + if (typeof mutations === 'string') { + source = mutations; + } + if (!Array.isArray(mutations)) { + mutations = this.observer.takeRecords(); + } + if (mutations.length > 0) { + this.emitter.emit(_emitter2.default.events.SCROLL_BEFORE_UPDATE, source, mutations); + } + _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'update', this).call(this, mutations.concat([])); // pass copy + if (mutations.length > 0) { + this.emitter.emit(_emitter2.default.events.SCROLL_UPDATE, source, mutations); + } + } + }]); + + return Scroll; + }(_parchment2.default.Scroll); + + Scroll.blotName = 'scroll'; + Scroll.className = 'ql-editor'; + Scroll.tagName = 'DIV'; + Scroll.defaultChild = 'block'; + Scroll.allowedChildren = [_block2.default, _block.BlockEmbed, _container2.default]; + + exports.default = Scroll; + +/***/ }, +/* 44 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.matchText = exports.matchSpacing = exports.matchNewline = exports.matchBlot = exports.matchAttributor = exports.default = undefined; + + 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"); } }; }(); + + 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; }; }(); + + var _quillDelta = __webpack_require__(20); + + var _quillDelta2 = _interopRequireDefault(_quillDelta); + + var _parchment = __webpack_require__(2); + + var _parchment2 = _interopRequireDefault(_parchment); + + var _quill = __webpack_require__(18); + + var _quill2 = _interopRequireDefault(_quill); + + var _logger = __webpack_require__(37); + + var _logger2 = _interopRequireDefault(_logger); + + var _module = __webpack_require__(39); + + var _module2 = _interopRequireDefault(_module); + + var _align = __webpack_require__(45); + + var _background = __webpack_require__(46); + + var _color = __webpack_require__(47); + + var _direction = __webpack_require__(48); + + var _font = __webpack_require__(49); + + var _size = __webpack_require__(50); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + 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; } + + 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); } } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + 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; } + + 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; } + + var debug = (0, _logger2.default)('quill:clipboard'); + + var DOM_KEY = '__ql-matcher'; + + var CLIPBOARD_CONFIG = [[Node.TEXT_NODE, matchText], ['br', matchBreak], [Node.ELEMENT_NODE, matchNewline], [Node.ELEMENT_NODE, matchBlot], [Node.ELEMENT_NODE, matchSpacing], [Node.ELEMENT_NODE, matchAttributor], [Node.ELEMENT_NODE, matchStyles], ['b', matchAlias.bind(matchAlias, 'bold')], ['i', matchAlias.bind(matchAlias, 'italic')], ['style', matchIgnore]]; + + var ATTRIBUTE_ATTRIBUTORS = [_align.AlignAttribute, _direction.DirectionAttribute].reduce(function (memo, attr) { + memo[attr.keyName] = attr; + return memo; + }, {}); + + var STYLE_ATTRIBUTORS = [_align.AlignStyle, _background.BackgroundStyle, _color.ColorStyle, _direction.DirectionStyle, _font.FontStyle, _size.SizeStyle].reduce(function (memo, attr) { + memo[attr.keyName] = attr; + return memo; + }, {}); + + var Clipboard = function (_Module) { + _inherits(Clipboard, _Module); + + function Clipboard(quill, options) { + _classCallCheck(this, Clipboard); + + var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this, quill, options)); + + _this.quill.root.addEventListener('paste', _this.onPaste.bind(_this)); + _this.container = _this.quill.addContainer('ql-clipboard'); + _this.container.setAttribute('contenteditable', true); + _this.container.setAttribute('tabindex', -1); + _this.matchers = []; + CLIPBOARD_CONFIG.concat(_this.options.matchers).forEach(function (pair) { + _this.addMatcher.apply(_this, _toConsumableArray(pair)); + }); + return _this; + } + + _createClass(Clipboard, [{ + key: 'addMatcher', + value: function addMatcher(selector, matcher) { + this.matchers.push([selector, matcher]); + } + }, { + key: 'convert', + value: function convert(html) { + if (typeof html === 'string') { + this.container.innerHTML = html; + } + + var _prepareMatching = this.prepareMatching(), + _prepareMatching2 = _slicedToArray(_prepareMatching, 2), + elementMatchers = _prepareMatching2[0], + textMatchers = _prepareMatching2[1]; + + var delta = traverse(this.container, elementMatchers, textMatchers); + // Remove trailing newline + if (deltaEndsWith(delta, '\n') && delta.ops[delta.ops.length - 1].attributes == null) { + delta = delta.compose(new _quillDelta2.default().retain(delta.length() - 1).delete(1)); + } + debug.log('convert', this.container.innerHTML, delta); + this.container.innerHTML = ''; + return delta; + } + }, { + key: 'dangerouslyPasteHTML', + value: function dangerouslyPasteHTML(index, html) { + var source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _quill2.default.sources.API; + + if (typeof index === 'string') { + return this.quill.setContents(this.convert(index), html); + } else { + var paste = this.convert(html); + return this.quill.updateContents(new _quillDelta2.default().retain(index).concat(paste), source); + } + } + }, { + key: 'onPaste', + value: function onPaste(e) { + var _this2 = this; + + if (e.defaultPrevented || !this.quill.isEnabled()) return; + var range = this.quill.getSelection(); + var delta = new _quillDelta2.default().retain(range.index); + var scrollTop = this.quill.scrollingContainer.scrollTop; + this.container.focus(); + setTimeout(function () { + _this2.quill.selection.update(_quill2.default.sources.SILENT); + delta = delta.concat(_this2.convert()).delete(range.length); + _this2.quill.updateContents(delta, _quill2.default.sources.USER); + // range.length contributes to delta.length() + _this2.quill.setSelection(delta.length() - range.length, _quill2.default.sources.SILENT); + _this2.quill.scrollingContainer.scrollTop = scrollTop; + _this2.quill.selection.scrollIntoView(); + }, 1); + } + }, { + key: 'prepareMatching', + value: function prepareMatching() { + var _this3 = this; + + var elementMatchers = [], + textMatchers = []; + this.matchers.forEach(function (pair) { + var _pair = _slicedToArray(pair, 2), + selector = _pair[0], + matcher = _pair[1]; + + switch (selector) { + case Node.TEXT_NODE: + textMatchers.push(matcher); + break; + case Node.ELEMENT_NODE: + elementMatchers.push(matcher); + break; + default: + [].forEach.call(_this3.container.querySelectorAll(selector), function (node) { + // TODO use weakmap + node[DOM_KEY] = node[DOM_KEY] || []; + node[DOM_KEY].push(matcher); + }); + break; + } + }); + return [elementMatchers, textMatchers]; + } + }]); + + return Clipboard; + }(_module2.default); + + Clipboard.DEFAULTS = { + matchers: [] + }; + + function computeStyle(node) { + if (node.nodeType !== Node.ELEMENT_NODE) return {}; + var DOM_KEY = '__ql-computed-style'; + return node[DOM_KEY] || (node[DOM_KEY] = window.getComputedStyle(node)); + } + + function deltaEndsWith(delta, text) { + var endText = ""; + for (var i = delta.ops.length - 1; i >= 0 && endText.length < text.length; --i) { + var op = delta.ops[i]; + if (typeof op.insert !== 'string') break; + endText = op.insert + endText; + } + return endText.slice(-1 * text.length) === text; + } + + function isLine(node) { + if (node.childNodes.length === 0) return false; // Exclude embed blocks + var style = computeStyle(node); + return ['block', 'list-item'].indexOf(style.display) > -1; + } + + function traverse(node, elementMatchers, textMatchers) { + // Post-order + if (node.nodeType === node.TEXT_NODE) { + return textMatchers.reduce(function (delta, matcher) { + return matcher(node, delta); + }, new _quillDelta2.default()); + } else if (node.nodeType === node.ELEMENT_NODE) { + return [].reduce.call(node.childNodes || [], function (delta, childNode) { + var childrenDelta = traverse(childNode, elementMatchers, textMatchers); + if (childNode.nodeType === node.ELEMENT_NODE) { + childrenDelta = elementMatchers.reduce(function (childrenDelta, matcher) { + return matcher(childNode, childrenDelta); + }, childrenDelta); + childrenDelta = (childNode[DOM_KEY] || []).reduce(function (childrenDelta, matcher) { + return matcher(childNode, childrenDelta); + }, childrenDelta); + } + return delta.concat(childrenDelta); + }, new _quillDelta2.default()); + } else { + return new _quillDelta2.default(); + } + } + + function matchAlias(format, node, delta) { + return delta.compose(new _quillDelta2.default().retain(delta.length(), _defineProperty({}, format, true))); + } + + function matchAttributor(node, delta) { + var attributes = _parchment2.default.Attributor.Attribute.keys(node); + var classes = _parchment2.default.Attributor.Class.keys(node); + var styles = _parchment2.default.Attributor.Style.keys(node); + var formats = {}; + attributes.concat(classes).concat(styles).forEach(function (name) { + var attr = _parchment2.default.query(name, _parchment2.default.Scope.ATTRIBUTE); + if (attr != null) { + formats[attr.attrName] = attr.value(node); + if (formats[attr.attrName]) return; + } + if (ATTRIBUTE_ATTRIBUTORS[name] != null) { + attr = ATTRIBUTE_ATTRIBUTORS[name]; + formats[attr.attrName] = attr.value(node) || undefined; + } + if (STYLE_ATTRIBUTORS[name] != null) { + attr = STYLE_ATTRIBUTORS[name]; + formats[attr.attrName] = attr.value(node) || undefined; + } + }); + if (Object.keys(formats).length > 0) { + delta = delta.compose(new _quillDelta2.default().retain(delta.length(), formats)); + } + return delta; + } + + function matchBlot(node, delta) { + var match = _parchment2.default.query(node); + if (match == null) return delta; + if (match.prototype instanceof _parchment2.default.Embed) { + var embed = {}; + var value = match.value(node); + if (value != null) { + embed[match.blotName] = value; + delta = new _quillDelta2.default().insert(embed, match.formats(node)); + } + } else if (typeof match.formats === 'function') { + var formats = _defineProperty({}, match.blotName, match.formats(node)); + delta = delta.compose(new _quillDelta2.default().retain(delta.length(), formats)); + } + return delta; + } + + function matchBreak(node, delta) { + if (!deltaEndsWith(delta, '\n')) { + delta.insert('\n'); + } + return delta; + } + + function matchIgnore() { + return new _quillDelta2.default(); + } + + function matchNewline(node, delta) { + if (isLine(node) && !deltaEndsWith(delta, '\n')) { + delta.insert('\n'); + } + return delta; + } + + function matchSpacing(node, delta) { + if (isLine(node) && node.nextElementSibling != null && !deltaEndsWith(delta, '\n\n')) { + var nodeHeight = node.offsetHeight + parseFloat(computeStyle(node).marginTop) + parseFloat(computeStyle(node).marginBottom); + if (node.nextElementSibling.offsetTop > node.offsetTop + nodeHeight * 1.5) { + delta.insert('\n'); + } + } + return delta; + } + + function matchStyles(node, delta) { + var formats = {}; + var style = node.style || {}; + if (style.fontStyle && computeStyle(node).fontStyle === 'italic') { + formats.italic = true; + } + if (style.fontWeight && computeStyle(node).fontWeight === 'bold') { + formats.bold = true; + } + if (Object.keys(formats).length > 0) { + delta = delta.compose(new _quillDelta2.default().retain(delta.length(), formats)); + } + if (parseFloat(style.textIndent || 0) > 0) { + // Could be 0.5in + delta = new _quillDelta2.default().insert('\t').concat(delta); + } + return delta; + } + + function matchText(node, delta) { + var text = node.data; + // Word represents empty line with   + if (node.parentNode.tagName === 'O:P') { + return delta.insert(text.trim()); + } + if (!computeStyle(node.parentNode).whiteSpace.startsWith('pre')) { + // eslint-disable-next-line func-style + var replacer = function replacer(collapse, match) { + match = match.replace(/[^\u00a0]/g, ''); // \u00a0 is nbsp; + return match.length < 1 && collapse ? ' ' : match; + }; + text = text.replace(/\r\n/g, ' ').replace(/\n/g, ' '); + text = text.replace(/\s\s+/g, replacer.bind(replacer, true)); // collapse whitespace + if (node.previousSibling == null && isLine(node.parentNode) || node.previousSibling != null && isLine(node.previousSibling)) { + text = text.replace(/^\s+/, replacer.bind(replacer, false)); + } + if (node.nextSibling == null && isLine(node.parentNode) || node.nextSibling != null && isLine(node.nextSibling)) { + text = text.replace(/\s+$/, replacer.bind(replacer, false)); + } + } + return delta.insert(text); + } + + exports.default = Clipboard; + exports.matchAttributor = matchAttributor; + exports.matchBlot = matchBlot; + exports.matchNewline = matchNewline; + exports.matchSpacing = matchSpacing; + exports.matchText = matchText; + +/***/ }, +/* 45 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.AlignStyle = exports.AlignClass = exports.AlignAttribute = undefined; + + var _parchment = __webpack_require__(2); + + var _parchment2 = _interopRequireDefault(_parchment); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + var config = { + scope: _parchment2.default.Scope.BLOCK, + whitelist: ['right', 'center', 'justify'] + }; + + var AlignAttribute = new _parchment2.default.Attributor.Attribute('align', 'align', config); + var AlignClass = new _parchment2.default.Attributor.Class('align', 'ql-align', config); + var AlignStyle = new _parchment2.default.Attributor.Style('align', 'text-align', config); + + exports.AlignAttribute = AlignAttribute; + exports.AlignClass = AlignClass; + exports.AlignStyle = AlignStyle; + +/***/ }, +/* 46 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.BackgroundStyle = exports.BackgroundClass = undefined; + + var _parchment = __webpack_require__(2); + + var _parchment2 = _interopRequireDefault(_parchment); + + var _color = __webpack_require__(47); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + var BackgroundClass = new _parchment2.default.Attributor.Class('background', 'ql-bg', { + scope: _parchment2.default.Scope.INLINE + }); + var BackgroundStyle = new _color.ColorAttributor('background', 'background-color', { + scope: _parchment2.default.Scope.INLINE + }); + + exports.BackgroundClass = BackgroundClass; + exports.BackgroundStyle = BackgroundStyle; + +/***/ }, +/* 47 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.ColorStyle = exports.ColorClass = exports.ColorAttributor = undefined; + + 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; }; }(); + + 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); } }; + + var _parchment = __webpack_require__(2); + + var _parchment2 = _interopRequireDefault(_parchment); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + 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; } + + 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; } + + var ColorAttributor = function (_Parchment$Attributor) { + _inherits(ColorAttributor, _Parchment$Attributor); + + function ColorAttributor() { + _classCallCheck(this, ColorAttributor); + + return _possibleConstructorReturn(this, (ColorAttributor.__proto__ || Object.getPrototypeOf(ColorAttributor)).apply(this, arguments)); + } + + _createClass(ColorAttributor, [{ + key: 'value', + value: function value(domNode) { + var value = _get(ColorAttributor.prototype.__proto__ || Object.getPrototypeOf(ColorAttributor.prototype), 'value', this).call(this, domNode); + if (!value.startsWith('rgb(')) return value; + value = value.replace(/^[^\d]+/, '').replace(/[^\d]+$/, ''); + return '#' + value.split(',').map(function (component) { + return ('00' + parseInt(component).toString(16)).slice(-2); + }).join(''); + } + }]); + + return ColorAttributor; + }(_parchment2.default.Attributor.Style); + + var ColorClass = new _parchment2.default.Attributor.Class('color', 'ql-color', { + scope: _parchment2.default.Scope.INLINE + }); + var ColorStyle = new ColorAttributor('color', 'color', { + scope: _parchment2.default.Scope.INLINE + }); + + exports.ColorAttributor = ColorAttributor; + exports.ColorClass = ColorClass; + exports.ColorStyle = ColorStyle; + +/***/ }, +/* 48 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.DirectionStyle = exports.DirectionClass = exports.DirectionAttribute = undefined; + + var _parchment = __webpack_require__(2); + + var _parchment2 = _interopRequireDefault(_parchment); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + var config = { + scope: _parchment2.default.Scope.BLOCK, + whitelist: ['rtl'] + }; + + var DirectionAttribute = new _parchment2.default.Attributor.Attribute('direction', 'dir', config); + var DirectionClass = new _parchment2.default.Attributor.Class('direction', 'ql-direction', config); + var DirectionStyle = new _parchment2.default.Attributor.Style('direction', 'direction', config); + + exports.DirectionAttribute = DirectionAttribute; + exports.DirectionClass = DirectionClass; + exports.DirectionStyle = DirectionStyle; + +/***/ }, +/* 49 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.FontClass = exports.FontStyle = undefined; + + 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; }; }(); + + 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); } }; + + var _parchment = __webpack_require__(2); + + var _parchment2 = _interopRequireDefault(_parchment); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + 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; } + + 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; } + + var config = { + scope: _parchment2.default.Scope.INLINE, + whitelist: ['serif', 'monospace'] + }; + + var FontClass = new _parchment2.default.Attributor.Class('font', 'ql-font', config); + + var FontStyleAttributor = function (_Parchment$Attributor) { + _inherits(FontStyleAttributor, _Parchment$Attributor); + + function FontStyleAttributor() { + _classCallCheck(this, FontStyleAttributor); + + return _possibleConstructorReturn(this, (FontStyleAttributor.__proto__ || Object.getPrototypeOf(FontStyleAttributor)).apply(this, arguments)); + } + + _createClass(FontStyleAttributor, [{ + key: 'value', + value: function value(node) { + return _get(FontStyleAttributor.prototype.__proto__ || Object.getPrototypeOf(FontStyleAttributor.prototype), 'value', this).call(this, node).replace(/["']/g, ''); + } + }]); + + return FontStyleAttributor; + }(_parchment2.default.Attributor.Style); + + var FontStyle = new FontStyleAttributor('font', 'font-family', config); + + exports.FontStyle = FontStyle; + exports.FontClass = FontClass; + +/***/ }, +/* 50 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.SizeStyle = exports.SizeClass = undefined; + + var _parchment = __webpack_require__(2); + + var _parchment2 = _interopRequireDefault(_parchment); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + var SizeClass = new _parchment2.default.Attributor.Class('size', 'ql-size', { + scope: _parchment2.default.Scope.INLINE, + whitelist: ['small', 'large', 'huge'] + }); + var SizeStyle = new _parchment2.default.Attributor.Style('size', 'font-size', { + scope: _parchment2.default.Scope.INLINE, + whitelist: ['10px', '18px', '32px'] + }); + + exports.SizeClass = SizeClass; + exports.SizeStyle = SizeStyle; + +/***/ }, +/* 51 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.getLastChangeIndex = exports.default = undefined; + + 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; }; }(); + + var _parchment = __webpack_require__(2); + + var _parchment2 = _interopRequireDefault(_parchment); + + var _quill = __webpack_require__(18); + + var _quill2 = _interopRequireDefault(_quill); + + var _module = __webpack_require__(39); + + var _module2 = _interopRequireDefault(_module); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + 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; } + + 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; } + + var History = function (_Module) { + _inherits(History, _Module); + + function History(quill, options) { + _classCallCheck(this, History); + + var _this = _possibleConstructorReturn(this, (History.__proto__ || Object.getPrototypeOf(History)).call(this, quill, options)); + + _this.lastRecorded = 0; + _this.ignoreChange = false; + _this.clear(); + _this.quill.on(_quill2.default.events.EDITOR_CHANGE, function (eventName, delta, oldDelta, source) { + if (eventName !== _quill2.default.events.TEXT_CHANGE || _this.ignoreChange) return; + if (!_this.options.userOnly || source === _quill2.default.sources.USER) { + _this.record(delta, oldDelta); + } else { + _this.transform(delta); + } + }); + _this.quill.keyboard.addBinding({ key: 'Z', shortKey: true }, _this.undo.bind(_this)); + _this.quill.keyboard.addBinding({ key: 'Z', shortKey: true, shiftKey: true }, _this.redo.bind(_this)); + if (/Win/i.test(navigator.platform)) { + _this.quill.keyboard.addBinding({ key: 'Y', shortKey: true }, _this.redo.bind(_this)); + } + return _this; + } + + _createClass(History, [{ + key: 'change', + value: function change(source, dest) { + if (this.stack[source].length === 0) return; + var delta = this.stack[source].pop(); + this.lastRecorded = 0; + this.ignoreChange = true; + this.quill.updateContents(delta[source], _quill2.default.sources.USER); + this.ignoreChange = false; + var index = getLastChangeIndex(delta[source]); + this.quill.setSelection(index); + this.quill.selection.scrollIntoView(); + this.stack[dest].push(delta); + } + }, { + key: 'clear', + value: function clear() { + this.stack = { undo: [], redo: [] }; + } + }, { + key: 'record', + value: function record(changeDelta, oldDelta) { + if (changeDelta.ops.length === 0) return; + this.stack.redo = []; + var undoDelta = this.quill.getContents().diff(oldDelta); + var timestamp = Date.now(); + if (this.lastRecorded + this.options.delay > timestamp && this.stack.undo.length > 0) { + var delta = this.stack.undo.pop(); + undoDelta = undoDelta.compose(delta.undo); + changeDelta = delta.redo.compose(changeDelta); + } else { + this.lastRecorded = timestamp; + } + this.stack.undo.push({ + redo: changeDelta, + undo: undoDelta + }); + if (this.stack.undo.length > this.options.maxStack) { + this.stack.undo.shift(); + } + } + }, { + key: 'redo', + value: function redo() { + this.change('redo', 'undo'); + } + }, { + key: 'transform', + value: function transform(delta) { + this.stack.undo.forEach(function (change) { + change.undo = delta.transform(change.undo, true); + change.redo = delta.transform(change.redo, true); + }); + this.stack.redo.forEach(function (change) { + change.undo = delta.transform(change.undo, true); + change.redo = delta.transform(change.redo, true); + }); + } + }, { + key: 'undo', + value: function undo() { + this.change('undo', 'redo'); + } + }]); + + return History; + }(_module2.default); + + History.DEFAULTS = { + delay: 1000, + maxStack: 100, + userOnly: false + }; + + function endsWithNewlineChange(delta) { + var lastOp = delta.ops[delta.ops.length - 1]; + if (lastOp == null) return false; + if (lastOp.insert != null) { + return typeof lastOp.insert === 'string' && lastOp.insert.endsWith('\n'); + } + if (lastOp.attributes != null) { + return Object.keys(lastOp.attributes).some(function (attr) { + return _parchment2.default.query(attr, _parchment2.default.Scope.BLOCK) != null; + }); + } + return false; + } + + function getLastChangeIndex(delta) { + var deleteLength = delta.reduce(function (length, op) { + length += op.delete || 0; + return length; + }, 0); + var changeIndex = delta.length() - deleteLength; + if (endsWithNewlineChange(delta)) { + changeIndex -= 1; + } + return changeIndex; + } + + exports.default = History; + exports.getLastChangeIndex = getLastChangeIndex; + +/***/ }, +/* 52 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + 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; }; + + 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"); } }; }(); + + 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; }; }(); + + var _clone = __webpack_require__(38); + + var _clone2 = _interopRequireDefault(_clone); + + var _deepEqual = __webpack_require__(22); + + var _deepEqual2 = _interopRequireDefault(_deepEqual); + + var _extend = __webpack_require__(25); + + var _extend2 = _interopRequireDefault(_extend); + + var _op = __webpack_require__(26); + + var _op2 = _interopRequireDefault(_op); + + var _parchment = __webpack_require__(2); + + var _parchment2 = _interopRequireDefault(_parchment); + + var _quill = __webpack_require__(18); + + var _quill2 = _interopRequireDefault(_quill); + + var _logger = __webpack_require__(37); + + var _logger2 = _interopRequireDefault(_logger); + + var _module = __webpack_require__(39); + + var _module2 = _interopRequireDefault(_module); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + 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; } + + 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; } + + var debug = (0, _logger2.default)('quill:keyboard'); + + var SHORTKEY = /Mac/i.test(navigator.platform) ? 'metaKey' : 'ctrlKey'; + + var Keyboard = function (_Module) { + _inherits(Keyboard, _Module); + + _createClass(Keyboard, null, [{ + key: 'match', + value: function match(evt, binding) { + binding = normalize(binding); + if (!!binding.shortKey !== evt[SHORTKEY] && binding.shortKey !== null) return false; + if (['altKey', 'ctrlKey', 'metaKey', 'shiftKey'].some(function (key) { + return key != SHORTKEY && !!binding[key] !== evt[key] && binding[key] !== null; + })) { + return false; + } + return binding.key === (evt.which || evt.keyCode); + } + }]); + + function Keyboard(quill, options) { + _classCallCheck(this, Keyboard); + + var _this = _possibleConstructorReturn(this, (Keyboard.__proto__ || Object.getPrototypeOf(Keyboard)).call(this, quill, options)); + + _this.bindings = {}; + Object.keys(_this.options.bindings).forEach(function (name) { + if (_this.options.bindings[name]) { + _this.addBinding(_this.options.bindings[name]); + } + }); + _this.addBinding({ key: Keyboard.keys.ENTER, shiftKey: null }, handleEnter); + _this.addBinding({ key: Keyboard.keys.ENTER, metaKey: null, ctrlKey: null, altKey: null }, function () {}); + if (/Gecko/i.test(navigator.userAgent)) { + // Need to handle delete and backspace for Firefox in the general case #1171 + _this.addBinding({ key: Keyboard.keys.BACKSPACE }, { collapsed: true }, handleBackspace); + _this.addBinding({ key: Keyboard.keys.DELETE }, { collapsed: true }, handleDelete); + } else { + _this.addBinding({ key: Keyboard.keys.BACKSPACE }, { collapsed: true, prefix: /^.?$/ }, handleBackspace); + _this.addBinding({ key: Keyboard.keys.DELETE }, { collapsed: true, suffix: /^.?$/ }, handleDelete); + } + _this.addBinding({ key: Keyboard.keys.BACKSPACE }, { collapsed: false }, handleDeleteRange); + _this.addBinding({ key: Keyboard.keys.DELETE }, { collapsed: false }, handleDeleteRange); + _this.listen(); + return _this; + } + + _createClass(Keyboard, [{ + key: 'addBinding', + value: function addBinding(key) { + var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var handler = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + + var binding = normalize(key); + if (binding == null || binding.key == null) { + return debug.warn('Attempted to add invalid keyboard binding', binding); + } + if (typeof context === 'function') { + context = { handler: context }; + } + if (typeof handler === 'function') { + handler = { handler: handler }; + } + binding = (0, _extend2.default)(binding, context, handler); + this.bindings[binding.key] = this.bindings[binding.key] || []; + this.bindings[binding.key].push(binding); + } + }, { + key: 'listen', + value: function listen() { + var _this2 = this; + + this.quill.root.addEventListener('keydown', function (evt) { + if (evt.defaultPrevented) return; + var which = evt.which || evt.keyCode; + var bindings = (_this2.bindings[which] || []).filter(function (binding) { + return Keyboard.match(evt, binding); + }); + if (bindings.length === 0) return; + var range = _this2.quill.getSelection(); + if (range == null || !_this2.quill.hasFocus()) return; + + var _quill$scroll$line = _this2.quill.scroll.line(range.index), + _quill$scroll$line2 = _slicedToArray(_quill$scroll$line, 2), + line = _quill$scroll$line2[0], + offset = _quill$scroll$line2[1]; + + var _quill$scroll$leaf = _this2.quill.scroll.leaf(range.index), + _quill$scroll$leaf2 = _slicedToArray(_quill$scroll$leaf, 2), + leafStart = _quill$scroll$leaf2[0], + offsetStart = _quill$scroll$leaf2[1]; + + var _ref = range.length === 0 ? [leafStart, offsetStart] : _this2.quill.scroll.leaf(range.index + range.length), + _ref2 = _slicedToArray(_ref, 2), + leafEnd = _ref2[0], + offsetEnd = _ref2[1]; + + var prefixText = leafStart instanceof _parchment2.default.Text ? leafStart.value().slice(0, offsetStart) : ''; + var suffixText = leafEnd instanceof _parchment2.default.Text ? leafEnd.value().slice(offsetEnd) : ''; + var curContext = { + collapsed: range.length === 0, + empty: range.length === 0 && line.length() <= 1, + format: _this2.quill.getFormat(range), + offset: offset, + prefix: prefixText, + suffix: suffixText + }; + var prevented = bindings.some(function (binding) { + if (binding.collapsed != null && binding.collapsed !== curContext.collapsed) return false; + if (binding.empty != null && binding.empty !== curContext.empty) return false; + if (binding.offset != null && binding.offset !== curContext.offset) return false; + if (Array.isArray(binding.format)) { + // any format is present + if (binding.format.every(function (name) { + return curContext.format[name] == null; + })) { + return false; + } + } else if (_typeof(binding.format) === 'object') { + // all formats must match + if (!Object.keys(binding.format).every(function (name) { + if (binding.format[name] === true) return curContext.format[name] != null; + if (binding.format[name] === false) return curContext.format[name] == null; + return (0, _deepEqual2.default)(binding.format[name], curContext.format[name]); + })) { + return false; + } + } + if (binding.prefix != null && !binding.prefix.test(curContext.prefix)) return false; + if (binding.suffix != null && !binding.suffix.test(curContext.suffix)) return false; + return binding.handler.call(_this2, range, curContext) !== true; + }); + if (prevented) { + evt.preventDefault(); + } + }); + } + }]); + + return Keyboard; + }(_module2.default); + + Keyboard.keys = { + BACKSPACE: 8, + TAB: 9, + ENTER: 13, + ESCAPE: 27, + LEFT: 37, + UP: 38, + RIGHT: 39, + DOWN: 40, + DELETE: 46 + }; + + Keyboard.DEFAULTS = { + bindings: { + 'bold': makeFormatHandler('bold'), + 'italic': makeFormatHandler('italic'), + 'underline': makeFormatHandler('underline'), + 'indent': { + // highlight tab or tab at beginning of list, indent or blockquote + key: Keyboard.keys.TAB, + format: ['blockquote', 'indent', 'list'], + handler: function handler(range, context) { + if (context.collapsed && context.offset !== 0) return true; + this.quill.format('indent', '+1', _quill2.default.sources.USER); + } + }, + 'outdent': { + key: Keyboard.keys.TAB, + shiftKey: true, + format: ['blockquote', 'indent', 'list'], + // highlight tab or tab at beginning of list, indent or blockquote + handler: function handler(range, context) { + if (context.collapsed && context.offset !== 0) return true; + this.quill.format('indent', '-1', _quill2.default.sources.USER); + } + }, + 'outdent backspace': { + key: Keyboard.keys.BACKSPACE, + collapsed: true, + format: ['blockquote', 'indent', 'list'], + offset: 0, + handler: function handler(range, context) { + if (context.format.indent != null) { + this.quill.format('indent', '-1', _quill2.default.sources.USER); + } else if (context.format.blockquote != null) { + this.quill.format('blockquote', false, _quill2.default.sources.USER); + } else if (context.format.list != null) { + this.quill.format('list', false, _quill2.default.sources.USER); + } + } + }, + 'indent code-block': makeCodeBlockHandler(true), + 'outdent code-block': makeCodeBlockHandler(false), + 'remove tab': { + key: Keyboard.keys.TAB, + shiftKey: true, + collapsed: true, + prefix: /\t$/, + handler: function handler(range) { + this.quill.deleteText(range.index - 1, 1, _quill2.default.sources.USER); + } + }, + 'tab': { + key: Keyboard.keys.TAB, + handler: function handler(range, context) { + if (!context.collapsed) { + this.quill.scroll.deleteAt(range.index, range.length); + } + this.quill.insertText(range.index, '\t', _quill2.default.sources.USER); + this.quill.setSelection(range.index + 1, _quill2.default.sources.SILENT); + } + }, + 'list empty enter': { + key: Keyboard.keys.ENTER, + collapsed: true, + format: ['list'], + empty: true, + handler: function handler(range, context) { + this.quill.format('list', false, _quill2.default.sources.USER); + if (context.format.indent) { + this.quill.format('indent', false, _quill2.default.sources.USER); + } + } + }, + 'checklist enter': { + key: Keyboard.keys.ENTER, + collapsed: true, + format: { list: 'checked' }, + handler: function handler(range) { + this.quill.scroll.insertAt(range.index, '\n'); + + var _quill$scroll$line3 = this.quill.scroll.line(range.index + 1), + _quill$scroll$line4 = _slicedToArray(_quill$scroll$line3, 1), + line = _quill$scroll$line4[0]; + + line.format('list', 'unchecked'); + this.quill.update(_quill2.default.sources.USER); + this.quill.setSelection(range.index + 1, _quill2.default.sources.SILENT); + this.quill.selection.scrollIntoView(); + } + }, + 'header enter': { + key: Keyboard.keys.ENTER, + collapsed: true, + format: ['header'], + suffix: /^$/, + handler: function handler(range) { + this.quill.scroll.insertAt(range.index, '\n'); + this.quill.formatText(range.index + 1, 1, 'header', false, _quill2.default.sources.USER); + this.quill.setSelection(range.index + 1, _quill2.default.sources.SILENT); + this.quill.selection.scrollIntoView(); + } + }, + 'list autofill': { + key: ' ', + collapsed: true, + format: { list: false }, + prefix: /^(1\.|-)$/, + handler: function handler(range, context) { + var length = context.prefix.length; + this.quill.scroll.deleteAt(range.index - length, length); + this.quill.formatLine(range.index - length, 1, 'list', length === 1 ? 'bullet' : 'ordered', _quill2.default.sources.USER); + this.quill.setSelection(range.index - length, _quill2.default.sources.SILENT); + } + } + } + }; + + function handleBackspace(range, context) { + if (range.index === 0) return; + + var _quill$scroll$line5 = this.quill.scroll.line(range.index), + _quill$scroll$line6 = _slicedToArray(_quill$scroll$line5, 1), + line = _quill$scroll$line6[0]; + + var formats = {}; + if (context.offset === 0) { + var curFormats = line.formats(); + var prevFormats = this.quill.getFormat(range.index - 1, 1); + formats = _op2.default.attributes.diff(curFormats, prevFormats) || {}; + } + this.quill.deleteText(range.index - 1, 1, _quill2.default.sources.USER); + if (Object.keys(formats).length > 0) { + this.quill.formatLine(range.index - 1, 1, formats, _quill2.default.sources.USER); + } + this.quill.selection.scrollIntoView(); + } + + function handleDelete(range) { + if (range.index >= this.quill.getLength() - 1) return; + this.quill.deleteText(range.index, 1, _quill2.default.sources.USER); + } + + function handleDeleteRange(range) { + this.quill.deleteText(range, _quill2.default.sources.USER); + this.quill.setSelection(range.index, _quill2.default.sources.SILENT); + this.quill.selection.scrollIntoView(); + } + + function handleEnter(range, context) { + var _this3 = this; + + if (range.length > 0) { + this.quill.scroll.deleteAt(range.index, range.length); // So we do not trigger text-change + } + var lineFormats = Object.keys(context.format).reduce(function (lineFormats, format) { + if (_parchment2.default.query(format, _parchment2.default.Scope.BLOCK) && !Array.isArray(context.format[format])) { + lineFormats[format] = context.format[format]; + } + return lineFormats; + }, {}); + this.quill.insertText(range.index, '\n', lineFormats, _quill2.default.sources.USER); + this.quill.selection.scrollIntoView(); + Object.keys(context.format).forEach(function (name) { + if (lineFormats[name] != null) return; + if (Array.isArray(context.format[name])) return; + if (name === 'link') return; + _this3.quill.format(name, context.format[name], _quill2.default.sources.USER); + }); + } + + function makeCodeBlockHandler(indent) { + return { + key: Keyboard.keys.TAB, + shiftKey: !indent, + format: { 'code-block': true }, + handler: function handler(range) { + var CodeBlock = _parchment2.default.query('code-block'); + var index = range.index, + length = range.length; + + var _quill$scroll$descend = this.quill.scroll.descendant(CodeBlock, index), + _quill$scroll$descend2 = _slicedToArray(_quill$scroll$descend, 2), + block = _quill$scroll$descend2[0], + offset = _quill$scroll$descend2[1]; + + if (block == null) return; + var scrollOffset = this.quill.scroll.offset(block); + var start = block.newlineIndex(offset, true) + 1; + var end = block.newlineIndex(scrollOffset + offset + length); + var lines = block.domNode.textContent.slice(start, end).split('\n'); + offset = 0; + lines.forEach(function (line, i) { + if (indent) { + block.insertAt(start + offset, CodeBlock.TAB); + offset += CodeBlock.TAB.length; + if (i === 0) { + index += CodeBlock.TAB.length; + } else { + length += CodeBlock.TAB.length; + } + } else if (line.startsWith(CodeBlock.TAB)) { + block.deleteAt(start + offset, CodeBlock.TAB.length); + offset -= CodeBlock.TAB.length; + if (i === 0) { + index -= CodeBlock.TAB.length; + } else { + length -= CodeBlock.TAB.length; + } + } + offset += line.length + 1; + }); + this.quill.update(_quill2.default.sources.USER); + this.quill.setSelection(index, length, _quill2.default.sources.SILENT); + } + }; + } + + function makeFormatHandler(format) { + return { + key: format[0].toUpperCase(), + shortKey: true, + handler: function handler(range, context) { + this.quill.format(format, !context.format[format], _quill2.default.sources.USER); + } + }; + } + + function normalize(binding) { + if (typeof binding === 'string' || typeof binding === 'number') { + return normalize({ key: binding }); + } + if ((typeof binding === 'undefined' ? 'undefined' : _typeof(binding)) === 'object') { + binding = (0, _clone2.default)(binding, false); + } + if (typeof binding.key === 'string') { + if (Keyboard.keys[binding.key.toUpperCase()] != null) { + binding.key = Keyboard.keys[binding.key.toUpperCase()]; + } else if (binding.key.length === 1) { + binding.key = binding.key.toUpperCase().charCodeAt(0); + } else { + return null; + } + } + return binding; + } + + exports.default = Keyboard; + +/***/ }, +/* 53 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var _core = __webpack_require__(1); + + var _core2 = _interopRequireDefault(_core); + + var _align = __webpack_require__(45); + + var _direction = __webpack_require__(48); + + var _indent = __webpack_require__(54); + + var _blockquote = __webpack_require__(55); + + var _blockquote2 = _interopRequireDefault(_blockquote); + + var _header = __webpack_require__(56); + + var _header2 = _interopRequireDefault(_header); + + var _list = __webpack_require__(57); + + var _list2 = _interopRequireDefault(_list); + + var _background = __webpack_require__(46); + + var _color = __webpack_require__(47); + + var _font = __webpack_require__(49); + + var _size = __webpack_require__(50); + + var _bold = __webpack_require__(58); + + var _bold2 = _interopRequireDefault(_bold); + + var _italic = __webpack_require__(59); + + var _italic2 = _interopRequireDefault(_italic); + + var _link = __webpack_require__(60); + + var _link2 = _interopRequireDefault(_link); + + var _script = __webpack_require__(61); + + var _script2 = _interopRequireDefault(_script); + + var _strike = __webpack_require__(62); + + var _strike2 = _interopRequireDefault(_strike); + + var _underline = __webpack_require__(63); + + var _underline2 = _interopRequireDefault(_underline); + + var _image = __webpack_require__(64); + + var _image2 = _interopRequireDefault(_image); + + var _video = __webpack_require__(65); + + var _video2 = _interopRequireDefault(_video); + + var _code = __webpack_require__(28); + + var _code2 = _interopRequireDefault(_code); + + var _formula = __webpack_require__(66); + + var _formula2 = _interopRequireDefault(_formula); + + var _syntax = __webpack_require__(67); + + var _syntax2 = _interopRequireDefault(_syntax); + + var _toolbar = __webpack_require__(68); + + var _toolbar2 = _interopRequireDefault(_toolbar); + + var _icons = __webpack_require__(69); + + var _icons2 = _interopRequireDefault(_icons); + + var _picker = __webpack_require__(102); + + var _picker2 = _interopRequireDefault(_picker); + + var _colorPicker = __webpack_require__(104); + + var _colorPicker2 = _interopRequireDefault(_colorPicker); + + var _iconPicker = __webpack_require__(105); + + var _iconPicker2 = _interopRequireDefault(_iconPicker); + + var _tooltip = __webpack_require__(106); + + var _tooltip2 = _interopRequireDefault(_tooltip); + + var _bubble = __webpack_require__(107); + + var _bubble2 = _interopRequireDefault(_bubble); + + var _snow = __webpack_require__(109); + + var _snow2 = _interopRequireDefault(_snow); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + _core2.default.register({ + 'attributors/attribute/direction': _direction.DirectionAttribute, + + 'attributors/class/align': _align.AlignClass, + 'attributors/class/background': _background.BackgroundClass, + 'attributors/class/color': _color.ColorClass, + 'attributors/class/direction': _direction.DirectionClass, + 'attributors/class/font': _font.FontClass, + 'attributors/class/size': _size.SizeClass, + + 'attributors/style/align': _align.AlignStyle, + 'attributors/style/background': _background.BackgroundStyle, + 'attributors/style/color': _color.ColorStyle, + 'attributors/style/direction': _direction.DirectionStyle, + 'attributors/style/font': _font.FontStyle, + 'attributors/style/size': _size.SizeStyle + }, true); + + _core2.default.register({ + 'formats/align': _align.AlignClass, + 'formats/direction': _direction.DirectionClass, + 'formats/indent': _indent.IndentClass, + + 'formats/background': _background.BackgroundStyle, + 'formats/color': _color.ColorStyle, + 'formats/font': _font.FontClass, + 'formats/size': _size.SizeClass, + + 'formats/blockquote': _blockquote2.default, + 'formats/code-block': _code2.default, + 'formats/header': _header2.default, + 'formats/list': _list2.default, + + 'formats/bold': _bold2.default, + 'formats/code': _code.Code, + 'formats/italic': _italic2.default, + 'formats/link': _link2.default, + 'formats/script': _script2.default, + 'formats/strike': _strike2.default, + 'formats/underline': _underline2.default, + + 'formats/image': _image2.default, + 'formats/video': _video2.default, + + 'formats/list/item': _list.ListItem, + + 'modules/formula': _formula2.default, + 'modules/syntax': _syntax2.default, + 'modules/toolbar': _toolbar2.default, + + 'themes/bubble': _bubble2.default, + 'themes/snow': _snow2.default, + + 'ui/icons': _icons2.default, + 'ui/picker': _picker2.default, + 'ui/icon-picker': _iconPicker2.default, + 'ui/color-picker': _colorPicker2.default, + 'ui/tooltip': _tooltip2.default + }, true); + + module.exports = _core2.default; + +/***/ }, +/* 54 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.IndentClass = undefined; + + 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; }; }(); + + 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); } }; + + var _parchment = __webpack_require__(2); + + var _parchment2 = _interopRequireDefault(_parchment); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + 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; } + + 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; } + + var IdentAttributor = function (_Parchment$Attributor) { + _inherits(IdentAttributor, _Parchment$Attributor); + + function IdentAttributor() { + _classCallCheck(this, IdentAttributor); + + return _possibleConstructorReturn(this, (IdentAttributor.__proto__ || Object.getPrototypeOf(IdentAttributor)).apply(this, arguments)); + } + + _createClass(IdentAttributor, [{ + key: 'add', + value: function add(node, value) { + if (value === '+1' || value === '-1') { + var indent = this.value(node) || 0; + value = value === '+1' ? indent + 1 : indent - 1; + } + if (value === 0) { + this.remove(node); + return true; + } else { + return _get(IdentAttributor.prototype.__proto__ || Object.getPrototypeOf(IdentAttributor.prototype), 'add', this).call(this, node, value); + } + } + }, { + key: 'canAdd', + value: function canAdd(node, value) { + 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)); + } + }, { + key: 'value', + value: function value(node) { + return parseInt(_get(IdentAttributor.prototype.__proto__ || Object.getPrototypeOf(IdentAttributor.prototype), 'value', this).call(this, node)) || undefined; // Don't return NaN + } + }]); + + return IdentAttributor; + }(_parchment2.default.Attributor.Class); + + var IndentClass = new IdentAttributor('indent', 'ql-indent', { + scope: _parchment2.default.Scope.BLOCK, + whitelist: [1, 2, 3, 4, 5, 6, 7, 8] + }); + + exports.IndentClass = IndentClass; + +/***/ }, +/* 55 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _block = __webpack_require__(29); + + var _block2 = _interopRequireDefault(_block); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + 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; } + + 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; } + + var Blockquote = function (_Block) { + _inherits(Blockquote, _Block); + + function Blockquote() { + _classCallCheck(this, Blockquote); + + return _possibleConstructorReturn(this, (Blockquote.__proto__ || Object.getPrototypeOf(Blockquote)).apply(this, arguments)); + } + + return Blockquote; + }(_block2.default); + + Blockquote.blotName = 'blockquote'; + Blockquote.tagName = 'blockquote'; + + exports.default = Blockquote; + +/***/ }, +/* 56 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + 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; }; }(); + + var _block = __webpack_require__(29); + + var _block2 = _interopRequireDefault(_block); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + 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; } + + 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; } + + var Header = function (_Block) { + _inherits(Header, _Block); + + function Header() { + _classCallCheck(this, Header); + + return _possibleConstructorReturn(this, (Header.__proto__ || Object.getPrototypeOf(Header)).apply(this, arguments)); + } + + _createClass(Header, null, [{ + key: 'formats', + value: function formats(domNode) { + return this.tagName.indexOf(domNode.tagName) + 1; + } + }]); + + return Header; + }(_block2.default); + + Header.blotName = 'header'; + Header.tagName = ['H1', 'H2', 'H3', 'H4', 'H5', 'H6']; + + exports.default = Header; + +/***/ }, +/* 57 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.default = exports.ListItem = undefined; + + 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; }; }(); + + 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); } }; + + var _parchment = __webpack_require__(2); + + var _parchment2 = _interopRequireDefault(_parchment); + + var _block = __webpack_require__(29); + + var _block2 = _interopRequireDefault(_block); + + var _container = __webpack_require__(42); + + var _container2 = _interopRequireDefault(_container); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + 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; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + 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; } + + 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; } + + var ListItem = function (_Block) { + _inherits(ListItem, _Block); + + function ListItem() { + _classCallCheck(this, ListItem); + + return _possibleConstructorReturn(this, (ListItem.__proto__ || Object.getPrototypeOf(ListItem)).apply(this, arguments)); + } + + _createClass(ListItem, [{ + key: 'format', + value: function format(name, value) { + if (name === List.blotName && !value) { + this.replaceWith(_parchment2.default.create(this.statics.scope)); + } else { + _get(ListItem.prototype.__proto__ || Object.getPrototypeOf(ListItem.prototype), 'format', this).call(this, name, value); + } + } + }, { + key: 'remove', + value: function remove() { + if (this.prev == null && this.next == null) { + this.parent.remove(); + } else { + _get(ListItem.prototype.__proto__ || Object.getPrototypeOf(ListItem.prototype), 'remove', this).call(this); + } + } + }, { + key: 'replaceWith', + value: function replaceWith(name, value) { + this.parent.isolate(this.offset(this.parent), this.length()); + if (name === this.parent.statics.blotName) { + this.parent.replaceWith(name, value); + return this; + } else { + this.parent.unwrap(); + return _get(ListItem.prototype.__proto__ || Object.getPrototypeOf(ListItem.prototype), 'replaceWith', this).call(this, name, value); + } + } + }], [{ + key: 'formats', + value: function formats(domNode) { + return domNode.tagName === this.tagName ? undefined : _get(ListItem.__proto__ || Object.getPrototypeOf(ListItem), 'formats', this).call(this, domNode); + } + }]); + + return ListItem; + }(_block2.default); + + ListItem.blotName = 'list-item'; + ListItem.tagName = 'LI'; + + var List = function (_Container) { + _inherits(List, _Container); + + function List() { + _classCallCheck(this, List); + + return _possibleConstructorReturn(this, (List.__proto__ || Object.getPrototypeOf(List)).apply(this, arguments)); + } + + _createClass(List, [{ + key: 'format', + value: function format(name, value) { + if (this.children.length > 0) { + this.children.tail.format(name, value); + } + } + }, { + key: 'formats', + value: function formats() { + // We don't inherit from FormatBlot + return _defineProperty({}, this.statics.blotName, this.statics.formats(this.domNode)); + } + }, { + key: 'insertBefore', + value: function insertBefore(blot, ref) { + if (blot instanceof ListItem) { + _get(List.prototype.__proto__ || Object.getPrototypeOf(List.prototype), 'insertBefore', this).call(this, blot, ref); + } else { + var index = ref == null ? this.length() : ref.offset(this); + var after = this.split(index); + after.parent.insertBefore(blot, after); + } + } + }, { + key: 'optimize', + value: function optimize() { + _get(List.prototype.__proto__ || Object.getPrototypeOf(List.prototype), 'optimize', this).call(this); + var next = this.next; + 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')) { + next.moveChildren(this); + next.remove(); + } + } + }, { + key: 'replace', + value: function replace(target) { + if (target.statics.blotName !== this.statics.blotName) { + var item = _parchment2.default.create(this.statics.defaultChild); + target.moveChildren(item); + this.appendChild(item); + } + _get(List.prototype.__proto__ || Object.getPrototypeOf(List.prototype), 'replace', this).call(this, target); + } + }], [{ + key: 'create', + value: function create(value) { + var tagName = value === 'ordered' ? 'OL' : 'UL'; + var node = _get(List.__proto__ || Object.getPrototypeOf(List), 'create', this).call(this, tagName); + if (value === 'checked' || value === 'unchecked') { + node.setAttribute('data-checked', value === 'checked'); + } + return node; + } + }, { + key: 'formats', + value: function formats(domNode) { + if (domNode.tagName === 'OL') return 'ordered'; + if (domNode.tagName === 'UL') { + if (domNode.hasAttribute('data-checked')) { + return domNode.getAttribute('data-checked') === 'true' ? 'checked' : 'unchecked'; + } else { + return 'bullet'; + } + } + return undefined; + } + }]); + + return List; + }(_container2.default); + + List.blotName = 'list'; + List.scope = _parchment2.default.Scope.BLOCK_BLOT; + List.tagName = ['OL', 'UL']; + List.defaultChild = 'list-item'; + List.allowedChildren = [ListItem]; + + exports.ListItem = ListItem; + exports.default = List; + +/***/ }, +/* 58 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + 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; }; }(); + + 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); } }; + + var _inline = __webpack_require__(32); + + var _inline2 = _interopRequireDefault(_inline); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + 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; } + + 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; } + + var Bold = function (_Inline) { + _inherits(Bold, _Inline); + + function Bold() { + _classCallCheck(this, Bold); + + return _possibleConstructorReturn(this, (Bold.__proto__ || Object.getPrototypeOf(Bold)).apply(this, arguments)); + } + + _createClass(Bold, [{ + key: 'optimize', + value: function optimize() { + _get(Bold.prototype.__proto__ || Object.getPrototypeOf(Bold.prototype), 'optimize', this).call(this); + if (this.domNode.tagName !== this.statics.tagName[0]) { + this.replaceWith(this.statics.blotName); + } + } + }], [{ + key: 'create', + value: function create() { + return _get(Bold.__proto__ || Object.getPrototypeOf(Bold), 'create', this).call(this); + } + }, { + key: 'formats', + value: function formats() { + return true; + } + }]); + + return Bold; + }(_inline2.default); + + Bold.blotName = 'bold'; + Bold.tagName = ['STRONG', 'B']; + + exports.default = Bold; + +/***/ }, +/* 59 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _bold = __webpack_require__(58); + + var _bold2 = _interopRequireDefault(_bold); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + 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; } + + 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; } + + var Italic = function (_Bold) { + _inherits(Italic, _Bold); + + function Italic() { + _classCallCheck(this, Italic); + + return _possibleConstructorReturn(this, (Italic.__proto__ || Object.getPrototypeOf(Italic)).apply(this, arguments)); + } + + return Italic; + }(_bold2.default); + + Italic.blotName = 'italic'; + Italic.tagName = ['EM', 'I']; + + exports.default = Italic; + +/***/ }, +/* 60 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.sanitize = exports.default = undefined; + + 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; }; }(); + + 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); } }; + + var _inline = __webpack_require__(32); + + var _inline2 = _interopRequireDefault(_inline); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + 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; } + + 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; } + + var Link = function (_Inline) { + _inherits(Link, _Inline); + + function Link() { + _classCallCheck(this, Link); + + return _possibleConstructorReturn(this, (Link.__proto__ || Object.getPrototypeOf(Link)).apply(this, arguments)); + } + + _createClass(Link, [{ + key: 'format', + value: function format(name, value) { + if (name !== this.statics.blotName || !value) return _get(Link.prototype.__proto__ || Object.getPrototypeOf(Link.prototype), 'format', this).call(this, name, value); + value = this.constructor.sanitize(value); + this.domNode.setAttribute('href', value); + } + }], [{ + key: 'create', + value: function create(value) { + var node = _get(Link.__proto__ || Object.getPrototypeOf(Link), 'create', this).call(this, value); + value = this.sanitize(value); + node.setAttribute('href', value); + node.setAttribute('target', '_blank'); + return node; + } + }, { + key: 'formats', + value: function formats(domNode) { + return domNode.getAttribute('href'); + } + }, { + key: 'sanitize', + value: function sanitize(url) { + return _sanitize(url, ['http', 'https', 'mailto']) ? url : this.SANITIZED_URL; + } + }]); + + return Link; + }(_inline2.default); + + Link.blotName = 'link'; + Link.tagName = 'A'; + Link.SANITIZED_URL = 'about:blank'; + + function _sanitize(url, protocols) { + var anchor = document.createElement('a'); + anchor.href = url; + var protocol = anchor.href.slice(0, anchor.href.indexOf(':')); + return protocols.indexOf(protocol) > -1; + } + + exports.default = Link; + exports.sanitize = _sanitize; + +/***/ }, +/* 61 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + 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; }; }(); + + 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); } }; + + var _inline = __webpack_require__(32); + + var _inline2 = _interopRequireDefault(_inline); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + 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; } + + 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; } + + var Script = function (_Inline) { + _inherits(Script, _Inline); + + function Script() { + _classCallCheck(this, Script); + + return _possibleConstructorReturn(this, (Script.__proto__ || Object.getPrototypeOf(Script)).apply(this, arguments)); + } + + _createClass(Script, null, [{ + key: 'create', + value: function create(value) { + if (value === 'super') { + return document.createElement('sup'); + } else if (value === 'sub') { + return document.createElement('sub'); + } else { + return _get(Script.__proto__ || Object.getPrototypeOf(Script), 'create', this).call(this, value); + } + } + }, { + key: 'formats', + value: function formats(domNode) { + if (domNode.tagName === 'SUB') return 'sub'; + if (domNode.tagName === 'SUP') return 'super'; + return undefined; + } + }]); + + return Script; + }(_inline2.default); + + Script.blotName = 'script'; + Script.tagName = ['SUB', 'SUP']; + + exports.default = Script; + +/***/ }, +/* 62 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _inline = __webpack_require__(32); + + var _inline2 = _interopRequireDefault(_inline); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + 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; } + + 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; } + + var Strike = function (_Inline) { + _inherits(Strike, _Inline); + + function Strike() { + _classCallCheck(this, Strike); + + return _possibleConstructorReturn(this, (Strike.__proto__ || Object.getPrototypeOf(Strike)).apply(this, arguments)); + } + + return Strike; + }(_inline2.default); + + Strike.blotName = 'strike'; + Strike.tagName = 'S'; + + exports.default = Strike; + +/***/ }, +/* 63 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _inline = __webpack_require__(32); + + var _inline2 = _interopRequireDefault(_inline); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + 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; } + + 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; } + + var Underline = function (_Inline) { + _inherits(Underline, _Inline); + + function Underline() { + _classCallCheck(this, Underline); + + return _possibleConstructorReturn(this, (Underline.__proto__ || Object.getPrototypeOf(Underline)).apply(this, arguments)); + } + + return Underline; + }(_inline2.default); + + Underline.blotName = 'underline'; + Underline.tagName = 'U'; + + exports.default = Underline; + +/***/ }, +/* 64 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + 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; }; }(); + + 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); } }; + + var _embed = __webpack_require__(31); + + var _embed2 = _interopRequireDefault(_embed); + + var _link = __webpack_require__(60); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + 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; } + + 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; } + + var ATTRIBUTES = ['alt', 'height', 'width']; + + var Image = function (_Embed) { + _inherits(Image, _Embed); + + function Image() { + _classCallCheck(this, Image); + + return _possibleConstructorReturn(this, (Image.__proto__ || Object.getPrototypeOf(Image)).apply(this, arguments)); + } + + _createClass(Image, [{ + key: 'format', + value: function format(name, value) { + if (ATTRIBUTES.indexOf(name) > -1) { + if (value) { + this.domNode.setAttribute(name, value); + } else { + this.domNode.removeAttribute(name); + } + } else { + _get(Image.prototype.__proto__ || Object.getPrototypeOf(Image.prototype), 'format', this).call(this, name, value); + } + } + }], [{ + key: 'create', + value: function create(value) { + var node = _get(Image.__proto__ || Object.getPrototypeOf(Image), 'create', this).call(this, value); + if (typeof value === 'string') { + node.setAttribute('src', this.sanitize(value)); + } + return node; + } + }, { + key: 'formats', + value: function formats(domNode) { + return ATTRIBUTES.reduce(function (formats, attribute) { + if (domNode.hasAttribute(attribute)) { + formats[attribute] = domNode.getAttribute(attribute); + } + return formats; + }, {}); + } + }, { + key: 'match', + value: function match(url) { + return (/\.(jpe?g|gif|png)$/.test(url) || /^data:image\/.+;base64/.test(url) + ); + } + }, { + key: 'sanitize', + value: function sanitize(url) { + return (0, _link.sanitize)(url, ['http', 'https', 'data']) ? url : '//:0'; + } + }, { + key: 'value', + value: function value(domNode) { + return domNode.getAttribute('src'); + } + }]); + + return Image; + }(_embed2.default); + + Image.blotName = 'image'; + Image.tagName = 'IMG'; + + exports.default = Image; + +/***/ }, +/* 65 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + 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; }; }(); + + 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); } }; + + var _block = __webpack_require__(29); + + var _link = __webpack_require__(60); + + var _link2 = _interopRequireDefault(_link); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + 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; } + + 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; } + + var ATTRIBUTES = ['height', 'width']; + + var Video = function (_BlockEmbed) { + _inherits(Video, _BlockEmbed); + + function Video() { + _classCallCheck(this, Video); + + return _possibleConstructorReturn(this, (Video.__proto__ || Object.getPrototypeOf(Video)).apply(this, arguments)); + } + + _createClass(Video, [{ + key: 'format', + value: function format(name, value) { + if (ATTRIBUTES.indexOf(name) > -1) { + if (value) { + this.domNode.setAttribute(name, value); + } else { + this.domNode.removeAttribute(name); + } + } else { + _get(Video.prototype.__proto__ || Object.getPrototypeOf(Video.prototype), 'format', this).call(this, name, value); + } + } + }], [{ + key: 'create', + value: function create(value) { + var node = _get(Video.__proto__ || Object.getPrototypeOf(Video), 'create', this).call(this, value); + node.setAttribute('frameborder', '0'); + node.setAttribute('allowfullscreen', true); + node.setAttribute('src', this.sanitize(value)); + return node; + } + }, { + key: 'formats', + value: function formats(domNode) { + return ATTRIBUTES.reduce(function (formats, attribute) { + if (domNode.hasAttribute(attribute)) { + formats[attribute] = domNode.getAttribute(attribute); + } + return formats; + }, {}); + } + }, { + key: 'sanitize', + value: function sanitize(url) { + return _link2.default.sanitize(url); + } + }, { + key: 'value', + value: function value(domNode) { + return domNode.getAttribute('src'); + } + }]); + + return Video; + }(_block.BlockEmbed); + + Video.blotName = 'video'; + Video.className = 'ql-video'; + Video.tagName = 'IFRAME'; + + exports.default = Video; + +/***/ }, +/* 66 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.default = exports.FormulaBlot = undefined; + + 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; }; }(); + + 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); } }; + + var _embed = __webpack_require__(31); + + var _embed2 = _interopRequireDefault(_embed); + + var _quill = __webpack_require__(18); + + var _quill2 = _interopRequireDefault(_quill); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + 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; } + + 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; } + + var FormulaBlot = function (_Embed) { + _inherits(FormulaBlot, _Embed); + + function FormulaBlot() { + _classCallCheck(this, FormulaBlot); + + return _possibleConstructorReturn(this, (FormulaBlot.__proto__ || Object.getPrototypeOf(FormulaBlot)).apply(this, arguments)); + } + + _createClass(FormulaBlot, [{ + key: 'index', + value: function index() { + return 1; + } + }], [{ + key: 'create', + value: function create(value) { + var node = _get(FormulaBlot.__proto__ || Object.getPrototypeOf(FormulaBlot), 'create', this).call(this, value); + if (typeof value === 'string') { + window.katex.render(value, node); + node.setAttribute('data-value', value); + } + node.setAttribute('contenteditable', false); + return node; + } + }, { + key: 'value', + value: function value(domNode) { + return domNode.getAttribute('data-value'); + } + }]); + + return FormulaBlot; + }(_embed2.default); + + FormulaBlot.blotName = 'formula'; + FormulaBlot.className = 'ql-formula'; + FormulaBlot.tagName = 'SPAN'; + + function Formula() { + if (window.katex == null) { + throw new Error('Formula module requires KaTeX.'); + } + _quill2.default.register(FormulaBlot, true); + } + + exports.FormulaBlot = FormulaBlot; + exports.default = Formula; + +/***/ }, +/* 67 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.default = exports.CodeToken = exports.CodeBlock = undefined; + + 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; }; }(); + + 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); } }; + + var _parchment = __webpack_require__(2); + + var _parchment2 = _interopRequireDefault(_parchment); + + var _quill = __webpack_require__(18); + + var _quill2 = _interopRequireDefault(_quill); + + var _module = __webpack_require__(39); + + var _module2 = _interopRequireDefault(_module); + + var _code = __webpack_require__(28); + + var _code2 = _interopRequireDefault(_code); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + 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; } + + 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; } + + var SyntaxCodeBlock = function (_CodeBlock) { + _inherits(SyntaxCodeBlock, _CodeBlock); + + function SyntaxCodeBlock() { + _classCallCheck(this, SyntaxCodeBlock); + + return _possibleConstructorReturn(this, (SyntaxCodeBlock.__proto__ || Object.getPrototypeOf(SyntaxCodeBlock)).apply(this, arguments)); + } + + _createClass(SyntaxCodeBlock, [{ + key: 'replaceWith', + value: function replaceWith(block) { + this.domNode.textContent = this.domNode.textContent; + this.attach(); + _get(SyntaxCodeBlock.prototype.__proto__ || Object.getPrototypeOf(SyntaxCodeBlock.prototype), 'replaceWith', this).call(this, block); + } + }, { + key: 'highlight', + value: function highlight(_highlight) { + if (this.cachedHTML !== this.domNode.innerHTML) { + var text = this.domNode.textContent; + if (text.trim().length > 0 || this.cachedHTML == null) { + this.domNode.innerHTML = _highlight(text); + this.attach(); + } + this.cachedHTML = this.domNode.innerHTML; + } + } + }]); + + return SyntaxCodeBlock; + }(_code2.default); + + SyntaxCodeBlock.className = 'ql-syntax'; + + var CodeToken = new _parchment2.default.Attributor.Class('token', 'hljs', { + scope: _parchment2.default.Scope.INLINE + }); + + var Syntax = function (_Module) { + _inherits(Syntax, _Module); + + function Syntax(quill, options) { + _classCallCheck(this, Syntax); + + var _this2 = _possibleConstructorReturn(this, (Syntax.__proto__ || Object.getPrototypeOf(Syntax)).call(this, quill, options)); + + if (typeof _this2.options.highlight !== 'function') { + throw new Error('Syntax module requires highlight.js. Please include the library on the page before Quill.'); + } + _quill2.default.register(CodeToken, true); + _quill2.default.register(SyntaxCodeBlock, true); + var timer = null; + _this2.quill.on(_quill2.default.events.SCROLL_OPTIMIZE, function () { + if (timer != null) return; + timer = setTimeout(function () { + _this2.highlight(); + timer = null; + }, 100); + }); + _this2.highlight(); + return _this2; + } + + _createClass(Syntax, [{ + key: 'highlight', + value: function highlight() { + var _this3 = this; + + if (this.quill.selection.composing) return; + var range = this.quill.getSelection(); + this.quill.scroll.descendants(SyntaxCodeBlock).forEach(function (code) { + code.highlight(_this3.options.highlight); + }); + this.quill.update(_quill2.default.sources.SILENT); + if (range != null) { + this.quill.setSelection(range, _quill2.default.sources.SILENT); + } + } + }]); + + return Syntax; + }(_module2.default); + + Syntax.DEFAULTS = { + highlight: function () { + if (window.hljs == null) return null; + return function (text) { + var result = window.hljs.highlightAuto(text); + return result.value; + }; + }() + }; + + exports.CodeBlock = SyntaxCodeBlock; + exports.CodeToken = CodeToken; + exports.default = Syntax; + +/***/ }, +/* 68 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.addControls = exports.default = undefined; + + 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"); } }; }(); + + 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; }; }(); + + var _quillDelta = __webpack_require__(20); + + var _quillDelta2 = _interopRequireDefault(_quillDelta); + + var _parchment = __webpack_require__(2); + + var _parchment2 = _interopRequireDefault(_parchment); + + var _quill = __webpack_require__(18); + + var _quill2 = _interopRequireDefault(_quill); + + var _logger = __webpack_require__(37); + + var _logger2 = _interopRequireDefault(_logger); + + var _module = __webpack_require__(39); + + var _module2 = _interopRequireDefault(_module); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + 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; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + 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; } + + 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; } + + var debug = (0, _logger2.default)('quill:toolbar'); + + var Toolbar = function (_Module) { + _inherits(Toolbar, _Module); + + function Toolbar(quill, options) { + _classCallCheck(this, Toolbar); + + var _this = _possibleConstructorReturn(this, (Toolbar.__proto__ || Object.getPrototypeOf(Toolbar)).call(this, quill, options)); + + if (Array.isArray(_this.options.container)) { + var container = document.createElement('div'); + addControls(container, _this.options.container); + quill.container.parentNode.insertBefore(container, quill.container); + _this.container = container; + } else if (typeof _this.options.container === 'string') { + _this.container = document.querySelector(_this.options.container); + } else { + _this.container = _this.options.container; + } + if (!(_this.container instanceof HTMLElement)) { + var _ret; + + return _ret = debug.error('Container required for toolbar', _this.options), _possibleConstructorReturn(_this, _ret); + } + _this.container.classList.add('ql-toolbar'); + _this.controls = []; + _this.handlers = {}; + Object.keys(_this.options.handlers).forEach(function (format) { + _this.addHandler(format, _this.options.handlers[format]); + }); + [].forEach.call(_this.container.querySelectorAll('button, select'), function (input) { + _this.attach(input); + }); + _this.quill.on(_quill2.default.events.EDITOR_CHANGE, function (type, range) { + if (type === _quill2.default.events.SELECTION_CHANGE) { + _this.update(range); + } + }); + _this.quill.on(_quill2.default.events.SCROLL_OPTIMIZE, function () { + var _this$quill$selection = _this.quill.selection.getRange(), + _this$quill$selection2 = _slicedToArray(_this$quill$selection, 1), + range = _this$quill$selection2[0]; // quill.getSelection triggers update + + + _this.update(range); + }); + return _this; + } + + _createClass(Toolbar, [{ + key: 'addHandler', + value: function addHandler(format, handler) { + this.handlers[format] = handler; + } + }, { + key: 'attach', + value: function attach(input) { + var _this2 = this; + + var format = [].find.call(input.classList, function (className) { + return className.indexOf('ql-') === 0; + }); + if (!format) return; + format = format.slice('ql-'.length); + if (input.tagName === 'BUTTON') { + input.setAttribute('type', 'button'); + } + if (this.handlers[format] == null) { + if (this.quill.scroll.whitelist != null && this.quill.scroll.whitelist[format] == null) { + debug.warn('ignoring attaching to disabled format', format, input); + return; + } + if (_parchment2.default.query(format) == null) { + debug.warn('ignoring attaching to nonexistent format', format, input); + return; + } + } + var eventName = input.tagName === 'SELECT' ? 'change' : 'click'; + input.addEventListener(eventName, function (e) { + var value = void 0; + if (input.tagName === 'SELECT') { + if (input.selectedIndex < 0) return; + var selected = input.options[input.selectedIndex]; + if (selected.hasAttribute('selected')) { + value = false; + } else { + value = selected.value || false; + } + } else { + if (input.classList.contains('ql-active')) { + value = false; + } else { + value = input.value || !input.hasAttribute('value'); + } + e.preventDefault(); + } + _this2.quill.focus(); + + var _quill$selection$getR = _this2.quill.selection.getRange(), + _quill$selection$getR2 = _slicedToArray(_quill$selection$getR, 1), + range = _quill$selection$getR2[0]; + + if (_this2.handlers[format] != null) { + _this2.handlers[format].call(_this2, value); + } else if (_parchment2.default.query(format).prototype instanceof _parchment2.default.Embed) { + value = prompt('Enter ' + format); + if (!value) return; + _this2.quill.updateContents(new _quillDelta2.default().retain(range.index).delete(range.length).insert(_defineProperty({}, format, value)), _quill2.default.sources.USER); + } else { + _this2.quill.format(format, value, _quill2.default.sources.USER); + } + _this2.update(range); + }); + // TODO use weakmap + this.controls.push([format, input]); + } + }, { + key: 'update', + value: function update(range) { + var formats = range == null ? {} : this.quill.getFormat(range); + this.controls.forEach(function (pair) { + var _pair = _slicedToArray(pair, 2), + format = _pair[0], + input = _pair[1]; + + if (input.tagName === 'SELECT') { + var option = void 0; + if (range == null) { + option = null; + } else if (formats[format] == null) { + option = input.querySelector('option[selected]'); + } else if (!Array.isArray(formats[format])) { + var value = formats[format]; + if (typeof value === 'string') { + value = value.replace(/\"/g, '\\"'); + } + option = input.querySelector('option[value="' + value + '"]'); + } + if (option == null) { + input.value = ''; // TODO make configurable? + input.selectedIndex = -1; + } else { + option.selected = true; + } + } else { + if (range == null) { + input.classList.remove('ql-active'); + } else if (input.hasAttribute('value')) { + // both being null should match (default values) + // '1' should match with 1 (headers) + var isActive = formats[format] === input.getAttribute('value') || formats[format] != null && formats[format].toString() === input.getAttribute('value') || formats[format] == null && !input.getAttribute('value'); + input.classList.toggle('ql-active', isActive); + } else { + input.classList.toggle('ql-active', formats[format] != null); + } + } + }); + } + }]); + + return Toolbar; + }(_module2.default); + + Toolbar.DEFAULTS = {}; + + function addButton(container, format, value) { + var input = document.createElement('button'); + input.setAttribute('type', 'button'); + input.classList.add('ql-' + format); + if (value != null) { + input.value = value; + } + container.appendChild(input); + } + + function addControls(container, groups) { + if (!Array.isArray(groups[0])) { + groups = [groups]; + } + groups.forEach(function (controls) { + var group = document.createElement('span'); + group.classList.add('ql-formats'); + controls.forEach(function (control) { + if (typeof control === 'string') { + addButton(group, control); + } else { + var format = Object.keys(control)[0]; + var value = control[format]; + if (Array.isArray(value)) { + addSelect(group, format, value); + } else { + addButton(group, format, value); + } + } + }); + container.appendChild(group); + }); + } + + function addSelect(container, format, values) { + var input = document.createElement('select'); + input.classList.add('ql-' + format); + values.forEach(function (value) { + var option = document.createElement('option'); + if (value !== false) { + option.setAttribute('value', value); + } else { + option.setAttribute('selected', 'selected'); + } + input.appendChild(option); + }); + container.appendChild(input); + } + + Toolbar.DEFAULTS = { + container: null, + handlers: { + clean: function clean() { + var _this3 = this; + + var range = this.quill.getSelection(); + if (range == null) return; + if (range.length == 0) { + var formats = this.quill.getFormat(); + Object.keys(formats).forEach(function (name) { + // Clean functionality in existing apps only clean inline formats + if (_parchment2.default.query(name, _parchment2.default.Scope.INLINE) != null) { + _this3.quill.format(name, false); + } + }); + } else { + this.quill.removeFormat(range, _quill2.default.sources.USER); + } + }, + direction: function direction(value) { + var align = this.quill.getFormat()['align']; + if (value === 'rtl' && align == null) { + this.quill.format('align', 'right', _quill2.default.sources.USER); + } else if (!value && align === 'right') { + this.quill.format('align', false, _quill2.default.sources.USER); + } + this.quill.format('direction', value, _quill2.default.sources.USER); + }, + link: function link(value) { + if (value === true) { + value = prompt('Enter link URL:'); + } + this.quill.format('link', value, _quill2.default.sources.USER); + }, + indent: function indent(value) { + var range = this.quill.getSelection(); + var formats = this.quill.getFormat(range); + var indent = parseInt(formats.indent || 0); + if (value === '+1' || value === '-1') { + var modifier = value === '+1' ? 1 : -1; + if (formats.direction === 'rtl') modifier *= -1; + this.quill.format('indent', indent + modifier, _quill2.default.sources.USER); + } + } + } + }; + + exports.default = Toolbar; + exports.addControls = addControls; + +/***/ }, +/* 69 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + module.exports = { + 'align': { + '': __webpack_require__(70), + 'center': __webpack_require__(71), + 'right': __webpack_require__(72), + 'justify': __webpack_require__(73) + }, + 'background': __webpack_require__(74), + 'blockquote': __webpack_require__(75), + 'bold': __webpack_require__(76), + 'clean': __webpack_require__(77), + 'code': __webpack_require__(78), + 'code-block': __webpack_require__(78), + 'color': __webpack_require__(79), + 'direction': { + '': __webpack_require__(80), + 'rtl': __webpack_require__(81) + }, + 'float': { + 'center': __webpack_require__(82), + 'full': __webpack_require__(83), + 'left': __webpack_require__(84), + 'right': __webpack_require__(85) + }, + 'formula': __webpack_require__(86), + 'header': { + '1': __webpack_require__(87), + '2': __webpack_require__(88) + }, + 'italic': __webpack_require__(89), + 'image': __webpack_require__(90), + 'indent': { + '+1': __webpack_require__(91), + '-1': __webpack_require__(92) + }, + 'link': __webpack_require__(93), + 'list': { + 'ordered': __webpack_require__(94), + 'bullet': __webpack_require__(95), + 'unchecked': __webpack_require__(96) + }, + 'script': { + 'sub': __webpack_require__(97), + 'super': __webpack_require__(98) + }, + 'strike': __webpack_require__(99), + 'underline': __webpack_require__(100), + 'video': __webpack_require__(101) + }; + +/***/ }, +/* 70 */ +/***/ function(module, exports) { + + module.exports = " "; + +/***/ }, +/* 71 */ +/***/ function(module, exports) { + + module.exports = " "; + +/***/ }, +/* 72 */ +/***/ function(module, exports) { + + module.exports = " "; + +/***/ }, +/* 73 */ +/***/ function(module, exports) { + + module.exports = " "; + +/***/ }, +/* 74 */ +/***/ function(module, exports) { + + module.exports = " "; + +/***/ }, +/* 75 */ +/***/ function(module, exports) { + + module.exports = " "; + +/***/ }, +/* 76 */ +/***/ function(module, exports) { + + module.exports = " "; + +/***/ }, +/* 77 */ +/***/ function(module, exports) { + + module.exports = " "; + +/***/ }, +/* 78 */ +/***/ function(module, exports) { + + module.exports = " "; + +/***/ }, +/* 79 */ +/***/ function(module, exports) { + + module.exports = " "; + +/***/ }, +/* 80 */ +/***/ function(module, exports) { + + module.exports = " "; + +/***/ }, +/* 81 */ +/***/ function(module, exports) { + + module.exports = " "; + +/***/ }, +/* 82 */ +/***/ function(module, exports) { + + module.exports = " "; + +/***/ }, +/* 83 */ +/***/ function(module, exports) { + + module.exports = " "; + +/***/ }, +/* 84 */ +/***/ function(module, exports) { + + module.exports = " "; + +/***/ }, +/* 85 */ +/***/ function(module, exports) { + + module.exports = " "; + +/***/ }, +/* 86 */ +/***/ function(module, exports) { + + module.exports = " "; + +/***/ }, +/* 87 */ +/***/ function(module, exports) { + + module.exports = " "; + +/***/ }, +/* 88 */ +/***/ function(module, exports) { + + module.exports = " "; + +/***/ }, +/* 89 */ +/***/ function(module, exports) { + + module.exports = " "; + +/***/ }, +/* 90 */ +/***/ function(module, exports) { + + module.exports = " "; + +/***/ }, +/* 91 */ +/***/ function(module, exports) { + + module.exports = " "; + +/***/ }, +/* 92 */ +/***/ function(module, exports) { + + module.exports = " "; + +/***/ }, +/* 93 */ +/***/ function(module, exports) { + + module.exports = " "; + +/***/ }, +/* 94 */ +/***/ function(module, exports) { + + module.exports = " "; + +/***/ }, +/* 95 */ +/***/ function(module, exports) { + + module.exports = " "; + +/***/ }, +/* 96 */ +/***/ function(module, exports) { + + module.exports = " "; + +/***/ }, +/* 97 */ +/***/ function(module, exports) { + + module.exports = " "; + +/***/ }, +/* 98 */ +/***/ function(module, exports) { + + module.exports = " "; + +/***/ }, +/* 99 */ +/***/ function(module, exports) { + + module.exports = " "; + +/***/ }, +/* 100 */ +/***/ function(module, exports) { + + module.exports = " "; + +/***/ }, +/* 101 */ +/***/ function(module, exports) { + + module.exports = " "; + +/***/ }, +/* 102 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + 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; }; + + 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; }; }(); + + var _dropdown = __webpack_require__(103); + + var _dropdown2 = _interopRequireDefault(_dropdown); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var Picker = function () { + function Picker(select) { + var _this = this; + + _classCallCheck(this, Picker); + + this.select = select; + this.container = document.createElement('span'); + this.buildPicker(); + this.select.style.display = 'none'; + this.select.parentNode.insertBefore(this.container, this.select); + this.label.addEventListener('mousedown', function () { + _this.container.classList.toggle('ql-expanded'); + }); + this.select.addEventListener('change', this.update.bind(this)); + } + + _createClass(Picker, [{ + key: 'buildItem', + value: function buildItem(option) { + var _this2 = this; + + var item = document.createElement('span'); + item.classList.add('ql-picker-item'); + if (option.hasAttribute('value')) { + item.setAttribute('data-value', option.getAttribute('value')); + } + if (option.textContent) { + item.setAttribute('data-label', option.textContent); + } + item.addEventListener('click', function () { + _this2.selectItem(item, true); + }); + return item; + } + }, { + key: 'buildLabel', + value: function buildLabel() { + var label = document.createElement('span'); + label.classList.add('ql-picker-label'); + label.innerHTML = _dropdown2.default; + this.container.appendChild(label); + return label; + } + }, { + key: 'buildOptions', + value: function buildOptions() { + var _this3 = this; + + var options = document.createElement('span'); + options.classList.add('ql-picker-options'); + [].slice.call(this.select.options).forEach(function (option) { + var item = _this3.buildItem(option); + options.appendChild(item); + if (option.hasAttribute('selected')) { + _this3.selectItem(item); + } + }); + this.container.appendChild(options); + } + }, { + key: 'buildPicker', + value: function buildPicker() { + var _this4 = this; + + [].slice.call(this.select.attributes).forEach(function (item) { + _this4.container.setAttribute(item.name, item.value); + }); + this.container.classList.add('ql-picker'); + this.label = this.buildLabel(); + this.buildOptions(); + } + }, { + key: 'close', + value: function close() { + this.container.classList.remove('ql-expanded'); + } + }, { + key: 'selectItem', + value: function selectItem(item) { + var trigger = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + + var selected = this.container.querySelector('.ql-selected'); + if (item === selected) return; + if (selected != null) { + selected.classList.remove('ql-selected'); + } + if (item == null) return; + item.classList.add('ql-selected'); + this.select.selectedIndex = [].indexOf.call(item.parentNode.children, item); + if (item.hasAttribute('data-value')) { + this.label.setAttribute('data-value', item.getAttribute('data-value')); + } else { + this.label.removeAttribute('data-value'); + } + if (item.hasAttribute('data-label')) { + this.label.setAttribute('data-label', item.getAttribute('data-label')); + } else { + this.label.removeAttribute('data-label'); + } + if (trigger) { + if (typeof Event === 'function') { + this.select.dispatchEvent(new Event('change')); + } else if ((typeof Event === 'undefined' ? 'undefined' : _typeof(Event)) === 'object') { + // IE11 + var event = document.createEvent('Event'); + event.initEvent('change', true, true); + this.select.dispatchEvent(event); + } + this.close(); + } + } + }, { + key: 'update', + value: function update() { + var option = void 0; + if (this.select.selectedIndex > -1) { + var item = this.container.querySelector('.ql-picker-options').children[this.select.selectedIndex]; + option = this.select.options[this.select.selectedIndex]; + this.selectItem(item); + } else { + this.selectItem(null); + } + var isActive = option != null && option !== this.select.querySelector('option[selected]'); + this.label.classList.toggle('ql-active', isActive); + } + }]); + + return Picker; + }(); + + exports.default = Picker; + +/***/ }, +/* 103 */ +/***/ function(module, exports) { + + module.exports = " "; + +/***/ }, +/* 104 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + 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; }; }(); + + 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); } }; + + var _picker = __webpack_require__(102); + + var _picker2 = _interopRequireDefault(_picker); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + 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; } + + 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; } + + var ColorPicker = function (_Picker) { + _inherits(ColorPicker, _Picker); + + function ColorPicker(select, label) { + _classCallCheck(this, ColorPicker); + + var _this = _possibleConstructorReturn(this, (ColorPicker.__proto__ || Object.getPrototypeOf(ColorPicker)).call(this, select)); + + _this.label.innerHTML = label; + _this.container.classList.add('ql-color-picker'); + [].slice.call(_this.container.querySelectorAll('.ql-picker-item'), 0, 7).forEach(function (item) { + item.classList.add('ql-primary'); + }); + return _this; + } + + _createClass(ColorPicker, [{ + key: 'buildItem', + value: function buildItem(option) { + var item = _get(ColorPicker.prototype.__proto__ || Object.getPrototypeOf(ColorPicker.prototype), 'buildItem', this).call(this, option); + item.style.backgroundColor = option.getAttribute('value') || ''; + return item; + } + }, { + key: 'selectItem', + value: function selectItem(item, trigger) { + _get(ColorPicker.prototype.__proto__ || Object.getPrototypeOf(ColorPicker.prototype), 'selectItem', this).call(this, item, trigger); + var colorLabel = this.label.querySelector('.ql-color-label'); + var value = item ? item.getAttribute('data-value') || '' : ''; + if (colorLabel) { + if (colorLabel.tagName === 'line') { + colorLabel.style.stroke = value; + } else { + colorLabel.style.fill = value; + } + } + } + }]); + + return ColorPicker; + }(_picker2.default); + + exports.default = ColorPicker; + +/***/ }, +/* 105 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + 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; }; }(); + + 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); } }; + + var _picker = __webpack_require__(102); + + var _picker2 = _interopRequireDefault(_picker); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + 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; } + + 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; } + + var IconPicker = function (_Picker) { + _inherits(IconPicker, _Picker); + + function IconPicker(select, icons) { + _classCallCheck(this, IconPicker); + + var _this = _possibleConstructorReturn(this, (IconPicker.__proto__ || Object.getPrototypeOf(IconPicker)).call(this, select)); + + _this.container.classList.add('ql-icon-picker'); + [].forEach.call(_this.container.querySelectorAll('.ql-picker-item'), function (item) { + item.innerHTML = icons[item.getAttribute('data-value') || '']; + }); + _this.defaultItem = _this.container.querySelector('.ql-selected'); + _this.selectItem(_this.defaultItem); + return _this; + } + + _createClass(IconPicker, [{ + key: 'selectItem', + value: function selectItem(item, trigger) { + _get(IconPicker.prototype.__proto__ || Object.getPrototypeOf(IconPicker.prototype), 'selectItem', this).call(this, item, trigger); + item = item || this.defaultItem; + this.label.innerHTML = item.innerHTML; + } + }]); + + return IconPicker; + }(_picker2.default); + + exports.default = IconPicker; + +/***/ }, +/* 106 */ +/***/ function(module, exports) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + 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; }; }(); + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + var Tooltip = function () { + function Tooltip(quill, boundsContainer) { + var _this = this; + + _classCallCheck(this, Tooltip); + + this.quill = quill; + this.boundsContainer = boundsContainer || document.body; + this.root = quill.addContainer('ql-tooltip'); + this.root.innerHTML = this.constructor.TEMPLATE; + this.quill.root.addEventListener('scroll', function () { + _this.root.style.marginTop = -1 * _this.quill.root.scrollTop + 'px'; + }); + this.hide(); + } + + _createClass(Tooltip, [{ + key: 'hide', + value: function hide() { + this.root.classList.add('ql-hidden'); + } + }, { + key: 'position', + value: function position(reference) { + var left = reference.left + reference.width / 2 - this.root.offsetWidth / 2; + var top = reference.bottom + this.quill.root.scrollTop; + this.root.style.left = left + 'px'; + this.root.style.top = top + 'px'; + this.root.classList.remove('ql-flip'); + var containerBounds = this.boundsContainer.getBoundingClientRect(); + var rootBounds = this.root.getBoundingClientRect(); + var shift = 0; + if (rootBounds.right > containerBounds.right) { + shift = containerBounds.right - rootBounds.right; + this.root.style.left = left + shift + 'px'; + } + if (rootBounds.left < containerBounds.left) { + shift = containerBounds.left - rootBounds.left; + this.root.style.left = left + shift + 'px'; + } + if (rootBounds.bottom > containerBounds.bottom) { + var height = rootBounds.bottom - rootBounds.top; + var verticalShift = containerBounds.bottom - rootBounds.bottom - height; + this.root.style.top = top + verticalShift + 'px'; + this.root.classList.add('ql-flip'); + } + return shift; + } + }, { + key: 'show', + value: function show() { + this.root.classList.remove('ql-editing'); + this.root.classList.remove('ql-hidden'); + } + }]); + + return Tooltip; + }(); + + exports.default = Tooltip; + +/***/ }, +/* 107 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.default = exports.BubbleTooltip = undefined; + + 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); } }; + + 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; }; }(); + + var _extend = __webpack_require__(25); + + var _extend2 = _interopRequireDefault(_extend); + + var _emitter = __webpack_require__(35); + + var _emitter2 = _interopRequireDefault(_emitter); + + var _base = __webpack_require__(108); + + var _base2 = _interopRequireDefault(_base); + + var _selection = __webpack_require__(40); + + var _icons = __webpack_require__(69); + + var _icons2 = _interopRequireDefault(_icons); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + 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; } + + 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; } + + var TOOLBAR_CONFIG = [['bold', 'italic', 'link'], [{ header: 1 }, { header: 2 }, 'blockquote']]; + + var BubbleTheme = function (_BaseTheme) { + _inherits(BubbleTheme, _BaseTheme); + + function BubbleTheme(quill, options) { + _classCallCheck(this, BubbleTheme); + + if (options.modules.toolbar != null && options.modules.toolbar.container == null) { + options.modules.toolbar.container = TOOLBAR_CONFIG; + } + + var _this = _possibleConstructorReturn(this, (BubbleTheme.__proto__ || Object.getPrototypeOf(BubbleTheme)).call(this, quill, options)); + + _this.quill.container.classList.add('ql-bubble'); + return _this; + } + + _createClass(BubbleTheme, [{ + key: 'extendToolbar', + value: function extendToolbar(toolbar) { + this.tooltip = new BubbleTooltip(this.quill, this.options.bounds); + this.tooltip.root.appendChild(toolbar.container); + this.buildButtons([].slice.call(toolbar.container.querySelectorAll('button')), _icons2.default); + this.buildPickers([].slice.call(toolbar.container.querySelectorAll('select')), _icons2.default); + } + }]); + + return BubbleTheme; + }(_base2.default); + + BubbleTheme.DEFAULTS = (0, _extend2.default)(true, {}, _base2.default.DEFAULTS, { + modules: { + toolbar: { + handlers: { + link: function link(value) { + if (!value) { + this.quill.format('link', false); + } else { + this.quill.theme.tooltip.edit(); + } + } + } + } + } + }); + + var BubbleTooltip = function (_BaseTooltip) { + _inherits(BubbleTooltip, _BaseTooltip); + + function BubbleTooltip(quill, bounds) { + _classCallCheck(this, BubbleTooltip); + + var _this2 = _possibleConstructorReturn(this, (BubbleTooltip.__proto__ || Object.getPrototypeOf(BubbleTooltip)).call(this, quill, bounds)); + + _this2.quill.on(_emitter2.default.events.EDITOR_CHANGE, function (type, range, oldRange, source) { + if (type !== _emitter2.default.events.SELECTION_CHANGE) return; + if (range != null && range.length > 0 && source === _emitter2.default.sources.USER) { + _this2.show(); + // Lock our width so we will expand beyond our offsetParent boundaries + _this2.root.style.left = '0px'; + _this2.root.style.width = ''; + _this2.root.style.width = _this2.root.offsetWidth + 'px'; + var lines = _this2.quill.scroll.lines(range.index, range.length); + if (lines.length === 1) { + _this2.position(_this2.quill.getBounds(range)); + } else { + var lastLine = lines[lines.length - 1]; + var index = lastLine.offset(_this2.quill.scroll); + var length = Math.min(lastLine.length() - 1, range.index + range.length - index); + var _bounds = _this2.quill.getBounds(new _selection.Range(index, length)); + _this2.position(_bounds); + } + } else if (document.activeElement !== _this2.textbox && _this2.quill.hasFocus()) { + _this2.hide(); + } + }); + return _this2; + } + + _createClass(BubbleTooltip, [{ + key: 'listen', + value: function listen() { + var _this3 = this; + + _get(BubbleTooltip.prototype.__proto__ || Object.getPrototypeOf(BubbleTooltip.prototype), 'listen', this).call(this); + this.root.querySelector('.ql-close').addEventListener('click', function () { + _this3.root.classList.remove('ql-editing'); + }); + this.quill.on(_emitter2.default.events.SCROLL_OPTIMIZE, function () { + // Let selection be restored by toolbar handlers before repositioning + setTimeout(function () { + if (_this3.root.classList.contains('ql-hidden')) return; + var range = _this3.quill.getSelection(); + if (range != null) { + _this3.position(_this3.quill.getBounds(range)); + } + }, 1); + }); + } + }, { + key: 'cancel', + value: function cancel() { + this.show(); + } + }, { + key: 'position', + value: function position(reference) { + var shift = _get(BubbleTooltip.prototype.__proto__ || Object.getPrototypeOf(BubbleTooltip.prototype), 'position', this).call(this, reference); + var arrow = this.root.querySelector('.ql-tooltip-arrow'); + arrow.style.marginLeft = ''; + if (shift === 0) return shift; + arrow.style.marginLeft = -1 * shift - arrow.offsetWidth / 2 + 'px'; + } + }]); + + return BubbleTooltip; + }(_base.BaseTooltip); + + BubbleTooltip.TEMPLATE = ['', '
', '', '', '
'].join(''); + + exports.BubbleTooltip = BubbleTooltip; + exports.default = BubbleTheme; + +/***/ }, +/* 108 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.default = exports.BaseTooltip = undefined; + + 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; }; }(); + + 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); } }; + + var _extend = __webpack_require__(25); + + var _extend2 = _interopRequireDefault(_extend); + + var _quillDelta = __webpack_require__(20); + + var _quillDelta2 = _interopRequireDefault(_quillDelta); + + var _emitter = __webpack_require__(35); + + var _emitter2 = _interopRequireDefault(_emitter); + + var _keyboard = __webpack_require__(52); + + var _keyboard2 = _interopRequireDefault(_keyboard); + + var _theme = __webpack_require__(41); + + var _theme2 = _interopRequireDefault(_theme); + + var _colorPicker = __webpack_require__(104); + + var _colorPicker2 = _interopRequireDefault(_colorPicker); + + var _iconPicker = __webpack_require__(105); + + var _iconPicker2 = _interopRequireDefault(_iconPicker); + + var _picker = __webpack_require__(102); + + var _picker2 = _interopRequireDefault(_picker); + + var _tooltip = __webpack_require__(106); + + var _tooltip2 = _interopRequireDefault(_tooltip); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + 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; } + + 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; } + + var ALIGNS = [false, 'center', 'right', 'justify']; + + 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"]; + + var FONTS = [false, 'serif', 'monospace']; + + var HEADERS = ['1', '2', '3', false]; + + var SIZES = ['small', false, 'large', 'huge']; + + var BaseTheme = function (_Theme) { + _inherits(BaseTheme, _Theme); + + function BaseTheme(quill, options) { + _classCallCheck(this, BaseTheme); + + var _this = _possibleConstructorReturn(this, (BaseTheme.__proto__ || Object.getPrototypeOf(BaseTheme)).call(this, quill, options)); + + var listener = function listener(e) { + if (!document.body.contains(quill.root)) { + return document.body.removeEventListener('click', listener); + } + if (_this.tooltip != null && !_this.tooltip.root.contains(e.target) && document.activeElement !== _this.tooltip.textbox && !_this.quill.hasFocus()) { + _this.tooltip.hide(); + } + if (_this.pickers != null) { + _this.pickers.forEach(function (picker) { + if (!picker.container.contains(e.target)) { + picker.close(); + } + }); + } + }; + document.body.addEventListener('click', listener); + return _this; + } + + _createClass(BaseTheme, [{ + key: 'addModule', + value: function addModule(name) { + var module = _get(BaseTheme.prototype.__proto__ || Object.getPrototypeOf(BaseTheme.prototype), 'addModule', this).call(this, name); + if (name === 'toolbar') { + this.extendToolbar(module); + } + return module; + } + }, { + key: 'buildButtons', + value: function buildButtons(buttons, icons) { + buttons.forEach(function (button) { + var className = button.getAttribute('class') || ''; + className.split(/\s+/).forEach(function (name) { + if (!name.startsWith('ql-')) return; + name = name.slice('ql-'.length); + if (icons[name] == null) return; + if (name === 'direction') { + button.innerHTML = icons[name][''] + icons[name]['rtl']; + } else if (typeof icons[name] === 'string') { + button.innerHTML = icons[name]; + } else { + var value = button.value || ''; + if (value != null && icons[name][value]) { + button.innerHTML = icons[name][value]; + } + } + }); + }); + } + }, { + key: 'buildPickers', + value: function buildPickers(selects, icons) { + var _this2 = this; + + this.pickers = selects.map(function (select) { + if (select.classList.contains('ql-align')) { + if (select.querySelector('option') == null) { + fillSelect(select, ALIGNS); + } + return new _iconPicker2.default(select, icons.align); + } else if (select.classList.contains('ql-background') || select.classList.contains('ql-color')) { + var format = select.classList.contains('ql-background') ? 'background' : 'color'; + if (select.querySelector('option') == null) { + fillSelect(select, COLORS, format === 'background' ? '#ffffff' : '#000000'); + } + return new _colorPicker2.default(select, icons[format]); + } else { + if (select.querySelector('option') == null) { + if (select.classList.contains('ql-font')) { + fillSelect(select, FONTS); + } else if (select.classList.contains('ql-header')) { + fillSelect(select, HEADERS); + } else if (select.classList.contains('ql-size')) { + fillSelect(select, SIZES); + } + } + return new _picker2.default(select); + } + }); + var update = function update() { + _this2.pickers.forEach(function (picker) { + picker.update(); + }); + }; + this.quill.on(_emitter2.default.events.SELECTION_CHANGE, update).on(_emitter2.default.events.SCROLL_OPTIMIZE, update); + } + }]); + + return BaseTheme; + }(_theme2.default); + + BaseTheme.DEFAULTS = (0, _extend2.default)(true, {}, _theme2.default.DEFAULTS, { + modules: { + toolbar: { + handlers: { + formula: function formula() { + this.quill.theme.tooltip.edit('formula'); + }, + image: function image() { + var _this3 = this; + + var fileInput = this.container.querySelector('input.ql-image[type=file]'); + if (fileInput == null) { + fileInput = document.createElement('input'); + fileInput.setAttribute('type', 'file'); + fileInput.setAttribute('accept', 'image/png, image/gif, image/jpeg, image/bmp, image/x-icon, image/svg+xml'); + fileInput.classList.add('ql-image'); + fileInput.addEventListener('change', function () { + if (fileInput.files != null && fileInput.files[0] != null) { + var reader = new FileReader(); + reader.onload = function (e) { + var range = _this3.quill.getSelection(true); + _this3.quill.updateContents(new _quillDelta2.default().retain(range.index).delete(range.length).insert({ image: e.target.result }), _emitter2.default.sources.USER); + fileInput.value = ""; + }; + reader.readAsDataURL(fileInput.files[0]); + } + }); + this.container.appendChild(fileInput); + } + fileInput.click(); + }, + video: function video() { + this.quill.theme.tooltip.edit('video'); + } + } + } + } + }); + + var BaseTooltip = function (_Tooltip) { + _inherits(BaseTooltip, _Tooltip); + + function BaseTooltip(quill, boundsContainer) { + _classCallCheck(this, BaseTooltip); + + var _this4 = _possibleConstructorReturn(this, (BaseTooltip.__proto__ || Object.getPrototypeOf(BaseTooltip)).call(this, quill, boundsContainer)); + + _this4.textbox = _this4.root.querySelector('input[type="text"]'); + _this4.listen(); + return _this4; + } + + _createClass(BaseTooltip, [{ + key: 'listen', + value: function listen() { + var _this5 = this; + + this.textbox.addEventListener('keydown', function (event) { + if (_keyboard2.default.match(event, 'enter')) { + _this5.save(); + event.preventDefault(); + } else if (_keyboard2.default.match(event, 'escape')) { + _this5.cancel(); + event.preventDefault(); + } + }); + } + }, { + key: 'cancel', + value: function cancel() { + this.hide(); + } + }, { + key: 'edit', + value: function edit() { + var mode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'link'; + var preview = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; + + this.root.classList.remove('ql-hidden'); + this.root.classList.add('ql-editing'); + if (preview != null) { + this.textbox.value = preview; + } else if (mode !== this.root.getAttribute('data-mode')) { + this.textbox.value = ''; + } + this.position(this.quill.getBounds(this.quill.selection.savedRange)); + this.textbox.select(); + this.textbox.setAttribute('placeholder', this.textbox.getAttribute('data-' + mode) || ''); + this.root.setAttribute('data-mode', mode); + } + }, { + key: 'restoreFocus', + value: function restoreFocus() { + var scrollTop = this.quill.root.scrollTop; + this.quill.focus(); + this.quill.root.scrollTop = scrollTop; + } + }, { + key: 'save', + value: function save() { + var value = this.textbox.value; + switch (this.root.getAttribute('data-mode')) { + case 'link': + { + var scrollTop = this.quill.root.scrollTop; + if (this.linkRange) { + this.quill.formatText(this.linkRange, 'link', value, _emitter2.default.sources.USER); + delete this.linkRange; + } else { + this.restoreFocus(); + this.quill.format('link', value, _emitter2.default.sources.USER); + } + this.quill.root.scrollTop = scrollTop; + break; + } + case 'video': + { + var match = value.match(/^(https?):\/\/(www\.)?youtube\.com\/watch.*v=([a-zA-Z0-9_-]+)/) || value.match(/^(https?):\/\/(www\.)?youtu\.be\/([a-zA-Z0-9_-]+)/); + if (match) { + value = match[1] + '://www.youtube.com/embed/' + match[3] + '?showinfo=0'; + } else if (match = value.match(/^(https?):\/\/(www\.)?vimeo\.com\/(\d+)/)) { + // eslint-disable-line no-cond-assign + value = match[1] + '://player.vimeo.com/video/' + match[3] + '/'; + } + } // eslint-disable-next-line no-fallthrough + case 'formula': + { + var range = this.quill.getSelection(true); + var index = range.index + range.length; + if (range != null) { + this.quill.insertEmbed(index, this.root.getAttribute('data-mode'), value, _emitter2.default.sources.USER); + if (this.root.getAttribute('data-mode') === 'formula') { + this.quill.insertText(index + 1, ' ', _emitter2.default.sources.USER); + } + this.quill.setSelection(index + 2, _emitter2.default.sources.USER); + } + break; + } + default: + } + this.textbox.value = ''; + this.hide(); + } + }]); + + return BaseTooltip; + }(_tooltip2.default); + + function fillSelect(select, values) { + var defaultValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + + values.forEach(function (value) { + var option = document.createElement('option'); + if (value === defaultValue) { + option.setAttribute('selected', 'selected'); + } else { + option.setAttribute('value', value); + } + select.appendChild(option); + }); + } + + exports.BaseTooltip = BaseTooltip; + exports.default = BaseTheme; + +/***/ }, +/* 109 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + 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"); } }; }(); + + 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); } }; + + 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; }; }(); + + var _extend = __webpack_require__(25); + + var _extend2 = _interopRequireDefault(_extend); + + var _emitter = __webpack_require__(35); + + var _emitter2 = _interopRequireDefault(_emitter); + + var _base = __webpack_require__(108); + + var _base2 = _interopRequireDefault(_base); + + var _link = __webpack_require__(60); + + var _link2 = _interopRequireDefault(_link); + + var _selection = __webpack_require__(40); + + var _icons = __webpack_require__(69); + + var _icons2 = _interopRequireDefault(_icons); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + 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; } + + 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; } + + var TOOLBAR_CONFIG = [[{ header: ['1', '2', '3', false] }], ['bold', 'italic', 'underline', 'link'], [{ list: 'ordered' }, { list: 'bullet' }], ['clean']]; + + var SnowTheme = function (_BaseTheme) { + _inherits(SnowTheme, _BaseTheme); + + function SnowTheme(quill, options) { + _classCallCheck(this, SnowTheme); + + if (options.modules.toolbar != null && options.modules.toolbar.container == null) { + options.modules.toolbar.container = TOOLBAR_CONFIG; + } + + var _this = _possibleConstructorReturn(this, (SnowTheme.__proto__ || Object.getPrototypeOf(SnowTheme)).call(this, quill, options)); + + _this.quill.container.classList.add('ql-snow'); + return _this; + } + + _createClass(SnowTheme, [{ + key: 'extendToolbar', + value: function extendToolbar(toolbar) { + toolbar.container.classList.add('ql-snow'); + this.buildButtons([].slice.call(toolbar.container.querySelectorAll('button')), _icons2.default); + this.buildPickers([].slice.call(toolbar.container.querySelectorAll('select')), _icons2.default); + this.tooltip = new SnowTooltip(this.quill, this.options.bounds); + if (toolbar.container.querySelector('.ql-link')) { + this.quill.keyboard.addBinding({ key: 'K', shortKey: true }, function (range, context) { + toolbar.handlers['link'].call(toolbar, !context.format.link); + }); + } + } + }]); + + return SnowTheme; + }(_base2.default); + + SnowTheme.DEFAULTS = (0, _extend2.default)(true, {}, _base2.default.DEFAULTS, { + modules: { + toolbar: { + handlers: { + link: function link(value) { + if (value) { + var range = this.quill.getSelection(); + if (range == null || range.length == 0) return; + var preview = this.quill.getText(range); + if (/^\S+@\S+\.\S+$/.test(preview) && preview.indexOf('mailto:') !== 0) { + preview = 'mailto:' + preview; + } + var tooltip = this.quill.theme.tooltip; + tooltip.edit('link', preview); + } else { + this.quill.format('link', false); + } + } + } + } + } + }); + + var SnowTooltip = function (_BaseTooltip) { + _inherits(SnowTooltip, _BaseTooltip); + + function SnowTooltip(quill, bounds) { + _classCallCheck(this, SnowTooltip); + + var _this2 = _possibleConstructorReturn(this, (SnowTooltip.__proto__ || Object.getPrototypeOf(SnowTooltip)).call(this, quill, bounds)); + + _this2.preview = _this2.root.querySelector('a.ql-preview'); + return _this2; + } + + _createClass(SnowTooltip, [{ + key: 'listen', + value: function listen() { + var _this3 = this; + + _get(SnowTooltip.prototype.__proto__ || Object.getPrototypeOf(SnowTooltip.prototype), 'listen', this).call(this); + this.root.querySelector('a.ql-action').addEventListener('click', function (event) { + if (_this3.root.classList.contains('ql-editing')) { + _this3.save(); + } else { + _this3.edit('link', _this3.preview.textContent); + } + event.preventDefault(); + }); + this.root.querySelector('a.ql-remove').addEventListener('click', function (event) { + if (_this3.linkRange != null) { + _this3.restoreFocus(); + _this3.quill.formatText(_this3.linkRange, 'link', false, _emitter2.default.sources.USER); + delete _this3.linkRange; + } + event.preventDefault(); + _this3.hide(); + }); + this.quill.on(_emitter2.default.events.SELECTION_CHANGE, function (range, oldRange, source) { + if (range == null) return; + if (range.length === 0 && source === _emitter2.default.sources.USER) { + var _quill$scroll$descend = _this3.quill.scroll.descendant(_link2.default, range.index), + _quill$scroll$descend2 = _slicedToArray(_quill$scroll$descend, 2), + link = _quill$scroll$descend2[0], + offset = _quill$scroll$descend2[1]; + + if (link != null) { + _this3.linkRange = new _selection.Range(range.index - offset, link.length()); + var preview = _link2.default.formats(link.domNode); + _this3.preview.textContent = preview; + _this3.preview.setAttribute('href', preview); + _this3.show(); + _this3.position(_this3.quill.getBounds(_this3.linkRange)); + return; + } + } else { + delete _this3.linkRange; + } + _this3.hide(); + }); + } + }, { + key: 'show', + value: function show() { + _get(SnowTooltip.prototype.__proto__ || Object.getPrototypeOf(SnowTooltip.prototype), 'show', this).call(this); + this.root.removeAttribute('data-mode'); + } + }]); + + return SnowTooltip; + }(_base.BaseTooltip); + + SnowTooltip.TEMPLATE = ['', '', '', ''].join(''); + + exports.default = SnowTheme; + +/***/ } +/******/ ]) +}); +; \ No newline at end of file diff --git a/vendor/assets/stylesheets/quill.css b/vendor/assets/stylesheets/quill.css new file mode 100644 index 0000000..70097ab --- /dev/null +++ b/vendor/assets/stylesheets/quill.css @@ -0,0 +1,899 @@ +/*! + * Quill Editor v1.1.9 + * https://quilljs.com/ + * Copyright (c) 2014, Jason Chen + * Copyright (c) 2013, salesforce.com + */ +.ql-container { + box-sizing: border-box; + font-family: Helvetica, Arial, sans-serif; + font-size: 13px; + height: 100%; + margin: 0px; + position: relative; +} +.ql-container.ql-disabled .ql-tooltip { + visibility: hidden; +} +.ql-clipboard { + left: -100000px; + height: 1px; + overflow-y: hidden; + position: absolute; + top: 50%; +} +.ql-clipboard p { + margin: 0; + padding: 0; +} +.ql-editor { + box-sizing: border-box; + cursor: text; + line-height: 1.42; + height: 100%; + outline: none; + overflow-y: auto; + padding: 12px 15px; + tab-size: 4; + -moz-tab-size: 4; + text-align: left; + white-space: pre-wrap; + word-wrap: break-word; +} +.ql-editor p, +.ql-editor ol, +.ql-editor ul, +.ql-editor pre, +.ql-editor blockquote, +.ql-editor h1, +.ql-editor h2, +.ql-editor h3, +.ql-editor h4, +.ql-editor h5, +.ql-editor h6 { + margin: 0; + padding: 0; + counter-reset: list-1 list-2 list-3 list-4 list-5 list-6 list-7 list-8 list-9; +} +.ql-editor ol, +.ql-editor ul { + padding-left: 1.5em; +} +.ql-editor ol > li, +.ql-editor ul > li { + list-style-type: none; +} +.ql-editor ul > li::before { + content: '\25CF'; +} +.ql-editor ul[data-checked=true] > li::before, +.ql-editor ul[data-checked=false] > li::before { + color: #777; + cursor: pointer; +} +.ql-editor ul[data-checked=true] > li::before { + content: '\2611'; +} +.ql-editor ul[data-checked=false] > li::before { + content: '\2610'; +} +.ql-editor li::before { + display: inline-block; + margin-right: 0.3em; + text-align: right; + white-space: nowrap; + width: 1.2em; +} +.ql-editor li:not(.ql-direction-rtl)::before { + margin-left: -1.5em; +} +.ql-editor ol li, +.ql-editor ul li { + padding-left: 1.5em; +} +.ql-editor ol li { + counter-reset: list-1 list-2 list-3 list-4 list-5 list-6 list-7 list-8 list-9; + counter-increment: list-num; +} +.ql-editor ol li:before { + content: counter(list-num, decimal) '. '; +} +.ql-editor ol li.ql-indent-1 { + counter-increment: list-1; +} +.ql-editor ol li.ql-indent-1:before { + content: counter(list-1, lower-alpha) '. '; +} +.ql-editor ol li.ql-indent-1 { + counter-reset: list-2 list-3 list-4 list-5 list-6 list-7 list-8 list-9; +} +.ql-editor ol li.ql-indent-2 { + counter-increment: list-2; +} +.ql-editor ol li.ql-indent-2:before { + content: counter(list-2, lower-roman) '. '; +} +.ql-editor ol li.ql-indent-2 { + counter-reset: list-3 list-4 list-5 list-6 list-7 list-8 list-9; +} +.ql-editor ol li.ql-indent-3 { + counter-increment: list-3; +} +.ql-editor ol li.ql-indent-3:before { + content: counter(list-3, decimal) '. '; +} +.ql-editor ol li.ql-indent-3 { + counter-reset: list-4 list-5 list-6 list-7 list-8 list-9; +} +.ql-editor ol li.ql-indent-4 { + counter-increment: list-4; +} +.ql-editor ol li.ql-indent-4:before { + content: counter(list-4, lower-alpha) '. '; +} +.ql-editor ol li.ql-indent-4 { + counter-reset: list-5 list-6 list-7 list-8 list-9; +} +.ql-editor ol li.ql-indent-5 { + counter-increment: list-5; +} +.ql-editor ol li.ql-indent-5:before { + content: counter(list-5, lower-roman) '. '; +} +.ql-editor ol li.ql-indent-5 { + counter-reset: list-6 list-7 list-8 list-9; +} +.ql-editor ol li.ql-indent-6 { + counter-increment: list-6; +} +.ql-editor ol li.ql-indent-6:before { + content: counter(list-6, decimal) '. '; +} +.ql-editor ol li.ql-indent-6 { + counter-reset: list-7 list-8 list-9; +} +.ql-editor ol li.ql-indent-7 { + counter-increment: list-7; +} +.ql-editor ol li.ql-indent-7:before { + content: counter(list-7, lower-alpha) '. '; +} +.ql-editor ol li.ql-indent-7 { + counter-reset: list-8 list-9; +} +.ql-editor ol li.ql-indent-8 { + counter-increment: list-8; +} +.ql-editor ol li.ql-indent-8:before { + content: counter(list-8, lower-roman) '. '; +} +.ql-editor ol li.ql-indent-8 { + counter-reset: list-9; +} +.ql-editor ol li.ql-indent-9 { + counter-increment: list-9; +} +.ql-editor ol li.ql-indent-9:before { + content: counter(list-9, decimal) '. '; +} +.ql-editor .ql-indent-1:not(.ql-direction-rtl) { + padding-left: 3em; +} +.ql-editor li.ql-indent-1:not(.ql-direction-rtl) { + padding-left: 4.5em; +} +.ql-editor .ql-indent-1.ql-direction-rtl.ql-align-right { + padding-right: 3em; +} +.ql-editor li.ql-indent-1.ql-direction-rtl.ql-align-right { + padding-right: 4.5em; +} +.ql-editor .ql-indent-2:not(.ql-direction-rtl) { + padding-left: 6em; +} +.ql-editor li.ql-indent-2:not(.ql-direction-rtl) { + padding-left: 7.5em; +} +.ql-editor .ql-indent-2.ql-direction-rtl.ql-align-right { + padding-right: 6em; +} +.ql-editor li.ql-indent-2.ql-direction-rtl.ql-align-right { + padding-right: 7.5em; +} +.ql-editor .ql-indent-3:not(.ql-direction-rtl) { + padding-left: 9em; +} +.ql-editor li.ql-indent-3:not(.ql-direction-rtl) { + padding-left: 10.5em; +} +.ql-editor .ql-indent-3.ql-direction-rtl.ql-align-right { + padding-right: 9em; +} +.ql-editor li.ql-indent-3.ql-direction-rtl.ql-align-right { + padding-right: 10.5em; +} +.ql-editor .ql-indent-4:not(.ql-direction-rtl) { + padding-left: 12em; +} +.ql-editor li.ql-indent-4:not(.ql-direction-rtl) { + padding-left: 13.5em; +} +.ql-editor .ql-indent-4.ql-direction-rtl.ql-align-right { + padding-right: 12em; +} +.ql-editor li.ql-indent-4.ql-direction-rtl.ql-align-right { + padding-right: 13.5em; +} +.ql-editor .ql-indent-5:not(.ql-direction-rtl) { + padding-left: 15em; +} +.ql-editor li.ql-indent-5:not(.ql-direction-rtl) { + padding-left: 16.5em; +} +.ql-editor .ql-indent-5.ql-direction-rtl.ql-align-right { + padding-right: 15em; +} +.ql-editor li.ql-indent-5.ql-direction-rtl.ql-align-right { + padding-right: 16.5em; +} +.ql-editor .ql-indent-6:not(.ql-direction-rtl) { + padding-left: 18em; +} +.ql-editor li.ql-indent-6:not(.ql-direction-rtl) { + padding-left: 19.5em; +} +.ql-editor .ql-indent-6.ql-direction-rtl.ql-align-right { + padding-right: 18em; +} +.ql-editor li.ql-indent-6.ql-direction-rtl.ql-align-right { + padding-right: 19.5em; +} +.ql-editor .ql-indent-7:not(.ql-direction-rtl) { + padding-left: 21em; +} +.ql-editor li.ql-indent-7:not(.ql-direction-rtl) { + padding-left: 22.5em; +} +.ql-editor .ql-indent-7.ql-direction-rtl.ql-align-right { + padding-right: 21em; +} +.ql-editor li.ql-indent-7.ql-direction-rtl.ql-align-right { + padding-right: 22.5em; +} +.ql-editor .ql-indent-8:not(.ql-direction-rtl) { + padding-left: 24em; +} +.ql-editor li.ql-indent-8:not(.ql-direction-rtl) { + padding-left: 25.5em; +} +.ql-editor .ql-indent-8.ql-direction-rtl.ql-align-right { + padding-right: 24em; +} +.ql-editor li.ql-indent-8.ql-direction-rtl.ql-align-right { + padding-right: 25.5em; +} +.ql-editor .ql-indent-9:not(.ql-direction-rtl) { + padding-left: 27em; +} +.ql-editor li.ql-indent-9:not(.ql-direction-rtl) { + padding-left: 28.5em; +} +.ql-editor .ql-indent-9.ql-direction-rtl.ql-align-right { + padding-right: 27em; +} +.ql-editor li.ql-indent-9.ql-direction-rtl.ql-align-right { + padding-right: 28.5em; +} +.ql-editor .ql-video { + display: block; + max-width: 100%; +} +.ql-editor .ql-video.ql-align-center { + margin: 0 auto; +} +.ql-editor .ql-video.ql-align-right { + margin: 0 0 0 auto; +} +.ql-editor .ql-bg-black { + background-color: #000; +} +.ql-editor .ql-bg-red { + background-color: #e60000; +} +.ql-editor .ql-bg-orange { + background-color: #f90; +} +.ql-editor .ql-bg-yellow { + background-color: #ff0; +} +.ql-editor .ql-bg-green { + background-color: #008a00; +} +.ql-editor .ql-bg-blue { + background-color: #06c; +} +.ql-editor .ql-bg-purple { + background-color: #93f; +} +.ql-editor .ql-color-white { + color: #fff; +} +.ql-editor .ql-color-red { + color: #e60000; +} +.ql-editor .ql-color-orange { + color: #f90; +} +.ql-editor .ql-color-yellow { + color: #ff0; +} +.ql-editor .ql-color-green { + color: #008a00; +} +.ql-editor .ql-color-blue { + color: #06c; +} +.ql-editor .ql-color-purple { + color: #93f; +} +.ql-editor .ql-font-serif { + font-family: Georgia, Times New Roman, serif; +} +.ql-editor .ql-font-monospace { + font-family: Monaco, Courier New, monospace; +} +.ql-editor .ql-size-small { + font-size: 0.75em; +} +.ql-editor .ql-size-large { + font-size: 1.5em; +} +.ql-editor .ql-size-huge { + font-size: 2.5em; +} +.ql-editor .ql-direction-rtl { + direction: rtl; + text-align: inherit; +} +.ql-editor .ql-align-center { + text-align: center; +} +.ql-editor .ql-align-justify { + text-align: justify; +} +.ql-editor .ql-align-right { + text-align: right; +} +.ql-editor.ql-blank::before { + color: rgba(0,0,0,0.6); + content: attr(data-placeholder); + font-style: italic; + pointer-events: none; + position: absolute; +} +.ql-snow.ql-toolbar:after, +.ql-snow .ql-toolbar:after { + clear: both; + content: ''; + display: table; +} +.ql-snow.ql-toolbar button, +.ql-snow .ql-toolbar button { + background: none; + border: none; + cursor: pointer; + display: inline-block; + float: left; + height: 24px; + padding: 3px 5px; + width: 28px; +} +.ql-snow.ql-toolbar button svg, +.ql-snow .ql-toolbar button svg { + float: left; + height: 100%; +} +.ql-snow.ql-toolbar button:active:hover, +.ql-snow .ql-toolbar button:active:hover { + outline: none; +} +.ql-snow.ql-toolbar input.ql-image[type=file], +.ql-snow .ql-toolbar input.ql-image[type=file] { + display: none; +} +.ql-snow.ql-toolbar button:hover, +.ql-snow .ql-toolbar button:hover, +.ql-snow.ql-toolbar button.ql-active, +.ql-snow .ql-toolbar button.ql-active, +.ql-snow.ql-toolbar .ql-picker-label:hover, +.ql-snow .ql-toolbar .ql-picker-label:hover, +.ql-snow.ql-toolbar .ql-picker-label.ql-active, +.ql-snow .ql-toolbar .ql-picker-label.ql-active, +.ql-snow.ql-toolbar .ql-picker-item:hover, +.ql-snow .ql-toolbar .ql-picker-item:hover, +.ql-snow.ql-toolbar .ql-picker-item.ql-selected, +.ql-snow .ql-toolbar .ql-picker-item.ql-selected { + color: #06c; +} +.ql-snow.ql-toolbar button:hover .ql-fill, +.ql-snow .ql-toolbar button:hover .ql-fill, +.ql-snow.ql-toolbar button.ql-active .ql-fill, +.ql-snow .ql-toolbar button.ql-active .ql-fill, +.ql-snow.ql-toolbar .ql-picker-label:hover .ql-fill, +.ql-snow .ql-toolbar .ql-picker-label:hover .ql-fill, +.ql-snow.ql-toolbar .ql-picker-label.ql-active .ql-fill, +.ql-snow .ql-toolbar .ql-picker-label.ql-active .ql-fill, +.ql-snow.ql-toolbar .ql-picker-item:hover .ql-fill, +.ql-snow .ql-toolbar .ql-picker-item:hover .ql-fill, +.ql-snow.ql-toolbar .ql-picker-item.ql-selected .ql-fill, +.ql-snow .ql-toolbar .ql-picker-item.ql-selected .ql-fill, +.ql-snow.ql-toolbar button:hover .ql-stroke.ql-fill, +.ql-snow .ql-toolbar button:hover .ql-stroke.ql-fill, +.ql-snow.ql-toolbar button.ql-active .ql-stroke.ql-fill, +.ql-snow .ql-toolbar button.ql-active .ql-stroke.ql-fill, +.ql-snow.ql-toolbar .ql-picker-label:hover .ql-stroke.ql-fill, +.ql-snow .ql-toolbar .ql-picker-label:hover .ql-stroke.ql-fill, +.ql-snow.ql-toolbar .ql-picker-label.ql-active .ql-stroke.ql-fill, +.ql-snow .ql-toolbar .ql-picker-label.ql-active .ql-stroke.ql-fill, +.ql-snow.ql-toolbar .ql-picker-item:hover .ql-stroke.ql-fill, +.ql-snow .ql-toolbar .ql-picker-item:hover .ql-stroke.ql-fill, +.ql-snow.ql-toolbar .ql-picker-item.ql-selected .ql-stroke.ql-fill, +.ql-snow .ql-toolbar .ql-picker-item.ql-selected .ql-stroke.ql-fill { + fill: #06c; +} +.ql-snow.ql-toolbar button:hover .ql-stroke, +.ql-snow .ql-toolbar button:hover .ql-stroke, +.ql-snow.ql-toolbar button.ql-active .ql-stroke, +.ql-snow .ql-toolbar button.ql-active .ql-stroke, +.ql-snow.ql-toolbar .ql-picker-label:hover .ql-stroke, +.ql-snow .ql-toolbar .ql-picker-label:hover .ql-stroke, +.ql-snow.ql-toolbar .ql-picker-label.ql-active .ql-stroke, +.ql-snow .ql-toolbar .ql-picker-label.ql-active .ql-stroke, +.ql-snow.ql-toolbar .ql-picker-item:hover .ql-stroke, +.ql-snow .ql-toolbar .ql-picker-item:hover .ql-stroke, +.ql-snow.ql-toolbar .ql-picker-item.ql-selected .ql-stroke, +.ql-snow .ql-toolbar .ql-picker-item.ql-selected .ql-stroke, +.ql-snow.ql-toolbar button:hover .ql-stroke-miter, +.ql-snow .ql-toolbar button:hover .ql-stroke-miter, +.ql-snow.ql-toolbar button.ql-active .ql-stroke-miter, +.ql-snow .ql-toolbar button.ql-active .ql-stroke-miter, +.ql-snow.ql-toolbar .ql-picker-label:hover .ql-stroke-miter, +.ql-snow .ql-toolbar .ql-picker-label:hover .ql-stroke-miter, +.ql-snow.ql-toolbar .ql-picker-label.ql-active .ql-stroke-miter, +.ql-snow .ql-toolbar .ql-picker-label.ql-active .ql-stroke-miter, +.ql-snow.ql-toolbar .ql-picker-item:hover .ql-stroke-miter, +.ql-snow .ql-toolbar .ql-picker-item:hover .ql-stroke-miter, +.ql-snow.ql-toolbar .ql-picker-item.ql-selected .ql-stroke-miter, +.ql-snow .ql-toolbar .ql-picker-item.ql-selected .ql-stroke-miter { + stroke: #06c; +} +.ql-snow { + box-sizing: border-box; +} +.ql-snow * { + box-sizing: border-box; +} +.ql-snow .ql-hidden { + display: none; +} +.ql-snow .ql-out-bottom, +.ql-snow .ql-out-top { + visibility: hidden; +} +.ql-snow .ql-tooltip { + position: absolute; + transform: translateY(10px); +} +.ql-snow .ql-tooltip a { + cursor: pointer; + text-decoration: none; +} +.ql-snow .ql-tooltip.ql-flip { + transform: translateY(-10px); +} +.ql-snow .ql-formats { + display: inline-block; + vertical-align: middle; +} +.ql-snow .ql-formats:after { + clear: both; + content: ''; + display: table; +} +.ql-snow .ql-stroke { + fill: none; + stroke: #444; + stroke-linecap: round; + stroke-linejoin: round; + stroke-width: 2; +} +.ql-snow .ql-stroke-miter { + fill: none; + stroke: #444; + stroke-miterlimit: 10; + stroke-width: 2; +} +.ql-snow .ql-fill, +.ql-snow .ql-stroke.ql-fill { + fill: #444; +} +.ql-snow .ql-empty { + fill: none; +} +.ql-snow .ql-even { + fill-rule: evenodd; +} +.ql-snow .ql-thin, +.ql-snow .ql-stroke.ql-thin { + stroke-width: 1; +} +.ql-snow .ql-transparent { + opacity: 0.4; +} +.ql-snow .ql-direction svg:last-child { + display: none; +} +.ql-snow .ql-direction.ql-active svg:last-child { + display: inline; +} +.ql-snow .ql-direction.ql-active svg:first-child { + display: none; +} +.ql-snow .ql-editor h1 { + font-size: 2em; +} +.ql-snow .ql-editor h2 { + font-size: 1.5em; +} +.ql-snow .ql-editor h3 { + font-size: 1.17em; +} +.ql-snow .ql-editor h4 { + font-size: 1em; +} +.ql-snow .ql-editor h5 { + font-size: 0.83em; +} +.ql-snow .ql-editor h6 { + font-size: 0.67em; +} +.ql-snow .ql-editor a { + text-decoration: underline; +} +.ql-snow .ql-editor blockquote { + border-left: 4px solid #ccc; + margin-bottom: 5px; + margin-top: 5px; + padding-left: 16px; +} +.ql-snow .ql-editor code, +.ql-snow .ql-editor pre { + background-color: #f0f0f0; + border-radius: 3px; +} +.ql-snow .ql-editor pre { + white-space: pre-wrap; + margin-bottom: 5px; + margin-top: 5px; + padding: 5px 10px; +} +.ql-snow .ql-editor code { + font-size: 85%; + padding-bottom: 2px; + padding-top: 2px; +} +.ql-snow .ql-editor code:before, +.ql-snow .ql-editor code:after { + content: "\A0"; + letter-spacing: -2px; +} +.ql-snow .ql-editor pre.ql-syntax { + background-color: #23241f; + color: #f8f8f2; + overflow: visible; +} +.ql-snow .ql-editor img { + max-width: 100%; +} +.ql-snow .ql-picker { + color: #444; + display: inline-block; + float: left; + font-size: 14px; + font-weight: 500; + height: 24px; + position: relative; + vertical-align: middle; +} +.ql-snow .ql-picker-label { + cursor: pointer; + display: inline-block; + height: 100%; + padding-left: 8px; + padding-right: 2px; + position: relative; + width: 100%; +} +.ql-snow .ql-picker-label::before { + display: inline-block; + line-height: 22px; +} +.ql-snow .ql-picker-options { + background-color: #fff; + display: none; + min-width: 100%; + padding: 4px 8px; + position: absolute; + white-space: nowrap; +} +.ql-snow .ql-picker-options .ql-picker-item { + cursor: pointer; + display: block; + padding-bottom: 5px; + padding-top: 5px; +} +.ql-snow .ql-picker.ql-expanded .ql-picker-label { + color: #ccc; + z-index: 2; +} +.ql-snow .ql-picker.ql-expanded .ql-picker-label .ql-fill { + fill: #ccc; +} +.ql-snow .ql-picker.ql-expanded .ql-picker-label .ql-stroke { + stroke: #ccc; +} +.ql-snow .ql-picker.ql-expanded .ql-picker-options { + display: block; + margin-top: -1px; + top: 100%; + z-index: 1; +} +.ql-snow .ql-color-picker, +.ql-snow .ql-icon-picker { + width: 28px; +} +.ql-snow .ql-color-picker .ql-picker-label, +.ql-snow .ql-icon-picker .ql-picker-label { + padding: 2px 4px; +} +.ql-snow .ql-color-picker .ql-picker-label svg, +.ql-snow .ql-icon-picker .ql-picker-label svg { + right: 4px; +} +.ql-snow .ql-icon-picker .ql-picker-options { + padding: 4px 0px; +} +.ql-snow .ql-icon-picker .ql-picker-item { + height: 24px; + width: 24px; + padding: 2px 4px; +} +.ql-snow .ql-color-picker .ql-picker-options { + padding: 3px 5px; + width: 152px; +} +.ql-snow .ql-color-picker .ql-picker-item { + border: 1px solid transparent; + float: left; + height: 16px; + margin: 2px; + padding: 0px; + width: 16px; +} +.ql-snow .ql-picker:not(.ql-color-picker):not(.ql-icon-picker) svg { + position: absolute; + margin-top: -9px; + right: 0; + top: 50%; + width: 18px; +} +.ql-snow .ql-picker.ql-header .ql-picker-label[data-label]:not([data-label=''])::before, +.ql-snow .ql-picker.ql-font .ql-picker-label[data-label]:not([data-label=''])::before, +.ql-snow .ql-picker.ql-size .ql-picker-label[data-label]:not([data-label=''])::before, +.ql-snow .ql-picker.ql-header .ql-picker-item[data-label]:not([data-label=''])::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-label]:not([data-label=''])::before, +.ql-snow .ql-picker.ql-size .ql-picker-item[data-label]:not([data-label=''])::before { + content: attr(data-label); +} +.ql-snow .ql-picker.ql-header { + width: 98px; +} +.ql-snow .ql-picker.ql-header .ql-picker-label::before, +.ql-snow .ql-picker.ql-header .ql-picker-item::before { + content: 'Normal'; +} +.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="1"]::before, +.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="1"]::before { + content: 'Heading 1'; +} +.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="2"]::before, +.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="2"]::before { + content: 'Heading 2'; +} +.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="3"]::before, +.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="3"]::before { + content: 'Heading 3'; +} +.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="4"]::before, +.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="4"]::before { + content: 'Heading 4'; +} +.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="5"]::before, +.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="5"]::before { + content: 'Heading 5'; +} +.ql-snow .ql-picker.ql-header .ql-picker-label[data-value="6"]::before, +.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="6"]::before { + content: 'Heading 6'; +} +.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="1"]::before { + font-size: 2em; +} +.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="2"]::before { + font-size: 1.5em; +} +.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="3"]::before { + font-size: 1.17em; +} +.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="4"]::before { + font-size: 1em; +} +.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="5"]::before { + font-size: 0.83em; +} +.ql-snow .ql-picker.ql-header .ql-picker-item[data-value="6"]::before { + font-size: 0.67em; +} +.ql-snow .ql-picker.ql-font { + width: 108px; +} +.ql-snow .ql-picker.ql-font .ql-picker-label::before, +.ql-snow .ql-picker.ql-font .ql-picker-item::before { + content: 'Sans Serif'; +} +.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=serif]::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=serif]::before { + content: 'Serif'; +} +.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=monospace]::before, +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=monospace]::before { + content: 'Monospace'; +} +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=serif]::before { + font-family: Georgia, Times New Roman, serif; +} +.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=monospace]::before { + font-family: Monaco, Courier New, monospace; +} +.ql-snow .ql-picker.ql-size { + width: 98px; +} +.ql-snow .ql-picker.ql-size .ql-picker-label::before, +.ql-snow .ql-picker.ql-size .ql-picker-item::before { + content: 'Normal'; +} +.ql-snow .ql-picker.ql-size .ql-picker-label[data-value=small]::before, +.ql-snow .ql-picker.ql-size .ql-picker-item[data-value=small]::before { + content: 'Small'; +} +.ql-snow .ql-picker.ql-size .ql-picker-label[data-value=large]::before, +.ql-snow .ql-picker.ql-size .ql-picker-item[data-value=large]::before { + content: 'Large'; +} +.ql-snow .ql-picker.ql-size .ql-picker-label[data-value=huge]::before, +.ql-snow .ql-picker.ql-size .ql-picker-item[data-value=huge]::before { + content: 'Huge'; +} +.ql-snow .ql-picker.ql-size .ql-picker-item[data-value=small]::before { + font-size: 10px; +} +.ql-snow .ql-picker.ql-size .ql-picker-item[data-value=large]::before { + font-size: 18px; +} +.ql-snow .ql-picker.ql-size .ql-picker-item[data-value=huge]::before { + font-size: 32px; +} +.ql-snow .ql-color-picker.ql-background .ql-picker-item { + background-color: #fff; +} +.ql-snow .ql-color-picker.ql-color .ql-picker-item { + background-color: #000; +} +.ql-toolbar.ql-snow { + border: 1px solid #ccc; + box-sizing: border-box; + font-family: 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif; + padding: 8px; +} +.ql-toolbar.ql-snow .ql-formats { + margin-right: 15px; +} +.ql-toolbar.ql-snow .ql-picker-label { + border: 1px solid transparent; +} +.ql-toolbar.ql-snow .ql-picker-options { + border: 1px solid transparent; + box-shadow: rgba(0,0,0,0.2) 0 2px 8px; +} +.ql-toolbar.ql-snow .ql-picker.ql-expanded .ql-picker-label { + border-color: #ccc; +} +.ql-toolbar.ql-snow .ql-picker.ql-expanded .ql-picker-options { + border-color: #ccc; +} +.ql-toolbar.ql-snow .ql-color-picker .ql-picker-item.ql-selected, +.ql-toolbar.ql-snow .ql-color-picker .ql-picker-item:hover { + border-color: #000; +} +.ql-toolbar.ql-snow + .ql-container.ql-snow { + border-top: 0px; +} +.ql-snow .ql-tooltip { + background-color: #fff; + border: 1px solid #ccc; + box-shadow: 0px 0px 5px #ddd; + color: #444; + padding: 5px 12px; + white-space: nowrap; +} +.ql-snow .ql-tooltip::before { + content: "Visit URL:"; + line-height: 26px; + margin-right: 8px; +} +.ql-snow .ql-tooltip input[type=text] { + display: none; + border: 1px solid #ccc; + font-size: 13px; + height: 26px; + margin: 0px; + padding: 3px 5px; + width: 170px; +} +.ql-snow .ql-tooltip a.ql-preview { + display: inline-block; + max-width: 200px; + overflow-x: hidden; + text-overflow: ellipsis; + vertical-align: top; +} +.ql-snow .ql-tooltip a.ql-action::after { + border-right: 1px solid #ccc; + content: 'Edit'; + margin-left: 16px; + padding-right: 8px; +} +.ql-snow .ql-tooltip a.ql-remove::before { + content: 'Remove'; + margin-left: 8px; +} +.ql-snow .ql-tooltip a { + line-height: 26px; +} +.ql-snow .ql-tooltip.ql-editing a.ql-preview, +.ql-snow .ql-tooltip.ql-editing a.ql-remove { + display: none; +} +.ql-snow .ql-tooltip.ql-editing input[type=text] { + display: inline-block; +} +.ql-snow .ql-tooltip.ql-editing a.ql-action::after { + border-right: 0px; + content: 'Save'; + padding-right: 0px; +} +.ql-snow .ql-tooltip[data-mode=link]::before { + content: "Enter link:"; +} +.ql-snow .ql-tooltip[data-mode=formula]::before { + content: "Enter formula:"; +} +.ql-snow .ql-tooltip[data-mode=video]::before { + content: "Enter video:"; +} +.ql-snow a { + color: #06c; +} +.ql-container.ql-snow { + border: 1px solid #ccc; +}