diff --git a/package-lock.json b/package-lock.json index 5ded18a9..ee53d5d0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -60,6 +60,9 @@ "react-syntax-highlighter": "^15.5.0", "redux": "^4.2.1", "rehype-katex": "^6.0.3", + "rehype-raw": "^6.1.1", + "remark-directive": "^2.0.1", + "remark-directive-rehype": "^0.4.2", "remark-emoji": "^3.1.1", "remark-gfm": "^3.0.1", "remark-math": "^5.1.1", @@ -5135,6 +5138,11 @@ "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz", "integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==" }, + "node_modules/@types/parse5": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/@types/parse5/-/parse5-6.0.3.tgz", + "integrity": "sha512-SuT16Q1K51EAVPz1K29DJ/sXjhSQ0zjvsypYJ6tlwVsRV9jwW5Adq2ch8Dq8kDBCkYnELS7N7VNCSB5nC56t/g==" + }, "node_modules/@types/prop-types": { "version": "15.7.5", "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.5.tgz", @@ -7078,6 +7086,15 @@ "url": "https://github.com/sponsors/wooorm" } }, + "node_modules/character-entities-html4": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/character-entities-html4/-/character-entities-html4-2.1.0.tgz", + "integrity": "sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/character-entities-legacy": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-1.1.4.tgz", @@ -10284,6 +10301,50 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/hast-util-raw": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/hast-util-raw/-/hast-util-raw-7.2.3.tgz", + "integrity": "sha512-RujVQfVsOrxzPOPSzZFiwofMArbQke6DJjnFfceiEbFh7S05CbPt0cYN+A5YeD3pso0JQk6O1aHBnx9+Pm2uqg==", + "dependencies": { + "@types/hast": "^2.0.0", + "@types/parse5": "^6.0.0", + "hast-util-from-parse5": "^7.0.0", + "hast-util-to-parse5": "^7.0.0", + "html-void-elements": "^2.0.0", + "parse5": "^6.0.0", + "unist-util-position": "^4.0.0", + "unist-util-visit": "^4.0.0", + "vfile": "^5.0.0", + "web-namespaces": "^2.0.0", + "zwitch": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/hast-util-raw/node_modules/parse5": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz", + "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==" + }, + "node_modules/hast-util-to-parse5": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/hast-util-to-parse5/-/hast-util-to-parse5-7.1.0.tgz", + "integrity": "sha512-YNRgAJkH2Jky5ySkIqFXTQiaqcAtJyVE+D5lkN6CdtOqrnkLfGYYrEcKuHOJZlp+MwjSwuD3fZuawI+sic/RBw==", + "dependencies": { + "@types/hast": "^2.0.0", + "comma-separated-tokens": "^2.0.0", + "property-information": "^6.0.0", + "space-separated-tokens": "^2.0.0", + "web-namespaces": "^2.0.0", + "zwitch": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/hast-util-to-text": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/hast-util-to-text/-/hast-util-to-text-3.1.2.tgz", @@ -10416,6 +10477,15 @@ "node": ">=12" } }, + "node_modules/html-void-elements": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/html-void-elements/-/html-void-elements-2.0.1.tgz", + "integrity": "sha512-0quDb7s97CfemeJAnW9wC0hw78MtW7NU3hqtCD75g2vFlDLt36llsYD7uB7SUzojLMP24N5IatXf7ylGXiGG9A==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/http-proxy-agent": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz", @@ -12328,6 +12398,101 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/mdast-util-directive": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/mdast-util-directive/-/mdast-util-directive-2.2.4.tgz", + "integrity": "sha512-sK3ojFP+jpj1n7Zo5ZKvoxP1MvLyzVG63+gm40Z/qI00avzdPCYxt7RBMgofwAva9gBjbDBWVRB/i+UD+fUCzQ==", + "dependencies": { + "@types/mdast": "^3.0.0", + "@types/unist": "^2.0.0", + "mdast-util-from-markdown": "^1.3.0", + "mdast-util-to-markdown": "^1.5.0", + "parse-entities": "^4.0.0", + "stringify-entities": "^4.0.0", + "unist-util-visit-parents": "^5.1.3" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-directive/node_modules/character-entities-legacy": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-3.0.0.tgz", + "integrity": "sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/mdast-util-directive/node_modules/character-reference-invalid": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-2.0.1.tgz", + "integrity": "sha512-iBZ4F4wRbyORVsu0jPV7gXkOsGYjGHPmAyv+HiHG8gi5PtC9KI2j1+v8/tlibRvjoWX027ypmG/n0HtO5t7unw==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/mdast-util-directive/node_modules/is-alphabetical": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-2.0.1.tgz", + "integrity": "sha512-FWyyY60MeTNyeSRpkM2Iry0G9hpr7/9kD40mD/cGQEuilcZYS4okz8SN2Q6rLCJ8gbCt6fN+rC+6tMGS99LaxQ==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/mdast-util-directive/node_modules/is-alphanumerical": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-2.0.1.tgz", + "integrity": "sha512-hmbYhX/9MUMF5uh7tOXyK/n0ZvWpad5caBA17GsC6vyuCqaWliRG5K1qS9inmUhEMaOBIW7/whAnSwveW/LtZw==", + "dependencies": { + "is-alphabetical": "^2.0.0", + "is-decimal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/mdast-util-directive/node_modules/is-decimal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-2.0.1.tgz", + "integrity": "sha512-AAB9hiomQs5DXWcRB1rqsxGUstbRroFOPPVAomNk/3XHR5JyEZChOyTWe2oayKnsSsr/kcGqF+z6yuH6HHpN0A==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/mdast-util-directive/node_modules/is-hexadecimal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-2.0.1.tgz", + "integrity": "sha512-DgZQp241c8oO6cA1SbTEWiXeoxV42vlcJxgH+B3hi1AiqqKruZR3ZGF8In3fj4+/y/7rHvlOZLZtgJ/4ttYGZg==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/mdast-util-directive/node_modules/parse-entities": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-4.0.1.tgz", + "integrity": "sha512-SWzvYcSJh4d/SGLIOQfZ/CoNv6BTlI6YEQ7Nj82oDVnRpwe/Z/F1EMx42x3JAOwGBlCjeCH0BRJQbQ/opHL17w==", + "dependencies": { + "@types/unist": "^2.0.0", + "character-entities": "^2.0.0", + "character-entities-legacy": "^3.0.0", + "character-reference-invalid": "^2.0.0", + "decode-named-character-reference": "^1.0.0", + "is-alphanumerical": "^2.0.0", + "is-decimal": "^2.0.0", + "is-hexadecimal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/mdast-util-find-and-replace": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/mdast-util-find-and-replace/-/mdast-util-find-and-replace-2.2.2.tgz", @@ -12726,6 +12891,101 @@ "uvu": "^0.5.0" } }, + "node_modules/micromark-extension-directive": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/micromark-extension-directive/-/micromark-extension-directive-2.2.0.tgz", + "integrity": "sha512-LWc2mGlJlPEcESz4IHNJR/tpJfWJEEFHGM+6vgCZGXkKMXc/y8rCKB07x5ZNnafIFe0/sjt6DIIihk78/Egj5Q==", + "dependencies": { + "micromark-factory-space": "^1.0.0", + "micromark-factory-whitespace": "^1.0.0", + "micromark-util-character": "^1.0.0", + "micromark-util-symbol": "^1.0.0", + "micromark-util-types": "^1.0.0", + "parse-entities": "^4.0.0", + "uvu": "^0.5.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/micromark-extension-directive/node_modules/character-entities-legacy": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-3.0.0.tgz", + "integrity": "sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/micromark-extension-directive/node_modules/character-reference-invalid": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-2.0.1.tgz", + "integrity": "sha512-iBZ4F4wRbyORVsu0jPV7gXkOsGYjGHPmAyv+HiHG8gi5PtC9KI2j1+v8/tlibRvjoWX027ypmG/n0HtO5t7unw==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/micromark-extension-directive/node_modules/is-alphabetical": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-2.0.1.tgz", + "integrity": "sha512-FWyyY60MeTNyeSRpkM2Iry0G9hpr7/9kD40mD/cGQEuilcZYS4okz8SN2Q6rLCJ8gbCt6fN+rC+6tMGS99LaxQ==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/micromark-extension-directive/node_modules/is-alphanumerical": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-2.0.1.tgz", + "integrity": "sha512-hmbYhX/9MUMF5uh7tOXyK/n0ZvWpad5caBA17GsC6vyuCqaWliRG5K1qS9inmUhEMaOBIW7/whAnSwveW/LtZw==", + "dependencies": { + "is-alphabetical": "^2.0.0", + "is-decimal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/micromark-extension-directive/node_modules/is-decimal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-2.0.1.tgz", + "integrity": "sha512-AAB9hiomQs5DXWcRB1rqsxGUstbRroFOPPVAomNk/3XHR5JyEZChOyTWe2oayKnsSsr/kcGqF+z6yuH6HHpN0A==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/micromark-extension-directive/node_modules/is-hexadecimal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-2.0.1.tgz", + "integrity": "sha512-DgZQp241c8oO6cA1SbTEWiXeoxV42vlcJxgH+B3hi1AiqqKruZR3ZGF8In3fj4+/y/7rHvlOZLZtgJ/4ttYGZg==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/micromark-extension-directive/node_modules/parse-entities": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-4.0.1.tgz", + "integrity": "sha512-SWzvYcSJh4d/SGLIOQfZ/CoNv6BTlI6YEQ7Nj82oDVnRpwe/Z/F1EMx42x3JAOwGBlCjeCH0BRJQbQ/opHL17w==", + "dependencies": { + "@types/unist": "^2.0.0", + "character-entities": "^2.0.0", + "character-entities-legacy": "^3.0.0", + "character-reference-invalid": "^2.0.0", + "decode-named-character-reference": "^1.0.0", + "is-alphanumerical": "^2.0.0", + "is-decimal": "^2.0.0", + "is-hexadecimal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/micromark-extension-gfm": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/micromark-extension-gfm/-/micromark-extension-gfm-2.0.1.tgz", @@ -17452,6 +17712,20 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/rehype-raw": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/rehype-raw/-/rehype-raw-6.1.1.tgz", + "integrity": "sha512-d6AKtisSRtDRX4aSPsJGTfnzrX2ZkHQLE5kiUuGOeEoLpbEulFF4hj0mLPbsa+7vmguDKOVVEQdHKDSwoaIDsQ==", + "dependencies": { + "@types/hast": "^2.0.0", + "hast-util-raw": "^7.2.0", + "unified": "^10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/remark": { "version": "14.0.2", "resolved": "https://registry.npmjs.org/remark/-/remark-14.0.2.tgz", @@ -17467,6 +17741,61 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/remark-directive": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/remark-directive/-/remark-directive-2.0.1.tgz", + "integrity": "sha512-oosbsUAkU/qmUE78anLaJePnPis4ihsE7Agp0T/oqTzvTea8pOiaYEtfInU/+xMOVTS9PN5AhGOiaIVe4GD8gw==", + "dependencies": { + "@types/mdast": "^3.0.0", + "mdast-util-directive": "^2.0.0", + "micromark-extension-directive": "^2.0.0", + "unified": "^10.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-directive-rehype": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/remark-directive-rehype/-/remark-directive-rehype-0.4.2.tgz", + "integrity": "sha512-T6e+IG+BwqU4++MK54vFb+KDFjs3a+tHeK6E0T0ctR1FSyngolfDtAEzqxHWlRzQZqGi2sB4DFXry6oqH87D/g==", + "dependencies": { + "hastscript": "^7.0.2", + "unist-util-map": "^3.1.2" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + } + }, + "node_modules/remark-directive-rehype/node_modules/hast-util-parse-selector": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/hast-util-parse-selector/-/hast-util-parse-selector-3.1.1.tgz", + "integrity": "sha512-jdlwBjEexy1oGz0aJ2f4GKMaVKkA9jwjr4MjAAI22E5fM/TXVZHuS5OpONtdeIkRKqAaryQ2E9xNQxijoThSZA==", + "dependencies": { + "@types/hast": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-directive-rehype/node_modules/hastscript": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/hastscript/-/hastscript-7.2.0.tgz", + "integrity": "sha512-TtYPq24IldU8iKoJQqvZOuhi5CyCQRAbvDOX0x1eW6rsHSxa/1i2CCiptNTotGHJ3VoHRGmqiv6/D3q113ikkw==", + "dependencies": { + "@types/hast": "^2.0.0", + "comma-separated-tokens": "^2.0.0", + "hast-util-parse-selector": "^3.0.0", + "property-information": "^6.0.0", + "space-separated-tokens": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/remark-emoji": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/remark-emoji/-/remark-emoji-3.1.1.tgz", @@ -18314,6 +18643,28 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/stringify-entities": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-4.0.3.tgz", + "integrity": "sha512-BP9nNHMhhfcMbiuQKCqMjhDP5yBCAxsPu4pHFFzJ6Alo9dZgY4VLDPutXqIjpRiMoKdp7Av85Gr73Q5uH9k7+g==", + "dependencies": { + "character-entities-html4": "^2.0.0", + "character-entities-legacy": "^3.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/stringify-entities/node_modules/character-entities-legacy": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-3.0.0.tgz", + "integrity": "sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/stringify-object": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/stringify-object/-/stringify-object-3.3.0.tgz", @@ -18872,6 +19223,18 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/unist-util-map": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/unist-util-map/-/unist-util-map-3.1.3.tgz", + "integrity": "sha512-4/mDauoxqZ6geK97lJ6n2kDk6JK88Vh+hWMSJqyaaP/7eqN1dDhjcjnNxKNm3YU6Sw7PVJtcFMUbnmHvYzb6Vg==", + "dependencies": { + "@types/unist": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/unist-util-position": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.4.tgz", @@ -23315,6 +23678,11 @@ "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz", "integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==" }, + "@types/parse5": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/@types/parse5/-/parse5-6.0.3.tgz", + "integrity": "sha512-SuT16Q1K51EAVPz1K29DJ/sXjhSQ0zjvsypYJ6tlwVsRV9jwW5Adq2ch8Dq8kDBCkYnELS7N7VNCSB5nC56t/g==" + }, "@types/prop-types": { "version": "15.7.5", "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.5.tgz", @@ -24755,6 +25123,11 @@ "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-2.0.2.tgz", "integrity": "sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ==" }, + "character-entities-html4": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/character-entities-html4/-/character-entities-html4-2.1.0.tgz", + "integrity": "sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA==" + }, "character-entities-legacy": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-1.1.4.tgz", @@ -27266,6 +27639,44 @@ "resolved": "https://registry.npmjs.org/hast-util-parse-selector/-/hast-util-parse-selector-2.2.5.tgz", "integrity": "sha512-7j6mrk/qqkSehsM92wQjdIgWM2/BW61u/53G6xmC8i1OmEdKLHbk419QKQUjz6LglWsfqoiHmyMRkP1BGjecNQ==" }, + "hast-util-raw": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/hast-util-raw/-/hast-util-raw-7.2.3.tgz", + "integrity": "sha512-RujVQfVsOrxzPOPSzZFiwofMArbQke6DJjnFfceiEbFh7S05CbPt0cYN+A5YeD3pso0JQk6O1aHBnx9+Pm2uqg==", + "requires": { + "@types/hast": "^2.0.0", + "@types/parse5": "^6.0.0", + "hast-util-from-parse5": "^7.0.0", + "hast-util-to-parse5": "^7.0.0", + "html-void-elements": "^2.0.0", + "parse5": "^6.0.0", + "unist-util-position": "^4.0.0", + "unist-util-visit": "^4.0.0", + "vfile": "^5.0.0", + "web-namespaces": "^2.0.0", + "zwitch": "^2.0.0" + }, + "dependencies": { + "parse5": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz", + "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==" + } + } + }, + "hast-util-to-parse5": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/hast-util-to-parse5/-/hast-util-to-parse5-7.1.0.tgz", + "integrity": "sha512-YNRgAJkH2Jky5ySkIqFXTQiaqcAtJyVE+D5lkN6CdtOqrnkLfGYYrEcKuHOJZlp+MwjSwuD3fZuawI+sic/RBw==", + "requires": { + "@types/hast": "^2.0.0", + "comma-separated-tokens": "^2.0.0", + "property-information": "^6.0.0", + "space-separated-tokens": "^2.0.0", + "web-namespaces": "^2.0.0", + "zwitch": "^2.0.0" + } + }, "hast-util-to-text": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/hast-util-to-text/-/hast-util-to-text-3.1.2.tgz", @@ -27372,6 +27783,11 @@ "whatwg-encoding": "^2.0.0" } }, + "html-void-elements": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/html-void-elements/-/html-void-elements-2.0.1.tgz", + "integrity": "sha512-0quDb7s97CfemeJAnW9wC0hw78MtW7NU3hqtCD75g2vFlDLt36llsYD7uB7SUzojLMP24N5IatXf7ylGXiGG9A==" + }, "http-proxy-agent": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz", @@ -28738,6 +29154,71 @@ "unist-util-visit": "^4.0.0" } }, + "mdast-util-directive": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/mdast-util-directive/-/mdast-util-directive-2.2.4.tgz", + "integrity": "sha512-sK3ojFP+jpj1n7Zo5ZKvoxP1MvLyzVG63+gm40Z/qI00avzdPCYxt7RBMgofwAva9gBjbDBWVRB/i+UD+fUCzQ==", + "requires": { + "@types/mdast": "^3.0.0", + "@types/unist": "^2.0.0", + "mdast-util-from-markdown": "^1.3.0", + "mdast-util-to-markdown": "^1.5.0", + "parse-entities": "^4.0.0", + "stringify-entities": "^4.0.0", + "unist-util-visit-parents": "^5.1.3" + }, + "dependencies": { + "character-entities-legacy": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-3.0.0.tgz", + "integrity": "sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==" + }, + "character-reference-invalid": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-2.0.1.tgz", + "integrity": "sha512-iBZ4F4wRbyORVsu0jPV7gXkOsGYjGHPmAyv+HiHG8gi5PtC9KI2j1+v8/tlibRvjoWX027ypmG/n0HtO5t7unw==" + }, + "is-alphabetical": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-2.0.1.tgz", + "integrity": "sha512-FWyyY60MeTNyeSRpkM2Iry0G9hpr7/9kD40mD/cGQEuilcZYS4okz8SN2Q6rLCJ8gbCt6fN+rC+6tMGS99LaxQ==" + }, + "is-alphanumerical": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-2.0.1.tgz", + "integrity": "sha512-hmbYhX/9MUMF5uh7tOXyK/n0ZvWpad5caBA17GsC6vyuCqaWliRG5K1qS9inmUhEMaOBIW7/whAnSwveW/LtZw==", + "requires": { + "is-alphabetical": "^2.0.0", + "is-decimal": "^2.0.0" + } + }, + "is-decimal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-2.0.1.tgz", + "integrity": "sha512-AAB9hiomQs5DXWcRB1rqsxGUstbRroFOPPVAomNk/3XHR5JyEZChOyTWe2oayKnsSsr/kcGqF+z6yuH6HHpN0A==" + }, + "is-hexadecimal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-2.0.1.tgz", + "integrity": "sha512-DgZQp241c8oO6cA1SbTEWiXeoxV42vlcJxgH+B3hi1AiqqKruZR3ZGF8In3fj4+/y/7rHvlOZLZtgJ/4ttYGZg==" + }, + "parse-entities": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-4.0.1.tgz", + "integrity": "sha512-SWzvYcSJh4d/SGLIOQfZ/CoNv6BTlI6YEQ7Nj82oDVnRpwe/Z/F1EMx42x3JAOwGBlCjeCH0BRJQbQ/opHL17w==", + "requires": { + "@types/unist": "^2.0.0", + "character-entities": "^2.0.0", + "character-entities-legacy": "^3.0.0", + "character-reference-invalid": "^2.0.0", + "decode-named-character-reference": "^1.0.0", + "is-alphanumerical": "^2.0.0", + "is-decimal": "^2.0.0", + "is-hexadecimal": "^2.0.0" + } + } + } + }, "mdast-util-find-and-replace": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/mdast-util-find-and-replace/-/mdast-util-find-and-replace-2.2.2.tgz", @@ -29047,6 +29528,71 @@ "uvu": "^0.5.0" } }, + "micromark-extension-directive": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/micromark-extension-directive/-/micromark-extension-directive-2.2.0.tgz", + "integrity": "sha512-LWc2mGlJlPEcESz4IHNJR/tpJfWJEEFHGM+6vgCZGXkKMXc/y8rCKB07x5ZNnafIFe0/sjt6DIIihk78/Egj5Q==", + "requires": { + "micromark-factory-space": "^1.0.0", + "micromark-factory-whitespace": "^1.0.0", + "micromark-util-character": "^1.0.0", + "micromark-util-symbol": "^1.0.0", + "micromark-util-types": "^1.0.0", + "parse-entities": "^4.0.0", + "uvu": "^0.5.0" + }, + "dependencies": { + "character-entities-legacy": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-3.0.0.tgz", + "integrity": "sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==" + }, + "character-reference-invalid": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-2.0.1.tgz", + "integrity": "sha512-iBZ4F4wRbyORVsu0jPV7gXkOsGYjGHPmAyv+HiHG8gi5PtC9KI2j1+v8/tlibRvjoWX027ypmG/n0HtO5t7unw==" + }, + "is-alphabetical": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-2.0.1.tgz", + "integrity": "sha512-FWyyY60MeTNyeSRpkM2Iry0G9hpr7/9kD40mD/cGQEuilcZYS4okz8SN2Q6rLCJ8gbCt6fN+rC+6tMGS99LaxQ==" + }, + "is-alphanumerical": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-2.0.1.tgz", + "integrity": "sha512-hmbYhX/9MUMF5uh7tOXyK/n0ZvWpad5caBA17GsC6vyuCqaWliRG5K1qS9inmUhEMaOBIW7/whAnSwveW/LtZw==", + "requires": { + "is-alphabetical": "^2.0.0", + "is-decimal": "^2.0.0" + } + }, + "is-decimal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-2.0.1.tgz", + "integrity": "sha512-AAB9hiomQs5DXWcRB1rqsxGUstbRroFOPPVAomNk/3XHR5JyEZChOyTWe2oayKnsSsr/kcGqF+z6yuH6HHpN0A==" + }, + "is-hexadecimal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-2.0.1.tgz", + "integrity": "sha512-DgZQp241c8oO6cA1SbTEWiXeoxV42vlcJxgH+B3hi1AiqqKruZR3ZGF8In3fj4+/y/7rHvlOZLZtgJ/4ttYGZg==" + }, + "parse-entities": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-4.0.1.tgz", + "integrity": "sha512-SWzvYcSJh4d/SGLIOQfZ/CoNv6BTlI6YEQ7Nj82oDVnRpwe/Z/F1EMx42x3JAOwGBlCjeCH0BRJQbQ/opHL17w==", + "requires": { + "@types/unist": "^2.0.0", + "character-entities": "^2.0.0", + "character-entities-legacy": "^3.0.0", + "character-reference-invalid": "^2.0.0", + "decode-named-character-reference": "^1.0.0", + "is-alphanumerical": "^2.0.0", + "is-decimal": "^2.0.0", + "is-hexadecimal": "^2.0.0" + } + } + } + }, "micromark-extension-gfm": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/micromark-extension-gfm/-/micromark-extension-gfm-2.0.1.tgz", @@ -32357,6 +32903,16 @@ "unist-util-visit": "^4.0.0" } }, + "rehype-raw": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/rehype-raw/-/rehype-raw-6.1.1.tgz", + "integrity": "sha512-d6AKtisSRtDRX4aSPsJGTfnzrX2ZkHQLE5kiUuGOeEoLpbEulFF4hj0mLPbsa+7vmguDKOVVEQdHKDSwoaIDsQ==", + "requires": { + "@types/hast": "^2.0.0", + "hast-util-raw": "^7.2.0", + "unified": "^10.0.0" + } + }, "remark": { "version": "14.0.2", "resolved": "https://registry.npmjs.org/remark/-/remark-14.0.2.tgz", @@ -32368,6 +32924,48 @@ "unified": "^10.0.0" } }, + "remark-directive": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/remark-directive/-/remark-directive-2.0.1.tgz", + "integrity": "sha512-oosbsUAkU/qmUE78anLaJePnPis4ihsE7Agp0T/oqTzvTea8pOiaYEtfInU/+xMOVTS9PN5AhGOiaIVe4GD8gw==", + "requires": { + "@types/mdast": "^3.0.0", + "mdast-util-directive": "^2.0.0", + "micromark-extension-directive": "^2.0.0", + "unified": "^10.0.0" + } + }, + "remark-directive-rehype": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/remark-directive-rehype/-/remark-directive-rehype-0.4.2.tgz", + "integrity": "sha512-T6e+IG+BwqU4++MK54vFb+KDFjs3a+tHeK6E0T0ctR1FSyngolfDtAEzqxHWlRzQZqGi2sB4DFXry6oqH87D/g==", + "requires": { + "hastscript": "^7.0.2", + "unist-util-map": "^3.1.2" + }, + "dependencies": { + "hast-util-parse-selector": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/hast-util-parse-selector/-/hast-util-parse-selector-3.1.1.tgz", + "integrity": "sha512-jdlwBjEexy1oGz0aJ2f4GKMaVKkA9jwjr4MjAAI22E5fM/TXVZHuS5OpONtdeIkRKqAaryQ2E9xNQxijoThSZA==", + "requires": { + "@types/hast": "^2.0.0" + } + }, + "hastscript": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/hastscript/-/hastscript-7.2.0.tgz", + "integrity": "sha512-TtYPq24IldU8iKoJQqvZOuhi5CyCQRAbvDOX0x1eW6rsHSxa/1i2CCiptNTotGHJ3VoHRGmqiv6/D3q113ikkw==", + "requires": { + "@types/hast": "^2.0.0", + "comma-separated-tokens": "^2.0.0", + "hast-util-parse-selector": "^3.0.0", + "property-information": "^6.0.0", + "space-separated-tokens": "^2.0.0" + } + } + } + }, "remark-emoji": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/remark-emoji/-/remark-emoji-3.1.1.tgz", @@ -33040,6 +33638,22 @@ "es-abstract": "^1.20.4" } }, + "stringify-entities": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-4.0.3.tgz", + "integrity": "sha512-BP9nNHMhhfcMbiuQKCqMjhDP5yBCAxsPu4pHFFzJ6Alo9dZgY4VLDPutXqIjpRiMoKdp7Av85Gr73Q5uH9k7+g==", + "requires": { + "character-entities-html4": "^2.0.0", + "character-entities-legacy": "^3.0.0" + }, + "dependencies": { + "character-entities-legacy": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-3.0.0.tgz", + "integrity": "sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==" + } + } + }, "stringify-object": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/stringify-object/-/stringify-object-3.3.0.tgz", @@ -33433,6 +34047,14 @@ "@types/unist": "^2.0.0" } }, + "unist-util-map": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/unist-util-map/-/unist-util-map-3.1.3.tgz", + "integrity": "sha512-4/mDauoxqZ6geK97lJ6n2kDk6JK88Vh+hWMSJqyaaP/7eqN1dDhjcjnNxKNm3YU6Sw7PVJtcFMUbnmHvYzb6Vg==", + "requires": { + "@types/unist": "^2.0.0" + } + }, "unist-util-position": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-4.0.4.tgz", diff --git a/package.json b/package.json index ce8a3cd6..91d2fbf8 100644 --- a/package.json +++ b/package.json @@ -63,6 +63,9 @@ "react-syntax-highlighter": "^15.5.0", "redux": "^4.2.1", "rehype-katex": "^6.0.3", + "rehype-raw": "^6.1.1", + "remark-directive": "^2.0.1", + "remark-directive-rehype": "^0.4.2", "remark-emoji": "^3.1.1", "remark-gfm": "^3.0.1", "remark-math": "^5.1.1", diff --git a/src/assets/templates/daily-sync.md b/src/assets/templates/daily-sync.md new file mode 100644 index 00000000..710199b7 --- /dev/null +++ b/src/assets/templates/daily-sync.md @@ -0,0 +1,37 @@ +# {date:YY-MM-DD} 데일리 싱크 + +## Name 🏠 + +어제 + +- 오늘 +- 토론 + +## Name 🏢 + +어제 + +- +- 오늘 +- 토론 + +## Name 🏠 + +어제 + +- 오늘 +- 토론 + +## 프로젝트 현황 + +23년 2Q + +- [x] 1. + +23년 1Q + +- [x] 1. + +23년 목표 + +- diff --git a/src/assets/templates/performance-review.md b/src/assets/templates/performance-review.md new file mode 100644 index 00000000..f3190f7b --- /dev/null +++ b/src/assets/templates/performance-review.md @@ -0,0 +1,85 @@ +# [People] Performance review + +:::info +:bulb: This template is for reviewing past performance and planning new objectives with the supervisor . +::: + +### :small_blue_diamond: Review Date: + +### :small_blue_diamond: Reviewer: + +## :book: Employee Information + +:::success +List the essential information for this employee. You can add the item you need. +::: + +### :small_blue_diamond: Department: + +### :small_blue_diamond: Manager: + +### :small_blue_diamond: Title: + +### :small_blue_diamond: Name: + +### :small_blue_diamond: ID: + +## :pencil: Scorecard + +:::success +Scoring your performance. +::: + +| **Item** | **1 = Poor** | **2 = Fair** | **3 = Satisfactory** | **4 = Good** | **5 = Excellent** | +| :------------------: | :-------------------------------: | :-------------------------------: | :-------------------------------: | :-------------------------------: | :-------------------------------: | +| Work Quality | | | | | | +| Job Knowledge | | | | | | +| Communication Skills | | | | | | +| Independent Work | | | | | | +| Creativity | | | | | | +| Dependability | | | | | | +| Skills | | | | | | +| Attendance | | | | | | + +### → Overall Rating: + +## :100: Evaluation + +:::success +Evaluate yourself and give examples. +::: + +### :small_blue_diamond: Example of Strengths + +1. +2. + +### :small_blue_diamond: Improvement Needed + +1. +2. + +## :+1: Goal + +:::success +Describe the goal for the previous and subsequent review. +::: + +### :small_orange_diamond: Did you achieve the goal from the previous review? + +- [ ] Yes +- [ ] No + +### :small_orange_diamond: Goal for next review period: + +1. +2. + +## :pencil2: Reviewer Comments/Feedbacks + +:::success +The comments/Feedbacks from the reviewer. According to the employee's performance to write. +::: + +1. +2. diff --git a/src/components/Editor/mime/application/whiteboard/CustomCursor.tsx b/src/components/Editor/mime/application/whiteboard/CustomCursor.tsx index c40ec2b9..161462f0 100644 --- a/src/components/Editor/mime/application/whiteboard/CustomCursor.tsx +++ b/src/components/Editor/mime/application/whiteboard/CustomCursor.tsx @@ -5,15 +5,16 @@ import { CursorComponent } from '@tldraw/core'; // Component overrides for the tldraw renderer const CustomCursor: CursorComponent = ({ color, - metadata = { - name: 'Anonymous', - }, + metadata, }: { color: string; metadata?: { name: string; }; }) => { + if (!metadata) { + return null; + } return (
{ const obj = (data as EmojiMartData).emojis[key]; return { - text: `:${key}:`, - displayText: `${obj.skins[0].native} :${key}:`, + text: obj.skins[0].native, + displayText: `${obj.skins[0].native} ${key}`, + keyText: `:${key}:`, className: 'emoji-hint', keywords: obj.keywords, name: obj.name, @@ -25,9 +26,8 @@ const emojiList = Object.keys((data as EmojiMartData).emojis).map((key) => { // Format the list of emojis as CodeMirror hints const hints = emojiList.filter((it) => { - // console.log(it.text, prefix); return ( - it.text.includes(query) || + it.keyText.includes(query) || it.keywords.some((keyword) => { return keyword.includes(query); }) diff --git a/src/components/Editor/mime/text/md/CodeEditor/index.tsx b/src/components/Editor/mime/text/md/CodeEditor/index.tsx index bd4aa164..d13dae7e 100644 --- a/src/components/Editor/mime/text/md/CodeEditor/index.tsx +++ b/src/components/Editor/mime/text/md/CodeEditor/index.tsx @@ -9,16 +9,12 @@ import { ActorID, DocEvent, TextChange } from 'yorkie-js-sdk'; import CodeMirror from 'codemirror'; import SimpleMDE from 'easymde'; import SimpleMDEReact from 'react-simplemde-editor'; -import ReactMarkdown from 'react-markdown'; -import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter'; - -import oneLight from 'react-syntax-highlighter/dist/esm/styles/prism/one-light'; -import oneDark from 'react-syntax-highlighter/dist/esm/styles/prism/one-dark'; import { AppState } from 'app/rootReducer'; import { ConnectionStatus, Presence } from 'features/peerSlices'; import { Theme as ThemeType } from 'features/settingSlices'; import { Preview, updateHeadings, getTableOfContents } from 'features/docSlices'; +import { MarkdownViewer } from 'components/commons/MarkdownViewer'; import { makeStyles } from 'styles/common'; import { @@ -32,19 +28,11 @@ import { Theme, Typography, } from '@mui/material'; -import { MetaInfo, NAVBAR_HEIGHT } from 'constants/editor'; +import { NAVBAR_HEIGHT } from 'constants/editor'; import { addRecentPage } from 'features/currentSlices'; import { setActionStatus } from 'features/actionSlices'; import { updateLinkNameWithHeading } from 'features/linkSlices'; -import remarkMath from 'remark-math'; -import remarkGfm from 'remark-gfm'; -import remarkToc from 'remark-toc'; -import remarkEmoji from 'remark-emoji'; - -import rehypeKatex from 'rehype-katex'; -import fenceparser from 'fenceparser'; -import 'katex/dist/katex.min.css'; // `rehype-katex` does not import the CSS for you import 'easymde/dist/easymde.min.css'; import 'codemirror/keymap/sublime'; import 'codemirror/keymap/emacs'; @@ -65,15 +53,10 @@ import Cursor from './Cursor'; import SlideView from './slideView'; import { CodeEditorMenu } from './Menu'; -import MermaidView from './MermaidView'; import MiniDraw from './MiniDraw'; import MiniMermaid from './MiniMermaid'; import { MermaidSampleType, samples } from './mermaid-samples'; -type StyleObject = { - [key: string]: string; -}; - const WIDGET_HEIGHT = 40; const globalContainer = { @@ -282,7 +265,7 @@ export default function CodeEditor() { }); cm.setOption('hintOptions', { completeOnSingleClick: true, - completeSingle: false, + completeSingle: true, container: cm.getWrapperElement(), }); @@ -301,47 +284,47 @@ export default function CodeEditor() { } // check keyword hint with normal text else if (event.text.length > 0 && /[a-zA-Z0-9]/.test(event.text[0])) { - cm2.showHint({ - completeSingle: false, - alignWithWord: true, - closeCharacters: /[\s()\[\]{};:>,]/, // eslint-disable-line no-useless-escape - closeOnUnfocus: true, - list: () => { - return [ - { text: 'function', displayText: '!function' }, - { text: 'if', displayText: '!if' }, - { text: 'else', displayText: '!else' }, - { text: 'for', displayText: '!for' }, - { text: 'while', displayText: '!while' }, - { text: 'do', displayText: '!do' }, - { text: 'switch', displayText: '!switch' }, - { text: 'case', displayText: '!case' }, - { text: 'try', displayText: '!try' }, - { text: 'catch', displayText: '!catch' }, - { text: 'finally', displayText: '!finally' }, - { text: 'class', displayText: '!class' }, - { text: 'interface', displayText: '!interface' }, - { text: 'extends', displayText: '!extends' }, - { - text: 'implements', - displayText: '!implements', - // self customize hint - hint: (cm3: CodeMirror.Editor, cur: any, data: any) => { - cm3.replaceRange( - `${data.displayText} self customize`, - cur.from || data.from, - cur.to || data.to, - 'complete', - ); - }, - render: (element: HTMLLIElement, cur: any, data: any) => { - const tempElement = element; - tempElement.textContent = `${data.displayText} (self customize)`; - }, - }, - ]; - }, - } as any); + // cm2.showHint({ + // completeSingle: false, + // alignWithWord: true, + // closeCharacters: /[\s()\[\]{};:>,]/, // eslint-disable-line no-useless-escape + // closeOnUnfocus: true, + // list: () => { + // return [ + // { text: 'function', displayText: '!function' }, + // { text: 'if', displayText: '!if' }, + // { text: 'else', displayText: '!else' }, + // { text: 'for', displayText: '!for' }, + // { text: 'while', displayText: '!while' }, + // { text: 'do', displayText: '!do' }, + // { text: 'switch', displayText: '!switch' }, + // { text: 'case', displayText: '!case' }, + // { text: 'try', displayText: '!try' }, + // { text: 'catch', displayText: '!catch' }, + // { text: 'finally', displayText: '!finally' }, + // { text: 'class', displayText: '!class' }, + // { text: 'interface', displayText: '!interface' }, + // { text: 'extends', displayText: '!extends' }, + // { + // text: 'implements', + // displayText: '!implements', + // // self customize hint + // hint: (cm3: CodeMirror.Editor, cur: any, data: any) => { + // cm3.replaceRange( + // `${data.displayText} self customize`, + // cur.from || data.from, + // cur.to || data.to, + // 'complete', + // ); + // }, + // render: (element: HTMLLIElement, cur: any, data: any) => { + // const tempElement = element; + // tempElement.textContent = `${data.displayText} (self customize)`; + // }, + // }, + // ]; + // }, + // } as any); } }); @@ -544,87 +527,7 @@ export default function CodeEditor() { globalContainer.rootElement = createRoot(previewElement) as any; } - (globalContainer.rootElement as any)?.render( - { - const match = /language-(\w+)/.exec(className || ''); - - const text = children[0]; - - const tempMetaInfo = fenceparser(`${node.data?.meta}`); - - const metaInfo: MetaInfo = {}; - Object.keys(tempMetaInfo).reduce((acc: any, key) => { - if (!key || key === 'undefined') { - return acc; - } - - acc[key] = tempMetaInfo[key]; - - return acc; - }, metaInfo); - - // if (className === 'language-chart') { - // return ; - // } - - if (className === 'language-mermaid') { - return ; - } - - if (className === 'language-tldraw') { - return ; - } - - return !inline && match ? ( - { - console.log(lineNumber, metaInfo.highlight); - const style: StyleObject = { display: 'block' }; - - // check line numbers - const hasHighlightedLineNumbers = Object.keys(metaInfo.highlight as any).some((key) => { - const lines = key.split('-'); - - if (lines.length === 1) { - if (key === `${lineNumber}`) { - return true; - } - } else if (lineNumber >= Number(lines[0]) && lineNumber <= Number(lines[1])) { - return true; - } - return false; - }); - if (hasHighlightedLineNumbers) { - style.backgroundColor = '#ffe7a4'; - } - return { style }; - }} - PreTag="div" - > - {String(children).replace(/\n$/, '')} - - ) : ( - - {children} - - ); - }, - }} - > - {markdown} - , - ); + (globalContainer.rootElement as any)?.render(); } catch (err) { console.error(err); } diff --git a/src/components/NavBar/CreateButton.tsx b/src/components/NavBar/CreateButton.tsx index b72e9010..477e2d64 100644 --- a/src/components/NavBar/CreateButton.tsx +++ b/src/components/NavBar/CreateButton.tsx @@ -1,10 +1,9 @@ import React, { useCallback, useState } from 'react'; -import { Button, ListItemIcon, ListItemText, Menu, MenuItem, Typography } from '@mui/material'; +import { Button, Divider, ListItemIcon, ListItemText, Menu, MenuItem, Typography } from '@mui/material'; import Add from '@mui/icons-material/Add'; import { useDispatch, useSelector } from 'react-redux'; import Gesture from '@mui/icons-material/Gesture'; import { createDoc } from 'features/docSlices'; -import yorkie from 'yorkie-js-sdk'; import { AppState } from 'app/rootReducer'; import { newLink } from 'features/linkSlices'; import { makeStyles } from 'styles/common'; @@ -13,6 +12,8 @@ import { useNavigate } from 'react-router-dom'; import { createDocumentKey, createRandomColor } from 'utils/document'; import DescriptionOutlined from '@mui/icons-material/DescriptionOutlined'; import { Theme } from 'features/settingSlices'; +import { ContentCopyOutlined } from '@mui/icons-material'; +import { TemplateDialog } from 'components/commons/TemplateDialog'; const useStyles = makeStyles()((theme) => ({ menu: { @@ -41,6 +42,8 @@ export function CreateButton() { const parentId = ''; + const [templateOpen, setTemplateOpen] = useState(false); + const handleMenuOpen = (event: React.MouseEvent) => { setAnchorEl(event.currentTarget); }; @@ -49,6 +52,15 @@ export function CreateButton() { setAnchorEl(null); }, []); + const handleCloseTemplate = useCallback(() => { + setTemplateOpen(false); + }, []); + + const handleOpenTemplate = useCallback(() => { + setTemplateOpen(true); + handleMenuClose(); + }, [handleMenuClose]); + const open = Boolean(anchorEl); const handleCreateWhiteboard = useCallback( @@ -87,39 +99,39 @@ export function CreateButton() { [dispatch, client, parentId, navigate, handleMenuClose], ); - const handleCreateMilkdown = useCallback( - async (name: string) => { - const newDocKey = `${createDocumentKey()}`; - const fileLink = `/${newDocKey}`; - const mimeType = MimeType.MILKDOWN; - - if (client) { - dispatch( - createDoc({ - client, - docKey: `codepairs-${newDocKey}`, - init: (root: any) => { - const newRoot = root; - if (!newRoot.mimeType) { - newRoot.mimeType = mimeType; - } - - if (!newRoot.content) { - newRoot.content = new yorkie.Text(); - } - }, - }) as any, - ); - - setTimeout(() => { - dispatch(newLink({ parentId, name, mimeType, fileLink, color: createRandomColor().background, emoji: '📅' })); - setTimeout(() => navigate(fileLink), 100); - handleMenuClose(); - }, 1000); - } - }, - [dispatch, client, parentId, navigate, handleMenuClose], - ); + // const handleCreateMilkdown = useCallback( + // async (name: string) => { + // const newDocKey = `${createDocumentKey()}`; + // const fileLink = `/${newDocKey}`; + // const mimeType = MimeType.MILKDOWN; + + // if (client) { + // dispatch( + // createDoc({ + // client, + // docKey: `codepairs-${newDocKey}`, + // init: (root: any) => { + // const newRoot = root; + // if (!newRoot.mimeType) { + // newRoot.mimeType = mimeType; + // } + + // if (!newRoot.content) { + // newRoot.content = new yorkie.Text(); + // } + // }, + // }) as any, + // ); + + // setTimeout(() => { + // dispatch(newLink({ parentId, name, mimeType, fileLink, color: createRandomColor().background, emoji: '📅' })); + // setTimeout(() => navigate(fileLink), 100); + // handleMenuClose(); + // }, 1000); + // } + // }, + // [dispatch, client, parentId, navigate, handleMenuClose], + // ); const handleCreateLink = useCallback( (name: string) => { @@ -178,17 +190,19 @@ export function CreateButton() { 2 - handleCreateMilkdown('Untitled milkdown')}> + + handleOpenTemplate()}> - + - Milkdown + Template 3 ) : undefined} + {templateOpen ? : undefined}
); } diff --git a/src/components/NavBar/PageButton.tsx b/src/components/NavBar/PageButton.tsx index 67748a16..c0afd978 100644 --- a/src/components/NavBar/PageButton.tsx +++ b/src/components/NavBar/PageButton.tsx @@ -1,5 +1,15 @@ import React, { useCallback, useState } from 'react'; -import { Button, IconButton, ListItemIcon, ListItemText, Menu, MenuItem, Tooltip, Typography } from '@mui/material'; +import { + Button, + Divider, + IconButton, + ListItemIcon, + ListItemText, + Menu, + MenuItem, + Tooltip, + Typography, +} from '@mui/material'; import Add from '@mui/icons-material/Add'; import { useDispatch, useSelector } from 'react-redux'; import Gesture from '@mui/icons-material/Gesture'; @@ -11,7 +21,8 @@ import { makeStyles } from 'styles/common'; import { MimeType } from 'constants/editor'; import { useNavigate } from 'react-router-dom'; import { createDocumentKey, createRandomColor } from 'utils/document'; -import { DescriptionOutlined } from '@mui/icons-material'; +import { ContentCopyOutlined, DescriptionOutlined } from '@mui/icons-material'; +import { TemplateDialog } from 'components/commons/TemplateDialog'; const useStyles = makeStyles()(() => ({ menu: { @@ -61,6 +72,8 @@ export function PageButton({ break; } + const [templateOpen, setTemplateOpen] = useState(false); + const handleMenuOpen = (event: React.MouseEvent) => { setAnchorEl(event.currentTarget); }; @@ -70,6 +83,15 @@ export function PageButton({ onClose?.(); }, [onClose]); + const handleCloseTemplate = useCallback(() => { + setTemplateOpen(false); + handleMenuClose(); + }, [handleMenuClose]); + + const handleOpenTemplate = useCallback(() => { + setTemplateOpen(true); + }, []); + const open = Boolean(anchorEl); const handleCreateWhiteboard = useCallback( @@ -218,17 +240,19 @@ export function PageButton({ 2 - {/* handleCreateMilkdown('Untitled milkdown')}> + + handleOpenTemplate()}> - + - Milkdown + Template 3 - */} + ) : undefined} + {templateOpen ? : undefined}
); } diff --git a/src/components/SideBar/CustomViewer/SidebarItem.tsx b/src/components/SideBar/CustomViewer/SidebarItem.tsx index b0531292..6e500359 100644 --- a/src/components/SideBar/CustomViewer/SidebarItem.tsx +++ b/src/components/SideBar/CustomViewer/SidebarItem.tsx @@ -97,6 +97,7 @@ const useStyles = makeStyles()((theme) => ({ }, }, sidebarItem: { + paddingRight: 2, borderRadius: 6, [`&:hover .sidebar-item-more`]: { visibility: 'visible !important' as any, diff --git a/src/components/commons/MarkdownViewer.tsx b/src/components/commons/MarkdownViewer.tsx new file mode 100644 index 00000000..42dd84fc --- /dev/null +++ b/src/components/commons/MarkdownViewer.tsx @@ -0,0 +1,129 @@ +/* eslint-disable react/no-unstable-nested-components */ +import React from 'react'; +import ReactMarkdown from 'react-markdown'; +import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter'; + +import oneLight from 'react-syntax-highlighter/dist/esm/styles/prism/one-light'; +import oneDark from 'react-syntax-highlighter/dist/esm/styles/prism/one-dark'; + +import { Theme as ThemeType } from 'features/settingSlices'; +import remarkMath from 'remark-math'; +import remarkGfm from 'remark-gfm'; +import remarkToc from 'remark-toc'; +import remarkEmoji from 'remark-emoji'; +import remarkDirective from 'remark-directive'; +import remarkDirectiveRehype from 'remark-directive-rehype'; + +import rehypeKatex from 'rehype-katex'; +import rehypeRaw from 'rehype-raw'; +import fenceparser from 'fenceparser'; +import MermaidView from 'components/Editor/mime/text/md/CodeEditor/MermaidView'; +import MiniDraw from 'components/Editor/mime/text/md/CodeEditor/MiniDraw'; +import { MetaInfo } from 'constants/editor'; +import 'katex/dist/katex.min.css'; // `rehype-katex` does not import the CSS for you + +type StyleObject = { + [key: string]: string; +}; + +interface MarkdownViewerProps { + markdown: string; + theme: string; +} + +export function MarkdownViewer({ markdown, theme }: MarkdownViewerProps) { + return ( +
+ { + return
{children}
; + }, + info: ({ children }: any) => { + return
{children}
; + }, + danger: ({ children }: any) => { + return
{children}
; + }, + code: ({ node, inline, className, children, ...props }: any) => { + const match = /language-(\w+)/.exec(className || ''); + + const text = children[0]; + + const tempMetaInfo = fenceparser(`${node.data?.meta}`); + + const metaInfo: MetaInfo = {}; + Object.keys(tempMetaInfo).reduce((acc: any, key) => { + if (!key || key === 'undefined') { + return acc; + } + + acc[key] = tempMetaInfo[key]; + + return acc; + }, metaInfo); + + // if (className === 'language-chart') { + // return ; + // } + + if (className === 'language-mermaid') { + return ; + } + + if (className === 'language-tldraw') { + return ; + } + + return !inline && match ? ( + { + console.log(lineNumber, metaInfo.highlight); + const style: StyleObject = { display: 'block' }; + + // check line numbers + const hasHighlightedLineNumbers = Object.keys(metaInfo.highlight as any).some((key) => { + const lines = key.split('-'); + + if (lines.length === 1) { + if (key === `${lineNumber}`) { + return true; + } + } else if (lineNumber >= Number(lines[0]) && lineNumber <= Number(lines[1])) { + return true; + } + return false; + }); + if (hasHighlightedLineNumbers) { + style.backgroundColor = '#ffe7a4'; + } + return { style }; + }} + PreTag="div" + > + {String(children).replace(/\n$/, '')} + + ) : ( + + {children} + + ); + }, + } as any + } + > + {markdown} +
+
+ ); +} diff --git a/src/components/commons/TemplateDialog.tsx b/src/components/commons/TemplateDialog.tsx new file mode 100644 index 00000000..9d3a830e --- /dev/null +++ b/src/components/commons/TemplateDialog.tsx @@ -0,0 +1,156 @@ +import { Button, Dialog, DialogContent, DialogTitle, List, ListItemButton, ListItemText } from '@mui/material'; +import { AppState } from 'app/rootReducer'; +import { MimeType } from 'constants/editor'; +import { createDoc } from 'features/docSlices'; +import { newLink } from 'features/linkSlices'; +import React, { useCallback } from 'react'; +import { useDispatch, useSelector } from 'react-redux'; +import { useNavigate } from 'react-router-dom'; +import { createDocumentKey, createRandomColor } from 'utils/document'; +import yorkie from 'yorkie-js-sdk'; +import { MarkdownViewer } from './MarkdownViewer'; + +import dailySyncTemplate from '../../assets/templates/daily-sync.md?raw'; +import performanceReviewTemplate from '../../assets/templates/performance-review.md?raw'; + +interface TemplateDialogProps { + onClose: () => void; + parentId?: string; +} + +const templateList = [ + { + name: 'Daily Sync', + title: '{date:YY-MM-DD} 데일리 싱크', + content: dailySyncTemplate, + }, + { + name: 'Performance review', + title: 'Performance review', + content: performanceReviewTemplate, + }, +]; + +function convertMarkdownText(markdown: string) { + return markdown.replace(/\{date:YY-MM-DD\}/g, new Date().toISOString().slice(0, 10)); +} + +export function TemplateDialog(props: TemplateDialogProps) { + const { onClose, parentId = '' } = props; + const navigate = useNavigate(); + const dispatch = useDispatch(); + const client = useSelector((state: AppState) => state.docState.client); + const menu = useSelector((state: AppState) => state.settingState.menu); + + const [selectedTemplate, setSelectedTemplate] = React.useState(0); + + const handleInsertTemplate = useCallback(async () => { + const newDocKey = `${createDocumentKey()}`; + const fileLink = `/${newDocKey}`; + const mimeType = MimeType.MARKDOWN; + const name = convertMarkdownText(templateList[selectedTemplate].title); + + if (client) { + await dispatch( + createDoc({ + client, + docKey: `codepairs-${newDocKey}`, + init: (root: any) => { + const newRoot = root; + + newRoot.content = new yorkie.Text(); + + newRoot.content.edit(0, 0, convertMarkdownText(templateList[selectedTemplate].content)); + }, + }) as any, + ); + + setTimeout(() => { + dispatch(newLink({ parentId, name, mimeType, fileLink, color: createRandomColor().background, emoji: '📅' })); + setTimeout(() => navigate(fileLink), 100); + onClose(); + }, 1000); + } + }, [dispatch, client, parentId, navigate, onClose, selectedTemplate]); + + return ( + + Template + +
+
+ + {templateList.map((template, index) => { + return ( + { + setSelectedTemplate(index); + }} + selected={selectedTemplate === index} + > + + + ); + })} + +
+
+
+ +
+
+
+
+ + +
+
+
+ ); +} diff --git a/src/features/linkSlices.ts b/src/features/linkSlices.ts index 006765dc..64d9a0b6 100644 --- a/src/features/linkSlices.ts +++ b/src/features/linkSlices.ts @@ -244,7 +244,7 @@ const linkSlice = createSlice({ newLink( state, action: PayloadAction<{ - parentId: string; + parentId?: string; name: string; mimeType?: string; fileLink?: string; @@ -252,7 +252,7 @@ const linkSlice = createSlice({ emoji?: string; }>, ) { - const { parentId, name, fileLink, mimeType = 'text/markdown', color, emoji } = action.payload; + const { parentId = '', name, fileLink, mimeType = 'text/markdown', color, emoji } = action.payload; const newLinkInfo = { type: 'link', diff --git a/src/index.scss b/src/index.scss index 60ef73bf..0ef34dee 100644 --- a/src/index.scss +++ b/src/index.scss @@ -193,6 +193,7 @@ body { cursor: pointer; padding: 5px 10px; border-radius: 0px !important; + font-size: 16px; } /* Style the selected hint item */ @@ -203,13 +204,13 @@ body { /* Style the hint label */ .CodeMirror-hints .CodeMirror-hint-label { color: rgb(53, 53, 53); - font-size: 12px; + font-size: 20px !important; margin-right: 5px; } /* Style the hint description */ .CodeMirror-hints .CodeMirror-hint-description { - font-size: 12px; + font-size: 16px; margin-left: 5px; } @@ -232,6 +233,62 @@ body { transform: translateY(-50%); } +.success { + background-color: #d4edda; + color: #155724; + border: 1px solid #c3e6cb; + padding: 10px; + > p:first-child { + margin-top: 0px; + } + > p:last-child { + margin-bottom: 0px; + } +} + +.info { + background-color: #d1ecf1; + color: #0c5460; + border: 1px solid #bee5eb; + padding: 10px; + > p:first-child { + margin-top: 0px; + } + > p:last-child { + margin-bottom: 0px; + } +} + +.danger { + background-color: #f8d7da; + color: #721c24; + border: 1px solid #f5c6cb; + padding: 10px; + > p:first-child { + margin-top: 0px; + } + > p:last-child { + margin-bottom: 0px; + } +} + +table { + width: 100%; + border-collapse: collapse; +} + +th, +td { + border: 1px solid black; + padding: 8px; + text-align: left; +} + +th { + background-color: gray; + color: white; +} + [data-theme='light'] { &[data-scroll='true'] *::-webkit-scrollbar { width: 5px; @@ -573,6 +630,13 @@ blockquote { } [data-theme='dark'] { + .success { + background-color: #d4edda; + color: #155724; + border: 1px solid #c3e6cb; + padding: 10px; + } + .inline-menu button { border: 1px solid rgb(113, 113, 113); background-color: #121212; @@ -665,6 +729,10 @@ blockquote { color: rgb(56, 234, 175); } + .CodeMirror-line span.cm-formatting-emoji { + color: rgb(206, 73, 255) !important; + } + .CodeMirror-line span.cm-formatting-header { color: rgb(102, 102, 102); } @@ -733,7 +801,7 @@ blockquote { } .CodeMirror-line span.cm-attribute { - color: #00c; + color: rgb(92, 92, 235); } .CodeMirror-line span.cm-hr {