文档拆分--查看--图片上传

This commit is contained in:
范强强
2024-03-10 13:18:09 +08:00
parent 46bcf687a3
commit a4464e58c3
5 changed files with 34 additions and 14 deletions
+3 -1
View File
@@ -911,7 +911,9 @@
} }
})(img)); })(img));
img.width = 113; img.width = 113;
img.setAttribute('src', urlPrefix + list[i].url + (list[i].url.indexOf('?') == -1 ? '?noCache=':'&noCache=') + (+new Date()).toString(36) );
console.log(urlPrefix + list[i].url)
img.setAttribute('src', urlPrefix + list[i].url + (list[i].url.indexOf('?') == -1 ? '?noCache=':'&noCache=') + (+new Date()).toString(36) );
img.setAttribute('_src', urlPrefix + list[i].url); img.setAttribute('_src', urlPrefix + list[i].url);
domUtils.addClass(icon, 'icon'); domUtils.addClass(icon, 'icon');
+16 -11
View File
@@ -7336,15 +7336,14 @@ var fillCharReg = new RegExp(domUtils.fillChar, 'g');
* editor.setContent('<p>new text</p>', true); //插入的结果是<p>old text</p><p>new text</p> * editor.setContent('<p>new text</p>', true); //插入的结果是<p>old text</p><p>new text</p>
* ``` * ```
*/ */
setContent: function (html, isAppendTo, notFireSelectionchange) { setContent: function (html, isAppendTo, notFireSelectionchange) {
var me = this; var me = this;
me.fireEvent('beforesetcontent', html);
me.fireEvent('beforesetcontent', html);
var root = UE.htmlparser(html); var root = UE.htmlparser(html);
me.filterInputRule(root); me.filterInputRule(root);
html = root.toHtml(); html = root.toHtml();
me.body.innerHTML = (isAppendTo ? me.body.innerHTML : '') + html;
me.body.innerHTML = (isAppendTo ? me.body.innerHTML : '') + html;
function isCdataDiv(node){ function isCdataDiv(node){
@@ -8078,14 +8077,14 @@ UE.Editor.defaultOptions = function(editor){
setTimeout(function(){ setTimeout(function(){
try{ try{
me.options.imageUrl && me.setOpt('serverUrl', me.options.imageUrl.replace(/^(.*[\/]).+([\.].+)$/, '$1controller$2')); me.options.imageUrl && me.setOpt('serverUrl', me.options.imageUrl.replace(/^(.*[\/]).+([\.].+)$/, '$1controller$2'));
console.log(me.options.imageUrl)
var configUrl = me.getActionUrl('config'), var configUrl = me.getActionUrl('config'),
isJsonp = utils.isCrossDomainUrl(configUrl); isJsonp = utils.isCrossDomainUrl(configUrl);
/* 发出ajax请求 */ /* 发出ajax请求 */
me._serverConfigLoaded = false; me._serverConfigLoaded = false;
configUrl && UE.ajax.request(configUrl,{ configUrl && UE.ajax.request('http://localhost:8184/laws-sinotruk/sys/split/file/getImage?fileName=7DS756NXKGimage5.png',{
'method': 'GET', 'method': 'GET',
'dataType': isJsonp ? 'jsonp':'', 'dataType': isJsonp ? 'jsonp':'',
'onsuccess':function(r){ 'onsuccess':function(r){
@@ -9378,7 +9377,7 @@ var filterWord = UE.filterWord = function () {
* ``` * ```
*/ */
var htmlparser = UE.htmlparser = function (htmlstr,ignoreBlank) { var htmlparser = UE.htmlparser = function (htmlstr,ignoreBlank) {
//todo 原来的方式 [^"'<>\/] 有\/就不能配对上 <TD vAlign=top background=../AAA.JPG> 这样的标签了 //todo 原来的方式 [^"'<>\/] 有\/就不能配对上 <TD vAlign=top background=../AAA.JPG> 这样的标签了
//先去掉了,加上的原因忘了,这里先记录 //先去掉了,加上的原因忘了,这里先记录
var re_tag = /<(?:(?:\/([^>]+)>)|(?:!--([\S|\s]*?)-->)|(?:([^\s\/<>]+)\s*((?:(?:"[^"]*")|(?:'[^']*')|[^"'<>])*)\/?>))/g, var re_tag = /<(?:(?:\/([^>]+)>)|(?:!--([\S|\s]*?)-->)|(?:([^\s\/<>]+)\s*((?:(?:"[^"]*")|(?:'[^']*')|[^"'<>])*)\/?>))/g,
@@ -9548,7 +9547,8 @@ var htmlparser = UE.htmlparser = function (htmlstr,ignoreBlank) {
if (nextIndex < htmlstr.length) { if (nextIndex < htmlstr.length) {
text(currentParent, htmlstr.slice(nextIndex)); text(currentParent, htmlstr.slice(nextIndex));
} }
return root; console.log(root)
return root;
}; };
@@ -27736,7 +27736,7 @@ UE.ui = baidu.editor.ui = {};
}); });
}, },
setContent: function(content){ setContent: function(content){
this.getDom('content').innerHTML = content; this.getDom('content').innerHTML = content;
}, },
setType: function(type){ setType: function(type){
type = type || 'info'; type = type || 'info';
@@ -29566,6 +29566,11 @@ UE.registerUI('autosave', function(editor) {
}); });
window.getHtml = function (content) {
let html = ''
var root = UE.htmlparser(content);
html = root.toHtml();
return html
}
})(); })();
@@ -197,6 +197,9 @@ export default {
if (res.success) { if (res.success) {
this.contentList = [...res.result] this.contentList = [...res.result]
this.contentList.forEach(item => { this.contentList.forEach(item => {
if (item.type === this.TypeOfClauseItem.TABLE.value) {
item.itemContent = window.getHtml(item.itemContent)
}
const imgData = item.itemContent.split('fileName=')[1] const imgData = item.itemContent.split('fileName=')[1]
item.thumbUrl = window._CONFIG.domianURL + '/sys/split/file/getImage?fileName=' + imgData item.thumbUrl = window._CONFIG.domianURL + '/sys/split/file/getImage?fileName=' + imgData
}) })
@@ -26,7 +26,8 @@ export default {
methods: { methods: {
open (val) { open (val) {
this.contentVisible = true this.contentVisible = true
this.contentValue = val console.log(val)
this.contentValue = window.getHtml(val)
}, },
handleCancel () { handleCancel () {
this.contentVisible = false this.contentVisible = false
@@ -15,6 +15,7 @@
<script> <script>
import UEditor from '../../../../components/uEditor/UEditor.vue' import UEditor from '../../../../components/uEditor/UEditor.vue'
import { getHtml } from '../../../../../public/ueditor/ueditor.all'
export default { export default {
name: 'SplitDetailAddTable', name: 'SplitDetailAddTable',
components: { UEditor }, components: { UEditor },
@@ -121,9 +122,17 @@ export default {
} }
}, },
methods: { methods: {
unhtml (str) {
return str ? str.replace(/[<>]/g, (a) => {
return {
'<': '&lt;',
'>': '&gt;',
}[a]
}) : ''
},
open (tableStr) { open (tableStr) {
console.log('$$$$$$$$$$$$', tableStr)
this.tableVisible = true this.tableVisible = true
// console.log(window.getHtml(tableStr))
this.ueContent = tableStr this.ueContent = tableStr
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.ueditor.setContent(this.ueContent) this.$refs.ueditor.setContent(this.ueContent)