This commit is contained in:
akhil-naidu 2022-02-25 12:24:08 +05:30
parent 32c82917e3
commit cfbfe3c8a8
386 changed files with 10768 additions and 16 deletions

274
src/package-lock.json generated
View file

@ -1285,6 +1285,73 @@
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
"integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
},
"aws-sdk": {
"version": "2.1081.0",
"resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.1081.0.tgz",
"integrity": "sha512-204Aqi3NmSRZDAvyzmi1usje6oCM+Q4g6PgA+vc/XQQPe1oxO95AgOXZvrpjX2QlLbA0JDItL1ufUh3nszjaqA==",
"requires": {
"buffer": "4.9.2",
"events": "1.1.1",
"ieee754": "1.1.13",
"jmespath": "0.16.0",
"querystring": "0.2.0",
"sax": "1.2.1",
"url": "0.10.3",
"uuid": "3.3.2",
"xml2js": "0.4.19"
},
"dependencies": {
"buffer": {
"version": "4.9.2",
"resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.2.tgz",
"integrity": "sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg==",
"requires": {
"base64-js": "^1.0.2",
"ieee754": "^1.1.4",
"isarray": "^1.0.0"
}
},
"events": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz",
"integrity": "sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ="
},
"ieee754": {
"version": "1.1.13",
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz",
"integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg=="
},
"isarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE="
},
"sax": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.1.tgz",
"integrity": "sha1-e45lYZCyKOgaZq6nSEgNgozS03o="
},
"uuid": {
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz",
"integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA=="
},
"xml2js": {
"version": "0.4.19",
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz",
"integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==",
"requires": {
"sax": ">=0.6.0",
"xmlbuilder": "~9.0.1"
}
},
"xmlbuilder": {
"version": "9.0.7",
"resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.7.tgz",
"integrity": "sha1-Ey7mPS7FVlxVfiD0wi35rKaGsQ0="
}
}
},
"aws-sign2": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz",
@ -1450,6 +1517,11 @@
}
}
},
"boolbase": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz",
"integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24="
},
"brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
@ -1509,6 +1581,14 @@
"resolved": "https://registry.npmjs.org/buffer-writer/-/buffer-writer-2.0.0.tgz",
"integrity": "sha512-a7ZpuTZU1TRtnwyCNW3I5dc0wWNC3VR9S++Ewyk2HHZdrO3CQJqSpd+95Us590V6AL7JqUAH2IwZ/398PmNFgw=="
},
"busboy": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/busboy/-/busboy-1.4.0.tgz",
"integrity": "sha512-TytIELfX6IPn1OClqcBz0NFE6+JT9e3iW0ZpgnEl7ffsfDxvRZGHfPaSHGbrI443nSV3GutCDWuqLB6yHY92Ew==",
"requires": {
"streamsearch": "^1.1.0"
}
},
"bytes": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz",
@ -1580,6 +1660,32 @@
"resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-3.0.0.tgz",
"integrity": "sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ=="
},
"cheerio": {
"version": "1.0.0-rc.10",
"resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.10.tgz",
"integrity": "sha512-g0J0q/O6mW8z5zxQ3A8E8J1hUgp4SMOvEoW/x84OwyHKe/Zccz83PVT4y5Crcr530FV6NgmKI1qvGTKVl9XXVw==",
"requires": {
"cheerio-select": "^1.5.0",
"dom-serializer": "^1.3.2",
"domhandler": "^4.2.0",
"htmlparser2": "^6.1.0",
"parse5": "^6.0.1",
"parse5-htmlparser2-tree-adapter": "^6.0.1",
"tslib": "^2.2.0"
}
},
"cheerio-select": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/cheerio-select/-/cheerio-select-1.5.0.tgz",
"integrity": "sha512-qocaHPv5ypefh6YNxvnbABM07KMxExbtbfuJoIie3iZXX1ERwYmJcIiRrr9H05ucQP1k28dav8rpdDgjQd8drg==",
"requires": {
"css-select": "^4.1.3",
"css-what": "^5.0.1",
"domelementtype": "^2.2.0",
"domhandler": "^4.2.0",
"domutils": "^2.7.0"
}
},
"chokidar": {
"version": "3.5.3",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz",
@ -1787,6 +1893,23 @@
"which": "^2.0.1"
}
},
"css-select": {
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/css-select/-/css-select-4.2.1.tgz",
"integrity": "sha512-/aUslKhzkTNCQUB2qTX84lVmfia9NyjP3WpDGtj/WxhwBzWBYUV3DgUpurHTme8UTPcPlAD1DJ+b0nN/t50zDQ==",
"requires": {
"boolbase": "^1.0.0",
"css-what": "^5.1.0",
"domhandler": "^4.3.0",
"domutils": "^2.8.0",
"nth-check": "^2.0.1"
}
},
"css-what": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/css-what/-/css-what-5.1.0.tgz",
"integrity": "sha512-arSMRWIIFY0hV8pIxZMEfmMI47Wj3R/aWpZDDxWYCPEiOMv6tfOrnpDtgxBYPEQD4V0Y/958+1TdC3iWTFcUPw=="
},
"cssom": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/cssom/-/cssom-0.5.0.tgz",
@ -1948,6 +2071,21 @@
"esutils": "^2.0.2"
}
},
"dom-serializer": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.3.2.tgz",
"integrity": "sha512-5c54Bk5Dw4qAxNOI1pFEizPSjVsx5+bpJKmL2kPn8JhBUq2q09tTCa3mjijun2NfK78NMouDYNMBkOrPZiS+ig==",
"requires": {
"domelementtype": "^2.0.1",
"domhandler": "^4.2.0",
"entities": "^2.0.0"
}
},
"domelementtype": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.2.0.tgz",
"integrity": "sha512-DtBMo82pv1dFtUmHyr48beiuq792Sxohr+8Hm9zoxklYPfa6n0Z3Byjj2IV7bmr2IyqClnqEQhfgHJJ5QF0R5A=="
},
"domexception": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/domexception/-/domexception-4.0.0.tgz",
@ -1956,6 +2094,24 @@
"webidl-conversions": "^7.0.0"
}
},
"domhandler": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/domhandler/-/domhandler-4.3.0.tgz",
"integrity": "sha512-fC0aXNQXqKSFTr2wDNZDhsEYjCiYsDWl3D01kwt25hm1YIPyDGHvvi3rw+PLqHAl/m71MaiF7d5zvBr0p5UB2g==",
"requires": {
"domelementtype": "^2.2.0"
}
},
"domutils": {
"version": "2.8.0",
"resolved": "https://registry.npmjs.org/domutils/-/domutils-2.8.0.tgz",
"integrity": "sha512-w96Cjofp72M5IIhpjgobBimYEfoPjx1Vx0BSX9P30WBdZW2WIKU0T1Bd0kz2eNZ9ikjKgHbEyKx8BB6H1L3h3A==",
"requires": {
"dom-serializer": "^1.0.1",
"domelementtype": "^2.2.0",
"domhandler": "^4.2.0"
}
},
"ecc-jsbn": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz",
@ -2117,6 +2273,11 @@
"has-binary2": "~1.0.2"
}
},
"entities": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz",
"integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A=="
},
"env-paths": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz",
@ -3038,6 +3199,23 @@
"integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==",
"optional": true
},
"fs-extra": {
"version": "10.0.1",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.1.tgz",
"integrity": "sha512-NbdoVMZso2Lsrn/QwLXOy6rm0ufY2zEOKCDzJR/0kBsb0E6qed0P3iYK+Ath3BfvXEeu4JhEtXLgILx5psUfag==",
"requires": {
"graceful-fs": "^4.2.0",
"jsonfile": "^6.0.1",
"universalify": "^2.0.0"
},
"dependencies": {
"universalify": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz",
"integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ=="
}
}
},
"fs-minipass": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz",
@ -3174,8 +3352,7 @@
"graceful-fs": {
"version": "4.2.9",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.9.tgz",
"integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==",
"optional": true
"integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ=="
},
"growl": {
"version": "1.10.5",
@ -3380,6 +3557,17 @@
"resolved": "https://registry.npmjs.org/html-void-elements/-/html-void-elements-2.0.1.tgz",
"integrity": "sha512-0quDb7s97CfemeJAnW9wC0hw78MtW7NU3hqtCD75g2vFlDLt36llsYD7uB7SUzojLMP24N5IatXf7ylGXiGG9A=="
},
"htmlparser2": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-6.1.0.tgz",
"integrity": "sha512-gyyPk6rgonLFEDGoeRgQNaEUvdJ4ktTmmUh/h2t7s+M8oPpIPxgNACWa+6ESR57kXstwqPiCut0V8NRpcwgU7A==",
"requires": {
"domelementtype": "^2.0.1",
"domhandler": "^4.0.0",
"domutils": "^2.5.2",
"entities": "^2.0.0"
}
},
"http-errors": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz",
@ -3800,6 +3988,11 @@
}
}
},
"jmespath": {
"version": "0.16.0",
"resolved": "https://registry.npmjs.org/jmespath/-/jmespath-0.16.0.tgz",
"integrity": "sha512-9FzQjJ7MATs1tSpnco1K6ayiYE3figslrXA72G2HQ/n76RzvYlofyi5QM+iX4YRs/pu3yzxlVQSST23+dMDknw=="
},
"js-cookie": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/js-cookie/-/js-cookie-3.0.1.tgz",
@ -3887,6 +4080,22 @@
"minimist": "^1.2.0"
}
},
"jsonfile": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz",
"integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==",
"requires": {
"graceful-fs": "^4.1.6",
"universalify": "^2.0.0"
},
"dependencies": {
"universalify": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz",
"integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ=="
}
}
},
"jsonminify": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/jsonminify/-/jsonminify-0.4.1.tgz",
@ -7890,6 +8099,14 @@
"set-blocking": "~2.0.0"
}
},
"nth-check": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.0.1.tgz",
"integrity": "sha512-it1vE95zF6dTT9lBsYbxvqh0Soy4SPowchj0UBGj/V6cTPnXXtQOPUbhZ6CmGzAD/rW22LQK6E96pcdJXk4A4w==",
"requires": {
"boolbase": "^1.0.0"
}
},
"number-is-nan": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz",
@ -8109,6 +8326,14 @@
"resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz",
"integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw=="
},
"parse5-htmlparser2-tree-adapter": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-6.0.1.tgz",
"integrity": "sha512-qPuWvbLgvDGilKc5BoicRovlT4MtYT6JfJyBOMDsKoiT+GiuP5qyrPCnR9HcPECIJJmZh5jRndyNThnhhb/vlA==",
"requires": {
"parse5": "^6.0.1"
}
},
"parseqs": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/parseqs/-/parseqs-0.0.6.tgz",
@ -8333,6 +8558,11 @@
"resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz",
"integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ=="
},
"querystring": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz",
"integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA="
},
"queue-microtask": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz",
@ -9082,6 +9312,30 @@
"resolved": "https://registry.npmjs.org/stoppable/-/stoppable-1.1.0.tgz",
"integrity": "sha512-KXDYZ9dszj6bzvnEMRYvxgeTHU74QBFL54XKtP3nyMuJ81CFYtABZ3bAzL2EdFUaEwJOBOgENyFj3R7oTzDyyw=="
},
"stream_upload": {
"version": "0.1.5",
"resolved": "https://registry.npmjs.org/stream_upload/-/stream_upload-0.1.5.tgz",
"integrity": "sha512-96Yiijdz7zIQnxe0SvuQ9r/IfkWNVxayw45rRCRKHrqgkc8tWmRHKAPNV1M6oNIlW/7bMskXHAdpaIdyasInqg==",
"requires": {
"aws-sdk": "^2.1033.0",
"fs-extra": "^10.0.0",
"mime-types": "^2.1.34",
"underscore": "^1.8.3",
"uuid": "^8.3.2"
},
"dependencies": {
"uuid": {
"version": "8.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg=="
}
}
},
"streamsearch": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz",
"integrity": "sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg=="
},
"string-width": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
@ -9820,6 +10074,22 @@
"punycode": "^2.1.0"
}
},
"url": {
"version": "0.10.3",
"resolved": "https://registry.npmjs.org/url/-/url-0.10.3.tgz",
"integrity": "sha1-Ah5NnHcF8hu/N9A861h2dAJ3TGQ=",
"requires": {
"punycode": "1.3.2",
"querystring": "0.2.0"
},
"dependencies": {
"punycode": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz",
"integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0="
}
}
},
"util-deprecate": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",

View file

@ -31,6 +31,8 @@
],
"dependencies": {
"async": "^3.2.2",
"busboy": "^1.4.0",
"cheerio": "^1.0.0-rc.10",
"clean-css": "^5.2.4",
"cookie-parser": "^1.4.6",
"cross-spawn": "^7.0.3",
@ -63,6 +65,7 @@
"security": "1.0.0",
"semver": "^7.3.5",
"socket.io": "^2.4.1",
"stream_upload": "^0.1.5",
"superagent": "^6.1.0",
"terser": "^5.10.0",
"threads": "^1.7.0",

View file

@ -0,0 +1 @@
Align Content in Mudoc

View file

@ -0,0 +1,24 @@
{
"parts": [
{
"name": "main",
"client_hooks": {
"aceEditEvent": "ep_align/static/js/index",
"postToolbarInit": "ep_align/static/js/index",
"aceDomLineProcessLineAttributes": "ep_align/static/js/index",
"postAceInit": "ep_align/static/js/index",
"aceInitialized": "ep_align/static/js/index",
"aceAttribsToClasses": "ep_align/static/js/index",
"collectContentPre": "ep_align/static/js/shared",
"aceRegisterBlockElements": "ep_align/static/js/index"
},
"hooks": {
"eejsBlock_editbarMenuLeft": "ep_align/index",
"collectContentPre": "ep_align/static/js/shared",
"collectContentPost": "ep_align/static/js/shared",
"padInitToolbar": "ep_align/index",
"getLineHTMLForExport": "ep_align/index"
}
}
]
}

View file

@ -0,0 +1,88 @@
'use strict';
const eejs = require('ep_etherpad-lite/node/eejs/');
const Changeset = require('ep_etherpad-lite/static/js/Changeset');
const settings = require('ep_etherpad-lite/node/utils/Settings');
exports.eejsBlock_editbarMenuLeft = (hookName, args, cb) => {
if (args.renderContext.isReadOnly) return cb();
for (const button of ['alignLeft', 'alignJustify', 'alignCenter', 'alignRight']) {
if (JSON.stringify(settings.toolbar).indexOf(button) > -1) {
return cb();
}
}
args.content += eejs.require('ep_align/templates/editbarButtons.ejs');
return cb();
};
const _analyzeLine = (alineAttrs, apool) => {
let alignment = null;
if (alineAttrs) {
const opIter = Changeset.opIterator(alineAttrs);
if (opIter.hasNext()) {
const op = opIter.next();
alignment = Changeset.opAttributeValue(op, 'align', apool);
}
}
return alignment;
};
// line, apool,attribLine,text
exports.getLineHTMLForExport = async (hookName, context) => {
const align = _analyzeLine(context.attribLine, context.apool);
if (align) {
if (context.text.indexOf('*') === 0) {
context.lineContent = context.lineContent.replace('*', '');
}
const heading = context.lineContent.match(/<h([1-6])([^>]+)?>/);
if (heading) {
if (heading.indexOf('style=') === -1) {
context.lineContent = context.lineContent.replace('>', ` style='text-align:${align}'>`);
} else {
context.lineContent = context.lineContent.replace('style=', `style='text-align:${align} `);
}
} else {
context.lineContent =
`<p style='text-align:${align}'>${context.lineContent}</p>`;
}
return context.lineContent;
}
};
exports.padInitToolbar = (hookName, args, cb) => {
const toolbar = args.toolbar;
const alignLeftButton = toolbar.button({
command: 'alignLeft',
localizationId: 'ep_align.toolbar.left.title',
class: 'buttonicon buttonicon-align-left ep_align ep_align_left',
});
const alignCenterButton = toolbar.button({
command: 'alignCenter',
localizationId: 'ep_align.toolbar.middle.title',
class: 'buttonicon buttonicon-align-center ep_align ep_align_center',
});
const alignJustifyButton = toolbar.button({
command: 'alignJustify',
localizationId: 'ep_align.toolbar.justify.title',
class: 'buttonicon buttonicon-align-justify ep_align ep_align_justify',
});
const alignRightButton = toolbar.button({
command: 'alignRight',
localizationId: 'ep_align.toolbar.right.title',
class: 'buttonicon buttonicon-align-right ep_align ep_align_right',
});
toolbar.registerButton('alignLeft', alignLeftButton);
toolbar.registerButton('alignCenter', alignCenterButton);
toolbar.registerButton('alignJustify', alignJustifyButton);
toolbar.registerButton('alignRight', alignRightButton);
return cb();
};

View file

@ -0,0 +1,12 @@
{
"@metadata": {
"authors": [
"Mguix"
]
},
"ep_align.align": "Alinear",
"ep_align.toolbar.left.title": "Esquerra",
"ep_align.toolbar.center.title": "Centre",
"ep_align.toolbar.right.title": "Dreta",
"ep_align.toolbar.justify.title": "Justifica"
}

View file

@ -0,0 +1,12 @@
{
"@metadata": {
"authors": [
"Spotter"
]
},
"ep_align.align": "Zarovnání",
"ep_align.toolbar.left.title": "Vlevo",
"ep_align.toolbar.center.title": "Střed",
"ep_align.toolbar.right.title": "Vpravo",
"ep_align.toolbar.justify.title": "Do bloku"
}

View file

@ -0,0 +1,11 @@
{
"@metadata": {
"authors": [
"Robin Owain"
]
},
"ep_align.align": "Alinio",
"ep_align.toolbar.left.title": "Chwith",
"ep_align.toolbar.right.title": "De",
"ep_align.toolbar.justify.title": "Unioni"
}

View file

@ -0,0 +1,9 @@
{
"@metadata": {
"authors": [
"Saederup92"
]
},
"ep_align.toolbar.left.title": "Venstre",
"ep_align.toolbar.right.title": "Højre"
}

View file

@ -0,0 +1,12 @@
{
"@metadata": {
"authors": [
"Lorisobi"
]
},
"ep_align.align": "Ausrichtung",
"ep_align.toolbar.left.title": "Linksbündig",
"ep_align.toolbar.center.title": "Zentrieren",
"ep_align.toolbar.right.title": "Rechtsbündig",
"ep_align.toolbar.justify.title": "Blocksatz"
}

View file

@ -0,0 +1,12 @@
{
"@metadata": {
"authors": [
"1917 Ekim Devrimi"
]
},
"ep_align.align": "Ratnayış",
"ep_align.toolbar.left.title": "Çep",
"ep_align.toolbar.center.title": "Merkez",
"ep_align.toolbar.right.title": "Raşt",
"ep_align.toolbar.justify.title": "Heq"
}

View file

@ -0,0 +1,7 @@
{
"ep_align.align" : "Align",
"ep_align.toolbar.left.title" : "Left",
"ep_align.toolbar.center.title" : "Center",
"ep_align.toolbar.right.title" : "Right",
"ep_align.toolbar.justify.title" : "Justify"
}

View file

@ -0,0 +1,12 @@
{
"@metadata": {
"authors": [
"Izendegi"
]
},
"ep_align.align": "Lerrokatu",
"ep_align.toolbar.left.title": "Ezkerrera",
"ep_align.toolbar.center.title": "Erdian",
"ep_align.toolbar.right.title": "Eskuinera",
"ep_align.toolbar.justify.title": "Justifikatu"
}

View file

@ -0,0 +1,12 @@
{
"@metadata": {
"authors": [
"Maantietäjä"
]
},
"ep_align.align": "Kohdista",
"ep_align.toolbar.left.title": "Vasen",
"ep_align.toolbar.center.title": "Keskellä",
"ep_align.toolbar.right.title": "Oikea",
"ep_align.toolbar.justify.title": "Perustele"
}

View file

@ -0,0 +1,14 @@
{
"@metadata": {
"authors": [
"Florian COLLIN",
"Gomoko",
"Verdy p"
]
},
"ep_align.align": "Alignement",
"ep_align.toolbar.left.title": "À gauche",
"ep_align.toolbar.center.title": "Centré",
"ep_align.toolbar.right.title": "À droite",
"ep_align.toolbar.justify.title": "Justifié"
}

View file

@ -0,0 +1,12 @@
{
"@metadata": {
"authors": [
"Ghose"
]
},
"ep_align.align": "Aliñar",
"ep_align.toolbar.left.title": "Esquerda",
"ep_align.toolbar.center.title": "Centro",
"ep_align.toolbar.right.title": "Dereita",
"ep_align.toolbar.justify.title": "Xustificar"
}

View file

@ -0,0 +1,12 @@
{
"@metadata": {
"authors": [
"YaronSh"
]
},
"ep_align.align": "יישור",
"ep_align.toolbar.left.title": "שמאל",
"ep_align.toolbar.center.title": "מרכז",
"ep_align.toolbar.right.title": "ימין",
"ep_align.toolbar.justify.title": "פיזור שוויוני"
}

View file

@ -0,0 +1,11 @@
{
"@metadata": {
"authors": [
"Hanna Tardos"
]
},
"ep_align.align": "Illesztés",
"ep_align.toolbar.left.title": "Balra igazítás",
"ep_align.toolbar.right.title": "Jobbra igazítás",
"ep_align.toolbar.justify.title": "Sorkizárt"
}

View file

@ -0,0 +1,13 @@
{
"@metadata": {
"authors": [
"Beta16",
"VamosErik88"
]
},
"ep_align.align": "Allinea",
"ep_align.toolbar.left.title": "Sinistra",
"ep_align.toolbar.center.title": "Centro",
"ep_align.toolbar.right.title": "Destra",
"ep_align.toolbar.justify.title": "Giustificato"
}

View file

@ -0,0 +1,12 @@
{
"@metadata": {
"authors": [
"Ykhwong"
]
},
"ep_align.align": "정렬",
"ep_align.toolbar.left.title": "왼쪽",
"ep_align.toolbar.center.title": "가운데",
"ep_align.toolbar.right.title": "오른쪽",
"ep_align.toolbar.justify.title": "균등"
}

View file

@ -0,0 +1,12 @@
{
"@metadata": {
"authors": [
"Bjankuloski06"
]
},
"ep_align.align": "Порамни",
"ep_align.toolbar.left.title": "Лево",
"ep_align.toolbar.center.title": "По средина",
"ep_align.toolbar.right.title": "Десно",
"ep_align.toolbar.justify.title": "Порамни пасус"
}

View file

@ -0,0 +1,12 @@
{
"@metadata": {
"authors": [
"Andibecker"
]
},
"ep_align.align": "ညှိပါ",
"ep_align.toolbar.left.title": "ဘယ်ဘက်",
"ep_align.toolbar.center.title": "စင်တာ",
"ep_align.toolbar.right.title": "မှန်တယ်",
"ep_align.toolbar.justify.title": "အကြောင်းပြပါ"
}

View file

@ -0,0 +1,11 @@
{
"@metadata": {
"authors": [
"woeterman_94"
]
},
"ep_align.align": "Uitlijnen",
"ep_align.toolbar.left.title": "Links",
"ep_align.toolbar.right.title": "Rechts",
"ep_align.toolbar.justify.title": "Uitvullen"
}

View file

@ -0,0 +1,12 @@
{
"@metadata": {
"authors": [
"Quentí"
]
},
"ep_align.align": "Alinhament",
"ep_align.toolbar.left.title": "Esquèrra",
"ep_align.toolbar.center.title": "Centre",
"ep_align.toolbar.right.title": "Drecha",
"ep_align.toolbar.justify.title": "Justifica"
}

View file

@ -0,0 +1,12 @@
{
"@metadata": {
"authors": [
"Rail"
]
},
"ep_align.align": "Wyrównanie",
"ep_align.toolbar.left.title": "Do lewej",
"ep_align.toolbar.center.title": "Wyśrodkowanie",
"ep_align.toolbar.right.title": "Do prawej",
"ep_align.toolbar.justify.title": "Justowanie"
}

View file

@ -0,0 +1,12 @@
{
"@metadata": {
"authors": [
"Borichèt"
]
},
"ep_align.align": "Aliniament",
"ep_align.toolbar.left.title": "Snistra",
"ep_align.toolbar.center.title": "Sènter",
"ep_align.toolbar.right.title": "Drita",
"ep_align.toolbar.justify.title": "Giustifiché"
}

View file

@ -0,0 +1,13 @@
{
"@metadata": {
"authors": [
"Eduardo Addad de Oliveira",
"Eduardoaddad"
]
},
"ep_align.align": "Alinhar",
"ep_align.toolbar.left.title": "Esquerda",
"ep_align.toolbar.center.title": "Centro",
"ep_align.toolbar.right.title": "Direita",
"ep_align.toolbar.justify.title": "Justificar"
}

View file

@ -0,0 +1,12 @@
{
"@metadata": {
"authors": [
"Guilha"
]
},
"ep_align.align": "Alinhar",
"ep_align.toolbar.left.title": "Esquerda",
"ep_align.toolbar.center.title": "Centro",
"ep_align.toolbar.right.title": "Direita",
"ep_align.toolbar.justify.title": "Justificado"
}

View file

@ -0,0 +1,12 @@
{
"@metadata": {
"authors": [
"Joetaras"
]
},
"ep_align.align": "Allineamende",
"ep_align.toolbar.left.title": "Sinistre",
"ep_align.toolbar.center.title": "Cendre",
"ep_align.toolbar.right.title": "Destre",
"ep_align.toolbar.justify.title": "Giustificate"
}

View file

@ -0,0 +1,12 @@
{
"@metadata": {
"authors": [
"Okras"
]
},
"ep_align.align": "Выравнивание",
"ep_align.toolbar.left.title": "Слева",
"ep_align.toolbar.center.title": "По центру",
"ep_align.toolbar.right.title": "Справа",
"ep_align.toolbar.justify.title": "Выровнять"
}

View file

@ -0,0 +1,12 @@
{
"@metadata": {
"authors": [
"Yardom78"
]
},
"ep_align.align": "Zarovnať",
"ep_align.toolbar.left.title": "Vľavo",
"ep_align.toolbar.center.title": "Na stred",
"ep_align.toolbar.right.title": "Vpravo",
"ep_align.toolbar.justify.title": "Zarovnať"
}

View file

@ -0,0 +1,9 @@
{
"@metadata": {
"authors": [
"HairyFotr"
]
},
"ep_align.toolbar.left.title": "Levo",
"ep_align.toolbar.right.title": "Desno"
}

View file

@ -0,0 +1,12 @@
{
"@metadata": {
"authors": [
"Besnik b"
]
},
"ep_align.align": "Drejtim",
"ep_align.toolbar.left.title": "Majtas",
"ep_align.toolbar.center.title": "Në qendër",
"ep_align.toolbar.right.title": "Djathtas",
"ep_align.toolbar.justify.title": "Përligje"
}

View file

@ -0,0 +1,12 @@
{
"@metadata": {
"authors": [
"WikiPhoenix"
]
},
"ep_align.align": "Textjustering",
"ep_align.toolbar.left.title": "Vänsterjustera",
"ep_align.toolbar.center.title": "Centrera",
"ep_align.toolbar.right.title": "Högerjustera",
"ep_align.toolbar.justify.title": "Marginaljustera"
}

View file

@ -0,0 +1,12 @@
{
"@metadata": {
"authors": [
"Andibecker"
]
},
"ep_align.align": "Panga",
"ep_align.toolbar.left.title": "Kushoto",
"ep_align.toolbar.center.title": "Kituo",
"ep_align.toolbar.right.title": "Haki",
"ep_align.toolbar.justify.title": "Thibitisha"
}

View file

@ -0,0 +1,12 @@
{
"@metadata": {
"authors": [
"Andibecker"
]
},
"ep_align.align": "จัดตำแหน่ง",
"ep_align.toolbar.left.title": "ซ้าย",
"ep_align.toolbar.center.title": "ศูนย์กลาง",
"ep_align.toolbar.right.title": "ขวา",
"ep_align.toolbar.justify.title": "เหตุผล"
}

View file

@ -0,0 +1,10 @@
{
"@metadata": {
"authors": [
"Mrkczr"
]
},
"ep_align.align": "Ihanay",
"ep_align.toolbar.left.title": "Kaliwa",
"ep_align.toolbar.right.title": "Kanan"
}

View file

@ -0,0 +1,13 @@
{
"@metadata": {
"authors": [
"Hedda",
"MuratTheTurkish"
]
},
"ep_align.align": "Hizalama",
"ep_align.toolbar.left.title": "Sol",
"ep_align.toolbar.center.title": "Merkez",
"ep_align.toolbar.right.title": "Sağ",
"ep_align.toolbar.justify.title": "Yasla"
}

View file

@ -0,0 +1,12 @@
{
"@metadata": {
"authors": [
"DDPAT"
]
},
"ep_align.align": "Вирівняти",
"ep_align.toolbar.left.title": "Ліворуч",
"ep_align.toolbar.center.title": "По центру",
"ep_align.toolbar.right.title": "Праворуч",
"ep_align.toolbar.justify.title": "Обґрунтуйте"
}

View file

@ -0,0 +1,12 @@
{
"@metadata": {
"authors": [
"列维劳德"
]
},
"ep_align.align": "对齐",
"ep_align.toolbar.left.title": "左对齐",
"ep_align.toolbar.center.title": "居中",
"ep_align.toolbar.right.title": "右对齐",
"ep_align.toolbar.justify.title": "左右对齐"
}

View file

@ -0,0 +1,12 @@
{
"@metadata": {
"authors": [
"Kly"
]
},
"ep_align.align": "校準",
"ep_align.toolbar.left.title": "左",
"ep_align.toolbar.center.title": "中",
"ep_align.toolbar.right.title": "右",
"ep_align.toolbar.justify.title": "左右對齊"
}

View file

@ -0,0 +1,71 @@
{
"_from": "ep_align",
"_id": "ep_align@0.0.1",
"_inBundle": false,
"_integrity": "sha512-QedMwuwHqgV24AERpNPXazZpGgnKn61zIo6rZHo9TyVIhNDRCZ9i9gtsZDNHNBPM+2XrcWjLIB45/LmAUMWuEw==",
"_location": "/ep_align",
"_phantomChildren": {},
"_requested": {
"type": "tag",
"registry": true,
"raw": "ep_align",
"name": "ep_align",
"escapedName": "ep_align",
"rawSpec": "",
"saveSpec": null,
"fetchSpec": "latest"
},
"_requiredBy": [
"#USER"
],
"_resolved": "https://registry.npmjs.org/ep_align/-/ep_align-0.0.1.tgz",
"_shasum": "8988e41f258aa6b0f5390da4efc035eb976c5e72",
"_spec": "ep_align",
"_where": "/Users/dev/Github/Edumatica/MuDocs/src",
"author": {
"name": "Akhil Naidu",
"email": "kaparapu.akhilnaidu@gmail.com"
},
"bugs": {
"url": "https://github.com/akhil-naidu/ep_align/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "Mu Doc plugin to set left, center, right, or full justification for a paragraph",
"devDependencies": {
"eslint": "^7.32.0",
"eslint-config-etherpad": "^2.0.2",
"eslint-plugin-cypress": "^2.12.1",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-mocha": "^9.0.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prefer-arrow": "^1.2.3",
"eslint-plugin-promise": "^5.1.1",
"eslint-plugin-you-dont-need-lodash-underscore": "^6.12.0"
},
"engines": {
"node": ">=12.13.0"
},
"eslintConfig": {
"root": true,
"extends": "etherpad/plugin"
},
"homepage": "https://github.com/akhil-naidu/ep_align#readme",
"keywords": [
"mudoc",
"plugin"
],
"name": "ep_align",
"peerDependencies": {
"ep_etherpad-lite": ">=0.0.2"
},
"repository": {
"type": "git",
"url": "git+https://github.com/akhil-naidu/ep_align.git"
},
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint --fix ."
},
"version": "0.0.1"
}

View file

@ -0,0 +1,153 @@
'use strict';
// All our tags are block elements, so we just return them.
const tags = ['left', 'center', 'justify', 'right'];
const range = (start, end) => Array.from(
Array(Math.abs(end - start) + 1),
(_, i) => start + i
);
exports.aceRegisterBlockElements = () => tags;
// Bind the event handler to the toolbar buttons
exports.postAceInit = (hookName, context) => {
$('body').on('click', '.ep_align', function () {
const value = $(this).data('align');
const intValue = parseInt(value, 10);
if (!isNaN(intValue)) {
context.ace.callWithAce((ace) => {
ace.ace_doInsertAlign(intValue);
}, 'insertalign', true);
}
});
return;
};
// On caret position change show the current align
exports.aceEditEvent = (hook, call) => {
// If it's not a click or a key event and the text hasn't changed then do nothing
const cs = call.callstack;
if (!(cs.type === 'handleClick') && !(cs.type === 'handleKeyEvent') && !(cs.docTextChanged)) {
return false;
}
// If it's an initial setup event then do nothing..
if (cs.type === 'setBaseText' || cs.type === 'setup') return false;
// It looks like we should check to see if this section has this attribute
return setTimeout(() => { // avoid race condition..
const attributeManager = call.documentAttributeManager;
const rep = call.rep;
const activeAttributes = {};
// $("#align-selection").val(-2); // TODO commented this out
const firstLine = rep.selStart[0];
const lastLine = Math.max(firstLine, rep.selEnd[0] - ((rep.selEnd[1] === 0) ? 1 : 0));
let totalNumberOfLines = 0;
range(firstLine, lastLine + 1).forEach((line) => {
totalNumberOfLines++;
const attr = attributeManager.getAttributeOnLine(line, 'align');
if (!activeAttributes[attr]) {
activeAttributes[attr] = {};
activeAttributes[attr].count = 1;
} else {
activeAttributes[attr].count++;
}
});
$.each(activeAttributes, (k, attr) => {
if (attr.count === totalNumberOfLines) {
// show as active class
// const ind = tags.indexOf(k);
// $("#align-selection").val(ind); // TODO commnented this out
}
});
return;
}, 250);
};
// Our align attribute will result in a heaading:left.... :left class
exports.aceAttribsToClasses = (hook, context) => {
if (context.key === 'align') {
return [`align:${context.value}`];
}
};
// Here we convert the class align:left into a tag
exports.aceDomLineProcessLineAttributes = (name, context) => {
const cls = context.cls;
const alignType = /(?:^| )align:([A-Za-z0-9]*)/.exec(cls);
let tagIndex;
if (alignType) tagIndex = tags.indexOf(alignType[1]);
if (tagIndex !== undefined && tagIndex >= 0) {
const tag = tags[tagIndex];
const styles =
`width:100%;margin:0 auto;list-style-position:inside;display:block;text-align:${tag}`;
const modifier = {
preHtml: `<${tag} style="${styles}">`,
postHtml: `</${tag}>`,
processedMarker: true,
};
return [modifier];
}
return [];
};
// Once ace is initialized, we set ace_doInsertAlign and bind it to the context
exports.aceInitialized = (hook, context) => {
// Passing a level >= 0 will set a alignment on the selected lines, level < 0
// will remove it
function doInsertAlign(level) {
const rep = this.rep;
const documentAttributeManager = this.documentAttributeManager;
if (!(rep.selStart && rep.selEnd) || (level >= 0 && tags[level] === undefined)) {
return;
}
const firstLine = rep.selStart[0];
const lastLine = Math.max(firstLine, rep.selEnd[0] - ((rep.selEnd[1] === 0) ? 1 : 0));
range(firstLine, lastLine).forEach((i) => {
if (level >= 0) {
documentAttributeManager.setAttributeOnLine(i, 'align', tags[level]);
} else {
documentAttributeManager.removeAttributeOnLine(i, 'align');
}
});
}
const editorInfo = context.editorInfo;
editorInfo.ace_doInsertAlign = doInsertAlign.bind(context);
return;
};
const align = (context, alignment) => {
context.ace.callWithAce((ace) => {
ace.ace_doInsertAlign(alignment);
ace.ace_focus();
}, 'insertalign', true);
};
exports.postToolbarInit = (hookName, context) => {
const editbar = context.toolbar; // toolbar is actually editbar
editbar.registerCommand('alignLeft', () => {
align(context, 0);
});
editbar.registerCommand('alignCenter', () => {
align(context, 1);
});
editbar.registerCommand('alignJustify', () => {
align(context, 2);
});
editbar.registerCommand('alignRight', () => {
align(context, 3);
});
return true;
};

View file

@ -0,0 +1,29 @@
'use strict';
const tags = ['left', 'center', 'justify', 'right'];
exports.collectContentPre = (hookName, context, cb) => {
const tname = context.tname;
const state = context.state;
const lineAttributes = state.lineAttributes;
const tagIndex = tags.indexOf(tname);
if (tname === 'div' || tname === 'p') {
delete lineAttributes.align;
}
if (tagIndex >= 0) {
lineAttributes.align = tags[tagIndex];
}
return cb();
};
// I don't even know when this is run..
exports.collectContentPost = (hookName, context, cb) => {
const tname = context.tname;
const state = context.state;
const lineAttributes = state.lineAttributes;
const tagIndex = tags.indexOf(tname);
if (tagIndex >= 0) {
delete lineAttributes.align;
}
return cb();
};

View file

@ -0,0 +1,25 @@
<li class="separator acl-write"></li>
<li data-type="button" data-key="alignLeft" data-l10n-id="ep_align.toolbar.left.title">
<a class="grouped-left ep_align" data-align="0" data-l10n-id="ep_align.toolbar.left.title" title="Align Left" aria-label="Align Left">
<button class="buttonicon buttonicon-align-left ep_align_left" data-align="0" aria-label="Align Left"></button>
</a>
</li>
<li data-type="button" data-key="alignCenter" data-l10n-id="ep_align.toolbar.center.title">
<a class="grouped-middle ep_align" data-align="1" data-l10n-id="ep_align.toolbar.center.title" title="Align Center" aria-label="Align Center">
<button class="buttonicon buttonicon-align-center ep_align_center" data-align="1" aria-label="Align Center"></button>
</a>
</li>
<li data-type="button" data-key="alignRight" data-l10n-id="ep_align.toolbar.right.title">
<a class="grouped-middle ep_align" data-align="3" data-l10n-id="ep_align.toolbar.right.title" title="Align Right" aria-label="Align Right">
<button class="buttonicon buttonicon-align-right ep_align_right" data-align="3" aria-label="Align Right"></button>
</a>
</li>
<li data-type="button" data-key="alignJustify" data-l10n-id="ep_align.toolbar.justify.title">
<a class="grouped-right ep_align" data-align="2" data-l10n-id="ep_align.toolbar.justify.title" title="Align Justify" aria-label="Align Justify">
<button class="buttonicon buttonicon-align-justify ep_align_justify" data-align="2" aria-label="Align Justify"></button>
</a>
</li>

View file

@ -0,0 +1 @@
Headings in MuDoc

View file

@ -0,0 +1,24 @@
{
"parts": [
{
"name": "main",
"client_hooks": {
"aceEditorCSS": "ep_all_headings/static/js/index",
"aceEditEvent": "ep_all_headings/static/js/index",
"aceDomLineProcessLineAttributes": "ep_all_headings/static/js/index",
"postAceInit": "ep_all_headings/static/js/index",
"aceInitialized": "ep_all_headings/static/js/index",
"aceAttribsToClasses": "ep_all_headings/static/js/index",
"collectContentPre": "ep_all_headings/static/js/shared",
"aceRegisterBlockElements": "ep_all_headings/static/js/index"
},
"hooks": {
"eejsBlock_editbarMenuLeft": "ep_all_headings/index",
"collectContentPre": "ep_all_headings/static/js/shared",
"collectContentPost": "ep_all_headings/static/js/shared",
"getLineHTMLForExport": "ep_all_headings/index",
"stylesForExport" : "ep_all_headings/index"
}
}
]
}

View file

@ -0,0 +1,48 @@
'use strict';
const eejs = require('ep_etherpad-lite/node/eejs/');
const Changeset = require('ep_etherpad-lite/static/js/Changeset');
exports.eejsBlock_editbarMenuLeft = (hookName, args, cb) => {
args.content += eejs.require('ep_all_headings/templates/editbarButtons.ejs');
return cb();
};
// Include CSS for HTML export
exports.stylesForExport = () => (
// These should be consistent with client CSS.
'h1{font-size: 2.5em;}\n' +
'h2{font-size: 1.8em;}\n' +
'h3{font-size: 1.5em;}\n' +
'h4{font-size: 1.2em;}\n' +
'code{font-family: RobotoMono;}\n');
const _analyzeLine = (alineAttrs, apool) => {
let header = null;
if (alineAttrs) {
const opIter = Changeset.opIterator(alineAttrs);
if (opIter.hasNext()) {
const op = opIter.next();
header = Changeset.opAttributeValue(op, 'heading', apool);
}
}
return header;
};
// line, apool,attribLine,text
exports.getLineHTMLForExport = async (hookName, context) => {
const header = _analyzeLine(context.attribLine, context.apool);
if (header) {
if (context.text.indexOf('*') === 0) {
context.lineContent = context.lineContent.replace('*', '');
}
const paragraph = context.lineContent.match(/<p([^>]+)?>/);
if (paragraph) {
context.lineContent = context.lineContent.replace('<p', `<${header} `);
context.lineContent = context.lineContent.replace('</p>', `</${header}>`);
} else {
context.lineContent = `<${header}>${context.lineContent}</${header}>`;
}
return context.lineContent;
}
};

View file

@ -0,0 +1,14 @@
{
"@metadata": {
"authors": [
"Mguix"
]
},
"ep_headings.style": "Estil",
"ep_headings.normal": "Normal",
"ep_headings.h1": "Encapçalament 1",
"ep_headings.h2": "Encapçalament 2",
"ep_headings.h3": "Encapçalament 3",
"ep_headings.h4": "Encapçalament 4",
"ep_headings.code": "Codi"
}

View file

@ -0,0 +1,14 @@
{
"@metadata": {
"authors": [
"Spotter"
]
},
"ep_headings.style": "Styl",
"ep_headings.normal": "Normální",
"ep_headings.h1": "Nadpis 1",
"ep_headings.h2": "Nadpis 2",
"ep_headings.h3": "Nadpis 3",
"ep_headings.h4": "Nadpis 4",
"ep_headings.code": "Kód"
}

View file

@ -0,0 +1,14 @@
{
"@metadata": {
"authors": [
"Robin Owain"
]
},
"ep_headings.style": "Math",
"ep_headings.normal": "Normal",
"ep_headings.h1": "Pennawd 1",
"ep_headings.h2": "Pennawd 2",
"ep_headings.h3": "Pennawd 3",
"ep_headings.h4": "Pennawd 4",
"ep_headings.code": "Cod"
}

View file

@ -0,0 +1,9 @@
{
"@metadata": {
"authors": [
"Saederup92"
]
},
"ep_headings.style": "Stil",
"ep_headings.code": "Kode"
}

View file

@ -0,0 +1,12 @@
{
"@metadata": {
"authors": []
},
"ep_headings.style": "Stil",
"ep_headings.normal": "Normal",
"ep_headings.h1": "Überschrift 1",
"ep_headings.h2": "Überschrift 2",
"ep_headings.h3": "Überschrift 3",
"ep_headings.h4": "Überschrift 4",
"ep_headings.code": "Code"
}

View file

@ -0,0 +1,14 @@
{
"@metadata": {
"authors": [
"1917 Ekim Devrimi"
]
},
"ep_headings.style": "Style",
"ep_headings.normal": "Normal",
"ep_headings.h1": "Sername 1",
"ep_headings.h2": "Sername 2",
"ep_headings.h3": "Sername 3",
"ep_headings.h4": "Sername 4",
"ep_headings.code": "Kod"
}

View file

@ -0,0 +1,9 @@
{
"ep_headings.style" : "Style",
"ep_headings.normal" : "Normal",
"ep_headings.h1" : "Heading 1",
"ep_headings.h2" : "Heading 2",
"ep_headings.h3" : "Heading 3",
"ep_headings.h4" : "Heading 4",
"ep_headings.code" : "Code"
}

View file

@ -0,0 +1,12 @@
{
"@metadata": {
"authors": []
},
"ep_headings.style": "Stiilid",
"ep_headings.normal": "Tavaline tekst",
"ep_headings.h1": "Pealkiri 1",
"ep_headings.h2": "Pealkiri 2",
"ep_headings.h3": "Pealkiri 3",
"ep_headings.h4": "Pealkiri 4",
"ep_headings.code": "Kood"
}

View file

@ -0,0 +1,14 @@
{
"@metadata": {
"authors": [
"Izendegi"
]
},
"ep_headings.style": "Estiloa",
"ep_headings.normal": "Normala",
"ep_headings.h1": "Goiburua 1",
"ep_headings.h2": "Goiburua 2",
"ep_headings.h3": "Goiburua 3",
"ep_headings.h4": "Goiburua 4",
"ep_headings.code": "Kodea"
}

View file

@ -0,0 +1,14 @@
{
"@metadata": {
"authors": [
"Maantietäjä"
]
},
"ep_headings.style": "Tyyli",
"ep_headings.normal": "Normaali",
"ep_headings.h1": "Otsikko 1",
"ep_headings.h2": "Otsikko 2",
"ep_headings.h3": "Otsikko 3",
"ep_headings.h4": "Otsikko 4",
"ep_headings.code": "Koodi"
}

View file

@ -0,0 +1,14 @@
{
"@metadata": {
"authors": [
"Verdy p"
]
},
"ep_headings.style": "Style",
"ep_headings.normal": "Normal",
"ep_headings.h1": "Titre 1",
"ep_headings.h2": "Titre 2",
"ep_headings.h3": "Titre 3",
"ep_headings.h4": "Titre 4",
"ep_headings.code": "Code"
}

View file

@ -0,0 +1,14 @@
{
"@metadata": {
"authors": [
"Ghose"
]
},
"ep_headings.style": "Estilo",
"ep_headings.normal": "Normal",
"ep_headings.h1": "Cabeceira 1",
"ep_headings.h2": "Cabeceira 2",
"ep_headings.h3": "Cabeceira 3",
"ep_headings.h4": "Cabeceira 4",
"ep_headings.code": "Código"
}

View file

@ -0,0 +1,14 @@
{
"@metadata": {
"authors": [
"YaronSh"
]
},
"ep_headings.style": "סגנון",
"ep_headings.normal": "רגיל",
"ep_headings.h1": "כותרת רמה 1",
"ep_headings.h2": "כותרת רמה 2",
"ep_headings.h3": "כותרת רמה 3",
"ep_headings.h4": "כותרת רמה 4",
"ep_headings.code": "קוד"
}

View file

@ -0,0 +1,12 @@
{
"@metadata": {
"authors": []
},
"ep_headings.style": "Stílus",
"ep_headings.normal": "Normál",
"ep_headings.h1": "Címsor 1",
"ep_headings.h2": "Címsor 2",
"ep_headings.h3": "Címsor 3",
"ep_headings.h4": "Címsor 4",
"ep_headings.code": "Kód"
}

View file

@ -0,0 +1,14 @@
{
"@metadata": {
"authors": [
"Beta16"
]
},
"ep_headings.style": "Stile",
"ep_headings.normal": "Normale",
"ep_headings.h1": "Titolo 1",
"ep_headings.h2": "Titolo 2",
"ep_headings.h3": "Titolo 3",
"ep_headings.h4": "Titolo 4",
"ep_headings.code": "Codice"
}

View file

@ -0,0 +1,15 @@
{
"@metadata": {
"authors": [
"Ykhwong",
"그냥기여자"
]
},
"ep_headings.style": "스타일",
"ep_headings.normal": "표준",
"ep_headings.h1": "제목 1",
"ep_headings.h2": "제목 2",
"ep_headings.h3": "제목 3",
"ep_headings.h4": "제목 4",
"ep_headings.code": "코드"
}

View file

@ -0,0 +1,14 @@
{
"@metadata": {
"authors": [
"Bjankuloski06"
]
},
"ep_headings.style": "Стил",
"ep_headings.normal": "Нормален",
"ep_headings.h1": "Наслов 1",
"ep_headings.h2": "Наслов 2",
"ep_headings.h3": "Наслов 3",
"ep_headings.h4": "Наслов 4",
"ep_headings.code": "Код"
}

View file

@ -0,0 +1,14 @@
{
"@metadata": {
"authors": [
"Andibecker"
]
},
"ep_headings.style": "ပုံစံ",
"ep_headings.normal": "ပုံမှန်ပါပဲ",
"ep_headings.h1": "ခေါင်းစဉ် ၁",
"ep_headings.h2": "ခေါင်းစီး ၂",
"ep_headings.h3": "ခေါင်းစဉ် ၃",
"ep_headings.h4": "ခေါင်းစဉ် ၄",
"ep_headings.code": "ကုဒ်"
}

View file

@ -0,0 +1,15 @@
{
"@metadata": {
"authors": [
"Aranka",
"woeterman_94"
]
},
"ep_headings.style": "Stijl",
"ep_headings.normal": "Normaal",
"ep_headings.h1": "Kop 1",
"ep_headings.h2": "Kop 2",
"ep_headings.h3": "Kop 3",
"ep_headings.h4": "Kop 4",
"ep_headings.code": "Code"
}

View file

@ -0,0 +1,14 @@
{
"@metadata": {
"authors": [
"Quentí"
]
},
"ep_headings.style": "Estil",
"ep_headings.normal": "Normal",
"ep_headings.h1": "Títol 1",
"ep_headings.h2": "Títol 2",
"ep_headings.h3": "Títol 3",
"ep_headings.h4": "Títol 4",
"ep_headings.code": "Còdi"
}

View file

@ -0,0 +1,12 @@
{
"@metadata": {
"authors": []
},
"ep_headings.style": "Styl",
"ep_headings.normal": "Normalny",
"ep_headings.h1": "Nagłówek 1",
"ep_headings.h2": "Nagłówek 2",
"ep_headings.h3": "Nagłówek 3",
"ep_headings.h4": "Nagłówek 4",
"ep_headings.code": "Kod"
}

View file

@ -0,0 +1,14 @@
{
"@metadata": {
"authors": [
"Borichèt"
]
},
"ep_headings.style": "Stil",
"ep_headings.normal": "Normal",
"ep_headings.h1": "Antestassion 1",
"ep_headings.h2": "Antestassion 2",
"ep_headings.h3": "Antestassion 3",
"ep_headings.h4": "Antestassion 4",
"ep_headings.code": "Còdes"
}

View file

@ -0,0 +1,15 @@
{
"@metadata": {
"authors": [
"Eduardo Addad de Oliveira",
"Eduardoaddad"
]
},
"ep_headings.style": "Estilo",
"ep_headings.normal": "Normal",
"ep_headings.h1": "Nível 1",
"ep_headings.h2": "Nível 2",
"ep_headings.h3": "Nível 3",
"ep_headings.h4": "Nível 4",
"ep_headings.code": "Código"
}

View file

@ -0,0 +1,14 @@
{
"@metadata": {
"authors": [
"Guilha"
]
},
"ep_headings.style": "Estilo",
"ep_headings.normal": "Normal",
"ep_headings.h1": "Título 1",
"ep_headings.h2": "Título 2",
"ep_headings.h3": "Título 3",
"ep_headings.h4": "Título 4",
"ep_headings.code": "Código"
}

View file

@ -0,0 +1,8 @@
{
"@metadata": {
"authors": [
"BryanDavis"
]
},
"ep_headings.style": "{{Identical|Style}}"
}

View file

@ -0,0 +1,14 @@
{
"@metadata": {
"authors": [
"Joetaras"
]
},
"ep_headings.style": "Stile",
"ep_headings.normal": "Normale",
"ep_headings.h1": "Testate 1",
"ep_headings.h2": "Testate 2",
"ep_headings.h3": "Testate 3",
"ep_headings.h4": "Testate 4",
"ep_headings.code": "Codece"
}

View file

@ -0,0 +1,12 @@
{
"@metadata": {
"authors": []
},
"ep_headings.style": "Стили",
"ep_headings.normal": "Обычный текст",
"ep_headings.h1": "Заголовок 1",
"ep_headings.h2": "Заголовок 2",
"ep_headings.h3": "Заголовок 3",
"ep_headings.h4": "Заголовок 4",
"ep_headings.code": "Код"
}

View file

@ -0,0 +1,14 @@
{
"@metadata": {
"authors": [
"Ajeje Brazorf"
]
},
"ep_headings.style": "Stili",
"ep_headings.normal": "Nurmali",
"ep_headings.h1": "Tìtulu 1",
"ep_headings.h2": "Tìtulu 2",
"ep_headings.h3": "Tìtulu 3",
"ep_headings.h4": "Tìtulu 4",
"ep_headings.code": "Còdici"
}

View file

@ -0,0 +1,14 @@
{
"@metadata": {
"authors": [
"Yardom78"
]
},
"ep_headings.style": "Štýl",
"ep_headings.normal": "Normálne",
"ep_headings.h1": "Nadpis 1",
"ep_headings.h2": "Nadpis 2",
"ep_headings.h3": "Nadpis 3",
"ep_headings.h4": "Nadpis 4",
"ep_headings.code": "Kód"
}

View file

@ -0,0 +1,12 @@
{
"@metadata": {
"authors": [
"HairyFotr"
]
},
"ep_headings.style": "Slog",
"ep_headings.h1": "Naslov 1",
"ep_headings.h2": "Naslov 2",
"ep_headings.h3": "Naslov 3",
"ep_headings.h4": "Naslov 4"
}

View file

@ -0,0 +1,14 @@
{
"@metadata": {
"authors": [
"Besnik b"
]
},
"ep_headings.style": "Stil",
"ep_headings.normal": "Normal",
"ep_headings.h1": "Krye 1",
"ep_headings.h2": "Krye 2",
"ep_headings.h3": "Krye 3",
"ep_headings.h4": "Krye 4",
"ep_headings.code": "Kod"
}

View file

@ -0,0 +1,12 @@
{
"@metadata": {
"authors": []
},
"ep_headings.style": "Stil",
"ep_headings.normal": "Normal",
"ep_headings.h1": "Rubrik 1",
"ep_headings.h2": "Rubrik 2",
"ep_headings.h3": "Rubrik 3",
"ep_headings.h4": "Rubrik 4",
"ep_headings.code": "Kod"
}

View file

@ -0,0 +1,14 @@
{
"@metadata": {
"authors": [
"Andibecker"
]
},
"ep_headings.style": "Mtindo",
"ep_headings.normal": "Kawaida",
"ep_headings.h1": "Kichwa 1",
"ep_headings.h2": "Kichwa 2",
"ep_headings.h3": "Kichwa 3",
"ep_headings.h4": "Kichwa 4",
"ep_headings.code": "Kanuni"
}

View file

@ -0,0 +1,14 @@
{
"@metadata": {
"authors": [
"Andibecker"
]
},
"ep_headings.style": "สไตล์",
"ep_headings.normal": "ปกติ",
"ep_headings.h1": "หัวเรื่อง 1",
"ep_headings.h2": "หัวเรื่อง 2",
"ep_headings.h3": "หัวเรื่อง 3",
"ep_headings.h4": "หัวเรื่อง 4",
"ep_headings.code": "รหัส"
}

View file

@ -0,0 +1,14 @@
{
"@metadata": {
"authors": [
"Mrkczr"
]
},
"ep_headings.style": "Istilo",
"ep_headings.normal": "Karaniwan",
"ep_headings.h1": "Pamuhatan 1",
"ep_headings.h2": "Pamuhatan 2",
"ep_headings.h3": "Pamuhatan 3",
"ep_headings.h4": "Pamuhatan 4",
"ep_headings.code": "Kodigo"
}

View file

@ -0,0 +1,14 @@
{
"@metadata": {
"authors": [
"MuratTheTurkish"
]
},
"ep_headings.style": "Stil",
"ep_headings.normal": "Normal",
"ep_headings.h1": "Başlık 1",
"ep_headings.h2": "Başlık 2",
"ep_headings.h3": "Başlık 3",
"ep_headings.h4": "Başlık 4",
"ep_headings.code": "Kod"
}

View file

@ -0,0 +1,14 @@
{
"@metadata": {
"authors": [
"DDPAT"
]
},
"ep_headings.style": "Стиль",
"ep_headings.normal": "Нормальний",
"ep_headings.h1": "Заголовок 1",
"ep_headings.h2": "Заголовок 2",
"ep_headings.h3": "Заголовок 3",
"ep_headings.h4": "Заголовок 4",
"ep_headings.code": "Код"
}

View file

@ -0,0 +1,14 @@
{
"@metadata": {
"authors": [
"Kly"
]
},
"ep_headings.style": "样式",
"ep_headings.normal": "正文",
"ep_headings.h1": "标题 1",
"ep_headings.h2": "标题 2",
"ep_headings.h3": "标题 3",
"ep_headings.h4": "标题 4",
"ep_headings.code": "代码"
}

View file

@ -0,0 +1,14 @@
{
"@metadata": {
"authors": [
"列维劳德"
]
},
"ep_headings.style": "样式",
"ep_headings.normal": "正常",
"ep_headings.h1": "标题 1",
"ep_headings.h2": "标题 2",
"ep_headings.h3": "标题 3",
"ep_headings.h4": "标题 4",
"ep_headings.code": "代码"
}

View file

@ -0,0 +1,14 @@
{
"@metadata": {
"authors": [
"Kly"
]
},
"ep_headings.style": "樣式",
"ep_headings.normal": "一般",
"ep_headings.h1": "標題 1",
"ep_headings.h2": "標題 2",
"ep_headings.h3": "標題 3",
"ep_headings.h4": "標題 4",
"ep_headings.code": "代碼"
}

View file

@ -0,0 +1,71 @@
{
"_from": "ep_all_headings",
"_id": "ep_all_headings@0.0.1",
"_inBundle": false,
"_integrity": "sha512-wi4NepzLTh4NhafeMPvEZsH9D73UQ8S+I5cK7Lup4UDuRMW4KRSm5UMu+g03uXDEBSLUPFQOK3HX0gzf4oTbLw==",
"_location": "/ep_all_headings",
"_phantomChildren": {},
"_requested": {
"type": "tag",
"registry": true,
"raw": "ep_all_headings",
"name": "ep_all_headings",
"escapedName": "ep_all_headings",
"rawSpec": "",
"saveSpec": null,
"fetchSpec": "latest"
},
"_requiredBy": [
"#USER"
],
"_resolved": "https://registry.npmjs.org/ep_all_headings/-/ep_all_headings-0.0.1.tgz",
"_shasum": "3581983c07bfd2f74bc98b79dab53e4427a81237",
"_spec": "ep_all_headings",
"_where": "/Users/dev/Github/Edumatica/MuDocs/src",
"author": {
"name": "Akhil Naidu",
"email": "kaparapu.akhilnaidu@gmail.com"
},
"bugs": {
"url": "https://github.com/ether/ep_all_headings/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "Adds heading support to Mu Doc Lite.",
"devDependencies": {
"eslint": "^7.32.0",
"eslint-config-etherpad": "^2.0.2",
"eslint-plugin-cypress": "^2.12.1",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-mocha": "^9.0.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prefer-arrow": "^1.2.3",
"eslint-plugin-promise": "^5.1.1",
"eslint-plugin-you-dont-need-lodash-underscore": "^6.12.0"
},
"engines": {
"node": ">=12.13.0"
},
"eslintConfig": {
"root": true,
"extends": "etherpad/plugin"
},
"homepage": "https://github.com/akhil-naidu/ep_all_headings#readme",
"keywords": [
"mudoc",
"plugin"
],
"name": "ep_all_headings",
"peerDependencies": {
"ep_etherpad-lite": ">=0.0.2"
},
"repository": {
"type": "git",
"url": "git+https://github.com/akhil-nadiu/ep_all_headings.git"
},
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint --fix ."
},
"version": "0.0.1"
}

View file

@ -0,0 +1,11 @@
#innerdocbody h1{font-size: 2.5em;}
#innerdocbody h2{font-size: 1.8em;}
#innerdocbody h3{font-size: 1.5em;}
#innerdocbody h4{font-size: 1.2em;}
#innerdocbody code{font-family: RobotoMono;}
#innerdocbody h1,
#innerdocbody h2,
#innerdocbody h3,
#innerdocbody h4 {
display: inline-block;
}

View file

@ -0,0 +1,121 @@
'use strict';
const cssFiles = ['ep_all_headings/static/css/editor.css'];
// All our tags are block elements, so we just return them.
const tags = ['h1', 'h2', 'h3', 'h4', 'code'];
exports.aceRegisterBlockElements = () => tags;
// Bind the event handler to the toolbar buttons
exports.postAceInit = (hookName, context) => {
const hs = $('#heading-selection');
hs.on('change', function () {
const value = $(this).val();
const intValue = parseInt(value, 10);
if (!isNaN(intValue)) {
context.ace.callWithAce((ace) => {
ace.ace_doInsertHeading(intValue);
}, 'insertheading', true);
hs.val('dummy');
}
});
};
const range = (start, end) => Array.from(
Array(Math.abs(end - start) + 1),
(_, i) => start + i
);
// On caret position change show the current heading
exports.aceEditEvent = (hookName, call) => {
// If it's not a click or a key event and the text hasn't changed then do nothing
const cs = call.callstack;
if (!(cs.type === 'handleClick') && !(cs.type === 'handleKeyEvent') && !(cs.docTextChanged)) {
return false;
}
// If it's an initial setup event then do nothing..
if (cs.type === 'setBaseText' || cs.type === 'setup') return false;
// It looks like we should check to see if this section has this attribute
setTimeout(() => { // avoid race condition..
const attributeManager = call.documentAttributeManager;
const rep = call.rep;
const activeAttributes = {};
$('#heading-selection').val('dummy').niceSelect('update');
const firstLine = rep.selStart[0];
const lastLine = Math.max(firstLine, rep.selEnd[0] - ((rep.selEnd[1] === 0) ? 1 : 0));
let totalNumberOfLines = 0;
range(firstLine, lastLine).forEach((line) => {
totalNumberOfLines++;
const attr = attributeManager.getAttributeOnLine(line, 'heading');
if (!activeAttributes[attr]) {
activeAttributes[attr] = {};
activeAttributes[attr].count = 1;
} else {
activeAttributes[attr].count++;
}
});
$.each(activeAttributes, (k, attr) => {
if (attr.count === totalNumberOfLines) {
// show as active class
const ind = tags.indexOf(k);
$('#heading-selection').val(ind).niceSelect('update');
}
});
}, 250);
};
// Our heading attribute will result in a heaading:h1... :h6 class
exports.aceAttribsToClasses = (hookName, context) => {
if (context.key === 'heading') {
return [`heading:${context.value}`];
}
};
// Here we convert the class heading:h1 into a tag
exports.aceDomLineProcessLineAttributes = (hookName, context) => {
const cls = context.cls;
const headingType = /(?:^| )heading:([A-Za-z0-9]*)/.exec(cls);
if (headingType) {
let tag = headingType[1];
// backward compatibility, we used propose h5 and h6, but not anymore
if (tag === 'h5' || tag === 'h6') tag = 'h4';
if (tags.indexOf(tag) >= 0) {
const modifier = {
preHtml: `<${tag}>`,
postHtml: `</${tag}>`,
processedMarker: true,
};
return [modifier];
}
}
return [];
};
// Once ace is initialized, we set ace_doInsertHeading and bind it to the context
exports.aceInitialized = (hookName, context) => {
const editorInfo = context.editorInfo;
// Passing a level >= 0 will set a heading on the selected lines, level < 0 will remove it.
editorInfo.ace_doInsertHeading = (level) => {
const {documentAttributeManager, rep} = context;
if (!(rep.selStart && rep.selEnd)) return;
if (level >= 0 && tags[level] === undefined) return;
const firstLine = rep.selStart[0];
const lastLine = Math.max(firstLine, rep.selEnd[0] - ((rep.selEnd[1] === 0) ? 1 : 0));
range(firstLine, lastLine).forEach((line) => {
if (level >= 0) {
documentAttributeManager.setAttributeOnLine(line, 'heading', tags[level]);
} else {
documentAttributeManager.removeAttributeOnLine(line, 'heading');
}
});
};
};
exports.aceEditorCSS = () => cssFiles;

View file

@ -0,0 +1,29 @@
'use strict';
const tags = ['h1', 'h2', 'h3', 'h4', 'code'];
exports.collectContentPre = (hookName, context, cb) => {
const tname = context.tname;
const state = context.state;
const lineAttributes = state.lineAttributes;
const tagIndex = tags.indexOf(tname);
if (tname === 'div' || tname === 'p') {
delete lineAttributes.heading;
}
if (tagIndex >= 0) {
lineAttributes.heading = tags[tagIndex];
}
return cb();
};
// I don't even know when this is run..
exports.collectContentPost = (hookName, context, cb) => {
const tname = context.tname;
const state = context.state;
const lineAttributes = state.lineAttributes;
const tagIndex = tags.indexOf(tname);
if (tagIndex >= 0) {
delete lineAttributes.heading;
}
return cb();
};

View file

@ -0,0 +1,12 @@
<li class="separator acl-write"></li>
<li id="headings" class="acl-write">
<select id="heading-selection">
<option value="dummy" selected data-l10n-id="ep_headings.style">Style</option>
<option value="-1" data-l10n-id="ep_headings.normal">Normal</option>
<option value="0" data-l10n-id="ep_headings.h1">Heading 1</option>
<option value="1" data-l10n-id="ep_headings.h2">Heading 2</option>
<option value="2" data-l10n-id="ep_headings.h3">Heading 3</option>
<option value="3" data-l10n-id="ep_headings.h4">Heading 4</option>
<option value="4" data-l10n-id="ep_headings.code">Code</option>
</select>
</li>

View file

@ -0,0 +1 @@
Visually pleasing looks in Mu Doc

View file

@ -0,0 +1,13 @@
{
"parts": [
{
"name": "ep_author_colors",
"client_hooks": {
"postAceInit": "ep_author_colors/static/js/index",
"aceSetAuthorStyle": "ep_author_colors/static/js/index",
"aceEditEvent": "ep_author_colors/static/js/index",
"acePostWriteDomLineHTML": "ep_author_colors/static/js/index"
}
}
]
}

View file

@ -0,0 +1,72 @@
{
"_from": "ep_author_colors",
"_id": "ep_author_colors@0.0.1",
"_inBundle": false,
"_integrity": "sha512-MX9iInCMKENgvi9dLzhAO/AnShx1a2lmhkBLPz5Az0saA0veUIyEAkzpFrxeag33Uonytb4OOAuIe1sucE24zQ==",
"_location": "/ep_author_colors",
"_phantomChildren": {},
"_requested": {
"type": "tag",
"registry": true,
"raw": "ep_author_colors",
"name": "ep_author_colors",
"escapedName": "ep_author_colors",
"rawSpec": "",
"saveSpec": null,
"fetchSpec": "latest"
},
"_requiredBy": [
"#USER"
],
"_resolved": "https://registry.npmjs.org/ep_author_colors/-/ep_author_colors-0.0.1.tgz",
"_shasum": "a39958ae24104b269ce76db4ad2c379b737450fd",
"_spec": "ep_author_colors",
"_where": "/Users/dev/Github/Edumatica/MuDocs/src",
"bugs": {
"url": "https://github.com/ether/ep_author_colors/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "Mudoc plugin that uses colored underlines instead of colored backgrounds to indicate authorship.",
"devDependencies": {
"eslint": "^7.32.0",
"eslint-config-etherpad": "^2.0.2",
"eslint-plugin-cypress": "^2.12.1",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-mocha": "^9.0.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prefer-arrow": "^1.2.3",
"eslint-plugin-promise": "^5.1.1",
"eslint-plugin-you-dont-need-lodash-underscore": "^6.12.0"
},
"engines": {
"node": ">=12.13.0"
},
"eslintConfig": {
"root": true,
"extends": "etherpad/plugin"
},
"funding": {
"type": "individual",
"url": "https://edumatica.io/"
},
"homepage": "https://github.com/akhil-naidu/ep_author_colors#readme",
"keywords": [
"mudoc",
"plugin"
],
"license": "MIT",
"name": "ep_author_colors",
"peerDependencies": {
"ep_etherpad-lite": ">=0.0.2"
},
"repository": {
"type": "git",
"url": "git+https://github.com/akhil-naidu/ep_author_colors.git"
},
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint --fix ."
},
"version": "0.0.1"
}

View file

@ -0,0 +1,222 @@
'use strict';
let $sidedivinner;
let init;
exports.postAceInit = (hookName, context) => {
$sidedivinner = $('iframe[name="ace_outer"]').contents().find('#sidedivinner');
if (!$('#editorcontainerbox').hasClass('flex-layout')) {
return $.gritter.add({
title: 'Error',
text: 'ep_author_colors: Please upgrade to Mudoc 0.0.2 for this plugin to work correctly',
sticky: true,
class_name: 'error',
});
}
};
const derivePrimaryAuthor = ($node) => {
let mPA, authorClass;
const byAuthor = new Map();
$node.find('span').each(function () {
const $this = $(this);
for (const spanclass of this.classList) {
if (spanclass.startsWith('author')) {
byAuthor.set(spanclass, (byAuthor.get(spanclass) || 0) + $this.text().length);
}
}
});
mPA = 0;
authorClass = null;
for (const [author, value] of byAuthor) {
if (value <= mPA) continue;
mPA = value;
authorClass = author;
}
return authorClass;
};
const toggleAuthor = ($node, prefix, authorClass) => {
if ($node.length === 0) return true;
let hasClass = false;
const myClass = `${prefix}-${authorClass}`;
for (const c of $node[0].classList) {
if (c.indexOf(prefix) !== 0) continue;
if (c === myClass) {
hasClass = true;
} else {
$node.removeClass(c);
}
}
if (hasClass) {
return false;
}
$node.addClass(myClass);
return true;
};
const updateDomline = ($node) => {
const lineNumber = $node.index() + 1;
if (!lineNumber) {
return false;
}
const authorClass = $node.text().length > 0 ? derivePrimaryAuthor($node) : 'none';
toggleAuthor($node, 'primary', authorClass);
return authorViewUpdate($node, lineNumber, null, authorClass);
};
const extractAuthor = ($node) => {
let ref$, ref1$;
return (ref$ = (() => {
const results$ = [];
for (const a of $node[0].classList) {
if (a.startsWith('primary-')) results$.push(a);
}
return results$;
})()) != null ? (ref1$ = ref$[0]) != null ? ref1$.replace(/^primary-/, '') : void 8 : void 8;
};
const authorViewUpdate = ($node, lineNumber, prevAuthor, authorClass) => {
let prev, ref$, authorChanged, logicalPrevAuthor;
if (!$sidedivinner) {
$sidedivinner = $('iframe[name="ace_outer"]').contents().find('#sidedivinner');
}
const $authorContainer = $sidedivinner.find(`div:nth-child(${lineNumber})`);
if (authorClass == null) authorClass = extractAuthor($node);
if (!prevAuthor) {
prev = $authorContainer;
while ((prev = prev.prev()) && prev.length) {
prevAuthor = extractAuthor(prev);
if (prevAuthor !== 'none') {
break;
}
}
}
$authorContainer.toggleClass('concise', prevAuthor === authorClass);
const prevId = (ref$ = $authorContainer.attr('id')) != null ? ref$.replace(/^ref-/, '') : void 8;
if (prevId === $node.attr('id')) {
authorChanged = toggleAuthor($authorContainer, 'primary', authorClass);
if (!authorChanged) {
return;
}
} else {
$authorContainer.attr('id', `ref-${$node.attr('id')}`);
toggleAuthor($authorContainer, 'primary', authorClass);
}
const next = $node.next();
if (next.length) {
logicalPrevAuthor = authorClass === 'none' ? prevAuthor : authorClass;
return authorViewUpdate(next, lineNumber + 1, logicalPrevAuthor);
}
};
const getAuthorClassName = (author) => `author-${author.replace(/[^a-y0-9]/g, (c) => {
if (c === '.') {
return '-';
} else {
return `z${c.charCodeAt(0)}z`;
}
})}`;
const outerInit = (outerDynamicCSS) => {
const x$ = outerDynamicCSS.selectorStyle('#sidedivinner.authorColors > div');
x$.borderRight = 'solid 5px transparent';
const y$ = outerDynamicCSS.selectorStyle('#sidedivinner.authorColors > div.concise::before');
y$.content = "' '";
const z$ = outerDynamicCSS.selectorStyle('#sidedivinner.authorColors > div::before');
z$.fontSize = '11px';
z$.textTransform = 'capitalize';
z$.textOverflow = 'ellipsis';
z$.overflow = 'hidden';
return init = true;
};
exports.aceSetAuthorStyle = (hookName, context) => {
const {author, dynamicCSS, info, outerDynamicCSS, parentDynamicCSS} = context;
if (!init) {
outerInit(outerDynamicCSS);
}
const authorClass = getAuthorClassName(author);
const authorSelector = `.authorColors span.${authorClass}`;
if (info) {
const color = info.bgcolor;
if (!color) {
return 1;
}
const authorName = authorNameAndColorFromAuthorId(author).name;
const x$ = dynamicCSS.selectorStyle(`#innerdocbody.authorColors span.${authorClass}`);
x$.borderBottom = `2px solid ${color}`;
x$.paddingBottom = '1px';
const y$ = parentDynamicCSS.selectorStyle(authorSelector);
y$.borderBottom = `2px solid ${color}`;
y$.paddingBottom = '1px';
const z$ = dynamicCSS.selectorStyle(
`#innerdocbody.authorColors .primary-${authorClass} span.${authorClass}`);
z$.borderBottom = '0px';
const z1$ = outerDynamicCSS.selectorStyle(
`#sidedivinner.authorColors > div.primary-${authorClass}`);
z1$.borderRight = `solid 5px ${color}`;
const z2$ = outerDynamicCSS.selectorStyle(
`#sidedivinner.authorColors > div.primary-${authorClass}::before`);
z2$.content = `'${authorName}'`;
z2$.paddingLeft = '5px';
z2$.whiteSpace = 'nowrap';
const z3$ = outerDynamicCSS.selectorStyle(
`.line-numbers-hidden #sidedivinner.authorColors > div.primary-${authorClass}::before`);
z3$.paddingRight = '12px';
} else {
dynamicCSS.removeSelectorStyle(`#innerdocbody.authorColors span.${authorClass}`);
parentDynamicCSS.removeSelectorStyle(authorSelector);
}
return 1;
};
const authorNameAndColorFromAuthorId = (authorId) => {
let authorObj;
const myAuthorId = pad.myUserInfo.userId;
if (myAuthorId === authorId) {
return {
name: 'Me',
color: pad.myUserInfo.colorId,
};
}
authorObj = {};
$('#otheruserstable > tbody > tr').each(function () {
let x$;
if (authorId === $(this).data('authorid')) {
x$ = $(this);
x$.find('.usertdname').each(function () {
return authorObj.name = $(this).text() || 'Unknown Author';
});
x$.find('.usertdswatch > div').each(function () {
return authorObj.color = $(this).css('background-color');
});
return authorObj;
}
});
if (!authorObj || !authorObj.name) {
authorObj = clientVars.collab_client_vars.historicalAuthorData[authorId];
}
return authorObj || {
name: 'Unknown Author',
color: '#fff',
};
};
exports.acePostWriteDomLineHTML =
(hookName, {node}) => setTimeout(() => updateDomline($(node)), 200);
exports.aceEditEvent = (hookName, {callstack}) => {
if (callstack.type !== 'setWraps') {
return;
}
const x$ = $('iframe[name="ace_outer"]').contents();
x$.find('#sidediv').css({
'padding-right': '0px',
});
x$.find('#sidedivinner').css({
'max-width': '180px',
'overflow': 'hidden',
});
return x$;
};

View file

@ -0,0 +1 @@
Checklist plugin for MuDoc

View file

@ -0,0 +1,14 @@
var eejs = require('ep_etherpad-lite/node/eejs/');
exports.eejsBlock_scripts = function (hook_name, args, cb) {
// args.content += eejs.require('ep_checklist/static/js/checklist.js');
args.content = args.content + '<script src="../static/plugins/ep_checklist/static/js/checklist.js" type="text/css"></script>';
return cb();
}
exports.eejsBlock_styles = function (hook_name, args, cb) {
// args.content += eejs.require('ep_checklist/static/css/fontello.css');
args.content = args.content + '<link rel="stylesheet" href="../static/plugins/ep_checklist/static/css/fontello.css" type="text/css" />';
return cb();
}

View file

@ -0,0 +1,21 @@
{
"parts":[
{
"name": "checklist",
"client_hooks": {
"aceEditorCSS": "ep_checklist/static/js/checklist",
"aceDomLineProcessLineAttributes": "ep_checklist/static/js/checklist",
"postAceInit": "ep_checklist/static/js/checklist",
"aceInitialized": "ep_checklist/static/js/checklist",
"collectContentPre": "ep_checklist/static/js/shared",
"aceAttribsToClasses": "ep_checklist/static/js/checklist"
},
"hooks": {
"eejsBlock_scripts": "ep_checklist/checklist",
"eejsBlock_styles": "ep_checklist/checklist",
"collectContentPre": "ep_checklist/static/js/shared",
"collectContentPost": "ep_checklist/static/js/shared"
}
}
]
}

Some files were not shown because too many files have changed in this diff Show more