Pārlūkot izejas kodu

修复简化富文本功能完整性

adminstyle
叙述、别离 pirms 2 nedēļām
vecāks
revīzija
49bdde725e
15 mainītis faili ar 2301 papildinājumiem un 0 dzēšanām
  1. +1883
    -0
      src/static/ckeditor/CHANGES.md
  2. Binārs
      src/static/ckeditor/plugins/emoji/assets/iconsall.png
  3. +58
    -0
      src/static/ckeditor/plugins/emoji/assets/iconsall.svg
  4. +1
    -0
      src/static/ckeditor/plugins/emoji/emoji.json
  5. Binārs
      src/static/ckeditor/plugins/emoji/icons/emojipanel.png
  6. Binārs
      src/static/ckeditor/plugins/emoji/icons/hidpi/emojipanel.png
  7. +1
    -0
      src/static/ckeditor/plugins/emoji/lang/en.js
  8. +28
    -0
      src/static/ckeditor/plugins/emoji/plugin.js
  9. +234
    -0
      src/static/ckeditor/plugins/emoji/skins/default.css
  10. +8
    -0
      src/static/ckeditor/plugins/pastefromgdocs/filter/default.js
  11. +6
    -0
      src/static/ckeditor/plugins/pastefromgdocs/plugin.js
  12. +11
    -0
      src/static/ckeditor/plugins/pastefromlibreoffice/filter/default.js
  13. +43
    -0
      src/static/ckeditor/plugins/pastefromword/filter/default.js
  14. +22
    -0
      src/static/ckeditor/plugins/pastetools/filter/common.js
  15. +6
    -0
      src/static/ckeditor/plugins/pastetools/filter/image.js

+ 1883
- 0
src/static/ckeditor/CHANGES.md
Failā izmaiņas netiks attēlotas, jo tās ir par lielu
Parādīt failu


Binārs
src/static/ckeditor/plugins/emoji/assets/iconsall.png Parādīt failu

Pirms Pēc
Platums: 105  |  Augstums: 42  |  Izmērs: 1.6KB

+ 58
- 0
src/static/ckeditor/plugins/emoji/assets/iconsall.svg Parādīt failu

@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg">
<defs>
<symbol id="cke4-icon-emoji-1" viewBox="0 0 34 34" fill="#454545">
<path d="M17,34 C7.61115925,34 0,26.3888408 0,17 C0,7.61115925 7.61115925,0 17,0 C26.3888408,0 34,7.61115925 34,17 C34,26.3888408 26.3888408,34 17,34 Z M17,31.0857143 C24.7793252,31.0857143 31.0857143,24.7793252 31.0857143,17 C31.0857143,9.22067481 24.7793252,2.91428571 17,2.91428571 C9.22067481,2.91428571 2.91428571,9.22067481 2.91428571,17 C2.91428571,24.7793252 9.22067481,31.0857143 17,31.0857143 Z M17.4857143,16.5142857 L25.7428571,16.5142857 C26.5476149,16.5142857 27.2,17.1666708 27.2,17.9714286 C27.2,18.7761863 26.5476149,19.4285714 25.7428571,19.4285714 L16.0285714,19.4285714 C15.2238137,19.4285714 14.5714286,18.7761863 14.5714286,17.9714286 L14.5714286,10.2 C14.5714286,9.39524222 15.2238137,8.74285714 16.0285714,8.74285714 C16.8333292,8.74285714 17.4857143,9.39524222 17.4857143,10.2 L17.4857143,16.5142857 Z" ></path>
</symbol>

<symbol id="cke4-icon-emoji-2" viewBox="0 0 34 34" fill="#454545">
<path d="M16.5142857,17.4857143 C11.685739,17.4857143 7.77142857,13.5714038 7.77142857,8.74285713 C7.77142857,3.91431047 11.685739,0 16.5142857,0 C21.3428324,0 25.2571429,3.91431047 25.2571429,8.74285713 C25.2571429,13.5714038 21.3428324,17.4857143 16.5142857,17.4857143 Z M16.5142857,14.5714286 C19.7333169,14.5714286 22.3428571,11.9618882 22.3428571,8.74285713 C22.3428571,5.52382603 19.7333169,2.91428572 16.5142857,2.91428572 C13.2952546,2.91428572 10.6857143,5.52382603 10.6857143,8.74285713 C10.6857143,11.9618882 13.2952546,14.5714286 16.5142857,14.5714286 Z M2.91428572,32.5428571 C2.91428572,33.3476149 2.26190063,34 1.45714286,34 C0.652385075,34 7.77156117e-16,33.3476149 7.77156117e-16,32.5428571 L7.77156117e-16,30.6 C7.77156117e-16,24.4301904 5.00161893,19.4285714 11.1714285,19.4285714 L22.8285714,19.4285714 C28.998381,19.4285714 34,24.4301904 34,30.6 L34,32.5428571 C34,33.3476149 33.3476149,34 32.5428571,34 C31.7380993,34 31.0857142,33.3476149 31.0857142,32.5428571 L31.0857142,30.6 C31.0857142,26.0397059 27.3888655,22.3428571 22.8285714,22.3428571 L11.1714285,22.3428571 C6.61113449,22.3428571 2.91428572,26.0397059 2.91428572,30.6 L2.91428572,32.5428571 Z" ></path>
</symbol>

<symbol id="cke4-icon-emoji-3" viewBox="0 0 34 34" fill="#454545">
<g transform="translate(3 0)">
<path d="M4.00202635,26.2459764 L23.926941,26.2459764 L13.9644837,4.72762621 L4.00202635,26.2459764 Z M15.2381169,0.811081912 L27.3893468,27.0570582 C27.8168927,27.9805335 27.138291,29.0337079 26.1157136,29.0337079 L1.81325379,29.0337079 C0.790676375,29.0337079 0.112074606,27.9805335 0.539620521,27.0570582 L12.6908504,0.811081912 C13.1915313,-0.270360637 14.7374361,-0.270360637 15.2381169,0.811081912 Z M12.7516975,28.0218646 C12.7516975,27.2520538 13.3794234,26.6279988 14.1537625,26.6279988 C14.9281016,26.6279988 15.5558274,27.2520538 15.5558274,28.0218646 L15.5558274,32.6061343 C15.5558274,33.375945 14.9281016,34 14.1537625,34 C13.3794234,34 12.7516975,33.375945 12.7516975,32.6061343 L12.7516975,28.0218646 Z M4.47133533,23.8735652 C3.69699622,23.8735652 3.06927034,23.2495102 3.06927034,22.4796994 C3.06927034,21.7098886 3.69699622,21.0858336 4.47133533,21.0858336 L10.3570873,21.0858336 C11.1314264,21.0858336 11.7591523,21.7098886 11.7591523,22.4796994 C11.7591523,23.2495102 11.1314264,23.8735652 10.3570873,23.8735652 L4.47133533,23.8735652 Z" ></path>
</g>
</symbol>

<symbol id="cke4-icon-emoji-4" viewBox="0 0 34 34" fill="#454545" >
<g transform="translate(0 1)">
<path d="M4.88004216,8.64704603 L14.366475,17.6941853 L23.8529077,8.64704603 L4.88004216,8.64704603 Z M20.4747083,5.64291295 C21.1242564,2.58092473 23.8749077,0.284688561 27.1647132,0.284688561 C30.9367587,0.284688561 34,3.30345831 34,7.03399043 C34,10.7645225 30.9367587,13.7832923 27.1647132,13.7832923 C25.8138219,13.7832923 24.5225459,13.3935932 23.4265632,12.6855023 L15.8064261,19.9527694 L15.8064261,28.9331565 L18.3816085,28.9331565 C19.1537727,28.9331565 19.7797354,29.5559631 19.7797354,30.324234 C19.7797354,31.0925048 19.1537727,31.7153114 18.3816085,31.7153114 L10.0167469,31.7153114 C9.24458279,31.7153114 8.61862008,31.0925048 8.61862008,30.324234 C8.61862008,29.5559631 9.24458279,28.9331565 10.0167469,28.9331565 L13.0101724,28.9331565 L13.0101724,20.0325445 L0.433467033,8.03823563 C-0.476094537,7.17079363 0.141017531,5.64291295 1.40093953,5.64291295 L20.4747083,5.64291295 Z M23.3810769,5.86489107 L27.3320104,5.86489107 C28.5919324,5.86489107 29.2090445,7.39277175 28.2994828,8.26021375 L25.541687,10.8903028 C26.0447863,11.1072592 26.5948672,11.2231154 27.1647132,11.2231154 C29.3983887,11.2231154 31.2037463,9.44396762 31.2037463,7.25596855 C31.2037463,5.06796944 29.3983887,3.28882165 27.1647132,3.28882165 C25.4304916,3.28882165 23.9544575,4.36128147 23.3810769,5.86489107 Z" ></path>
</g>
</symbol>

<symbol id="cke4-icon-emoji-5" viewBox="0 0 34 34" fill="#454545">
<g transform="translate(.5)">
<path d="M16.46875,33.4848485 C7.37331053,33.4848485 0,26.1043304 0,17 C0,7.89566958 7.37331053,0.51515151 16.46875,0.51515151 C25.5641895,0.51515151 32.9375,7.89566958 32.9375,17 C32.9375,26.1043304 25.5641895,33.4848485 16.46875,33.4848485 Z M16.46875,30.3939394 C23.8587946,30.3939394 29.8496094,24.3972684 29.8496094,17 C29.8496094,9.60273156 23.8587946,3.6060606 16.46875,3.6060606 C9.07870539,3.6060606 3.08789062,9.60273156 3.08789062,17 C3.08789062,24.3972684 9.07870539,30.3939394 16.46875,30.3939394 Z M24.2682177,4.29364565 C24.7385835,3.58171977 25.6964566,3.38626931 26.4076873,3.85709484 C27.1189179,4.32792036 27.3141774,5.28672982 26.8438118,5.9986557 C24.9221214,8.90724567 23.8528363,12.5284825 23.8528363,16.3592005 C23.8528363,20.4487952 25.0723043,24.2961134 27.23534,27.2859568 C27.7354692,27.9772575 27.5810414,28.9434986 26.8904158,29.4441167 C26.1997902,29.9447348 25.2344927,29.790156 24.7343635,29.0988554 C22.1858456,25.5761815 20.7649457,21.0933626 20.7649457,16.3592005 C20.7649457,11.9271905 22.0095222,7.71231267 24.2682177,4.29364565 Z M8.92182355,4.29364565 C11.1805192,7.71231267 12.4250957,11.9271905 12.4250957,16.3592005 C12.4250957,21.0933626 11.0041956,25.5761815 8.45567789,29.0988554 C7.95554867,29.790156 6.99025118,29.9447348 6.29962558,29.4441167 C5.60899999,28.9434986 5.45457216,27.9772575 5.95470137,27.2859568 C8.11773699,24.2961134 9.33720506,20.4487952 9.33720506,16.3592005 C9.33720506,12.5284825 8.26791992,8.90724567 6.34622961,5.9986557 C5.87586388,5.28672982 6.07112347,4.32792036 6.78235411,3.85709484 C7.49358474,3.38626931 8.45145786,3.58171977 8.92182355,4.29364565 Z" ></path>
</g>
</symbol>

<symbol id="cke4-icon-emoji-6" viewBox="0 0 34 34" fill="#454545">
<g transform="translate(0 4)">
<path d="M5.34285714,3.4761905 C4.00159418,3.4761905 2.91428572,4.54217919 2.91428572,5.85714293 L2.91428572,20.1428571 C2.91428572,21.4578209 4.00159418,22.5238096 5.34285714,22.5238096 L28.6571428,22.5238096 C29.9984058,22.5238096 31.0857142,21.4578209 31.0857142,20.1428571 L31.0857142,5.85714293 C31.0857142,4.54217919 29.9984058,3.4761905 28.6571428,3.4761905 L5.34285714,3.4761905 Z M5.34285714,0.619047645 L28.6571428,0.619047645 C31.6079214,0.619047645 34,2.96422277 34,5.85714293 L34,20.1428571 C34,23.0357773 31.6079214,25.3809524 28.6571428,25.3809524 L5.34285714,25.3809524 C2.39207862,25.3809524 0,23.0357773 0,20.1428571 L0,5.85714293 C0,2.96422277 2.39207862,0.619047645 5.34285714,0.619047645 Z M7.28571429,7.76190478 L32.5428571,7.76190478 L32.5428571,12.5238095 L7.28571429,12.5238095 L7.28571429,7.76190478 Z" ></path>
</g>
</symbol>

<symbol id="cke4-icon-emoji-7" viewBox="0 0 34 34" fill="#454545">
<g transform="translate(0 1)">
<path d="M17,27.8098419 L29.008654,15.8011879 C31.8020597,13.0077822 31.8020597,8.47877655 29.008654,5.68537081 C26.2152483,2.89196506 21.6862427,2.89196506 18.892837,5.68537081 L18.0239937,6.55421399 C17.4584576,7.11975012 16.5415424,7.11975012 15.9760063,6.55421399 L15.107163,5.68537081 C12.3137573,2.89196506 7.78475175,2.89196506 4.99134601,5.68537081 C2.19794026,8.47877655 2.19794026,13.0077822 4.99134601,15.8011879 L17,27.8098419 Z M31.0566415,3.63738331 C34.9811195,7.56186131 34.9811195,13.9246973 31.0566415,17.8491754 L18.0239937,30.8818231 C17.4584576,31.4473592 16.5415424,31.4473592 15.9760063,30.8818231 L2.94335851,17.8491754 C-0.981119504,13.9246973 -0.981119504,7.56186131 2.94335851,3.63738331 C6.81653275,-0.235790937 13.0647295,-0.286424027 17,3.48548401 C20.9352705,-0.286424027 27.1834673,-0.235790937 31.0566415,3.63738331 Z" ></path>
</g>
</symbol>

<symbol id="cke4-icon-emoji-8" viewBox="0 0 34 34" fill="#454545">
<g transform="translate(0 2)">
<path d="M2.91428572,8.66227563 L2.91428572,25.2718751 L11.3010504,20.9241246 C11.7291868,20.7021761 12.2440736,20.7005011 12.6737574,20.9196591 L22.6694289,26.0178991 L31.0857142,21.3486657 L31.0857142,4.79066595 L23.426437,9.03992213 C22.9922058,9.28082733 22.4598922,9.28994853 22.0170362,9.06407213 L11.9973262,3.95357149 L2.91428572,8.66227563 Z M11.9973262,23.7504328 L2.14783843,28.8564679 C1.17704967,29.3597308 0,28.6826187 0,27.6208979 L0,7.82403653 C0,7.30776117 0.294388844,6.83318444 0.76644729,6.58846643 L11.3010504,1.1272633 C11.7291868,0.905314754 12.2440736,0.903639774 12.6737574,1.12279772 L22.6694289,6.22103771 L31.8154676,1.14694772 C32.7868956,0.608013564 34,1.28321355 34,2.36283337 L34,22.1596947 C34,22.6614885 33.7217541,23.1250905 33.2702466,23.3755804 L23.426437,28.8367835 C22.9922058,29.0776887 22.4598922,29.0868099 22.0170362,28.8609335 L11.9973262,23.7504328 Z M21.0692063,7.82403653 C21.0692063,7.0490563 21.7215914,6.4208107 22.5263492,6.4208107 C23.331107,6.4208107 23.9834921,7.0490563 23.9834921,7.82403653 L23.9834921,26.9382475 C23.9834921,27.7132277 23.331107,28.3414733 22.5263492,28.3414733 C21.7215914,28.3414733 21.0692063,27.7132277 21.0692063,26.9382475 L21.0692063,7.82403653 Z M10.5367619,3.04548376 C10.5367619,2.27050355 11.189147,1.64225796 11.9939048,1.64225796 C12.7986626,1.64225796 13.4510476,2.27050355 13.4510476,3.04548376 L13.4510476,22.1596947 C13.4510476,22.9346749 12.7986626,23.5629205 11.9939048,23.5629205 C11.189147,23.5629205 10.5367619,22.9346749 10.5367619,22.1596947 L10.5367619,3.04548376 Z" ></path>
</g>
</symbol>

<symbol id="cke4-icon-emoji-9" viewBox="0 0 34 34" fill="#454545">
<g transform="translate(2)">
<path d="M28.7320655,20.4745255 C29.460932,21.5678252 28.6771913,23.0322581 27.3632086,23.0322581 L2.13740212,23.0322581 C1.22880463,23.0322581 0.492240826,22.2956942 0.492240826,21.3870968 L0.492240826,4.93548387 C0.492240826,4.02688638 1.22880463,3.29032258 2.13740212,3.29032258 L27.3632086,3.29032258 C28.6771913,3.29032258 29.460932,4.75475545 28.7320655,5.84805516 L23.8565754,13.1612903 L28.7320655,20.4745255 Z M3.78256341,19.7419355 L24.2891966,19.7419355 L20.5104807,14.0738616 C20.1420748,13.5212529 20.1420748,12.8013277 20.5104807,12.248719 L24.2891966,6.58064516 L3.78256341,6.58064516 L3.78256341,19.7419355 Z M3.78256341,32.3548387 C3.78256341,33.2634362 3.0459996,34 2.13740212,34 C1.22880463,34 0.492240826,33.2634362 0.492240826,32.3548387 L0.492240826,1.64516129 C0.492240826,0.736563804 1.22880463,0 2.13740212,0 C3.0459996,0 3.78256341,0.736563804 3.78256341,1.64516129 L3.78256341,32.3548387 Z" ></path>
</g>
</symbol>

<symbol id="cke4-icon-emoji-10" viewBox="0 0 34 34" fill="#454545">
<path d="M24.0262636,21.2319113 L33.6101333,30.5592 L30.1716,34 L20.4197867,24.5823493 C18.3640092,25.8812696 15.9280529,26.6330279 13.3165139,26.6330279 C5.96200637,26.6330279 0,20.6710215 0,13.3165139 C0,5.96200637 5.96200637,-5.68434189e-14 13.3165139,-5.68434189e-14 C20.6710215,-5.68434189e-14 26.6330279,5.96200637 26.6330279,13.3165139 C26.6330279,16.2809788 25.6643535,19.0191975 24.0262636,21.2319113 Z M13.3165139,23.0648142 C18.7003515,23.0648142 23.0648142,18.7003515 23.0648142,13.3165139 C23.0648142,7.93267637 18.7003515,3.56821367 13.3165139,3.56821367 C7.93267637,3.56821367 3.56821367,7.93267637 3.56821367,13.3165139 C3.56821367,18.7003515 7.93267637,23.0648142 13.3165139,23.0648142 Z" id="path"></path>
</symbol>
</defs>
</svg>

+ 1
- 0
src/static/ckeditor/plugins/emoji/emoji.json
Failā izmaiņas netiks attēlotas, jo tās ir par lielu
Parādīt failu


Binārs
src/static/ckeditor/plugins/emoji/icons/emojipanel.png Parādīt failu

Pirms Pēc
Platums: 16  |  Augstums: 16  |  Izmērs: 670B

Binārs
src/static/ckeditor/plugins/emoji/icons/hidpi/emojipanel.png Parādīt failu

Pirms Pēc
Platums: 32  |  Augstums: 32  |  Izmērs: 1.6KB

+ 1
- 0
src/static/ckeditor/plugins/emoji/lang/en.js Parādīt failu

@@ -0,0 +1 @@
CKEDITOR.plugins.setLang("emoji","en",{searchPlaceholder:"Search emoji…",searchLabel:"Input field responsible for searching and filtering emoji inside panel.",navigationLabel:"Groups navigation for emoji sections.",title:"Emoji List",groups:{people:"People",nature:"Nature and animals",food:"Food and drinks",travel:"Travel and places",activities:"Activities",objects:"Objects",symbols:"Symbols",flags:"Flags"}});

+ 28
- 0
src/static/ckeditor/plugins/emoji/plugin.js Parādīt failu

@@ -0,0 +1,28 @@
/*
Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/
(function(){function k(a){a.name||(a.name=e(a.id.replace(/::.*$/,":").replace(/^:|:$/g,"")));return a}var g=!1,f=CKEDITOR.tools.array,e=CKEDITOR.tools.htmlEncode,h=CKEDITOR.tools.createClass({$:function(a,d){var c=this.lang=a.lang.emoji,b=this;this.listeners=[];this.plugin=d;this.editor=a;this.groups=[{name:"people",sectionName:c.groups.people,svgId:"cke4-icon-emoji-2",position:{x:-21,y:0},items:[]},{name:"nature",sectionName:c.groups.nature,svgId:"cke4-icon-emoji-3",position:{x:-42,y:0},items:[]},
{name:"food",sectionName:c.groups.food,svgId:"cke4-icon-emoji-4",position:{x:-63,y:0},items:[]},{name:"travel",sectionName:c.groups.travel,svgId:"cke4-icon-emoji-6",position:{x:-42,y:-21},items:[]},{name:"activities",sectionName:c.groups.activities,svgId:"cke4-icon-emoji-5",position:{x:-84,y:0},items:[]},{name:"objects",sectionName:c.groups.objects,svgId:"cke4-icon-emoji-7",position:{x:0,y:-21},items:[]},{name:"symbols",sectionName:c.groups.symbols,svgId:"cke4-icon-emoji-8",position:{x:-21,y:-21},
items:[]},{name:"flags",sectionName:c.groups.flags,svgId:"cke4-icon-emoji-9",position:{x:-63,y:-21},items:[]}];this.elements={};a.ui.addToolbarGroup("emoji","insert");a.ui.add("EmojiPanel",CKEDITOR.UI_PANELBUTTON,{label:"emoji",title:c.title,modes:{wysiwyg:1},editorFocus:0,toolbar:"insert",panel:{css:[CKEDITOR.skin.getPath("editor"),d.path+"skins/default.css"],attributes:{role:"listbox","aria-label":c.title},markFirst:!1},onBlock:function(d,c){var e=c.keys,f="rtl"===a.lang.dir;e[f?37:39]="next";e[40]=
"next";e[9]="next";e[f?39:37]="prev";e[38]="prev";e[CKEDITOR.SHIFT+9]="prev";e[32]="click";b.blockElement=c.element;b.emojiList=b.editor._.emoji.list;b.addEmojiToGroups();c.element.getAscendant("html").addClass("cke_emoji");c.element.getDocument().appendStyleSheet(CKEDITOR.getUrl(CKEDITOR.basePath+"contents.css"));c.element.addClass("cke_emoji-panel_block");c.element.setHtml(b.createEmojiBlock());c.element.removeAttribute("title");d.element.addClass("cke_emoji-panel");b.items=c._.getItems();b.blockObject=
c;b.elements.emojiItems=c.element.find(".cke_emoji-outer_emoji_block li \x3e a");b.elements.sectionHeaders=c.element.find(".cke_emoji-outer_emoji_block h2");b.elements.input=c.element.findOne("input");b.inputIndex=b.getItemIndex(b.items,b.elements.input);b.elements.emojiBlock=c.element.findOne(".cke_emoji-outer_emoji_block");b.elements.navigationItems=c.element.find("nav li");b.elements.statusIcon=c.element.findOne(".cke_emoji-status_icon");b.elements.statusDescription=c.element.findOne("p.cke_emoji-status_description");
b.elements.statusName=c.element.findOne("p.cke_emoji-status_full_name");b.elements.sections=c.element.find("section");b.registerListeners()},onOpen:b.openReset()})},proto:{registerListeners:function(){f.forEach(this.listeners,function(a){var d=a.listener,c=a.event,b=a.ctx||this;f.forEach(this.blockElement.find(a.selector).toArray(),function(a){a.on(c,d,b)})},this)},createEmojiBlock:function(){var a=[];a.push(this.createGroupsNavigation());a.push(this.createSearchSection());a.push(this.createEmojiListBlock());
a.push(this.createStatusBar());return'\x3cdiv class\x3d"cke_emoji-inner_panel"\x3e'+a.join("")+"\x3c/div\x3e"},createGroupsNavigation:function(){var a,d;CKEDITOR.env.ie&&!CKEDITOR.env.edge?(d=CKEDITOR.getUrl(this.plugin.path+"assets/iconsall.png"),a=new CKEDITOR.template('\x3cli class\x3d"cke_emoji-navigation_item" data-cke-emoji-group\x3d"{group}"\x3e\x3ca href\x3d"#" draggable\x3d"false" _cke_focus\x3d"1" title\x3d"{name}"\x3e\x3cspan style\x3d"background-image:url('+d+');background-repeat:no-repeat;background-position:{positionX}px {positionY}px;"\x3e\x3c/span\x3e\x3c/a\x3e\x3c/li\x3e'),
d=f.reduce(this.groups,function(c,b){return b.items.length?c+a.output({group:e(b.name),name:e(b.sectionName),positionX:b.position.x,positionY:b.position.y}):c},"")):(d=CKEDITOR.getUrl(this.plugin.path+"assets/iconsall.svg"),d=CKEDITOR.env.safari?'xlink:href\x3d"'+d+'#{svgId}"':'href\x3d"'+d+'#{svgId}"',a=new CKEDITOR.template('\x3cli class\x3d"cke_emoji-navigation_item" data-cke-emoji-group\x3d"{group}"\x3e\x3ca href\x3d"#" title\x3d"{name}" draggable\x3d"false" _cke_focus\x3d"1"\x3e\x3csvg viewBox\x3d"0 0 34 34" aria-labelledby\x3d"{svgId}-title"\x3e\x3ctitle id\x3d"{svgId}-title"\x3e{name}\x3c/title\x3e\x3cuse '+
d+"\x3e\x3c/use\x3e\x3c/svg\x3e\x3c/a\x3e\x3c/li\x3e"),d=f.reduce(this.groups,function(c,b){return b.items.length?c+a.output({group:e(b.name),name:e(b.sectionName),svgId:e(b.svgId),translateX:b.translate&&b.translate.x?e(b.translate.x):0,translateY:b.translate&&b.translate.y?e(b.translate.y):0}):c},""));this.listeners.push({selector:"nav",event:"click",listener:function(a){var b=a.data.getTarget().getAscendant("li",!0);b&&(f.forEach(this.elements.navigationItems.toArray(),function(a){a.equals(b)?
a.addClass("active"):a.removeClass("active")}),this.clearSearchAndMoveFocus(b),a.data.preventDefault())}});return'\x3cnav aria-label\x3d"'+e(this.lang.navigationLabel)+'"\x3e\x3cul\x3e'+d+"\x3c/ul\x3e\x3c/nav\x3e"},createSearchSection:function(){this.listeners.push({selector:"input",event:"input",listener:CKEDITOR.tools.throttle(200,this.filter,this).input});this.listeners.push({selector:"input",event:"click",listener:function(){this.blockObject._.markItem(this.inputIndex)}});return'\x3clabel class\x3d"cke_emoji-search"\x3e'+
this.getLoupeIcon()+'\x3cinput placeholder\x3d"'+e(this.lang.searchPlaceholder)+'" type\x3d"search" aria-label\x3d"'+e(this.lang.searchLabel)+'" role\x3d"search" _cke_focus\x3d"1"\x3e\x3c/label\x3e'},createEmojiListBlock:function(){this.listeners.push({selector:".cke_emoji-outer_emoji_block",event:"scroll",listener:CKEDITOR.tools.throttle(150,this.refreshNavigationStatus,this).input});this.listeners.push({selector:".cke_emoji-outer_emoji_block",event:"click",listener:function(a){a.data.getTarget().data("cke-emoji-name")&&
this.editor.execCommand("insertEmoji",{emojiText:a.data.getTarget().data("cke-emoji-symbol")})}});this.listeners.push({selector:".cke_emoji-outer_emoji_block",event:"mouseover",listener:function(a){this.updateStatusbar(a.data.getTarget())}});this.listeners.push({selector:".cke_emoji-outer_emoji_block",event:"keyup",listener:function(){this.updateStatusbar(this.items.getItem(this.blockObject._.focusIndex))}});return'\x3cdiv class\x3d"cke_emoji-outer_emoji_block"\x3e'+this.getEmojiSections()+"\x3c/div\x3e"},
createStatusBar:function(){return'\x3cdiv class\x3d"cke_emoji-status_bar"\x3e\x3cdiv class\x3d"cke_emoji-status_icon"\x3e\x3c/div\x3e\x3cp class\x3d"cke_emoji-status_description"\x3e\x3c/p\x3e\x3cp class\x3d"cke_emoji-status_full_name"\x3e\x3c/p\x3e\x3c/div\x3e'},getLoupeIcon:function(){var a=CKEDITOR.getUrl(this.plugin.path+"assets/iconsall.svg"),d=CKEDITOR.getUrl(this.plugin.path+"assets/iconsall.png");return CKEDITOR.env.ie&&!CKEDITOR.env.edge?'\x3cspan class\x3d"cke_emoji-search_loupe" aria-hidden\x3d"true" style\x3d"background-image:url('+
d+');"\x3e\x3c/span\x3e':'\x3csvg viewBox\x3d"0 0 34 34" role\x3d"img" aria-hidden\x3d"true" class\x3d"cke_emoji-search_loupe"\x3e\x3cuse '+(CKEDITOR.env.safari?'xlink:href\x3d"'+a+'#cke4-icon-emoji-10"':'href\x3d"'+a+'#cke4-icon-emoji-10"')+"\x3e\x3c/use\x3e\x3c/svg\x3e"},getEmojiSections:function(){return f.reduce(this.groups,function(a,d){return d.items.length?a+this.getEmojiSection(d):a},"",this)},getEmojiSection:function(a){var d=e(a.name),c=e(a.sectionName);a=this.getEmojiListGroup(a.items);
return'\x3csection data-cke-emoji-group\x3d"'+d+'" \x3e\x3ch2 id\x3d"'+d+'"\x3e'+c+"\x3c/h2\x3e\x3cul\x3e"+a+"\x3c/ul\x3e\x3c/section\x3e"},getEmojiListGroup:function(a){var d=new CKEDITOR.template('\x3cli class\x3d"cke_emoji-item"\x3e\x3ca draggable\x3d"false" data-cke-emoji-full-name\x3d"{id}" data-cke-emoji-name\x3d"{name}" data-cke-emoji-symbol\x3d"{symbol}" data-cke-emoji-group\x3d"{group}" data-cke-emoji-keywords\x3d"{keywords}" title\x3d"{name}" href\x3d"#" _cke_focus\x3d"1"\x3e{symbol}\x3c/a\x3e\x3c/li\x3e');
return f.reduce(a,function(a,b){k(b);return a+d.output({symbol:e(b.symbol),id:e(b.id),name:b.name,group:e(b.group),keywords:e((b.keywords||[]).join(","))})},"",this)},filter:function(a){var d={},c="string"===typeof a?a:a.sender.getValue();f.forEach(this.elements.emojiItems.toArray(),function(a){var e;a:{e=a.data("cke-emoji-name");var f=a.data("cke-emoji-keywords");if(-1!==e.indexOf(c))e=!0;else{if(f)for(e=f.split(","),f=0;f<e.length;f++)if(-1!==e[f].indexOf(c)){e=!0;break a}e=!1}}e||""===c?(a.removeClass("hidden"),
a.getParent().removeClass("hidden"),d[a.data("cke-emoji-group")]=!0):(a.addClass("hidden"),a.getParent().addClass("hidden"))});f.forEach(this.elements.sectionHeaders.toArray(),function(a){d[a.getId()]?(a.getParent().removeClass("hidden"),a.removeClass("hidden")):(a.addClass("hidden"),a.getParent().addClass("hidden"))});this.refreshNavigationStatus()},clearSearchInput:function(){this.elements.input.setValue("");this.filter("")},openReset:function(){var a=this,d;return function(){d||(a.filter(""),d=
!0);a.elements.emojiBlock.$.scrollTop=0;a.refreshNavigationStatus();a.clearSearchInput();CKEDITOR.tools.setTimeout(function(){a.elements.input.focus(!0);a.blockObject._.markItem(a.inputIndex)},0,a);a.clearStatusbar()}},refreshNavigationStatus:function(){var a=this.elements.emojiBlock.getClientRect().top,d,c;d=f.filter(this.elements.sections.toArray(),function(b){var c=b.getClientRect();return!c.height||b.findOne("h2").hasClass("hidden")?!1:c.height+c.top>a});c=d.length?d[0].data("cke-emoji-group"):
!1;f.forEach(this.elements.navigationItems.toArray(),function(a){a.data("cke-emoji-group")===c?a.addClass("active"):a.removeClass("active")})},updateStatusbar:function(a){"a"===a.getName()&&a.hasAttribute("data-cke-emoji-name")&&(this.elements.statusIcon.setText(e(a.getText())),this.elements.statusDescription.setText(e(a.data("cke-emoji-name"))),this.elements.statusName.setText(e(a.data("cke-emoji-full-name"))))},clearStatusbar:function(){this.elements.statusIcon.setText("");this.elements.statusDescription.setText("");
this.elements.statusName.setText("")},clearSearchAndMoveFocus:function(a){this.clearSearchInput();this.moveFocus(a.data("cke-emoji-group"))},moveFocus:function(a){a=this.blockElement.findOne('a[data-cke-emoji-group\x3d"'+e(a)+'"]');var d;a&&(d=this.getItemIndex(this.items,a),a.focus(!0),a.getAscendant("section").getFirst().scrollIntoView(!0),this.blockObject._.markItem(d))},getItemIndex:function(a,d){return f.indexOf(a.toArray(),function(a){return a.equals(d)})},addEmojiToGroups:function(){var a=
{};f.forEach(this.groups,function(d){a[d.name]=d.items},this);f.forEach(this.emojiList,function(d){a[d.group].push(d)},this)}}});CKEDITOR.plugins.add("emoji",{requires:"autocomplete,textmatch,ajax,panelbutton,floatpanel",lang:"en",icons:"emojipanel",hidpi:!0,isSupportedEnvironment:function(){return!CKEDITOR.env.ie||11<=CKEDITOR.env.version},beforeInit:function(){this.isSupportedEnvironment()&&!g&&(CKEDITOR.document.appendStyleSheet(this.path+"skins/default.css"),g=!0)},init:function(a){if(this.isSupportedEnvironment()){var d=
CKEDITOR.tools.array;CKEDITOR.ajax.load(CKEDITOR.getUrl(a.config.emoji_emojiListUrl||"plugins/emoji/emoji.json"),function(c){function b(){a._.emoji.autocomplete=new CKEDITOR.plugins.autocomplete(a,{textTestCallback:e(),dataCallback:g,itemTemplate:'\x3cli data-id\x3d"{id}" class\x3d"cke_emoji-suggestion_item"\x3e\x3cspan\x3e{symbol}\x3c/span\x3e {name}\x3c/li\x3e',outputTemplate:"{symbol}"})}function e(){return function(a){return a.collapsed?CKEDITOR.plugins.textMatch.match(a,f):null}}function f(a,
b){var c=a.slice(0,b),d=c.match(new RegExp("(?:\\s|^)(:\\S{"+l+"}\\S*)$"));return d?{start:c.lastIndexOf(d[1]),end:b}:null}function g(a,b){var c=a.query.substr(1).toLowerCase(),e=d.filter(h,function(a){return-1!==a.id.toLowerCase().indexOf(c)}).sort(function(a,b){var d=!a.id.substr(1).indexOf(c),e=!b.id.substr(1).indexOf(c);return d!=e?d?-1:1:a.id>b.id?1:-1}),e=d.map(e,k);b(e)}if(null!==c){void 0===a._.emoji&&(a._.emoji={});void 0===a._.emoji.list&&(a._.emoji.list=JSON.parse(c));var h=a._.emoji.list,
l=void 0===a.config.emoji_minChars?2:a.config.emoji_minChars;if("ready"!==a.status)a.once("instanceReady",b);else b()}});a.addCommand("insertEmoji",{exec:function(a,b){a.insertHtml(b.emojiText)}});a.plugins.toolbar&&new h(a,this)}}})})();

+ 234
- 0
src/static/ckeditor/plugins/emoji/skins/default.css Parādīt failu

@@ -0,0 +1,234 @@
.cke_emoji {
overflow-y: hidden;
height: 100%;
}

.cke_emoji-suggestion_item {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-family: sans-serif, Arial, Verdana, "Trebuchet MS", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}

.cke_emoji-suggestion_item span {
font-family: "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}

.cke_emoji-panel {
width: 310px;
height: 300px;
overflow: hidden;
}

.cke_emoji-inner_panel {
width: 100%;
}

.cke_emoji-panel_block a {
display: inline-block;
width: 100%;
padding-top: 2px;
}

.cke_emoji-inner_panel > h2 {
font-size: 2em;
}

/* TOP NAVIGATION */
.cke_emoji-inner_panel > nav {
width: 100%;
height: 24px;
margin-top: 10px;
margin-bottom: 6px;
padding-bottom: 4px;
border-bottom: 1px solid #d1d1d1;
}
.cke_emoji-inner_panel > nav > ul {
margin-left: 10px;
margin-right: 10px;
margin-top: 8px;
padding: 0;
list-style-type: none;
height: 24px;
}

.cke_emoji-inner_panel > nav li {
display: inline-block;
width: 24px;
height: auto;
margin: 0 6px;
text-align: center;
}

.cke_browser_ie .cke_emoji-inner_panel > nav li {
height: 22px;
}

.cke_emoji-inner_panel li svg {
opacity: 0.4;
width: 80%;
}

.cke_emoji-inner_panel li span {
opacity: 0.4;
}

.cke_emoji-inner_panel li:hover svg, .cke_emoji-inner_panel li:hover span{
opacity: 1;
}

.cke_emoji-inner_panel .active {
border-bottom: 5px solid rgba(44, 195, 255, 1);
}

.cke_emoji-navigation_item span {
width: 21px;
height: 21px;
display: inline-block;
}

/* SEARCHBOX */
.cke_emoji-search {
position: relative;
height: 25px;
display: block;
border: 1px solid #d1d1d1;
margin-left: 10px;
margin-right: 10px;
}

.cke_emoji-search .cke_emoji-search_loupe {
position: absolute;
top: 6px;
left: 6px;
display: inline-block;
width: 14px;
height: 14px;
opacity: 0.4;
}

.cke_rtl .cke_emoji-search .cke_emoji-search_loupe {
left: auto;
right: 6px;
}

.cke_emoji-search span {
background-repeat: no-repeat;
background-position: -60px -15px;
background-size: 75px 30px;
}

.cke_emoji-search input {
-webkit-appearance: none;
border: none;
width: 100%;
height: 100%;
padding-left: 25px;
padding-right: 10px;
margin-left: 0
}

.cke_rtl .cke_emoji-search input {
padding-left: 10px;
padding-right: 25px;
margin-right: 0;
}

/* EMOJI */
.cke_emoji-outer_emoji_block {
height: 180px;
overflow-x: hidden;
overflow-y: auto;
margin-top: 5px;
margin-left: 10px;
margin-right: 10px;
padding-left: 2px;
padding-right: 2px;
}

.cke_emoji-outer_emoji_block h2 {
font-size: 1.3em;
font-weight: 600;
margin: 5px 0 3px 0;
}

.cke_emoji-outer_emoji_block ul {
margin: 0 0 15px 0;
padding: 0;
list-style-type: none;
}

.cke_emoji-item {
font-family: "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
list-style-type: none;
display: inline-table;
width: 36px;
height: 36px;
font-size: 1.8em;
text-align: center;
}

.cke_emoji-item:hover {
border-radius: 10%;
background-color: rgba(44, 195, 255, 0.2);
}

.cke_emoji-item > a {
text-decoration: none;
display: table-cell;
vertical-align: middle;
}

.cke_emoji-outer_emoji_block .hidden {
display: none
}

/* STATUS BAR */
.cke_emoji-status_bar {
height: 34px;
padding-left: 10px;
padding-right: 10px;
padding-top: 3px;
margin-top: 3px;
border-top: 1px solid #d1d1d1;
line-height: 1;
}

.cke_emoji-status_bar p {
margin-top: 3px;
}

.cke_emoji-status_bar > div {
display: inline-block;
margin-top: 3px;
}

.cke_emoji-status_icon {
font-family: "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
font-size: 2.2em;
float: left;
margin-right: 10px;
}

.cke_rtl .cke_emoji-status_icon {
float: right;
margin-right: 0px;
margin-left: 10px;
}

.cke_emoji-panel_block p {
margin-bottom: 0;
}

p.cke_emoji-status_description {
font-weight: 600;
}

p.cke_emoji-status_full_name {
font-size: 0.8em;
color: #d1d1d1;
}

.cke_emoji-inner_panel a:focus, .cke_emoji-inner_panel input:focus {
outline: 2px solid #139FF7;
}

+ 8
- 0
src/static/ckeditor/plugins/pastefromgdocs/filter/default.js Parādīt failu

@@ -0,0 +1,8 @@
/*
Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/
(function(){function g(b){return""===b?!1:b}function h(b){if(!/(o|u)l/i.test(b.parent.name))return b;d.elements.replaceWithChildren(b);return!1}function k(b){function d(a,f){var b,c;if(a&&"tr"===a.name){b=a.children;for(c=0;c<f.length&&b[c];c++)b[c].attributes.width=f[c];d(a.next,f)}}var c=b.parent;b=function(a){return CKEDITOR.tools.array.map(a,function(a){return Number(a.attributes.width)})}(b.children);var a=function(a){return CKEDITOR.tools.array.reduce(a,function(a,b){return a+b},0)}(b);c.attributes.width=
a;d(function(a){return(a=CKEDITOR.tools.array.find(a.children,function(a){return a.name&&("tr"===a.name||"tbody"===a.name)}))&&a.name&&"tbody"===a.name?a.children[0]:a}(c),b)}var e=CKEDITOR.plugins.pastetools,d=e.filters.common,c=d.styles;CKEDITOR.plugins.pastetools.filters.gdocs={rules:function(b,e,l){return{elementNames:[[/^meta/,""]],comment:function(){return!1},attributes:{id:function(a){return!/^docs\-internal\-guid\-/.test(a)},dir:function(a){return"ltr"===a?!1:a},style:function(a,b){return g(c.normalizedStyles(b,
e))},"class":function(a){return g(a.replace(/kix-line-break/ig,""))}},elements:{div:function(a){var b=1===a.children.length,c="table"===a.children[0].name;"div"===a.name&&b&&c&&delete a.attributes.align},colgroup:k,span:function(a){c.createStyleStack(a,l,e,/vertical-align|white-space|font-variant/);var b=/vertical-align:\s*sub/,d=a.attributes.style;/vertical-align:\s*super/.test(d)?a.name="sup":b.test(d)&&(a.name="sub");a.attributes.style=d.replace(/vertical-align\s*.+?;?/,"")},b:function(a){d.elements.replaceWithChildren(a);
return!1},p:function(a){if(a.parent&&"li"===a.parent.name)return d.elements.replaceWithChildren(a),!1},ul:function(a){c.pushStylesLower(a);return h(a)},ol:function(a){c.pushStylesLower(a);return h(a)},li:function(a){c.pushStylesLower(a);var b=a.children,e=/(o|u)l/i;1===b.length&&e.test(b[0].name)&&(d.elements.replaceWithChildren(a),a=!1);return a}}}}};CKEDITOR.pasteFilters.gdocs=e.createFilter({rules:[d.rules,CKEDITOR.plugins.pastetools.filters.gdocs.rules]})})();

+ 6
- 0
src/static/ckeditor/plugins/pastefromgdocs/plugin.js Parādīt failu

@@ -0,0 +1,6 @@
/*
Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/
(function(){CKEDITOR.plugins.add("pastefromgdocs",{requires:"pastetools",init:function(a){var c=CKEDITOR.plugins.getPath("pastetools"),d=this.path;a.pasteTools.register({filters:[CKEDITOR.getUrl(c+"filter/common.js"),CKEDITOR.getUrl(d+"filter/default.js")],canHandle:function(a){return/id=(\"|\')?docs\-internal\-guid\-/.test(a.data.dataValue)},handle:function(c,d){var b=c.data,e=CKEDITOR.plugins.pastetools.getClipboardData(b,"text/html");b.dontFilter=!0;b.dataValue=CKEDITOR.pasteFilters.gdocs(e,a);
!0===a.config.forcePasteAsPlainText&&(b.type="text");d()}})}})})();

+ 11
- 0
src/static/ckeditor/plugins/pastefromlibreoffice/filter/default.js Parādīt failu

@@ -0,0 +1,11 @@
/*
Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/
(function(){function k(b,c){if(!(b.previous&&g(b.previous)&&b.getFirst().children.length&&1===b.children.length&&g(b.getFirst().getFirst())))return!1;for(var d=l(b.previous),a=0,f=d,r=q();f=f.getAscendant(r);)a++;return(a=m(b,a))?(d.add(a),a.filterChildren(c),!0):!1}function l(b){var c=b.children[b.children.length-1];return g(c)||"li"===c.name?l(c):b}function q(){var b=!1;return function(c){return b?!1:g(c)||"li"===c.name?g(c):(b=!0,!1)}}function m(b,c){return c?m(b.getFirst().getFirst(),--c):b}function g(b){return"ol"===
b.name||"ul"===b.name}function h(){return!1}var n=CKEDITOR.plugins.pastetools,p=n.filters.common,e=p.styles;CKEDITOR.plugins.pastetools.filters.libreoffice={rules:function(b,c,d){return{root:function(a){a.filterChildren(d)},comment:function(){return!1},elementNames:[[/^head$/i,""],[/^meta$/i,""],[/^strike$/i,"s"]],elements:{"!doctype":function(a){a.replaceWithChildren()},span:function(a){a.attributes.style&&(a.attributes.style=e.normalizedStyles(a,c),e.createStyleStack(a,d,c));CKEDITOR.tools.object.entries(a.attributes).length||
a.replaceWithChildren()},p:function(a){var f=CKEDITOR.tools.parseCssText(a.attributes.style);if(c.plugins.pagebreak&&("always"===f["page-break-before"]||"page"===f["break-before"])){var b=CKEDITOR.plugins.pagebreak.createElement(c),b=CKEDITOR.htmlParser.fragment.fromHtml(b.getOuterHtml()).children[0];b.insertBefore(a)}a.attributes.style=CKEDITOR.tools.writeCssText(f);a.filterChildren(d);e.createStyleStack(a,d,c)},div:function(a){e.createStyleStack(a,d,c)},a:function(a){if(a.attributes.style){var c=
a.attributes;a=CKEDITOR.tools.parseCssText(a.attributes.style);"#000080"===a.color&&delete a.color;"underline"===a["text-decoration"]&&delete a["text-decoration"];a=CKEDITOR.tools.writeCssText(a);c.style=a}},h1:function(a){e.createStyleStack(a,d,c)},h2:function(a){e.createStyleStack(a,d,c)},h3:function(a){e.createStyleStack(a,d,c)},h4:function(a){e.createStyleStack(a,d,c)},h5:function(a){e.createStyleStack(a,d,c)},h6:function(a){e.createStyleStack(a,d,c)},pre:function(a){e.createStyleStack(a,d,c)},
font:function(a){var c;c="a"===a.parent.name&&"#000080"===a.attributes.color?!0:1!==a.parent.children.length||"sup"!==a.parent.name&&"sub"!==a.parent.name||"2"!==a.attributes.size?!1:!0;c&&a.replaceWithChildren();c=CKEDITOR.tools.parseCssText(a.attributes.style);var b=a.getFirst();a.attributes.size&&b&&b.type===CKEDITOR.NODE_ELEMENT&&/font-size/.test(b.attributes.style)&&a.replaceWithChildren();c["font-size"]&&(delete a.attributes.size,a.name="span",b&&b.type===CKEDITOR.NODE_ELEMENT&&b.attributes.size&&
b.replaceWithChildren())},ul:function(a){if(k(a,d))return!1},ol:function(a){if(k(a,d))return!1},img:function(a){if(!a.attributes.src)return!1},table:function(a){var c=a.attributes;a=a.attributes.style;var b=CKEDITOR.tools.parseCssText(a);b["border-collapse"]||(b["border-collapse"]="collapse",a=CKEDITOR.tools.writeCssText(b));c.style=a}},attributes:{style:function(a,b){return e.normalizedStyles(b,c)||!1},align:function(a,b){if("img"!==b.name){var c=CKEDITOR.tools.parseCssText(b.attributes.style);c["text-align"]=
b.attributes.align;b.attributes.style=CKEDITOR.tools.writeCssText(c);return!1}},cellspacing:h,cellpadding:h,border:h}}}};CKEDITOR.pasteFilters.libreoffice=n.createFilter({rules:[p.rules,CKEDITOR.plugins.pastetools.filters.libreoffice.rules]})})();

+ 43
- 0
src/static/ckeditor/plugins/pastefromword/filter/default.js Parādīt failu

@@ -0,0 +1,43 @@
/*
Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/
(function(){function r(){return!1}var n=CKEDITOR.tools,B=CKEDITOR.plugins.pastetools,t=B.filters.common,k=t.styles,C=t.createAttributeStack,z=t.lists.getElementIndentation,D=["o:p","xml","script","meta","link"],E="v:arc v:curve v:line v:oval v:polyline v:rect v:roundrect v:group".split(" "),A={},y=0,q={},g,p;CKEDITOR.plugins.pastetools.filters.word=q;CKEDITOR.plugins.pastefromword=q;q.rules=function(b,a,c){function e(d){(d.attributes["o:gfxdata"]||"v:group"===d.parent.name)&&l.push(d.attributes.id)}
var f=Boolean(b.match(/mso-list:\s*l\d+\s+level\d+\s+lfo\d+/)),l=[],w={root:function(d){d.filterChildren(c);CKEDITOR.plugins.pastefromword.lists.cleanup(g.createLists(d))},elementNames:[[/^\?xml:namespace$/,""],[/^v:shapetype/,""],[new RegExp(D.join("|")),""]],elements:{a:function(d){if(d.attributes.name){if("_GoBack"==d.attributes.name){delete d.name;return}if(d.attributes.name.match(/^OLE_LINK\d+$/)){delete d.name;return}}if(d.attributes.href&&d.attributes.href.match(/#.+$/)){var a=d.attributes.href.match(/#(.+)$/)[1];
A[a]=d}d.attributes.name&&A[d.attributes.name]&&(d=A[d.attributes.name],d.attributes.href=d.attributes.href.replace(/.*#(.*)$/,"#$1"))},div:function(d){if(a.plugins.pagebreak&&d.attributes["data-cke-pagebreak"])return d;k.createStyleStack(d,c,a)},img:function(d){if(d.parent&&d.parent.attributes){var a=d.parent.attributes;(a=a.style||a.STYLE)&&a.match(/mso\-list:\s?Ignore/)&&(d.attributes["cke-ignored"]=!0)}k.mapCommonStyles(d);d.attributes.src&&d.attributes.src.match(/^file:\/\//)&&d.attributes.alt&&
d.attributes.alt.match(/^https?:\/\//)&&(d.attributes.src=d.attributes.alt);d=d.attributes["v:shapes"]?d.attributes["v:shapes"].split(" "):[];a=CKEDITOR.tools.array.every(d,function(a){return-1<l.indexOf(a)});if(d.length&&a)return!1},p:function(d){d.filterChildren(c);if(d.attributes.style&&d.attributes.style.match(/display:\s*none/i))return!1;if(g.thisIsAListItem(a,d))p.isEdgeListItem(a,d)&&p.cleanupEdgeListItem(d),g.convertToFakeListItem(a,d),n.array.reduce(d.children,function(a,d){"p"===d.name&&
(0<a&&(new CKEDITOR.htmlParser.element("br")).insertBefore(d),d.replaceWithChildren(),a+=1);return a},0);else{var b=d.getAscendant(function(a){return"ul"==a.name||"ol"==a.name}),e=n.parseCssText(d.attributes.style);b&&!b.attributes["cke-list-level"]&&e["mso-list"]&&e["mso-list"].match(/level/)&&(b.attributes["cke-list-level"]=e["mso-list"].match(/level(\d+)/)[1]);a.config.enterMode==CKEDITOR.ENTER_BR&&(delete d.name,d.add(new CKEDITOR.htmlParser.element("br")))}k.createStyleStack(d,c,a)},pre:function(d){g.thisIsAListItem(a,
d)&&g.convertToFakeListItem(a,d);k.createStyleStack(d,c,a)},h1:function(d){g.thisIsAListItem(a,d)&&g.convertToFakeListItem(a,d);k.createStyleStack(d,c,a)},h2:function(d){g.thisIsAListItem(a,d)&&g.convertToFakeListItem(a,d);k.createStyleStack(d,c,a)},h3:function(d){g.thisIsAListItem(a,d)&&g.convertToFakeListItem(a,d);k.createStyleStack(d,c,a)},h4:function(d){g.thisIsAListItem(a,d)&&g.convertToFakeListItem(a,d);k.createStyleStack(d,c,a)},h5:function(d){g.thisIsAListItem(a,d)&&g.convertToFakeListItem(a,
d);k.createStyleStack(d,c,a)},h6:function(d){g.thisIsAListItem(a,d)&&g.convertToFakeListItem(a,d);k.createStyleStack(d,c,a)},font:function(d){if(d.getHtml().match(/^\s*$/))return d.parent.type===CKEDITOR.NODE_ELEMENT&&(new CKEDITOR.htmlParser.text(" ")).insertAfter(d),!1;a&&!0===a.config.pasteFromWordRemoveFontStyles&&d.attributes.size&&delete d.attributes.size;CKEDITOR.dtd.tr[d.parent.name]&&CKEDITOR.tools.arrayCompare(CKEDITOR.tools.object.keys(d.attributes),["class","style"])?k.createStyleStack(d,
c,a):C(d,c)},ul:function(a){if(f)return"li"==a.parent.name&&0===n.indexOf(a.parent.children,a)&&k.setStyle(a.parent,"list-style-type","none"),g.dissolveList(a),!1},li:function(d){p.correctLevelShift(d);f&&(d.attributes.style=k.normalizedStyles(d,a),k.pushStylesLower(d))},ol:function(a){if(f)return"li"==a.parent.name&&0===n.indexOf(a.parent.children,a)&&k.setStyle(a.parent,"list-style-type","none"),g.dissolveList(a),!1},span:function(d){d.filterChildren(c);d.attributes.style=k.normalizedStyles(d,a);
if(!d.attributes.style||d.attributes.style.match(/^mso\-bookmark:OLE_LINK\d+$/)||d.getHtml().match(/^(\s|&nbsp;)+$/))return t.elements.replaceWithChildren(d),!1;d.attributes.style.match(/FONT-FAMILY:\s*Symbol/i)&&d.forEach(function(a){a.value=a.value.replace(/&nbsp;/g,"")},CKEDITOR.NODE_TEXT,!0);k.createStyleStack(d,c,a)},"v:imagedata":r,"v:shape":function(a){var b=!1;if(null===a.getFirst("v:imagedata"))e(a);else{a.parent.find(function(c){"img"==c.name&&c.attributes&&c.attributes["v:shapes"]==a.attributes.id&&
(b=!0)},!0);if(b)return!1;var f="";"v:group"===a.parent.name?e(a):(a.forEach(function(a){a.attributes&&a.attributes.src&&(f=a.attributes.src)},CKEDITOR.NODE_ELEMENT,!0),a.filterChildren(c),a.name="img",a.attributes.src=a.attributes.src||f,delete a.attributes.type)}},style:function(){return!1},object:function(a){return!(!a.attributes||!a.attributes.data)},br:function(b){if(a.plugins.pagebreak&&(b=n.parseCssText(b.attributes.style,!0),"always"===b["page-break-before"]||"page"===b["break-before"]))return b=
CKEDITOR.plugins.pagebreak.createElement(a),CKEDITOR.htmlParser.fragment.fromHtml(b.getOuterHtml()).children[0]}},attributes:{style:function(b,c){return k.normalizedStyles(c,a)||!1},"class":function(a){a=a.replace(/(el\d+)|(font\d+)|msonormal|msolistparagraph\w*/ig,"");return""===a?!1:a},cellspacing:r,cellpadding:r,border:r,"v:shapes":r,"o:spid":r},comment:function(a){a.match(/\[if.* supportFields.*\]/)&&y++;"[endif]"==a&&(y=0<y?y-1:0);return!1},text:function(a,b){if(y)return"";var c=b.parent&&b.parent.parent;
return c&&c.attributes&&c.attributes.style&&c.attributes.style.match(/mso-list:\s*ignore/i)?a.replace(/&nbsp;/g," "):a}};n.array.forEach(E,function(a){w.elements[a]=e});return w};q.lists={thisIsAListItem:function(b,a){return p.isEdgeListItem(b,a)||a.attributes.style&&a.attributes.style.match(/mso\-list:\s?l\d/)&&"li"!==a.parent.name||a.attributes["cke-dissolved"]||a.getHtml().match(/<!\-\-\[if !supportLists]\-\->/)?!0:!1},convertToFakeListItem:function(b,a){p.isDegenerateListItem(b,a)&&p.assignListLevels(b,
a);this.getListItemInfo(a);if(!a.attributes["cke-dissolved"]){var c;a.forEach(function(a){!c&&"img"==a.name&&a.attributes["cke-ignored"]&&"*"==a.attributes.alt&&(c="·",a.remove())},CKEDITOR.NODE_ELEMENT);a.forEach(function(a){c||a.value.match(/^ /)||(c=a.value)},CKEDITOR.NODE_TEXT);if("undefined"==typeof c)return;a.attributes["cke-symbol"]=c.replace(/(?: |&nbsp;).*$/,"");g.removeSymbolText(a)}var e=a.attributes&&n.parseCssText(a.attributes.style);if(e["margin-left"]){var f=e["margin-left"],l=a.attributes["cke-list-level"];
(f=Math.max(CKEDITOR.tools.convertToPx(f)-40*l,0))?e["margin-left"]=f+"px":delete e["margin-left"];a.attributes.style=CKEDITOR.tools.writeCssText(e)}a.name="cke:li"},convertToRealListItems:function(b){var a=[];b.forEach(function(b){"cke:li"==b.name&&(b.name="li",a.push(b))},CKEDITOR.NODE_ELEMENT,!1);return a},removeSymbolText:function(b){var a=b.attributes["cke-symbol"],c=b.findOne(function(b){return b.value&&-1<b.value.indexOf(a)},!0),e;c&&(c.value=c.value.replace(a,""),e=c.parent,e.getHtml().match(/^(\s|&nbsp;)*$/)&&
e!==b?e.remove():c.value||c.remove())},setListSymbol:function(b,a,c){c=c||1;var e=n.parseCssText(b.attributes.style);if("ol"==b.name){if(b.attributes.type||e["list-style-type"])return;var f={"[ivx]":"lower-roman","[IVX]":"upper-roman","[a-z]":"lower-alpha","[A-Z]":"upper-alpha","\\d":"decimal"},l;for(l in f)if(g.getSubsectionSymbol(a).match(new RegExp(l))){e["list-style-type"]=f[l];break}b.attributes["cke-list-style-type"]=e["list-style-type"]}else f={"·":"disc",o:"circle","§":"square"},!e["list-style-type"]&&
f[a]&&(e["list-style-type"]=f[a]);g.setListSymbol.removeRedundancies(e,c);(b.attributes.style=CKEDITOR.tools.writeCssText(e))||delete b.attributes.style},setListStart:function(b){for(var a=[],c=0,e=0;e<b.children.length;e++)a.push(b.children[e].attributes["cke-symbol"]||"");a[0]||c++;switch(b.attributes["cke-list-style-type"]){case "lower-roman":case "upper-roman":b.attributes.start=g.toArabic(g.getSubsectionSymbol(a[c]))-c;break;case "lower-alpha":case "upper-alpha":b.attributes.start=g.getSubsectionSymbol(a[c]).replace(/\W/g,
"").toLowerCase().charCodeAt(0)-96-c;break;case "decimal":b.attributes.start=parseInt(g.getSubsectionSymbol(a[c]),10)-c||1}"1"==b.attributes.start&&delete b.attributes.start;delete b.attributes["cke-list-style-type"]},numbering:{toNumber:function(b,a){function c(a){a=a.toUpperCase();for(var b=1,c=1;0<a.length;c*=26)b+="ABCDEFGHIJKLMNOPQRSTUVWXYZ".indexOf(a.charAt(a.length-1))*c,a=a.substr(0,a.length-1);return b}function e(a){var b=[[1E3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,
"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]];a=a.toUpperCase();for(var c=b.length,d=0,e=0;e<c;++e)for(var g=b[e],u=g[1].length;a.substr(0,u)==g[1];a=a.substr(u))d+=g[0];return d}return"decimal"==a?Number(b):"upper-roman"==a||"lower-roman"==a?e(b.toUpperCase()):"lower-alpha"==a||"upper-alpha"==a?c(b):1},getStyle:function(b){b=b.slice(0,1);var a={i:"lower-roman",v:"lower-roman",x:"lower-roman",l:"lower-roman",m:"lower-roman",I:"upper-roman",V:"upper-roman",X:"upper-roman",L:"upper-roman",
M:"upper-roman"}[b];a||(a="decimal",b.match(/[a-z]/)&&(a="lower-alpha"),b.match(/[A-Z]/)&&(a="upper-alpha"));return a}},getSubsectionSymbol:function(b){return(b.match(/([\da-zA-Z]+).?$/)||["placeholder","1"])[1]},setListDir:function(b){var a=0,c=0;b.forEach(function(b){"li"==b.name&&("rtl"==(b.attributes.dir||b.attributes.DIR||"").toLowerCase()?c++:a++)},CKEDITOR.ELEMENT_NODE);c>a&&(b.attributes.dir="rtl")},createList:function(b){return(b.attributes["cke-symbol"].match(/([\da-np-zA-NP-Z]).?/)||[])[1]?
new CKEDITOR.htmlParser.element("ol"):new CKEDITOR.htmlParser.element("ul")},createLists:function(b){function a(a){return CKEDITOR.tools.array.reduce(a,function(a,b){if(b.attributes&&b.attributes.style)var c=CKEDITOR.tools.parseCssText(b.attributes.style)["margin-left"];return c?a+parseInt(c,10):a},0)}var c,e,f,l=g.convertToRealListItems(b);if(0===l.length)return[];var k=g.groupLists(l);for(b=0;b<k.length;b++){var d=k[b],h=d[0];for(f=0;f<d.length;f++)if(1==d[f].attributes["cke-list-level"]){h=d[f];
break}var h=[g.createList(h)],m=h[0],u=[h[0]];m.insertBefore(d[0]);for(f=0;f<d.length;f++){c=d[f];for(e=c.attributes["cke-list-level"];e>h.length;){var v=g.createList(c),x=m.children;0<x.length?x[x.length-1].add(v):(x=new CKEDITOR.htmlParser.element("li",{style:"list-style-type:none"}),x.add(v),m.add(x));h.push(v);u.push(v);m=v;e==h.length&&g.setListSymbol(v,c.attributes["cke-symbol"],e)}for(;e<h.length;)h.pop(),m=h[h.length-1],e==h.length&&g.setListSymbol(m,c.attributes["cke-symbol"],e);c.remove();
m.add(c)}h[0].children.length&&(f=h[0].children[0].attributes["cke-symbol"],!f&&1<h[0].children.length&&(f=h[0].children[1].attributes["cke-symbol"]),f&&g.setListSymbol(h[0],f));for(f=0;f<u.length;f++)g.setListStart(u[f]);for(f=0;f<d.length;f++)this.determineListItemValue(d[f])}CKEDITOR.tools.array.forEach(l,function(b){for(var c=[],d=b.parent;d;)"li"===d.name&&c.push(d),d=d.parent;var c=a(c),e;c&&(b.attributes=b.attributes||{},d=CKEDITOR.tools.parseCssText(b.attributes.style),e=d["margin-left"]||
0,(e=Math.max(parseInt(e,10)-c,0))?d["margin-left"]=e+"px":delete d["margin-left"],b.attributes.style=CKEDITOR.tools.writeCssText(d))});return l},cleanup:function(b){var a=["cke-list-level","cke-symbol","cke-list-id","cke-indentation","cke-dissolved"],c,e;for(c=0;c<b.length;c++)for(e=0;e<a.length;e++)delete b[c].attributes[a[e]]},determineListItemValue:function(b){if("ol"===b.parent.name){var a=this.calculateValue(b),c=b.attributes["cke-symbol"].match(/[a-z0-9]+/gi),e;c&&(c=c[c.length-1],e=b.parent.attributes["cke-list-style-type"]||
this.numbering.getStyle(c),c=this.numbering.toNumber(c,e),c!==a&&(b.attributes.value=c))}},calculateValue:function(b){if(!b.parent)return 1;var a=b.parent;b=b.getIndex();var c=null,e,f,g;for(g=b;0<=g&&null===c;g--)f=a.children[g],f.attributes&&void 0!==f.attributes.value&&(e=g,c=parseInt(f.attributes.value,10));null===c&&(c=void 0!==a.attributes.start?parseInt(a.attributes.start,10):1,e=0);return c+(b-e)},dissolveList:function(b){function a(b){return 50<=b?"l"+a(b-50):40<=b?"xl"+a(b-40):10<=b?"x"+
a(b-10):9==b?"ix":5<=b?"v"+a(b-5):4==b?"iv":1<=b?"i"+a(b-1):""}function c(a,b){function c(b,d){return b&&b.parent?a(b.parent)?c(b.parent,d+1):c(b.parent,d):d}return c(b,0)}var e=function(a){return function(b){return b.name==a}},f=function(a){return e("ul")(a)||e("ol")(a)},g=CKEDITOR.tools.array,w=[],d,h;b.forEach(function(a){w.push(a)},CKEDITOR.NODE_ELEMENT,!1);d=g.filter(w,e("li"));var m=g.filter(w,f);g.forEach(m,function(b){var d=b.attributes.type,h=parseInt(b.attributes.start,10)||1,m=c(f,b)+1;
d||(d=n.parseCssText(b.attributes.style)["list-style-type"]);g.forEach(g.filter(b.children,e("li")),function(c,e){var f;switch(d){case "disc":f="·";break;case "circle":f="o";break;case "square":f="§";break;case "1":case "decimal":f=h+e+".";break;case "a":case "lower-alpha":f=String.fromCharCode(97+h-1+e)+".";break;case "A":case "upper-alpha":f=String.fromCharCode(65+h-1+e)+".";break;case "i":case "lower-roman":f=a(h+e)+".";break;case "I":case "upper-roman":f=a(h+e).toUpperCase()+".";break;default:f=
"ul"==b.name?"·":h+e+"."}c.attributes["cke-symbol"]=f;c.attributes["cke-list-level"]=m})});d=g.reduce(d,function(a,b){var c=b.children[0];if(c&&c.name&&c.attributes.style&&c.attributes.style.match(/mso-list:/i)){k.pushStylesLower(b,{"list-style-type":!0,display:!0});var d=n.parseCssText(c.attributes.style,!0);k.setStyle(b,"mso-list",d["mso-list"],!0);k.setStyle(c,"mso-list","");delete b["cke-list-level"];(c=d.display?"display":d.DISPLAY?"DISPLAY":"")&&k.setStyle(b,"display",d[c],!0)}if(1===b.children.length&&
f(b.children[0]))return a;b.name="p";b.attributes["cke-dissolved"]=!0;a.push(b);return a},[]);for(h=d.length-1;0<=h;h--)d[h].insertAfter(b);for(h=m.length-1;0<=h;h--)delete m[h].name},groupLists:function(b){var a,c,e=[[b[0]]],f=e[0];c=b[0];c.attributes["cke-indentation"]=c.attributes["cke-indentation"]||z(c);for(a=1;a<b.length;a++){c=b[a];var l=b[a-1];c.attributes["cke-indentation"]=c.attributes["cke-indentation"]||z(c);c.previous!==l&&(g.chopDiscontinuousLists(f,e),e.push(f=[]));f.push(c)}g.chopDiscontinuousLists(f,
e);return e},chopDiscontinuousLists:function(b,a){for(var c={},e=[[]],f,l=0;l<b.length;l++){var k=c[b[l].attributes["cke-list-level"]],d=this.getListItemInfo(b[l]),h,m;k?(m=k.type.match(/alpha/)&&7==k.index?"alpha":m,m="o"==b[l].attributes["cke-symbol"]&&14==k.index?"alpha":m,h=g.getSymbolInfo(b[l].attributes["cke-symbol"],m),d=this.getListItemInfo(b[l]),(k.type!=h.type||f&&d.id!=f.id&&!this.isAListContinuation(b[l]))&&e.push([])):h=g.getSymbolInfo(b[l].attributes["cke-symbol"]);for(f=parseInt(b[l].attributes["cke-list-level"],
10)+1;20>f;f++)c[f]&&delete c[f];c[b[l].attributes["cke-list-level"]]=h;e[e.length-1].push(b[l]);f=d}[].splice.apply(a,[].concat([n.indexOf(a,b),1],e))},isAListContinuation:function(b){var a=b;do if((a=a.previous)&&a.type===CKEDITOR.NODE_ELEMENT){if(void 0===a.attributes["cke-list-level"])break;if(a.attributes["cke-list-level"]===b.attributes["cke-list-level"])return a.attributes["cke-list-id"]===b.attributes["cke-list-id"]}while(a);return!1},toArabic:function(b){return b.match(/[ivxl]/i)?b.match(/^l/i)?
50+g.toArabic(b.slice(1)):b.match(/^lx/i)?40+g.toArabic(b.slice(1)):b.match(/^x/i)?10+g.toArabic(b.slice(1)):b.match(/^ix/i)?9+g.toArabic(b.slice(2)):b.match(/^v/i)?5+g.toArabic(b.slice(1)):b.match(/^iv/i)?4+g.toArabic(b.slice(2)):b.match(/^i/i)?1+g.toArabic(b.slice(1)):g.toArabic(b.slice(1)):0},getSymbolInfo:function(b,a){var c=b.toUpperCase()==b?"upper-":"lower-",e={"·":["disc",-1],o:["circle",-2],"§":["square",-3]};if(b in e||a&&a.match(/(disc|circle|square)/))return{index:e[b][1],type:e[b][0]};
if(b.match(/\d/))return{index:b?parseInt(g.getSubsectionSymbol(b),10):0,type:"decimal"};b=b.replace(/\W/g,"").toLowerCase();return!a&&b.match(/[ivxl]+/i)||a&&"alpha"!=a||"roman"==a?{index:g.toArabic(b),type:c+"roman"}:b.match(/[a-z]/i)?{index:b.charCodeAt(0)-97,type:c+"alpha"}:{index:-1,type:"disc"}},getListItemInfo:function(b){if(void 0!==b.attributes["cke-list-id"])return{id:b.attributes["cke-list-id"],level:b.attributes["cke-list-level"]};var a=n.parseCssText(b.attributes.style)["mso-list"],c=
{id:"0",level:"1"};a&&(a+=" ",c.level=a.match(/level(.+?)\s+/)[1],c.id=a.match(/l(\d+?)\s+/)[1]);b.attributes["cke-list-level"]=void 0!==b.attributes["cke-list-level"]?b.attributes["cke-list-level"]:c.level;b.attributes["cke-list-id"]=c.id;return c}};g=q.lists;q.images={extractFromRtf:function(b){var a=[],c=/\{\\pict[\s\S]+?\\bliptag\-?\d+(\\blipupi\-?\d+)?(\{\\\*\\blipuid\s?[\da-fA-F]+)?[\s\}]*?/,e;b=b.match(new RegExp("(?:("+c.source+"))([\\da-fA-F\\s]+)\\}","g"));if(!b)return a;for(var f=0;f<b.length;f++)if(c.test(b[f])){if(-1!==
b[f].indexOf("\\pngblip"))e="image/png";else if(-1!==b[f].indexOf("\\jpegblip"))e="image/jpeg";else continue;a.push({hex:e?b[f].replace(c,"").replace(/[^\da-fA-F]/g,""):null,type:e})}return a},extractTagsFromHtml:function(b){for(var a=/<img[^>]+src="([^"]+)[^>]+/g,c=[],e;e=a.exec(b);)c.push(e[1]);return c}};q.heuristics={isEdgeListItem:function(b,a){if(!CKEDITOR.env.edge||!b.config.pasteFromWord_heuristicsEdgeList)return!1;var c="";a.forEach&&a.forEach(function(a){c+=a.value},CKEDITOR.NODE_TEXT);
return c.match(/^(?: |&nbsp;)*\(?[a-zA-Z0-9]+?[\.\)](?: |&nbsp;){2,}/)?!0:p.isDegenerateListItem(b,a)},cleanupEdgeListItem:function(b){var a=!1;b.forEach(function(b){a||(b.value=b.value.replace(/^(?:&nbsp;|[\s])+/,""),b.value.length&&(a=!0))},CKEDITOR.NODE_TEXT)},isDegenerateListItem:function(b,a){return!!a.attributes["cke-list-level"]||a.attributes.style&&!a.attributes.style.match(/mso\-list/)&&!!a.find(function(b){if(b.type==CKEDITOR.NODE_ELEMENT&&a.name.match(/h\d/i)&&b.getHtml().match(/^[a-zA-Z0-9]+?[\.\)]$/))return!0;
var e=n.parseCssText(b.attributes&&b.attributes.style,!0);if(!e)return!1;var f=e["font-family"]||"";return(e.font||e["font-size"]||"").match(/7pt/i)&&!!b.previous||f.match(/symbol/i)},!0).length},assignListLevels:function(b,a){if(!a.attributes||void 0===a.attributes["cke-list-level"]){for(var c=[z(a)],e=[a],f=[],g=CKEDITOR.tools.array,k=g.map;a.next&&a.next.attributes&&!a.next.attributes["cke-list-level"]&&p.isDegenerateListItem(b,a.next);)a=a.next,c.push(z(a)),e.push(a);var d=k(c,function(a,b){return 0===
b?0:a-c[b-1]}),h=this.guessIndentationStep(g.filter(c,function(a){return 0!==a})),f=k(c,function(a){return Math.round(a/h)});-1!==g.indexOf(f,0)&&(f=k(f,function(a){return a+1}));g.forEach(e,function(a,b){a.attributes["cke-list-level"]=f[b]});return{indents:c,levels:f,diffs:d}}},guessIndentationStep:function(b){return b.length?Math.min.apply(null,b):null},correctLevelShift:function(b){if(this.isShifted(b)){var a=CKEDITOR.tools.array.filter(b.children,function(a){return"ul"==a.name||"ol"==a.name}),
c=CKEDITOR.tools.array.reduce(a,function(a,b){return(b.children&&1==b.children.length&&p.isShifted(b.children[0])?[b]:b.children).concat(a)},[]);CKEDITOR.tools.array.forEach(a,function(a){a.remove()});CKEDITOR.tools.array.forEach(c,function(a){b.add(a)});delete b.name}},isShifted:function(b){return"li"!==b.name?!1:0===CKEDITOR.tools.array.filter(b.children,function(a){return a.name&&("ul"==a.name||"ol"==a.name||"p"==a.name&&0===a.children.length)?!1:!0}).length}};p=q.heuristics;g.setListSymbol.removeRedundancies=
function(b,a){(1===a&&"disc"===b["list-style-type"]||"decimal"===b["list-style-type"])&&delete b["list-style-type"]};CKEDITOR.cleanWord=CKEDITOR.pasteFilters.word=B.createFilter({rules:[t.rules,q.rules],additionalTransforms:function(b){CKEDITOR.plugins.clipboard.isCustomDataTypesSupported&&(b=t.styles.inliner.inline(b).getBody().getHtml());return b.replace(/<!\[/g,"\x3c!--[").replace(/\]>/g,"]--\x3e")}});CKEDITOR.config.pasteFromWord_heuristicsEdgeList=!0})();

+ 22
- 0
src/static/ckeditor/plugins/pastetools/filter/common.js Parādīt failu

@@ -0,0 +1,22 @@
/*
Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/
(function(){function q(a){return/%$/.test(a)?a:a+"px"}function r(a){var b=a.margin?"margin":a.MARGIN?"MARGIN":!1,c,e;if(b){e=CKEDITOR.tools.style.parse.margin(a[b]);for(c in e)a["margin-"+c]=e[c];delete a[b]}}function t(a){var b="background-color:transparent;background:transparent;background-color:none;background:none;background-position:initial initial;background-repeat:initial initial;caret-color;font-family:-webkit-standard;font-variant-caps;letter-spacing:normal;orphans;widows;text-transform:none;word-spacing:0px;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;text-indent:0px;margin-bottom:0in".split(";"),
c=CKEDITOR.tools.parseCssText(a.attributes.style),e,f;for(e in c)f=e+":"+c[e],CKEDITOR.tools.array.some(b,function(a){return f.substring(0,a.length).toLowerCase()===a})&&delete c[e];c=CKEDITOR.tools.writeCssText(c);""!==c?a.attributes.style=c:delete a.attributes.style}function u(a){a=a.config.font_names;var b=[];if(!a||!a.length)return!1;b=CKEDITOR.tools.array.map(a.split(";"),function(a){return-1===a.indexOf("/")?a:a.split("/")[1]});return b.length?b:!1}function v(a,b){var c=a.split(",");return CKEDITOR.tools.array.find(b,
function(a){for(var f=0;f<c.length;f++)if(-1===a.indexOf(CKEDITOR.tools.trim(c[f])))return!1;return!0})||a}var h,l=CKEDITOR.tools,p={};CKEDITOR.plugins.pastetools.filters.common=p;p.rules=function(a,b,c){var e=u(b);return{elements:{"^":function(a){t(a);if(a.attributes.bgcolor){var b=CKEDITOR.tools.parseCssText(a.attributes.style);b["background-color"]||(b["background-color"]=a.attributes.bgcolor,a.attributes.style=CKEDITOR.tools.writeCssText(b))}},span:function(a){if(a.hasClass("Apple-converted-space"))return new CKEDITOR.htmlParser.text(" ")},
table:function(a){a.filterChildren(c);var b=a.parent,d=b&&b.parent,e,k;if(b.name&&"div"===b.name&&b.attributes.align&&1===l.object.keys(b.attributes).length&&1===b.children.length){a.attributes.align=b.attributes.align;e=b.children.splice(0);a.remove();for(k=e.length-1;0<=k;k--)d.add(e[k],b.getIndex());b.remove()}h.convertStyleToPx(a)},tr:function(a){a.attributes={}},td:function(a){var g=a.getAscendant("table"),g=l.parseCssText(g.attributes.style,!0),d=g.background;d&&h.setStyle(a,"background",d,
!0);(g=g["background-color"])&&h.setStyle(a,"background-color",g,!0);var g=l.parseCssText(a.attributes.style,!0),d=g.border?CKEDITOR.tools.style.border.fromCssRule(g.border):{},d=l.style.border.splitCssValues(g,d),e=CKEDITOR.tools.clone(g),k;for(k in e)0==k.indexOf("border")&&delete e[k];a.attributes.style=CKEDITOR.tools.writeCssText(e);g.background&&(k=CKEDITOR.tools.style.parse.background(g.background),k.color&&(h.setStyle(a,"background-color",k.color,!0),h.setStyle(a,"background","")));for(var m in d)k=
g[m]?CKEDITOR.tools.style.border.fromCssRule(g[m]):d[m],"none"===k.style?h.setStyle(a,m,"none"):h.setStyle(a,m,k.toString());h.mapCommonStyles(a);h.convertStyleToPx(a);h.createStyleStack(a,c,b,/margin|text\-align|padding|list\-style\-type|width|height|border|white\-space|vertical\-align|background/i)},font:function(a){a.attributes.face&&e&&(a.attributes.face=v(a.attributes.face,e))}}}};p.styles={setStyle:function(a,b,c,e){var f=l.parseCssText(a.attributes.style);e&&f[b]||(""===c?delete f[b]:f[b]=
c,a.attributes.style=CKEDITOR.tools.writeCssText(f))},convertStyleToPx:function(a){var b=a.attributes.style;b&&(a.attributes.style=b.replace(/\d+(\.\d+)?pt/g,function(a){return CKEDITOR.tools.convertToPx(a)+"px"}))},mapStyles:function(a,b){for(var c in b)if(a.attributes[c]){if("function"===typeof b[c])b[c](a.attributes[c]);else h.setStyle(a,b[c],a.attributes[c]);delete a.attributes[c]}},mapCommonStyles:function(a){return h.mapStyles(a,{vAlign:function(b){h.setStyle(a,"vertical-align",b)},width:function(b){h.setStyle(a,
"width",q(b))},height:function(b){h.setStyle(a,"height",q(b))}})},normalizedStyles:function(a,b){var c="background-color:transparent border-image:none color:windowtext direction:ltr mso- visibility:visible div:border:none".split(" "),e="font-family font font-size color background-color line-height text-decoration".split(" "),f=function(){for(var a=[],b=0;b<arguments.length;b++)arguments[b]&&a.push(arguments[b]);return-1!==l.indexOf(c,a.join(":"))},g=!0===CKEDITOR.plugins.pastetools.getConfigValue(b,
"removeFontStyles"),d=l.parseCssText(a.attributes.style);"cke:li"==a.name&&(d["TEXT-INDENT"]&&d.MARGIN?(a.attributes["cke-indentation"]=p.lists.getElementIndentation(a),d.MARGIN=d.MARGIN.replace(/(([\w\.]+ ){3,3})[\d\.]+(\w+$)/,"$10$3")):delete d["TEXT-INDENT"],delete d["text-indent"]);for(var n=l.object.keys(d),k=0;k<n.length;k++){var m=n[k].toLowerCase(),h=d[n[k]],q=CKEDITOR.tools.indexOf;(g&&-1!==q(e,m.toLowerCase())||f(null,m,h)||f(null,m.replace(/\-.*$/,"-"))||f(null,m)||f(a.name,m,h)||f(a.name,
m.replace(/\-.*$/,"-"))||f(a.name,m)||f(h))&&delete d[n[k]]}var t=CKEDITOR.plugins.pastetools.getConfigValue(b,"keepZeroMargins");r(d);(function(){CKEDITOR.tools.array.forEach(["top","right","bottom","left"],function(a){a="margin-"+a;if(a in d){var b=CKEDITOR.tools.convertToPx(d[a]);b||t?d[a]=b?b+"px":0:delete d[a]}})})();return CKEDITOR.tools.writeCssText(d)},createStyleStack:function(a,b,c,e){var f=[];a.filterChildren(b);for(b=a.children.length-1;0<=b;b--)f.unshift(a.children[b]),a.children[b].remove();
h.sortStyles(a);b=l.parseCssText(h.normalizedStyles(a,c));c=a;var g="span"===a.name,d;for(d in b)if(!d.match(e||/margin((?!-)|-left|-top|-bottom|-right)|text-indent|text-align|width|border|padding/i))if(g)g=!1;else{var n=new CKEDITOR.htmlParser.element("span");n.attributes.style=d+":"+b[d];c.add(n);c=n;delete b[d]}CKEDITOR.tools.isEmpty(b)?delete a.attributes.style:a.attributes.style=CKEDITOR.tools.writeCssText(b);for(b=0;b<f.length;b++)c.add(f[b])},sortStyles:function(a){for(var b=["border","border-bottom",
"font-size","background"],c=l.parseCssText(a.attributes.style),e=l.object.keys(c),f=[],g=[],d=0;d<e.length;d++)-1!==l.indexOf(b,e[d].toLowerCase())?f.push(e[d]):g.push(e[d]);f.sort(function(a,c){var d=l.indexOf(b,a.toLowerCase()),f=l.indexOf(b,c.toLowerCase());return d-f});e=[].concat(f,g);f={};for(d=0;d<e.length;d++)f[e[d]]=c[e[d]];a.attributes.style=CKEDITOR.tools.writeCssText(f)},pushStylesLower:function(a,b,c){if(!a.attributes.style||0===a.children.length)return!1;b=b||{};var e={"list-style-type":!0,
width:!0,height:!0,border:!0,"border-":!0},f=l.parseCssText(a.attributes.style),g;for(g in f)if(!(g.toLowerCase()in e||e[g.toLowerCase().replace(/\-.*$/,"-")]||g.toLowerCase()in b)){for(var d=!1,n=0;n<a.children.length;n++){var k=a.children[n];if(k.type===CKEDITOR.NODE_TEXT&&c){var m=new CKEDITOR.htmlParser.element("span");m.setHtml(k.value);k.replaceWith(m);k=m}k.type===CKEDITOR.NODE_ELEMENT&&(d=!0,h.setStyle(k,g,f[g]))}d&&delete f[g]}a.attributes.style=CKEDITOR.tools.writeCssText(f);return!0},inliner:{filtered:"break-before break-after break-inside page-break page-break-before page-break-after page-break-inside".split(" "),
parse:function(a){function b(a){var b=new CKEDITOR.dom.element("style"),c=new CKEDITOR.dom.element("iframe");c.hide();CKEDITOR.document.getBody().append(c);c.$.contentDocument.documentElement.appendChild(b.$);b.$.textContent=a;c.remove();return b.$.sheet}function c(a){var b=a.indexOf("{"),c=a.indexOf("}");return e(a.substring(b+1,c),!0)}var e=CKEDITOR.tools.parseCssText,f=h.inliner.filter,g=a.is?a.$.sheet:b(a);a=[];var d;if(g)for(g=g.cssRules,d=0;d<g.length;d++)g[d].type===window.CSSRule.STYLE_RULE&&
a.push({selector:g[d].selectorText,styles:f(c(g[d].cssText))});return a},filter:function(a){var b=h.inliner.filtered,c=l.array.indexOf,e={},f;for(f in a)-1===c(b,f)&&(e[f]=a[f]);return e},sort:function(a){return a.sort(function(a){var c=CKEDITOR.tools.array.map(a,function(a){return a.selector});return function(a,b){var g=-1!==(""+a.selector).indexOf(".")?1:0,g=(-1!==(""+b.selector).indexOf(".")?1:0)-g;return 0!==g?g:c.indexOf(b.selector)-c.indexOf(a.selector)}}(a))},inline:function(a){var b=h.inliner.parse,
c=h.inliner.sort,e=function(a){a=(new DOMParser).parseFromString(a,"text/html");return new CKEDITOR.dom.document(a)}(a);a=e.find("style");c=c(function(a){var c=[],d;for(d=0;d<a.count();d++)c=c.concat(b(a.getItem(d)));return c}(a));CKEDITOR.tools.array.forEach(c,function(a){var b=a.styles;a=e.find(a.selector);var c,h,k;r(b);for(k=0;k<a.count();k++)c=a.getItem(k),h=CKEDITOR.tools.parseCssText(c.getAttribute("style")),r(h),h=CKEDITOR.tools.extend({},h,b),c.setAttribute("style",CKEDITOR.tools.writeCssText(h))});
return e}}};h=p.styles;p.lists={getElementIndentation:function(a){a=l.parseCssText(a.attributes.style);if(a.margin||a.MARGIN){a.margin=a.margin||a.MARGIN;var b={styles:{margin:a.margin}};CKEDITOR.filter.transformationsTools.splitMarginShorthand(b);a["margin-left"]=b.styles["margin-left"]}return parseInt(l.convertToPx(a["margin-left"]||"0px"),10)}};p.elements={replaceWithChildren:function(a){for(var b=a.children.length-1;0<=b;b--)a.children[b].insertAfter(a)}};p.createAttributeStack=function(a,b){var c,
e=[];a.filterChildren(b);for(c=a.children.length-1;0<=c;c--)e.unshift(a.children[c]),a.children[c].remove();c=a.attributes;var f=a,g=!0,d;for(d in c)if(g)g=!1;else{var h=new CKEDITOR.htmlParser.element(a.name);h.attributes[d]=c[d];f.add(h);f=h;delete c[d]}for(c=0;c<e.length;c++)f.add(e[c])};p.parseShorthandMargins=r})();

+ 6
- 0
src/static/ckeditor/plugins/pastetools/filter/image.js Parādīt failu

@@ -0,0 +1,6 @@
/*
Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/
(function(){function f(b){var c=[],a=/(\{\\pict[^{}]+?|\{\\\*\\shppict\{\\pict\{\\\*[^*]+?)\\(?:jpeg|png)blip/,d;b=b.match(new RegExp("(?:("+a.source+"))([\\da-fA-F\\s]+)\\}","g"));if(!b)return c;for(var e=0;e<b.length;e++)if(a.test(b[e])){if(-1!==b[e].indexOf("\\pngblip"))d="image/png";else if(-1!==b[e].indexOf("\\jpegblip"))d="image/jpeg";else continue;c.push({hex:d?b[e].replace(a,"").replace(/[^\da-fA-F]/g,""):null,type:d})}return c}function g(b){for(var c=/<img[^>]+src="([^"]+)[^>]+/g,a=[],d;d=
c.exec(b);)a.push(d[1]);return a}CKEDITOR.pasteFilters.image=function(b,c,a){var d=[];if(!a)return b;c=g(b);if(0===c.length)return b;a=f(a);if(0===a.length)return b;CKEDITOR.tools.array.forEach(a,function(a){d.push(a.type?"data:"+a.type+";base64,"+CKEDITOR.tools.convertBytesToBase64(CKEDITOR.tools.convertHexStringToBytes(a.hex)):null)},this);if(c.length===d.length)for(a=0;a<c.length;a++)0===c[a].indexOf("file://")&&d[a]&&(b=b.replace(c[a],d[a]));return b}})();

Notiek ielāde…
Atcelt
Saglabāt