1、English name这块,除了中文,数字不能用,其他都可以
2、blue空格
This commit is contained in:
@@ -219,9 +219,15 @@ export default {
|
||||
}
|
||||
// 获取单元格的 HTML 内容
|
||||
let htmlContent = cell.trim();
|
||||
// 在第 21 行之后添加
|
||||
let processedContent = htmlContent.replace(/(<\/p>)\s*(?=<p)/gi, '$1<br>');
|
||||
|
||||
|
||||
str = this.transformHtmlString(htmlContent, 'table')
|
||||
|
||||
|
||||
str = this.transformHtmlString(processedContent, 'table',{ keepBr: true })
|
||||
console.log("🚀 ~ extractContentWithoutOuterSpan888888 ~ str:", str);
|
||||
|
||||
|
||||
// 创建一个临时的 DOM 元素来解析 HTML
|
||||
const div = document.createElement('div');
|
||||
@@ -971,10 +977,14 @@ str = str.replace(regex, function (match, content, offset, fullString) {
|
||||
|
||||
|
||||
async parseTableToArray(tableString, callback) {
|
||||
|
||||
|
||||
|
||||
const parser = new DOMParser();
|
||||
const doc = parser.parseFromString(tableString, 'text/html');
|
||||
const rows = doc.querySelectorAll('table tr'); // 获取所有的行(<tr>)
|
||||
|
||||
|
||||
|
||||
// 使用 Promise 来处理异步的 MathJax 解析
|
||||
const result = await Promise.all(
|
||||
@@ -982,6 +992,8 @@ str = str.replace(regex, function (match, content, offset, fullString) {
|
||||
const cells = row.querySelectorAll('th, td'); // 获取每个行中的单元格(包括 <th> 和 <td>)
|
||||
return await Promise.all(
|
||||
Array.from(cells).map(async (cell) => {
|
||||
console.log("🚀 ~ parseTableToArray777 ~ cell:", cell);
|
||||
|
||||
const text = await this.extractMathJaxLatex(cell);
|
||||
return {
|
||||
text,
|
||||
@@ -2125,14 +2137,18 @@ str = str.replace(regex, function (match, content, offset, fullString) {
|
||||
text: 'Blue',
|
||||
className: 'custom-button-blue',
|
||||
onAction: function () {
|
||||
// 必须获取带 HTML 的内容,否则里面的 em/i 标签在拼接前就丢了
|
||||
// 获取选中的 HTML
|
||||
var selectedText = ed.selection.getContent({ format: 'html' });
|
||||
|
||||
if (selectedText) {
|
||||
// 这就是你想要的:直接外层套一个 blue
|
||||
var wrappedText = `<blue>${selectedText}</blue>`;
|
||||
|
||||
// 使用 setContent 强行回写
|
||||
|
||||
if (selectedText && selectedText.trim().length > 0) {
|
||||
|
||||
var processedText = selectedText.replace(/ /g, ' ');
|
||||
|
||||
|
||||
|
||||
var wrappedText = `<blue>${processedText}</blue>`;
|
||||
|
||||
// 使用 setContent 插入
|
||||
ed.selection.setContent(wrappedText);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user