Skip to content

Let's use AI to Earn!

feat(Publish): Intelligently identify topics, mention, describe beyond styles, and remotely search for topics

gaoSir27e97cf409a6
diff --git a/package.json b/package.json
index e2a99108..6eb70e54 100644
--- a/package.json
+++ b/package.json
@@ -24,6 +24,7 @@
"@fullcalendar/daygrid": "^6.1.17",
"@fullcalendar/react": "^6.1.17",
"@kwooshung/react-no-ssr": "^1.1.4",
+ "@lexical/react": "^0.37.0",
"@react-oauth/google": "^0.12.2",
"@svgr/webpack": "^6.5.1",
"@szhsin/react-menu": "^4.4.1",
@@ -44,6 +45,8 @@
"i18next-browser-languagedetector": "8.0.4",
"i18next-resources-to-backend": "1.2.1",
"idb-keyval": "^6.2.2",
+ "lexical": "^0.37.0",
+ "lexical-beautiful-mentions": "^0.1.48",
"lodash": "^4.17.21",
"next": "14.2.29",
"next-sitemap": "^4.2.3",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index d2332a20..06975364 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -29,6 +29,9 @@ importers:
'@kwooshung/react-no-ssr':
specifier: ^1.1.4
+ '@lexical/react':
+ specifier: ^0.37.0
'@react-oauth/google':
specifier: ^0.12.2
@@ -89,6 +92,12 @@ importers:
idb-keyval:
specifier: ^6.2.2
version: 6.2.2
+ lexical:
+ specifier: ^0.37.0
+ version: 0.37.0
+ lexical-beautiful-mentions:
+ specifier: ^0.1.48
lodash:
specifier: ^4.17.21
version: 4.17.21
@@ -896,6 +905,27 @@ packages:
resolution: {integrity: sha512-0J+zgWxHN+xXONWIyPWKFMgVuJoZuGiIFu8yxk7RJjxkzpGmyja5wRFqZIVtjDVOQpV+Rw0iOAjYPE2eQyjr0w==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
+ '@floating-ui/[email protected]':
+ resolution: {integrity: sha512-sGnvb5dmrJaKEZ+LDIpguvdX3bDlEllmv4/ClQ9awcmCZrlx5jQyyMWFM5kBI+EyNOCDDiKk8il0zeuX3Zlg/w==}
+
+ '@floating-ui/[email protected]':
+ resolution: {integrity: sha512-OOchDgh4F2CchOX94cRVqhvy7b3AFb+/rQXyswmzmGakRfkMgoWVjfnLWkRirfLEfuD4ysVW16eXzwt3jHIzKA==}
+
+ '@floating-ui/[email protected]':
+ resolution: {integrity: sha512-4JX6rEatQEvlmgU80wZyq9RT96HZJa88q8hp0pBd+LrczeDI4o6uA2M+uvxngVHo4Ihr8uibXxH6+70zhAFrVw==}
+ peerDependencies:
+ react: '>=16.8.0'
+ react-dom: '>=16.8.0'
+
+ '@floating-ui/[email protected]':
+ resolution: {integrity: sha512-9O8N4SeG2z++TSM8QA/KTeKFBVCNEz/AGS7gWPJf6KFRzmRWixFRnCnkPHRDwSVZW6QPDO6uT0P2SpWNKCc9/g==}
+ peerDependencies:
+ react: '>=17.0.0'
+ react-dom: '>=17.0.0'
+
+ '@floating-ui/[email protected]':
+ resolution: {integrity: sha512-aGTxbpbg8/b5JfU1HXSrbH3wXZuLPJcNEcZQFMxLs3oSzgtVu6nFPkbbGGUvBcUjKV2YyB9Wxxabo+HEH9tcRQ==}
+
'@fluent/[email protected]':
resolution: {integrity: sha512-5D2qVpZrgpjtqU4eNOcWGp1gnUCgjfM+vKGE2y03kKN6z5EBhtx0qdRFbg8QuNNj8wXNoX93KJoYb+NqoxswmQ==}
engines: {node: '>=14.0.0', npm: '>=7.0.0'}
@@ -975,6 +1005,80 @@ packages:
react: '>=16.6.0'
react-dom: '>=16.6.0'
+ '@lexical/[email protected]':
+ resolution: {integrity: sha512-hRwASFX/ilaI5r8YOcZuQgONFshRgCPfdxfofNL7uruSFYAO6LkUhsjzZwUgf0DbmCJmbBADFw15FSthgCUhGA==}
+
+ '@lexical/[email protected]':
+ resolution: {integrity: sha512-ZXA4j/S8yLrxjrTnEp39VeDMp4Rd8bLYUlT4Buy1MQlS1WafxOiMhNQJG7k0BP/pO96YPkAebpA81ATKJL0IgA==}
+
+ '@lexical/[email protected]':
+ resolution: {integrity: sha512-iOR+aKLJR92nKYcEOW3K/bgjTN7dJIRC/OM4OvzigU0Xygxped0lXV6UmkYBp0eoqOOwckB8+rZWZszj9lKA8Q==}
+ peerDependencies:
+ react: '>=17.x'
+ react-dom: '>=17.x'
+
+ '@lexical/[email protected]':
+ resolution: {integrity: sha512-iC4OKivEPtt7cGVSwZylLfz5T7Oqr9q9EOosS6E/byMyoqwkYWGjXn/qFiwIv1Xo3+G19vhfChi/+ZcYLXpHPw==}
+
+ '@lexical/[email protected]':
+ resolution: {integrity: sha512-Z58f2tIdz9bn8gltUu5cVg37qROGha38dUZv20gI2GeNugXAkoPzJYEcxlI1D/26tkevJ/7VaFUr9PTk+iKmaA==}
+
+ '@lexical/[email protected]':
+ resolution: {integrity: sha512-DHoDpiokJRBu+GnC0qQH529hamn9YNjL7vzzkTAeEMKsT9+4O848Cq6F2GJn8QjQToySlkVZW3mkh76uf/XLfg==}
+
+ '@lexical/[email protected]':
+ resolution: {integrity: sha512-QKkrWCw4bsn/ZeLIkMVIpbtWKPhMYeax1nE7erHqTEwE52QR6pmZsZBgGSQDO73Ae29vahOmqlN7+ZJFvTKMVA==}
+
+ '@lexical/[email protected]':
+ resolution: {integrity: sha512-oTsBc45eL8/lmF7fqGR+UCjrJYP04gumzf5nk4TczrxWL2pM4GIMLLKG1mpQI2H1MDiRLzq3T/xdI7Gh74z7Zw==}
+
+ '@lexical/[email protected]':
+ resolution: {integrity: sha512-gglkjE99tKYnGAxQbrUq9TcaVKBQhidXhgPPbVw3x1Fba9biMafkbSJhE/7/pzQTPoQBAIl0w7DOUWmBOv+JbQ==}
+
+ '@lexical/[email protected]':
+ resolution: {integrity: sha512-AOC6yAA3mfNvJKbwo+kvAbPJI+13yF2ISA65vbA578CugvJ08zIVgM+pSzxquGhD0ioJY3cXVW7+gdkCP1qu5g==}
+
+ '@lexical/[email protected]':
+ resolution: {integrity: sha512-ncjaL6kNHVioekx6vI5oJRDExFDJLbnXT7AdMnUv2LE3sxn/ea+JsZO/MDI4Ygmxq+lGtgZvbBDER8Yh/+5jdA==}
+
+ '@lexical/[email protected]':
+ resolution: {integrity: sha512-pcLMpxWkSxU2QaN2GLA3hNy4lV2A8sJOvb5YEkcsFEcVvFFbAz7lxgyKVYtDboRCW1eZFks1UGGuJEogLeEFdg==}
+
+ '@lexical/[email protected]':
+ resolution: {integrity: sha512-q9Ckftfhb+VepJQeaClOYzpuV+WqWWGkSUuoexV4zjAm/HVjOie9lrNF4NkhQe5crnIBXI5zOofhuEfiCQWsbQ==}
+
+ '@lexical/[email protected]':
+ resolution: {integrity: sha512-GC5qoQJQzaofCq1eMMvv9wIGMAbpFbFwny5BKA1C2Nmn+/2bi6v+7qlHwiBlbSVqfLVPvT4nYdrmNdnKoE0jZg==}
+
+ '@lexical/[email protected]':
+ resolution: {integrity: sha512-4IxG9Tr0NnQ+clN1eoXfe2W8JTgw0xtPMzqvHP2IaO7RILUE6H8VFSOdhAOI0dHrjlXRMUS3I2Fhqr2ZRq8kdQ==}
+
+ '@lexical/[email protected]':
+ resolution: {integrity: sha512-PGIGmI5xDSAguqpAStd+89TfWsi6hs/R4a3hQAyNwXXDEt4anUFJic4Qet4YftybLGajP3vMvouLE5hrkmBihg==}
+ peerDependencies:
+ react: '>=17.x'
+ react-dom: '>=17.x'
+
+ '@lexical/[email protected]':
+ resolution: {integrity: sha512-A9i5Es/RrZv71tB6dDSyd4TYdbkn/+oUrUdTwnWa+B8EZW26q0h+wgxCGwPtTU7ho4JNP9HOot+EIhe2DbyaYg==}
+
+ '@lexical/[email protected]':
+ resolution: {integrity: sha512-Lix1s2r71jHfsTEs4q/YqK2s3uXKOnyA3fd1VDMWysO+bZzRwEO5+qyDvENZ0WrXSDCnlibNFV1HttWX9/zqyw==}
+
+ '@lexical/[email protected]':
+ resolution: {integrity: sha512-g7S8ml8kIujEDLWlzYKETgPCQ2U9oeWqdytRuHjHGi/rjAAGHSej5IRqTPIMxNP3VVQHnBoQ+Y9hBtjiuddhgQ==}
+
+ '@lexical/[email protected]':
+ resolution: {integrity: sha512-qByNjHp88mlUWHxfYutH4vhSs3nzfCGHKsf/MqUMOC8K7Kmp0V1NK6cOW1sgsHpzkovfpgcNOGDzZxTNCFgHtg==}
+
+ '@lexical/[email protected]':
+ resolution: {integrity: sha512-CFp4diY/kR5RqhzQSl/7SwsMod1sgLpI1FBifcOuJ6L/S6YywGpEB4B7aV5zqW21A/jU2T+2NZtxSUn6S+9gMg==}
+
+ '@lexical/[email protected]':
+ resolution: {integrity: sha512-7UjHvXDd+Is/qTdNkpQ/K04Zduh2uh7UTlSWbMiqwbQh8VRJNXXgcH8iK0TXLwc7M3VgVk+FlnNApNvcReKB6g==}
+ peerDependencies:
+ yjs: '>=13.5.22'
+
'@mapbox/[email protected]':
resolution: {integrity: sha512-Yhlar6v9WQgUp/He7BdgzOz8lqMQ8sU+jkCq7Wx8Myc5YFJLbEe7lgui/V7G1qB1DJykHSGwreceSaD60Y0PUQ==}
hasBin: true
@@ -1150,6 +1254,9 @@ packages:
resolution: {integrity: sha512-YLT9Zo3oNPJoBjBc4q8G2mjU4tqIbf5CEOORbUUr48dCD9q3umJ3IPlVqOqDakPfd2HuwccBaqlGhN4Gmr5OWg==}
engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0}
+ '@preact/[email protected]':
+ resolution: {integrity: sha512-BwbTXpj+9QutoZLQvbttRg5x3l5468qaV2kufh+51yha1c53ep5dY4kTuZR35+3pAZxpfQerGJiQqg34ZNZ6uA==}
+
'@rc-component/[email protected]':
resolution: {integrity: sha512-qgGdcVIF604M9EqjNF0hbUTz42bz/RDtxWdWuU5EQe3hi7M8ob54B6B35rOsvX5eSvIHIzT9iH1R3n+hk3CGfg==}
engines: {node: '>=14.x'}
@@ -2890,6 +2997,9 @@ packages:
resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==}
+ resolution: {integrity: sha512-PIeMbHqMt4DnUP3MA/Flc0HElYjMXArsw1qwJZcm9sqR8mq3l8NYizFMty0pWwE/tzIGH3EKK5+jes5mAr85yw==}
+
resolution: {integrity: sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==}
@@ -2999,6 +3109,23 @@ packages:
resolution: {integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==}
engines: {node: '>= 0.8.0'}
+ resolution: {integrity: sha512-ukiSAxMB9Hl88V19eT5uDSC7gDpeXKhgO6MEtmHKnj69VgwLVCKclIr2UO6yJs97QEw3cqJA5nM4j72obgXlmw==}
+ peerDependencies:
+ '@lexical/react': '>=0.11.0'
+ '@lexical/utils': '>=0.11.0'
+ lexical: '>=0.11.0'
+ react: '>=17.x'
+ react-dom: '>=17.x'
+
+ resolution: {integrity: sha512-r5VJR2TioQPAsZATfktnJFrGIiy6gjQN8b/+0a2u1d7/QTH7lhbB7byhGSvcq1iaa1TV/xcf/pFV55a5V5hTDQ==}
+
+ resolution: {integrity: sha512-gcxmNFzA4hv8UYi8j43uPlQ7CGcyMJ2KQb5kZASw6SnAKAf10hK12i2fjrS3Cl/ugZa5Ui6WwIu1/6MIXiHttQ==}
+ engines: {node: '>=16'}
+ hasBin: true
+
resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==}
@@ -3374,6 +3501,10 @@ packages:
engines: {node: '>=14'}
hasBin: true
+ resolution: {integrity: sha512-DEvV2ZF2r2/63V+tK8hQvrR2ZGn10srHbXviTlcv7Kpzw8jWiNTqbVgjO3IY8RxrrOUF8VPMQQFysYYYv0YZxw==}
+ engines: {node: '>=6'}
+
resolution: {integrity: sha512-WQOWF/VB0pTJu7c3ko0y5w6HWDQf6Wm3ppvKDI7ET4OSYBDOvcliBRM1HFIHHkJPNa/1bYTzmUinjF8492oaBg==}
@@ -3672,6 +3803,11 @@ packages:
peerDependencies:
react: ^18.3.1
+ resolution: {integrity: sha512-gdlJjD7NWr0IfkPlaREN2d9uUZUlksrfOx7SX62VRerwXbMY6ftGCIZua1VG1aXFNOimhISsTq+Owp725b9SiA==}
+ peerDependencies:
+ react: '>=16.13.1'
+
resolution: {integrity: sha512-ahGab+IaSgZmNPYXdV1n+OYky95TGpFwnKRflX/16dY04DsYYKHtVLjeny7sBSCREEcoMbAgSkFiGLF5g5Oofw==}
peerDependencies:
@@ -4132,6 +4268,9 @@ packages:
resolution: {integrity: sha512-+XZ+r1XGIJGeQk3VvXhT6xx/VpbHsRzsTkGgF6E5RX9TTXD0118l87puaEBZ566FhqblC6U0d4XnubznJDm30A==}
engines: {node: ^14.18.0 || >=16.0.0}
+ resolution: {integrity: sha512-Cat63mxsVJlzYvN51JmVXIgNoUokrIaT2zLclCXjRd8boZ0004U4KCs/sToJ75C6sdlByWxpYnb5Boif1VSFew==}
+
resolution: {integrity: sha512-ZL6DDuAlRlLGghwcfmSn9sK3Hr6ArtyudlSAiCqQ6IfE+b+HHbydbYDIG15IfS5do+7XQQBdBiubF/cV2dnDzg==}
engines: {node: '>=6'}
@@ -4458,6 +4597,10 @@ packages:
engines: {node: '>= 14.6'}
hasBin: true
+ resolution: {integrity: sha512-OIDwaflOaq4wC6YlPBy2L6ceKeKuF7DeTxx+jPzv1FHn9tCZ0ZwSRnUBxD05E3yed46fv/FWJbvR+Ud7x0L7zw==}
+ engines: {node: '>=16.0.0', npm: '>=8.0.0'}
+
resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==}
engines: {node: '>=10'}
@@ -5355,6 +5498,31 @@ snapshots:
'@eslint/core': 0.14.0
levn: 0.4.1
+ '@floating-ui/[email protected]':
+ dependencies:
+ '@floating-ui/utils': 0.2.10
+
+ '@floating-ui/[email protected]':
+ dependencies:
+ '@floating-ui/core': 1.7.3
+ '@floating-ui/utils': 0.2.10
+
+ dependencies:
+ '@floating-ui/dom': 1.7.4
+ react: 18.3.1
+ react-dom: 18.3.1([email protected])
+
+ dependencies:
+ '@floating-ui/react-dom': 2.1.6([email protected]([email protected]))([email protected])
+ '@floating-ui/utils': 0.2.10
+ react: 18.3.1
+ react-dom: 18.3.1([email protected])
+ tabbable: 6.2.0
+
+ '@floating-ui/[email protected]': {}
+
'@fluent/[email protected]': {}
'@fullcalendar/[email protected]':
@@ -5430,6 +5598,167 @@ snapshots:
react: 18.3.1
react-dom: 18.3.1([email protected])
+ '@lexical/[email protected]':
+ dependencies:
+ '@lexical/html': 0.37.0
+ '@lexical/list': 0.37.0
+ '@lexical/selection': 0.37.0
+ '@lexical/utils': 0.37.0
+ lexical: 0.37.0
+
+ '@lexical/[email protected]':
+ dependencies:
+ '@lexical/utils': 0.37.0
+ lexical: 0.37.0
+ prismjs: 1.30.0
+
+ dependencies:
+ '@lexical/html': 0.37.0
+ '@lexical/link': 0.37.0
+ '@lexical/mark': 0.37.0
+ '@lexical/table': 0.37.0
+ '@lexical/utils': 0.37.0
+ lexical: 0.37.0
+ react: 18.3.1
+ react-dom: 18.3.1([email protected])
+
+ '@lexical/[email protected]':
+ dependencies:
+ '@lexical/extension': 0.37.0
+ lexical: 0.37.0
+
+ '@lexical/[email protected]':
+ dependencies:
+ '@lexical/utils': 0.37.0
+ '@preact/signals-core': 1.12.1
+ lexical: 0.37.0
+
+ '@lexical/[email protected]':
+ dependencies:
+ '@lexical/text': 0.37.0
+ '@lexical/utils': 0.37.0
+ lexical: 0.37.0
+
+ '@lexical/[email protected]':
+ dependencies:
+ '@lexical/extension': 0.37.0
+ '@lexical/utils': 0.37.0
+ lexical: 0.37.0
+
+ '@lexical/[email protected]':
+ dependencies:
+ '@lexical/selection': 0.37.0
+ '@lexical/utils': 0.37.0
+ lexical: 0.37.0
+
+ '@lexical/[email protected]':
+ dependencies:
+ '@lexical/extension': 0.37.0
+ '@lexical/utils': 0.37.0
+ lexical: 0.37.0
+
+ '@lexical/[email protected]':
+ dependencies:
+ '@lexical/extension': 0.37.0
+ '@lexical/selection': 0.37.0
+ '@lexical/utils': 0.37.0
+ lexical: 0.37.0
+
+ '@lexical/[email protected]':
+ dependencies:
+ '@lexical/utils': 0.37.0
+ lexical: 0.37.0
+
+ '@lexical/[email protected]':
+ dependencies:
+ '@lexical/code': 0.37.0
+ '@lexical/link': 0.37.0
+ '@lexical/list': 0.37.0
+ '@lexical/rich-text': 0.37.0
+ '@lexical/text': 0.37.0
+ '@lexical/utils': 0.37.0
+ lexical: 0.37.0
+
+ '@lexical/[email protected]':
+ dependencies:
+ lexical: 0.37.0
+
+ '@lexical/[email protected]':
+ dependencies:
+ lexical: 0.37.0
+
+ '@lexical/[email protected]':
+ dependencies:
+ '@lexical/clipboard': 0.37.0
+ '@lexical/dragon': 0.37.0
+ '@lexical/selection': 0.37.0
+ '@lexical/utils': 0.37.0
+ lexical: 0.37.0
+
+ dependencies:
+ '@floating-ui/react': 0.27.16([email protected]([email protected]))([email protected])
+ '@lexical/devtools-core': 0.37.0([email protected]([email protected]))([email protected])
+ '@lexical/dragon': 0.37.0
+ '@lexical/extension': 0.37.0
+ '@lexical/hashtag': 0.37.0
+ '@lexical/history': 0.37.0
+ '@lexical/link': 0.37.0
+ '@lexical/list': 0.37.0
+ '@lexical/mark': 0.37.0
+ '@lexical/markdown': 0.37.0
+ '@lexical/overflow': 0.37.0
+ '@lexical/plain-text': 0.37.0
+ '@lexical/rich-text': 0.37.0
+ '@lexical/table': 0.37.0
+ '@lexical/text': 0.37.0
+ '@lexical/utils': 0.37.0
+ '@lexical/yjs': 0.37.0([email protected])
+ lexical: 0.37.0
+ react: 18.3.1
+ react-dom: 18.3.1([email protected])
+ react-error-boundary: 6.0.0([email protected])
+ transitivePeerDependencies:
+ - yjs
+
+ '@lexical/[email protected]':
+ dependencies:
+ '@lexical/clipboard': 0.37.0
+ '@lexical/dragon': 0.37.0
+ '@lexical/selection': 0.37.0
+ '@lexical/utils': 0.37.0
+ lexical: 0.37.0
+
+ '@lexical/[email protected]':
+ dependencies:
+ lexical: 0.37.0
+
+ '@lexical/[email protected]':
+ dependencies:
+ '@lexical/clipboard': 0.37.0
+ '@lexical/extension': 0.37.0
+ '@lexical/utils': 0.37.0
+ lexical: 0.37.0
+
+ '@lexical/[email protected]':
+ dependencies:
+ lexical: 0.37.0
+
+ '@lexical/[email protected]':
+ dependencies:
+ '@lexical/list': 0.37.0
+ '@lexical/selection': 0.37.0
+ '@lexical/table': 0.37.0
+ lexical: 0.37.0
+
+ dependencies:
+ '@lexical/offset': 0.37.0
+ '@lexical/selection': 0.37.0
+ lexical: 0.37.0
+ yjs: 13.6.27
+
dependencies:
detect-libc: 2.1.2
@@ -5569,6 +5898,8 @@ snapshots:
'@pkgr/[email protected]': {}
+ '@preact/[email protected]': {}
+
'@rc-component/[email protected]':
dependencies:
'@babel/runtime': 7.27.6
@@ -7643,6 +7974,8 @@ snapshots:
+
optional: true
@@ -7781,6 +8114,20 @@ snapshots:
prelude-ls: 1.2.1
type-check: 0.4.0
+ dependencies:
+ '@lexical/utils': 0.37.0
+ lexical: 0.37.0
+ react: 18.3.1
+ react-dom: 18.3.1([email protected])
+
+
+ dependencies:
+ isomorphic.js: 0.2.5
+
@@ -8179,6 +8526,8 @@ snapshots:
+
dependencies:
obop: 0.2.3
@@ -8577,6 +8926,11 @@ snapshots:
react: 18.3.1
scheduler: 0.23.2
+ dependencies:
+ '@babel/runtime': 7.27.6
+ react: 18.3.1
+
dependencies:
'@babel/runtime': 7.27.6
@@ -9132,6 +9486,8 @@ snapshots:
dependencies:
'@pkgr/core': 0.2.7
+
@@ -9536,6 +9892,10 @@ snapshots:
+ dependencies:
+ lib0: 0.2.114
+
diff --git a/src/api/dataStatistics.ts b/src/api/dataStatistics.ts
index 47a2d1d2..e39b51b4 100644
--- a/src/api/dataStatistics.ts
+++ b/src/api/dataStatistics.ts
@@ -11,3 +11,10 @@ export const getStatisticsPeriodApi = (data: StatisticsPeriodApiParams) => {
data,
);
};
+
+// 获取抖音话题
+export const getDouyinTopicsApi = (keyword: string) => {
+ return http.post<string[]>("statistics/channels/douyin/searchTopic", {
+ topic: keyword,
+ });
+};
diff --git a/src/api/tools.ts b/src/api/tools.ts
index d2b2cd2a..dcf99cb9 100644
--- a/src/api/tools.ts
+++ b/src/api/tools.ts
@@ -98,14 +98,19 @@ export const toolsApi = {
onProgress?: (prog: number) => void,
): Promise<string> {
const fileSize = file.size;
- const fileName = (file as any).name || 'file';
- const contentType = file.type || 'application/octet-stream';
-
+ const fileName = (file as any).name || "file";
+ const contentType = file.type || "application/octet-stream";
+
// 如果文件大于10MB,使用分片上传
- if (fileSize > (10 * 1024 * 1024)) {
- return this.uploadFileTempMultipart(file, fileName, contentType, onProgress);
+ if (fileSize > 10 * 1024 * 1024) {
+ return this.uploadFileTempMultipart(
+ file,
+ fileName,
+ contentType,
+ onProgress,
+ );
}
-
+
// 小于10MB,使用普通上传
const formData = new FormData();
formData.append("file", file);
@@ -169,7 +174,7 @@ export const toolsApi = {
// 上传分片
const formData = new FormData();
formData.append("file", chunk);
-
+
const partResponse = await axios({
url: `${process.env.NEXT_PUBLIC_API_URL}/file/uploadPart/upload`,
method: "POST",
@@ -196,19 +201,19 @@ export const toolsApi = {
console.log(`分片 ${i + 1}/${chunks} 上传完成`);
}
- // 3. 完成分片上传
- await axios({
- url: `${process.env.NEXT_PUBLIC_API_URL}/file/uploadPart/complete`,
- method: "POST",
- data: {
- fileId,
- uploadId,
- parts,
- },
- });
-
- // 文件地址在初始化时就已经返回了
- return fileId;
+ // 3. 完成分片上传
+ await axios({
+ url: `${process.env.NEXT_PUBLIC_API_URL}/file/uploadPart/complete`,
+ method: "POST",
+ data: {
+ fileId,
+ uploadId,
+ parts,
+ },
+ });
+
+ // 文件地址在初始化时就已经返回了
+ return fileId;
} catch (error) {
console.error("分片上传失败:", error);
throw error;
diff --git a/src/components/PublishDialog/compoents/PlatParamsSetting/index.tsx b/src/components/PublishDialog/compoents/PlatParamsSetting/index.tsx
index 06bd6cbe..0cd5646f 100644
--- a/src/components/PublishDialog/compoents/PlatParamsSetting/index.tsx
+++ b/src/components/PublishDialog/compoents/PlatParamsSetting/index.tsx
@@ -94,7 +94,14 @@ const PlatParamsSetting = memo(
setExpandedPubItem(pubItem);
}}
>
- <p>
+ <p
+ className={
+ platConfig.commonPubParamsConfig.desMax <
+ pubItem.params.des.length
+ ? 'platParamsSetting-textOverflow'
+ : ""
+ }
+ >
{pubItem.params.des ? (
pubItem.params.des
) : (
diff --git a/src/components/PublishDialog/compoents/PlatParamsSetting/platParamsSetting.module.scss b/src/components/PublishDialog/compoents/PlatParamsSetting/platParamsSetting.module.scss
index 41d24572..20a223e2 100644
--- a/src/components/PublishDialog/compoents/PlatParamsSetting/platParamsSetting.module.scss
+++ b/src/components/PublishDialog/compoents/PlatParamsSetting/platParamsSetting.module.scss
@@ -1,5 +1,8 @@
.platParamsSetting {
:global {
+ .platParamsSetting-textOverflow {
+ background: rgba(255, 48, 48, 0.1);
+ }
.platParamsSetting-wrapper {
display: flex;
width: 100%;
@@ -21,7 +24,7 @@
cursor: pointer;
display: flex;
align-items: center;
- padding-left: 15px;
+ padding: 0 15px;
color: var(--grayColor11);
p {
white-space: nowrap;
diff --git a/src/components/PublishDialog/compoents/PubParmasTextarea/PubParmasMentionInput/components/Menu.tsx b/src/components/PublishDialog/compoents/PubParmasTextarea/PubParmasMentionInput/components/Menu.tsx
new file mode 100644
index 00000000..d4442dde
--- /dev/null
+++ b/src/components/PublishDialog/compoents/PubParmasTextarea/PubParmasMentionInput/components/Menu.tsx
@@ -0,0 +1,37 @@
+import {
+ BeautifulMentionsMenuItemProps,
+ BeautifulMentionsMenuProps,
+} from "lexical-beautiful-mentions";
+import { forwardRef } from "react";
+import styles from "../pubParmasMentionInput.module.scss";
+import { LoadingOutlined } from "@ant-design/icons";
+
+/**
+ * Menu component for the BeautifulMentionsPlugin.
+ */
+export function Menu({ loading, ...other }: BeautifulMentionsMenuProps) {
+ if (loading) {
+ return (
+ <div className={styles.mentionMenuLoading}>
+ <span>Loading</span>
+ <LoadingOutlined />
+ </div>
+ );
+ }
+ return <ul className={styles.mentionMenu} {...other} />;
+}
+
+/**
+ * MenuItem component for the BeautifulMentionsPlugin.
+ */
+export const MenuItem = forwardRef<
+ HTMLLIElement,
+ BeautifulMentionsMenuItemProps
+>(({ selected, item, itemValue, ...props }, ref) => (
+ <li
+ ref={ref}
+ {...props}
+ className={`${styles.mentionMenuItem} ${selected ? styles.selected : ""}`}
+ />
+));
+MenuItem.displayName = "MenuItem";
diff --git a/src/components/PublishDialog/compoents/PubParmasTextarea/PubParmasMentionInput/index.tsx b/src/components/PublishDialog/compoents/PubParmasTextarea/PubParmasMentionInput/index.tsx
new file mode 100644
index 00000000..497c7313
--- /dev/null
+++ b/src/components/PublishDialog/compoents/PubParmasTextarea/PubParmasMentionInput/index.tsx
@@ -0,0 +1,136 @@
+"use client";
+
+import React, {
+ ForwardedRef,
+ forwardRef,
+ memo,
+ useCallback,
+ useRef,
+} from "react";
+import {
+ BeautifulMentionNode,
+ BeautifulMentionsPlugin,
+ BeautifulMentionsPluginProps,
+ PlaceholderNode,
+} from "lexical-beautiful-mentions";
+import {
+ InitialConfigType,
+ LexicalComposer,
+} from "@lexical/react/LexicalComposer";
+import { RichTextPlugin } from "@lexical/react/LexicalRichTextPlugin";
+import { ContentEditable } from "@lexical/react/LexicalContentEditable";
+import { LexicalErrorBoundary } from "@lexical/react/LexicalErrorBoundary";
+import { OnChangePlugin } from "@lexical/react/LexicalOnChangePlugin";
+import { EditorState, $getRoot, LexicalEditor } from "lexical";
+import { HistoryPlugin } from "@lexical/react/LexicalHistoryPlugin";
+import { AutoFocusPlugin } from "@lexical/react/LexicalAutoFocusPlugin";
+import styles from "./pubParmasMentionInput.module.scss";
+
+import {
+ Menu,
+ MenuItem,
+} from "@/components/PublishDialog/compoents/PubParmasTextarea/PubParmasMentionInput/components/Menu";
+import { getDouyinTopicsApi } from "@/api/dataStatistics";
+import { InitialValuePlugin } from "@/components/PublishDialog/compoents/PubParmasTextarea/PubParmasMentionInput/utils/editor-utils";
+
+export interface IPubParmasMentionInputRef {}
+
+export interface IPubParmasMentionInputProps {
+ onChange: (value: string) => void;
+ value: string;
+ placeholder: string;
+ maxLength: number;
+}
+
+const mentionItems = {
+ "#": ["AiToEarn"],
+};
+
+const editorConfig: InitialConfigType = {
+ nodes: [BeautifulMentionNode, PlaceholderNode],
+ namespace: "PublishDescriptionEditor",
+ onError(error: Error) {
+ throw error;
+ },
+ theme: {
+ beautifulMentions: {
+ "#": `${styles.mentionsStyle}`,
+ },
+ },
+};
+
+const PubParmasMentionInput = memo(
+ forwardRef(
+ (
+ { onChange, value, placeholder, maxLength }: IPubParmasMentionInputProps,
+ ref: ForwardedRef<IPubParmasMentionInputRef>,
+ ) => {
+ const comboboxAnchor = useRef<HTMLDivElement>(null);
+ const handleChange = useCallback(
+ (editorState: EditorState, editor: LexicalEditor) => {
+ editorState.read(() => {
+ const root = $getRoot();
+ const text = root.getTextContent();
+ onChange(text);
+ });
+ },
+ [],
+ );
+
+ const handleSearch = useCallback(
+ async (trigger: string, queryString?: string | null) => {
+ if (!queryString) return [];
+ const res = await getDouyinTopicsApi(queryString!);
+ return res?.data ?? [];
+ },
+ [],
+ );
+
+ // @ts-ignore
+ const beautifulMentionsProps: BeautifulMentionsPluginProps = {
+ comboboxAnchor: comboboxAnchor.current,
+ items: mentionItems,
+ triggers: ["#"],
+ autoSpace: true,
+ creatable: {
+ "#": 'Add tag "{{name}}"',
+ },
+ menuComponent: Menu,
+ menuItemComponent: MenuItem,
+ emptyComponent: undefined,
+ insertOnBlur: true,
+ allowSpaces: false,
+ searchDelay: 200,
+ onSearch: handleSearch,
+ };
+
+ return (
+ <div className={styles.mentionsContainer} ref={comboboxAnchor}>
+ <LexicalComposer initialConfig={editorConfig}>
+ <RichTextPlugin
+ contentEditable={
+ <ContentEditable
+ className={styles.mentionsContentEditable}
+ style={{ tabSize: 1 }}
+ />
+ }
+ placeholder={
+ <div className={styles.mentionsPlaceholder}>{placeholder}</div>
+ }
+ ErrorBoundary={LexicalErrorBoundary}
+ />
+ <OnChangePlugin onChange={handleChange} />
+ <HistoryPlugin />
+ <AutoFocusPlugin defaultSelection="rootStart" />
+
+ <InitialValuePlugin value={value} />
+
+ <BeautifulMentionsPlugin {...beautifulMentionsProps} />
+ </LexicalComposer>
+ </div>
+ );
+ },
+ ),
+);
+
+export default PubParmasMentionInput;
diff --git a/src/components/PublishDialog/compoents/PubParmasTextarea/PubParmasMentionInput/pubParmasMentionInput.module.scss b/src/components/PublishDialog/compoents/PubParmasTextarea/PubParmasMentionInput/pubParmasMentionInput.module.scss
new file mode 100644
index 00000000..2254d9ef
--- /dev/null
+++ b/src/components/PublishDialog/compoents/PubParmasTextarea/PubParmasMentionInput/pubParmasMentionInput.module.scss
@@ -0,0 +1,102 @@
+.mentionMenu, .mentionMenuLoading {
+ position: absolute;
+ top: 2px;
+ left: 0;
+ z-index: 1000;
+ background: #fff;
+ color: #222;
+ min-width: 8rem;
+ border: 1px solid #e5e7eb;
+ border-radius: 0.375rem;
+ box-shadow: 0 4px 16px rgba(0,0,0,0.08);
+ padding: 0.25rem;
+ margin: 0;
+ overflow: hidden;
+ white-space: nowrap;
+
+ li {
+ padding: 0.5rem 0.75rem;
+ border-radius: 0.25rem;
+ cursor: pointer;
+ transition: background 0.15s;
+ &:hover, &[aria-selected="true"] {
+ background: #f3f4f6;
+ }
+ }
+}
+
+.mentionMenuLoading {
+ padding: 12px;
+ display: flex;
+ align-items: center;
+ gap: 10px;
+ span {
+ display: block;
+ }
+}
+
+.mentionMenuItem {
+ position: relative;
+ display: flex;
+ align-items: center;
+ cursor: pointer;
+ border-radius: 0.25rem;
+ padding: 0.375rem 0.5rem;
+ font-size: 0.95rem;
+ user-select: none;
+ outline: none;
+
+ &.selected {
+ background: #e0e7ff;
+ color: var(--colorPrimary5);
+ }
+}
+
+// 提及样式
+.mentionsStyle {
+ display: inline-block;
+ background: var(--colorPrimary5);
+ color: #fff;
+ border-radius: 0.375rem;
+ padding: 0.1em 0.5em;
+ font-size: var(--fs-sm);
+ font-weight: 500;
+ margin: 0 2px;
+ vertical-align: middle;
+ box-shadow: 0 2px 8px rgba(130, 106, 228, 0.08);
+ transition: background 0.2s;
+}
+
+.mentionsPlaceholder {
+ position: absolute;
+ top: 3px;
+ left: 3px;
+ z-index: 1001;
+ color: var(--grayColor5);
+}
+
+.mentionsContainer {
+ position: relative;
+ border-radius: 6px;
+ margin-bottom: 15px;
+}
+
+.mentionsContentEditable {
+ background: var(--background-color);
+ position: relative;
+ z-index: 1;
+ width: 100%;
+ flex: 1;
+ border-radius: 0.375rem;
+ font-size: var(--fs-md);
+ color: var(--text-primary);
+ outline: none;
+ height: 250px;
+ overflow: auto !important;
+ transition: box-shadow 0.2s, border-color 0.2s;
+
+ &::placeholder {
+ color: var(--grayColor7);
+ opacity: 1;
+ }
+}
diff --git a/src/components/PublishDialog/compoents/PubParmasTextarea/PubParmasMentionInput/utils/editor-utils.ts b/src/components/PublishDialog/compoents/PubParmasTextarea/PubParmasMentionInput/utils/editor-utils.ts
new file mode 100644
index 00000000..f901efdf
--- /dev/null
+++ b/src/components/PublishDialog/compoents/PubParmasTextarea/PubParmasMentionInput/utils/editor-utils.ts
@@ -0,0 +1,48 @@
+import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
+import { useEffect, useRef } from "react";
+import { $createParagraphNode, $createTextNode, $getRoot } from "lexical";
+import { BeautifulMentionNode } from "lexical-beautiful-mentions";
+
+export function InitialValuePlugin({ value }: { value: string }) {
+ const [editor] = useLexicalComposerContext();
+ const lastAppliedRef = useRef<string>("");
+
+ useEffect(() => {
+ editor.update(() => {
+ const root = $getRoot();
+ const currentText = root.getTextContent();
+ if (value === currentText || value === lastAppliedRef.current) return;
+
+ root.clear();
+ const paragraph = $createParagraphNode();
+ root.append(paragraph);
+
+ if (!value) {
+ lastAppliedRef.current = value;
+ return;
+ }
+
+ // 按原顺序拆分:话题片段形如 "#xxx"
+ const parts = value.split(/(#\S+)/g).filter(Boolean);
+
+ parts.forEach((part) => {
+ if (part.startsWith("#")) {
+ const topic = part.slice(1);
+ if (topic) {
+ // @ts-ignore 构造函数依库版本
+ const mentionNode = new BeautifulMentionNode("#", topic);
+ paragraph.append(mentionNode);
+ }
+ } else {
+ if (part) {
+ paragraph.append($createTextNode(part));
+ }
+ }
+ });
+
+ lastAppliedRef.current = value;
+ });
+ }, [editor, value]);
+
+ return null;
+}
diff --git a/src/components/PublishDialog/compoents/PubParmasTextarea/index.tsx b/src/components/PublishDialog/compoents/PubParmasTextarea/index.tsx
index 64a30fb2..5cce6020 100644
--- a/src/components/PublishDialog/compoents/PubParmasTextarea/index.tsx
+++ b/src/components/PublishDialog/compoents/PubParmasTextarea/index.tsx
@@ -9,7 +9,7 @@ import React, {
useRef,
useState,
} from "react";
-import { Button, Image, Input, message, Tooltip, Upload } from "antd";
+import { Button, Image, Input, message, Tooltip } from "antd";
import styles from "@/components/PublishDialog/compoents/PubParmasTextarea/pubCommonComps.module.scss";
import { ReactSortable } from "react-sortablejs";
import { CSSTransition, TransitionGroup } from "react-transition-group";
@@ -36,10 +36,9 @@ import Aibrush from "@/components/PublishDialog/svgs/aibrush.svg";
import { usePublishDialog } from "@/components/PublishDialog/usePublishDialog";
import { useShallow } from "zustand/react/shallow";
import DraftSelectionModal from "@/components/PublishDialog/compoents/DraftSelectionModal";
+import PubParmasMentionInput from "@/components/PublishDialog/compoents/PubParmasTextarea/PubParmasMentionInput";
const { TextArea } = Input;
-const { Dragger } = Upload;
-
export interface IPubParmasTextareaRef {}
export interface IChangeParams {
@@ -109,7 +108,6 @@ const PubParmasTextarea = memo(
);
// 裁剪弹框
const [videoCoverSetingModal, setVideoCoverSetingModal] = useState(false);
- const textareaRef = useRef<TextAreaRef>(null);
const isFirst = useRef({
effect: true,
sort: true,
@@ -325,25 +323,31 @@ const PubParmasTextarea = memo(
<div className={styles.pubParmasTextarea} style={style}>
<div className="pubParmasTextarea-input">
{beforeExtend}
- <TextArea
- ref={textareaRef}
- placeholder={t("form.descriptionPlaceholder")}
+ <PubParmasMentionInput
value={value}
- onChange={(e) => setValue(e.target.value)}
- rows={rows}
- autoFocus={true}
+ onChange={(value) => setValue(value)}
+ placeholder={t("form.descriptionPlaceholder")}
maxLength={desMax}
- onFocus={() => {
- setTimeout(() => {
- if (textareaRef.current) {
- const val =
- textareaRef.current.resizableTextArea!.textArea;
- const len = value.length;
- val.setSelectionRange(len, len);
- }
- }, 10);
- }}
/>
+ {/*<TextArea*/}
+ {/* ref={textareaRef}*/}
+ {/* placeholder={t("form.descriptionPlaceholder")}*/}
+ {/* value={value}*/}
+ {/* onChange={(e) => setValue(e.target.value)}*/}
+ {/* rows={rows}*/}
+ {/* autoFocus={true}*/}
+ {/* maxLength={desMax}*/}
+ {/* onFocus={() => {*/}
+ {/* setTimeout(() => {*/}
+ {/* if (textareaRef.current) {*/}
+ {/* const val =*/}
+ {/* textareaRef.current.resizableTextArea!.textArea;*/}
+ {/* const len = value.length;*/}
+ {/* val.setSelectionRange(len, len);*/}
+ {/* }*/}
+ {/* }, 10);*/}
+ {/* }}*/}
+ {/*/>*/}
<ReactSortable
className="pubParmasTextarea-uploads"
list={imageFileList}