TinyMCE的复制/从Excel粘贴(插件的BBcode)(Tinymce copy/paste

2019-09-17 01:15发布

我使用TinyMCE的,下面你可以看到执行。 现在的问题:当我从Excel中复制一些记录,并将其粘贴在我的TinyMCE的领域。 它显示出良好的足以让我(与插件:糊状,他将实际显示的字段),当我问从我的字段中的值,我得到一个表结构返回depeding你贴什么。 但我不希望任何HTML,见下面我想要的。

实现代码:

tinyMCE.init({ 
mode : "exact", 
elements: "id", 
theme : "advanced", 
plugins : "bbcode, inlinepopups", 
content_css : "tinymce.css", 
entity_encoding : "raw", 
remove_linebreaks : false, 
forced_root_block: false, 
force_br_newlines: true, 
invalid_elements : "p, div, span", 
force_p_newlines: false, t
heme_advanced_buttons1 : $cur_buttons, 
theme_advanced_buttons2: "", 
theme_advanced_buttons3: "", 
init_instance_callback : "tiny_mce_callback"});

从TinyMCE的对象返回:

<table style="border-collapse: collapse;" width="216" border="0"
       cellspacing="0" cellpadding="0">
<!--StartFragment-->
<colgroup>
  <col style="mso-width-source: userset; mso-width-alt: 1152;" width="27"/>
  <col width="55" />
  <col style="mso-width-source: userset; mso-width-alt: 2858;"
       span="2" width="67"/>
</colgroup>
<tbody>
<tr style="mso-height-source: userset;">
<td class="xl24" width="27" height="12">1</td>
<td class="xl26" width="55">26/05/12</td>
<td class="xl24" width="67">Amsterdam</td>
<td class="xl24" width="67">Casablanca</td>
</tr>
<tr style="mso-height-source: userset;">
<td class="xl24" height="12">2</td>
<td class="xl25">27/05/12</td>
<td class="xl24">Casablanca</td>
<td class="xl24">Rabat</td>
</tr>
<tr style="mso-height-source: userset;">
<td class="xl24" height="12">3</td>
<td class="xl25">28/05/12</td>
<td class="xl24">Rabat</td>
<td class="xl24">Fes</td>
</tr>
<tr style="mso-height-source: userset;">
<td class="xl24" height="12">4</td>
<td class="xl25">29/05/12</td>
<td class="xl24">Fes</td>
<td class="xl24"> </td>
</tr>
<tr style="mso-height-source: userset;">
<td class="xl24" height="12">5</td>
<td class="xl25">30/05/12</td>
<td class="xl24">Fes</td>
<td class="xl24">Erg Chebbi</td>
</tr>
<tr style="mso-height-source: userset;">
<td class="xl24" height="12">6</td>
<td class="xl25">31/05/12</td>
<td class="xl24">Erg Chebbi</td>
<td class="xl24">Dades Vallei</td>
</tr>
<tr style="mso-height-source: userset;">
<td class="xl24" height="12">7</td>
<td class="xl25">01/06/12</td>
<td class="xl24">Dades Vallei</td>
<td class="xl24">Ouarzazate</td>
</tr>
<tr style="mso-height-source: userset;">
<td class="xl24" height="12">8</td>
<td class="xl25">02/06/12</td>
<td class="xl24">Ouarzazate</td>
<td class="xl24">Marrakesh</td>
</tr>
<tr style="mso-height-source: userset;">
<td class="xl24" height="12">9</td>
<td class="xl25">03/06/12</td>
<td class="xl24">Marrakesh</td>
<td class="xl24"> </td>
</tr>
<tr style="mso-height-source: userset;">
<td class="xl24" height="12">10</td>
<td class="xl25">04/06/12</td>
<td class="xl24">Marrakesh</td>
<td class="xl24"> </td>
</tr>
<tr style="mso-height-source: userset;">
<td class="xl24" height="12">11</td>
<td class="xl25">05/06/12</td>
<td class="xl24">Marrakesh</td>
<td class="xl24">Amsterdam</td>
</tr>
<!--EndFragment--></tbody>
</table>

预期收益:

1   26/05/12    Amsterdam   Casablanca
2   27/05/12    Casablanca  Rabat
3   28/05/12    Rabat   Fes
4   29/05/12    Fes 
5   30/05/12    Fes Erg Chebbi
6   31/05/12    Erg Chebbi  Dades Vallei
7   01/06/12    Dades Vallei    Ouarzazate
8   02/06/12    Ouarzazate  Marrakesh
9   03/06/12    Marrakesh   
10  04/06/12    Marrakesh   
11  05/06/12    Marrakesh   Amsterdam

Answer 1:

你应该看看TinyMCE的配置选项有关的贴插件。

另一种选择是去掉所有不必要的HTML标签,只是使用纯文本: TinyMCE的粘贴为纯文本



文章来源: Tinymce copy/paste from excel (Plugin BBcode)