word粘贴html内容,如何从word中替换粘贴到htmleditor中的这些标记

我将一些内容从word粘贴到htmleditor()【http://mindmup.github.io/bootstrap-wysiwyg/】,但是一些单词定义的标签仍然在html中,如“< v:shape>< / v:shape>”和“< v:shapetype>< / v:shapetype>”和“< v:imagedata>< / v:imagedata>”等等...

除了这种标签之外,我已经用jquery删除了大部分无用的标签。

以下所有内容都不起作用,例如$(xxxxxx).find('v')/.find('v:shape')/.find('shape');。但$(xxxxxx).find('a')/.find('span')效果很好。

我想使用正则表达式将所有< v:xxx>< /v:xxx>标签替换为< vword>< /vword>然后删除所有vword标签,但我不知道正则表达式语法,在这两天我没有时间学习它和我想知道这是否正确。

那么,谁能告诉我应该怎么做以及应该做什么? THX。

这很有效:

container.find("font").each(function () {

$(this).replaceWith(function () { return $(this).contents(); });

});

这不起作用:

container.find("v").each(function () {

$(this).remove();

});

container.find("shape").each(function () {

$(this).remove();

});

container.find("shapetype").each(function () {

$(this).remove();

});

container.find("v:shape").each(function () {

$(this).remove();

});

container.find("v:shapetype").each(function () {

$(this).remove();

});

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
在 Vue ,v-model 指令通常用于绑定表单元素的值,以便将用户输入的数据绑定到 Vue 实例的数据属性上。但是,有时候我们需要在渲染 HTML 内容时,也能够使用 v-model 来实现双向数据绑定。这时候,我们可以使用 v-html 指令与自定义组件结合使用。 具体来说,我们可以在自定义组件使用 v-model 指令,然后在组件内部将 v-model 绑定到一个 props 属性上,这样就可以在使用组件时通过 v-model 双向绑定 HTML 内容了。 例如,我们可以创建一个名为 `HtmlEditor` 的自定义组件,并在其使用 v-model 指令来实现双向绑定 HTML 内容: ``` <template> <div> <div contenteditable="true" @input="updateHtml">{{ value }}</div> </div> </template> <script> export default { props: ['value'], methods: { updateHtml(event) { this.$emit('input', event.target.innerHTML); } } } </script> ``` 在上面的代码,我们通过 `props: ['value']` 定义了一个名为 `value` 的 props 属性,并在组件模板使用了 v-model 指令来双向绑定该属性。在组件内部,我们将 contenteditable 属性设置为 true,以便让用户可以编辑 HTML 内容,并通过 @input 事件来更新组件的 value 属性。最后,我们通过 `$emit` 方法将更新后的 HTML 内容发送给父组件。 在使用该组件时,我们只需要使用 v-model 指令来绑定 HTML 内容即可: ``` <template> <div> <html-editor v-model="htmlContent"></html-editor> </div> </template> <script> import HtmlEditor from './HtmlEditor.vue'; export default { components: { HtmlEditor }, data() { return { htmlContent: '<p>Hello, world!</p>' } } } </script> ``` 上面的代码,我们将 `<html-editor>` 组件包含在父组件模板,并使用 v-model 指令来绑定父组件的 `htmlContent` 数据属性。这样,在编辑器输入或修改 HTML 内容时,`htmlContent` 数据属性也会被同步更新。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值