news 2026/3/30 7:56:08

TinyMCE5处理word文档超链接自动检测

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
TinyMCE5处理word文档超链接自动检测

tinymce 5.0 粘贴word带图片

业务需求

在现有tinymce编辑器的基础上增加复制ctrl+c复制图片和ctrl+v粘贴图片并上传到服务器的功能,需要支持信创国产化环境,因为是给一个国企单位做的项目,现在有这个要求。

技术栈

vue2+js+tinymce 5.0

业务实现

之前的逻辑是将tinymce放到public下面。

//初始化增加配置{paste_data_images:true,//允许粘贴图片images_upload_handler:(blobInfo,success,failure,progress)=>{//blobInfo:粘贴的图片的blob//succuss:上传完成调用//failure:上传失败调用this.handleImgUpload(blobInfo,success,failure,progress)}}

发现问题

从微信、本地、word纯图片复制都可以回显,但是word复制图文混合就不行。

问题原因

原因是word图文混合里面的img标签src都是以file://开头的本地地址

解决问题

tinymce有付费软件powerpaste
自己写 参考了以下两个tinymce6的帖子:

用的是tinymce5 所以参考第二篇文章的回答,改造一下现有的paste插件(只是改造了一下,还是要用安装原来的插件的!!)
改造思路:
1.官方自带的 paste 已经自带过滤器,但是过滤了img->修改自带的过滤器(尝试过完全放弃自带的过滤,取消paste_enabled_default_filter 但是word中的无效元素太多了,自建过滤器在在网上抄了很多还不如原来的)
2. paste_preprocess - 粘贴内容插入编辑器之前的钩子。在这里提取图片,并将图片上传到服务器,再将粘贴内容插入到编辑器中。

处理粘贴插件

tinymce5 粘贴插件用的是ts,从网上下了一份js的。也能将就着用,尝试用第一个文章中的过滤器但是不知道为什么过滤之后还是有很多无效元素,看了paste源码发现自带的过滤器实现已经很好了所以在原来的过滤上做改造。
本步骤主要做了两件事:

删除自带过滤器中对图片的过滤
过滤rtf中word适配低版本ie的vml标签,以免在后面从rtf中正则切割有问题

paste.js

/** * Copyright (c) Tiny Technologies, Inc. All rights reserved. * Licensed under the LGPL or a commercial license. * For LGPL see License.txt in the project root for license information. * For commercial licenses see https://www.tiny.cloud/ * * Version: 5.10.3 (2022-02-09) */(function(){"use strict";varCell=function(initial){varvalue=initial;varget=function(){returnvalue;};varset=function(v){value=v;};return{get:get,set:set,};};varglobal$b=tinymce.util.Tools.resolve("tinymce.PluginManager");varhasProPlugin=function(editor){if(editor.hasPlugin("powerpaste",true)){if(typeofwindow.console!=="undefined"&&window.console.log){window.console.log("PowerPaste is incompatible with Paste plugin! Remove 'paste' from the 'plugins' option.");}returntrue;}else{returnfalse;}};varget=function(clipboard){return{clipboard:clipboard};};vartypeOf=function(x){vart=typeofx;if(x===null){return"null";}elseif(t==="object"&&(Array.prototype.isPrototypeOf(x)||(x.constructor&&x.constructor.name==="Array"))){return"array";}elseif(t==="object"&&(String.prototype.isPrototypeOf(x)||(x.constructor&&x.constructor.name==="String"))){return"string";}else{returnt;}};varisType=function(type){returnfunction(value){returntypeOf(value)===type;};};varisSimpleType=function(type){returnfunction(value){returntypeofvalue===type;};};varisArray=isType("array");varisNullable=function(a){returna===null||a===undefined;};varisNonNullable=function(a){return!isNullable(a);};varisFunction=isSimpleType("function");varnoop=function(){};varconstant=function(value){returnfunction(){returnvalue;};};varidentity=function(x){returnx;};varnever=constant(false);varalways=constant(true);varnone=function(){returnNONE;};varNONE=(function(){varcall=function(thunk){returnthunk();};varid=identity;varme={fold:function(n,_s){returnn();},isSome:never,isNone:always,getOr:id,getOrThunk:call,getOrDie:function(msg){thrownewError(msg||"error: getOrDie called on none.");},getOrNull:constant(null),getOrUndefined:constant(undefined),or:id,orThunk:call,map:none,each:noop,bind:none,exists:never,forall:always,filter:function(){returnnone();},toArray:function(){return[];},toString:constant("none()"),};returnme;})();varsome=function(a){varconstant_a=constant(a);varself=function(){returnme;};varbind=function(f){returnf(a);};varme={fold:function(n,s){returns(a);},isSome:always,isNone:never,getOr:constant_a,getOrThunk:constant_a,getOrDie:constant_a,getOrNull:constant_a,getOrUndefined:constant_a,or:self,orThunk:self,map:function(f){returnsome(f(a));},each:function(f){f(a);},bind:bind,exists:bind,forall:bind,filter:function(f){returnf(a)?me:NONE;},toArray:function(){return[a];},toString:function(){return"some("+a+")";},};returnme;};varfrom$1=function(value){returnvalue===null||value===undefined?NONE:some(value);};varOptional={some:some,none:none,from:from$1,};varnativeSlice=Array.prototype.slice;varnativePush=Array.prototype.push;varexists=function(xs,pred){for(vari=0,len=xs.length;i<len;i++){varx=xs[i];if(pred(x,i)){returntrue;}}returnfalse;};varmap=function(xs,f){varlen=xs.length;varr=newArray(len);for(vari=0;i<len;i++){varx=xs[i];r[i]=f(x,i);}returnr;};vareach=function(xs,f){for(vari=0,len=xs.length;i<len;i++){varx=xs[i];f(x,i);}};varfilter$1=function(xs,pred){varr=[];for(vari=0,len=xs.length;i<len;i++){varx=xs[i];if(pred(x,i)){r.push(x);}}returnr;};varfoldl=function(xs,f,acc){each(xs,function(x,i){acc=f(acc,x,i);});returnacc;};varflatten=function(xs){varr=[];for(vari=0,len=xs.length;i<len;++i){if(!isArray(xs[i])){thrownewError("Arr.flatten item "+i+" was not an array, input: "+xs);}nativePush.apply(r,xs[i]);}returnr;};varbind=function(xs,f){returnflatten(map(xs,f));};varfrom=isFunction(Array.from)?Array.from:function(x){returnnativeSlice.call(x);};var__assign=function(){__assign=Object.assign||function__assign(t){for(vars,i=1,n=arguments.length;i<n;i++){s=arguments[i];for(varpins)if(Object.prototype.hasOwnProperty.call(s,p))t[p]=s[p];}returnt;};return__assign.apply(this,arguments);};varsingleton=function(doRevoke){varsubject=Cell(Optional.none());varrevoke=function(){returnsubject.get().each(doRevoke);};varclear=function(){revoke();subject.set(Optional.none());};varisSet=function(){returnsubject.get().isSome();};varget=function(){returnsubject.get();};varset=function(s){revoke();subject.set(Optional.some(s));};return{clear:clear,isSet:isSet,get:get,set:set,};};varvalue=function(){varsubject=singleton(noop);varon=function(f){returnsubject.get().each(f);};return__assign(__assign({},subject),{on:on});};varcheckRange=function(str,substr,start){return(substr===""||(str.length>=substr.length&&str.substr(start,start+substr.length)===substr));};varstartsWith=function(str,prefix){returncheckRange(str,prefix,0);};varendsWith=function(str,suffix){returncheckRange(str,suffix,str.length-suffix.length);};varrepeat=function(s,count){returncount<=0?"":newArray(count+1).join(s);};varglobal$a=tinymce.util.Tools.resolve("tinymce.Env");varglobal$9=tinymce.util.Tools.resolve("tinymce.util.Delay");varglobal$8=tinymce.util.Tools.resolve("tinymce.util.Promise");varglobal$7=tinymce.util.Tools.resolve("tinymce.util.VK");varfirePastePreProcess=function(editor,html,internal,isWordHtml,event){returneditor.fire("PastePreProcess",{content:html,internal:internal,wordContent:isWordHtml,__event:event,});};varfirePastePostProcess=function(editor,node,internal,isWordHtml){returneditor.fire("PastePostProcess",{node:node,internal:internal,wordContent:isWordHtml,});};varfirePastePlainTextToggle=function(editor,state){returneditor.fire("PastePlainTextToggle",{state:state});};varfirePaste=function(editor,ieFake){returneditor.fire("paste",{ieFake:ieFake});};/** tinymce.util.Tools */varglobal$6=tinymce.util.Tools.resolve("tinymce.util.Tools");varshouldBlockDrop=function(editor){returneditor.getParam("paste_block_drop",false);};varshouldPasteDataImages=function(editor){returneditor.getParam("paste_data_images",false);};varshouldFilterDrop=function(editor){returneditor.getParam("paste_filter_drop",true);};vargetPreProcess=function(editor){returneditor.getParam("paste_preprocess");};vargetPostProcess=function(editor){returneditor.getParam("paste_postprocess");};vargetWebkitStyles=function(editor){returneditor.getParam("paste_webkit_styles");};varshouldRemoveWebKitStyles=function(editor){returneditor.getParam("paste_remove_styles_if_webkit",true);};varshouldMergeFormats=function(editor){returneditor.getParam("paste_merge_formats",true);};varisSmartPasteEnabled=function(editor){returneditor.getParam("smart_paste",true);};varisPasteAsTextEnabled=function(editor){returneditor.getParam("paste_as_text",false);};vargetRetainStyleProps=function(editor){returneditor.getParam("paste_retain_style_properties");};/** * 过滤word有效元素 * @param {*} editor * @returns */vargetWordValidElements=function(editor){vardefaultValidElements="-strong/b,-em/i,-u,-span,-p,-ol,-ul,-li,-h1,-h2,-h3,-h4,-h5,-h6,"+"-p/div,-a[href|name],sub,sup,strike,br,del,table[width],tr,"+"td[colspan|rowspan|width],th[colspan|rowspan|width],thead,tfoot,tbody";//从此处可以知道可以在paste_word_valid_elements配置过滤什么元素returneditor.getParam("paste_word_valid_elements",defaultValidElements);};varshouldConvertWordFakeLists=function(editor){returneditor.getParam("paste_convert_word_fake_lists",true);};varshouldUseDefaultFilters=function(editor){returneditor.getParam("paste_enable_default_filters",true);};vargetValidate=function(editor){returneditor.getParam("validate");};vargetAllowHtmlDataUrls=function(editor){returneditor.getParam("allow_html_data_urls",false,"boolean");};vargetPasteDataImages=function(editor){returneditor.getParam("paste_data_images",false,"boolean");};vargetImagesDataImgFilter=function(editor){returneditor.getParam("images_dataimg_filter");};vargetImagesReuseFilename=function(editor){returneditor.getParam("images_reuse_filename");};vargetForcedRootBlock=function(editor){returneditor.getParam("forced_root_block");};vargetForcedRootBlockAttrs=function(editor){returneditor.getParam("forced_root_block_attrs");};vargetTabSpaces=function(editor){returneditor.getParam("paste_tab_spaces",4,"number");};vargetAllowedImageFileTypes=function(editor){vardefaultImageFileTypes="jpeg,jpg,jpe,jfi,jif,jfif,png,gif,bmp,webp";returnglobal$6.explode(editor.getParam("images_file_types",defaultImageFileTypes,"string"));};varinternalMimeType="x-tinymce/html";varinternalMark="";varmark=function(html){returninternalMark+html;};varunmark=function(html){returnhtml.replace(internalMark,"");};varisMarked=function(html){returnhtml.indexOf(internalMark)!==-1;};varinternalHtmlMime=constant(internalMimeType);varhasOwnProperty=Object.hasOwnProperty;varhas=function(obj,key){returnhasOwnProperty.call(obj,key);};varglobal$5=tinymce.util.Tools.resolve("tinymce.html.Entities");varisPlainText=function(text){return!/<(?:\/?(?!(?:div|p|br|span)>)\w+|(?:(?!(?:span style="white-space:\s?pre;?">)|br\s?\/>))\w+\s[^>]+)>/i.test(text);};vartoBRs=function(text){returntext.replace(/\r?\n/g," ");};varopenContainer=function(rootTag,rootAttrs){varattrs=[];vartag="<"+rootTag;if(typeofrootAttrs==="object"){for(varkeyinrootAttrs){if(has(rootAttrs,key)){attrs.push(key+'="'+global$5.encodeAllRaw(rootAttrs[key])+'"');}}if(attrs.length){tag+=" "+attrs.join(" ");}}returntag+">";};vartoBlockElements=function(text,rootTag,rootAttrs){varblocks=text.split(/\n\n/);vartagOpen=openContainer(rootTag,rootAttrs);vartagClose="";varparagraphs=global$6.map(blocks,function(p){returnp.split(/\n/).join(" ");});varstitch=function(p){returntagOpen+p+tagClose;};returnparagraphs.length===1?paragraphs[0]:global$6.map(paragraphs,stitch).join("");};varconvert=function(text,rootTag,rootAttrs){returnrootTag?toBlockElements(text,rootTag===true?"p":rootTag,rootAttrs):toBRs(text);};/** tinymce.html.DomParser */varglobal$4=tinymce.util.Tools.resolve("tinymce.html.DomParser");/** tinymce.html.Serializer */varglobal$3=tinymce.util.Tools.resolve("tinymce.html.Serializer");varnbsp="\xA0";varglobal$2=tinymce.util.Tools.resolve("tinymce.html.Node");varglobal$1=tinymce.util.Tools.resolve("tinymce.html.Schema");varisRegExp=function(val){returnval.constructor===RegExp;};varfilter=function(content,items){global$6.each(items,function(v){if(isRegExp(v)){content=content.replace(v,"");}else{content=content.replace(v[0],v[1]);}});returncontent;};varinnerText=function(html){varschema=global$1();vardomParser=global$4({},schema);vartext="";varshortEndedElements=schema.getShortEndedElements();varignoreElements=global$6.makeMap("script noscript style textarea video audio iframe object"," ");varblockElements=schema.getBlockElements();varwalk=function(node){varname=node.name,currentNode=node;if(name==="br"){text+="\n";return;}if(name==="wbr"){return;}if(shortEndedElements[name]){text+=" ";}if(ignoreElements[name]){text+=" ";return;}if(node.type===3){text+=node.value;}if(!node.shortEnded){if((node=node.firstChild)){do{walk(node);}while((node=node.next));}}if(blockElements[name]&&currentNode.next){text+="\n";if(name==="p"){text+="\n";}}};html=filter(html,[//g]);walk(domParser.parse(html));returntext;};vartrimHtml=function(html){vartrimSpaces=function(all,s1,s2){if(!s1&&!s2){return" ";}returnnbsp;};html=filter(html,[/^[\s\S]*]*>\s*|\s*<\/body[^>]*>[\s\S]*$/gi,/|/g,[/( ?)\u00a0<\/span>( ?)/g,trimSpaces,],//g,/$/i,]);returnhtml;};varcreateIdGenerator=function(prefix){varcount=0;returnfunction(){returnprefix+count++;};};vargetImageMimeType=function(ext){varlowerExt=ext.toLowerCase();varmimeOverrides={jpg:"jpeg",jpe:"jpeg",jfi:"jpeg",jif:"jpeg",jfif:"jpeg",pjpeg:"jpeg",pjp:"jpeg",svg:"svg+xml",};returnglobal$6.hasOwn(mimeOverrides,lowerExt)?"image/"+mimeOverrides[lowerExt]:"image/"+lowerExt;};varisWordContent=function(content){return(/1){currentListNode.attr("start",""+start);}paragraphNode.wrap(currentListNode);}else{currentListNode.append(paragraphNode);}paragraphNode.name="li";if(level>lastLevel&&prevListNode){prevListNode.lastChild.append(currentListNode);}lastLevel=level;removeIgnoredNodes(paragraphNode);trimListStart(paragraphNode,/^\u00a0+/);trimListStart(paragraphNode,/^\s*([\u2022\u00b7\u00a7\u25CF]|\w+\.)/);trimListStart(paragraphNode,/^\u00a0+/);};varelements=[];varchild=node.firstChild;while(typeofchild!=="undefined"&&child!==null){elements.push(child);child=child.walk();if(child!==null){while(typeofchild!=="undefined"&&child.parent!==node){child=child.walk();}}}for(vari=0;i<elements.length;i++){node=elements[i];if(node.name==="p"&&node.firstChild){varnodeText=getText(node);if(isBulletList(nodeText)){convertParagraphToLi(node,"ul");continue;}if(isNumericList(nodeText)){varmatches=/([0-9]+)\./.exec(nodeText);varstart=1;if(matches){start=parseInt(matches[1],10);}convertParagraphToLi(node,"ol",start);continue;}if(node._listLevel){convertParagraphToLi(node,"ul",1);continue;}currentListNode=null;}else{prevListNode=currentListNode;currentListNode=null;}}};varfilterStyles=function(editor,validStyles,node,styleValue){varoutputStyles={};varstyles=editor.dom.parseStyle(styleValue);global$6.each(styles,function(value,name){switch(name){case"mso-list":varmatches=/\w+ \w+([0-9]+)/i.exec(styleValue);if(matches){node._listLevel=parseInt(matches[1],10);}if(/Ignore/i.test(value)&&node.firstChild){node._listIgnore=true;node.firstChild._listIgnore=true;}break;case"horiz-align":name="text-align";break;case"vert-align":name="vertical-align";break;case"font-color":case"mso-foreground":name="color";break;case"mso-background":case"mso-highlight":name="background";break;case"font-weight":case"font-style":if(value!=="normal"){outputStyles[name]=value;}return;case"mso-element":if(/^(comment|comment-list)$/i.test(value)){node.remove();return;}break;}if(name.indexOf("mso-comment")===0){node.remove();return;}if(name.indexOf("mso-")===0){return;}if(getRetainStyleProps(editor)==="all"||(validStyles&&validStyles[name])){outputStyles[name]=value;}});if(/(bold)/i.test(outputStyles["font-weight"])){deleteoutputStyles["font-weight"];node.wrap(newglobal$2("b",1));}if(/(italic)/i.test(outputStyles["font-style"])){deleteoutputStyles["font-style"];node.wrap(newglobal$2("i",1));}varoutputStyle=editor.dom.serializeStyle(outputStyles,node.name);if(outputStyle){returnoutputStyle;}returnnull;};/** * 过滤word文档内容 * @param {*} editor * @param {*} content * @returns */varfilterWordContent=function(editor,content){varvalidStyles;varretainStyleProperties=getRetainStyleProps(editor);if(retainStyleProperties){validStyles=global$6.makeMap(retainStyleProperties.split(/[, ]/));}content=filter(content,[//gi,/]+id="?docs-internal-[^>]*>/gi,//gi,// 去除特殊标签(默认去除img,将img解开)/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,[/<(\/?)s>/gi,"<$1strike>"],[//gi,nbsp],[/([\s\u00a0]*)<\/span>/gi,function(str,spaces){returnspaces.length>0?spaces.replace(/./," ").slice(Math.floor(spaces.length/2)).split("").join(nbsp):"";},],//word为了适配旧ie会有重复的image相关标签,过滤时去掉[/]+>]+src="([^"]+)"[^>]*><\/v:shape>/g,''],/]+>]+src="([^"]+)"[^>]*><\/v:shape>/g]);varvalidElements=getWordValidElements(editor);varschema=global$1({valid_elements:validElements,valid_children:"-li[p]",});global$6.each(schema.elements,function(rule){if(!rule.attributes.class){rule.attributes.class={};rule.attributesOrder.push("class");}if(!rule.attributes.style){rule.attributes.style={};rule.attributesOrder.push("style");}});vardomParser=global$4({},schema);domParser.addAttributeFilter("style",function(nodes){vari=nodes.length,node;while(i--){node=nodes[i];node.attr("style",filterStyles(editor,validStyles,node,node.attr("style")));if(node.name==="span"&&node.parent&&!node.attributes.length){node.unwrap();}}});domParser.addAttributeFilter("class",function(nodes){vari=nodes.length,node,className;while(i--){node=nodes[i];className=node.attr("class");if(/^(MsoCommentReference|MsoCommentText|msoDel)$/i.test(className)){node.remove();}node.attr("class",null);}});domParser.addNodeFilter("del",function(nodes){vari=nodes.length;while(i--){nodes[i].remove();}});domParser.addNodeFilter("a",function(nodes){vari=nodes.length,node,href,name;while(i--){node=nodes[i];href=node.attr("href");name=node.attr("name");if(href&&href.indexOf("#_msocom_")!==-1){node.remove();continue;}if(href&&href.indexOf("file://")===0){href=href.split("#")[1];if(href){href="#"+href;}}if(!href&&!name){node.unwrap();}else{if(name&&!/^_?(?:toc|edn|ftn)/i.test(name)){node.unwrap();continue;}node.attr({href:href,name:name,});}}});varrootNode=domParser.parse(content);if(shouldConvertWordFakeLists(editor)){convertFakeListsToProperLists(rootNode);}content=global$3({validate:getValidate(editor)},schema).serialize(rootNode);returncontent;};varpreProcess$1=function(editor,content){returnshouldUseDefaultFilters(editor)?filterWordContent(editor,content):content;};varpreProcess=function(editor,html){varparser=global$4({},editor.schema);parser.addNodeFilter("meta",function(nodes){global$6.each(nodes,function(node){node.remove();});});varfragment=parser.parse(html,{forced_root_block:false,isRootContent:true,});returnglobal$3({validate:getValidate(editor)},editor.schema).serialize(fragment);};varprocessResult=function(content,cancelled){return{content:content,cancelled:cancelled,};};varpostProcessFilter=function(editor,html,internal,isWordHtml){vartempBody=editor.dom.create("div",{style:"display:none"},html);varpostProcessArgs=firePastePostProcess(editor,tempBody,internal,isWordHtml);returnprocessResult(postProcessArgs.node.innerHTML,postProcessArgs.isDefaultPrevented());};varfilterContent=function(editor,content,internal,isWordHtml,event){varpreProcessArgs=firePastePreProcess(editor,content,internal,isWordHtml,event);varfilteredContent=preProcess(editor,preProcessArgs.content);if(editor.hasEventListeners("PastePostProcess")&&!preProcessArgs.isDefaultPrevented()){returnpostProcessFilter(editor,filteredContent,internal,isWordHtml);}else{returnprocessResult(filteredContent,preProcessArgs.isDefaultPrevented());}};varprocess=function(editor,html,internal,event){varisWordHtml=isWordContent(html);varcontent=isWordHtml?preProcess$1(editor,html):html;returnfilterContent(editor,content,internal,isWordHtml,event);};varpasteHtml$1=function(editor,html){editor.insertContent(html,{merge:shouldMergeFormats(editor),paste:true,});returntrue;};varisAbsoluteUrl=function(url){return/^https?:\/\/[\w\?\-\/+=.&%@~#]+$/i.test(url);};varisImageUrl=function(editor,url){return(isAbsoluteUrl(url)&&exists(getAllowedImageFileTypes(editor),function(type){returnendsWith(url.toLowerCase(),"."+type.toLowerCase());}));};varcreateImage=function(editor,url,pasteHtmlFn){editor.undoManager.extra(function(){pasteHtmlFn(editor,url);},function(){editor.insertContent('');});returntrue;};varcreateLink=function(editor,url,pasteHtmlFn){editor.undoManager.extra(function(){pasteHtmlFn(editor,url);},function(){editor.execCommand("mceInsertLink",false,url);});returntrue;};varlinkSelection=function(editor,html,pasteHtmlFn){returneditor.selection.isCollapsed()===false&&isAbsoluteUrl(html)?createLink(editor,html,pasteHtmlFn):false;};varinsertImage=function(editor,html,pasteHtmlFn){returnisImageUrl(editor,html)?createImage(editor,html,pasteHtmlFn):false;};varsmartInsertContent=function(editor,html){global$6.each([linkSelection,insertImage,pasteHtml$1],function(action){returnaction(editor,html,pasteHtml$1)!==true;});};varinsertContent=function(editor,html,pasteAsText){if(pasteAsText||isSmartPasteEnabled(editor)===false){pasteHtml$1(editor,html);}else{smartInsertContent(editor,html);}};varisCollapsibleWhitespace=function(c){return" \f\t\x0B".indexOf(c)!==-1;};varisNewLineChar=function(c){returnc==="\n"||c==="\r";};varisNewline=function(text,idx){returnidx<text.length&&idx>=0?isNewLineChar(text[idx]):false;};varnormalizeWhitespace=function(editor,text){vartabSpace=repeat(" ",getTabSpaces(editor));varnormalizedText=text.replace(/\t/g,tabSpace);varresult=foldl(normalizedText,function(acc,c){if(isCollapsibleWhitespace(c)||c===nbsp){if(acc.pcIsSpace||acc.str===""||acc.str.length===normalizedText.length-1||isNewline(normalizedText,acc.str.length+1)){return{pcIsSpace:false,str:acc.str+nbsp,};}else{return{pcIsSpace:true,str:acc.str+" ",};}}else{return{pcIsSpace:isNewLineChar(c),str:acc.str+c,};}},{pcIsSpace:false,str:"",});returnresult.str;};vardoPaste=function(editor,content,internal,pasteAsText,event){varargs=process(editor,content,internal,event);if(args.cancelled===false){insertContent(editor,args.content,pasteAsText);}};varpasteHtml=function(editor,html,internalFlag,event){varinternal=internalFlag?internalFlag:isMarked(html);doPaste(editor,unmark(html),internal,false,event);};varpasteText=function(editor,text,event){varencodedText=editor.dom.encode(text).replace(/\r\n/g,"\n");varnormalizedText=normalizeWhitespace(editor,encodedText);varhtml=convert(normalizedText,getForcedRootBlock(editor),getForcedRootBlockAttrs(editor));doPaste(editor,html,false,true,event);};vargetDataTransferItems=function(dataTransfer){varitems={};varmceInternalUrlPrefix="data:text/mce-internal,";if(dataTransfer){if(dataTransfer.getData){varlegacyText=dataTransfer.getData("Text");if(legacyText&&legacyText.length>0){if(legacyText.indexOf(mceInternalUrlPrefix)===-1){items["text/plain"]=legacyText;}}}if(dataTransfer.types){for(vari=0;i<dataTransfer.types.length;i++){varcontentType=dataTransfer.types[i];try{items[contentType]=dataTransfer.getData(contentType);}catch(ex){items[contentType]="";}}}}returnitems;};vargetClipboardContent=function(editor,clipboardEvent){returngetDataTransferItems(clipboardEvent.clipboardData||editor.getDoc().dataTransfer);};varhasContentType=function(clipboardContent,mimeType){return(mimeTypeinclipboardContent&&clipboardContent[mimeType].length>0);};varhasHtmlOrText=function(content){return(hasContentType(content,"text/html")||hasContentType(content,"text/plain"));};varparseDataUri=function(uri){varmatches=/data:([^;]+);base64,([a-z0-9\+\/=]+)/i.exec(uri);if(matches){return{type:matches[1],data:decodeURIComponent(matches[2]),};}else{return{type:null,data:null,};}};varisValidDataUriImage=function(editor,imgElm){varfilter=getImagesDataImgFilter(editor);returnfilter?filter(imgElm):true;};varextractFilename=function(editor,str){varm=str.match(/([\s\S]+?)(?:\.[a-z0-9.]+)$/i);returnisNonNullable(m)?editor.dom.encode(m[1]):null;};varuniqueId=createIdGenerator("mceclip");varpasteImage=function(editor,imageItem,event){var_a=parseDataUri(imageItem.uri),base64=_a.data,type=_a.type;varid=uniqueId();varfile=imageItem.blob;varimg=newImage();img.src=imageItem.uri;if(isValidDataUriImage(editor,img)){varblobCache=editor.editorUpload.blobCache;varblobInfo=void0;varexistingBlobInfo=blobCache.getByData(base64,type);if(!existingBlobInfo){varuseFileName=getImagesReuseFilename(editor)&&isNonNullable(file.name);varname_1=useFileName?extractFilename(editor,file.name):id;varfilename=useFileName?file.name:undefined;blobInfo=blobCache.create(id,file,base64,name_1,filename);blobCache.add(blobInfo);}else{blobInfo=existingBlobInfo;}pasteHtml(editor,'',false,event);}else{pasteHtml(editor,'',false,event);}};varisClipboardEvent=function(event){returnevent.type==="paste";};varisDataTransferItem=function(item){returnisNonNullable(item.getAsFile);};varreadFilesAsDataUris=function(items){returnglobal$8.all(map(items,function(item){returnnewglobal$8(function(resolve){varblob=isDataTransferItem(item)?item.getAsFile():item;varreader=newwindow.FileReader();reader.onload=function(){resolve({blob:blob,uri:reader.result,});};reader.readAsDataURL(blob);});}));};varisImage=function(editor){varallowedExtensions=getAllowedImageFileTypes(editor);returnfunction(file){return(startsWith(file.type,"image/")&&exists(allowedExtensions,function(extension){returngetImageMimeType(extension)===file.type;}));};};vargetImagesFromDataTransfer=function(editor,dataTransfer){varitems=dataTransfer.items?bind(from(dataTransfer.items),function(item){returnitem.kind==="file"?[item.getAsFile()]:[];}):[];varfiles=dataTransfer.files?from(dataTransfer.files):[];returnfilter$1(items.length>0?items:files,isImage(editor));};varpasteImageData=function(editor,e,rng){vardataTransfer=isClipboardEvent(e)?e.clipboardData:e.dataTransfer;if(getPasteDataImages(editor)&&dataTransfer){varimages=getImagesFromDataTransfer(editor,dataTransfer);if(images.length>0){e.preventDefault();readFilesAsDataUris(images).then(function(fileResults){if(rng){editor.selection.setRng(rng);}each(fileResults,function(result){pasteImage(editor,result,e);});});returntrue;}}returnfalse;};varisBrokenAndroidClipboardEvent=function(e){varclipboardData=e.clipboardData;return(navigator.userAgent.indexOf("Android")!==-1&&clipboardData&&clipboardData.items&&clipboardData.items.length===0);};varisKeyboardPasteEvent=function(e){return((global$7.metaKeyPressed(e)&&e.keyCode===86)||(e.shiftKey&&e.keyCode===45));};varregisterEventHandlers=function(editor,pasteBin,pasteFormat){varkeyboardPasteEvent=value();varkeyboardPastePressed=value();varkeyboardPastePlainTextState;editor.on("keyup",keyboardPastePressed.clear);editor.on("keydown",function(e){varremovePasteBinOnKeyUp=function(e){if(isKeyboardPasteEvent(e)&&!e.isDefaultPrevented()){pasteBin.remove();}};if(isKeyboardPasteEvent(e)&&!e.isDefaultPrevented()){keyboardPastePlainTextState=e.shiftKey&&e.keyCode===86;if(keyboardPastePlainTextState&&global$a.webkit&&navigator.userAgent.indexOf("Version/")!==-1){return;}e.stopImmediatePropagation();keyboardPasteEvent.set(e);keyboardPastePressed.set(true);if(global$a.ie&&keyboardPastePlainTextState){e.preventDefault();firePaste(editor,true);return;}pasteBin.remove();pasteBin.create();editor.once("keyup",removePasteBinOnKeyUp);editor.once("paste",function(){editor.off("keyup",removePasteBinOnKeyUp);});}});varinsertClipboardContent=function(editor,clipboardContent,isKeyBoardPaste,plainTextMode,internal,event){varcontent;if(hasContentType(clipboardContent,"text/html")){content=clipboardContent["text/html"];}else{content=pasteBin.getHtml();internal=internal?internal:isMarked(content);if(pasteBin.isDefaultContent(content)){plainTextMode=true;}}content=trimHtml(content);pasteBin.remove();varisPlainTextHtml=internal===false&&isPlainText(content);varisAbsoluteUrl$1=isAbsoluteUrl(content);if(!content.length||(isPlainTextHtml&&!isAbsoluteUrl$1)){plainTextMode=true;}if(plainTextMode||isAbsoluteUrl$1){if(hasContentType(clipboardContent,"text/plain")&&isPlainTextHtml){content=clipboardContent["text/plain"];}else{content=innerText(content);}}if(pasteBin.isDefaultContent(content)){if(!isKeyBoardPaste){editor.windowManager.alert("Please use Ctrl+V/Cmd+V keyboard shortcuts to paste contents.");}return;}if(plainTextMode){pasteText(editor,content,event);}else{pasteHtml(editor,content,internal,event);}};vargetLastRng=function(){returnpasteBin.getLastRng()||editor.selection.getRng();};// 粘贴事件editor.on("paste",function(e){varisKeyboardPaste=keyboardPasteEvent.isSet()||keyboardPastePressed.isSet();if(isKeyboardPaste){keyboardPasteEvent.clear();}varclipboardContent=getClipboardContent(editor,e);varplainTextMode=pasteFormat.get()==="text"||keyboardPastePlainTextState;varinternal=hasContentType(clipboardContent,internalHtmlMime());keyboardPastePlainTextState=false;if(e.isDefaultPrevented()||isBrokenAndroidClipboardEvent(e)){pasteBin.remove();return;}if(!hasHtmlOrText(clipboardContent)&&pasteImageData(editor,e,getLastRng())){pasteBin.remove();return;}if(!isKeyboardPaste){e.preventDefault();}if(global$a.ie&&(!isKeyboardPaste||e.ieFake)&&!hasContentType(clipboardContent,"text/html")){pasteBin.create();editor.dom.bind(pasteBin.getEl(),"paste",function(e){e.stopPropagation();});editor.getDoc().execCommand("Paste",false,null);clipboardContent["text/html"]=pasteBin.getHtml();}if(hasContentType(clipboardContent,"text/html")){e.preventDefault();if(!internal){internal=isMarked(clipboardContent["text/html"]);}insertClipboardContent(editor,clipboardContent,isKeyboardPaste,plainTextMode,internal,e);}else{global$9.setEditorTimeout(editor,function(){insertClipboardContent(editor,clipboardContent,isKeyboardPaste,plainTextMode,internal,e);},0);}});};varregisterEventsAndFilters=function(editor,pasteBin,pasteFormat){registerEventHandlers(editor,pasteBin,pasteFormat);varsrc;editor.parser.addNodeFilter("img",function(nodes,name,args){varisPasteInsert=function(args){returnargs.data&&args.data.paste===true;};varremove=function(node){if(!node.attr("data-mce-object")&&src!==global$a.transparentSrc){node.remove();}};varisWebKitFakeUrl=function(src){returnsrc.indexOf("webkit-fake-url")===0;};varisDataUri=function(src){returnsrc.indexOf("data:")===0;};if(!getPasteDataImages(editor)&&isPasteInsert(args)){vari=nodes.length;while(i--){src=nodes[i].attr("src");if(!src){continue;}if(isWebKitFakeUrl(src)){remove(nodes[i]);}elseif(!getAllowHtmlDataUrls(editor)&&isDataUri(src)){remove(nodes[i]);}}}});};vargetPasteBinParent=function(editor){returnglobal$a.ie&&editor.inline?document.body:editor.getBody();};varisExternalPasteBin=function(editor){returngetPasteBinParent(editor)!==editor.getBody();};vardelegatePasteEvents=function(editor,pasteBinElm,pasteBinDefaultContent){if(isExternalPasteBin(editor)){editor.dom.bind(pasteBinElm,"paste keyup",function(_e){if(!isDefault(editor,pasteBinDefaultContent)){editor.fire("paste");}});}};varcreate=function(editor,lastRngCell,pasteBinDefaultContent){vardom=editor.dom,body=editor.getBody();lastRngCell.set(editor.selection.getRng());varpasteBinElm=editor.dom.add(getPasteBinParent(editor),"div",{id:"mcepastebin",class:"mce-pastebin",contentEditable:true,"data-mce-bogus":"all",style:"position: fixed; top: 50%; width: 10px; height: 10px; overflow: hidden; opacity: 0",},pasteBinDefaultContent);if(global$a.ie||global$a.gecko){dom.setStyle(pasteBinElm,"left",dom.getStyle(body,"direction",true)==="rtl"?65535:-65535);}dom.bind(pasteBinElm,"beforedeactivate focusin focusout",function(e){e.stopPropagation();});delegatePasteEvents(editor,pasteBinElm,pasteBinDefaultContent);pasteBinElm.focus();editor.selection.select(pasteBinElm,true);};varremove=function(editor,lastRngCell){if(getEl(editor)){varpasteBinClone=void0;varlastRng=lastRngCell.get();while((pasteBinClone=editor.dom.get("mcepastebin"))){editor.dom.remove(pasteBinClone);editor.dom.unbind(pasteBinClone);}if(lastRng){editor.selection.setRng(lastRng);}}lastRngCell.set(null);};vargetEl=function(editor){returneditor.dom.get("mcepastebin");};vargetHtml=function(editor){varcopyAndRemove=function(toElm,fromElm){toElm.appendChild(fromElm);editor.dom.remove(fromElm,true);};varpasteBinClones=global$6.grep(getPasteBinParent(editor).childNodes,function(elm){returnelm.id==="mcepastebin";});varpasteBinElm=pasteBinClones.shift();global$6.each(pasteBinClones,function(pasteBinClone){copyAndRemove(pasteBinElm,pasteBinClone);});vardirtyWrappers=editor.dom.select("div[id=mcepastebin]",pasteBinElm);for(vari=dirtyWrappers.length-1;i>=0;i--){varcleanWrapper=editor.dom.create("div");pasteBinElm.insertBefore(cleanWrapper,dirtyWrappers[i]);copyAndRemove(cleanWrapper,dirtyWrappers[i]);}returnpasteBinElm?pasteBinElm.innerHTML:"";};varisDefaultContent=function(pasteBinDefaultContent,content){returncontent===pasteBinDefaultContent;};varisPasteBin=function(elm){returnelm&&elm.id==="mcepastebin";};varisDefault=function(editor,pasteBinDefaultContent){varpasteBinElm=getEl(editor);return(isPasteBin(pasteBinElm)&&isDefaultContent(pasteBinDefaultContent,pasteBinElm.innerHTML));};varPasteBin=function(editor){varlastRng=Cell(null);varpasteBinDefaultContent="%MCEPASTEBIN%";return{create:function(){returncreate(editor,lastRng,pasteBinDefaultContent);},remove:function(){returnremove(editor,lastRng);},getEl:function(){returngetEl(editor);},getHtml:function(){returngetHtml(editor);},getLastRng:lastRng.get,isDefault:function(){returnisDefault(editor,pasteBinDefaultContent);},isDefaultContent:function(content){returnisDefaultContent(pasteBinDefaultContent,content);},};};varClipboard=function(editor,pasteFormat){varpasteBin=PasteBin(editor);editor.on("PreInit",function(){returnregisterEventsAndFilters(editor,pasteBin,pasteFormat);});return{pasteFormat:pasteFormat,pasteHtml:function(html,internalFlag){returnpasteHtml(editor,html,internalFlag);},pasteText:function(text){returnpasteText(editor,text);},pasteImageData:function(e,rng){returnpasteImageData(editor,e,rng);},getDataTransferItems:getDataTransferItems,hasHtmlOrText:hasHtmlOrText,hasContentType:hasContentType,};};vartogglePlainTextPaste=function(editor,clipboard){if(clipboard.pasteFormat.get()==="text"){clipboard.pasteFormat.set("html");firePastePlainTextToggle(editor,false);}else{clipboard.pasteFormat.set("text");firePastePlainTextToggle(editor,true);}editor.focus();};varregister$2=function(editor,clipboard){editor.addCommand("mceTogglePlainTextPaste",function(){togglePlainTextPaste(editor,clipboard);});editor.addCommand("mceInsertClipboardContent",function(ui,value){if(value.content){clipboard.pasteHtml(value.content,value.internal);}if(value.text){clipboard.pasteText(value.text);}});};varhasWorkingClipboardApi=function(clipboardData){return(global$a.iOS===false&&typeof(clipboardData===null||clipboardData===void0?void0:clipboardData.setData)==="function");};varsetHtml5Clipboard=function(clipboardData,html,text){if(hasWorkingClipboardApi(clipboardData)){try{clipboardData.clearData();clipboardData.setData("text/html",html);clipboardData.setData("text/plain",text);clipboardData.setData(internalHtmlMime(),html);returntrue;}catch(e){returnfalse;}}else{returnfalse;}};varsetClipboardData=function(evt,data,fallback,done){if(setHtml5Clipboard(evt.clipboardData,data.html,data.text)){evt.preventDefault();done();}else{fallback(data.html,done);}};varfallback=function(editor){returnfunction(html,done){varmarkedHtml=mark(html);varouter=editor.dom.create("div",{contenteditable:"false","data-mce-bogus":"all",});varinner=editor.dom.create("div",{contenteditable:"true"},markedHtml);editor.dom.setStyles(outer,{position:"fixed",top:"0",left:"-3000px",width:"1000px",overflow:"hidden",});outer.appendChild(inner);editor.dom.add(editor.getBody(),outer);varrange=editor.selection.getRng();inner.focus();varoffscreenRange=editor.dom.createRng();offscreenRange.selectNodeContents(inner);editor.selection.setRng(offscreenRange);global$9.setTimeout(function(){editor.selection.setRng(range);outer.parentNode.removeChild(outer);done();},0);};};vargetData=function(editor){return{html:editor.selection.getContent({contextual:true}),text:editor.selection.getContent({format:"text"}),};};varisTableSelection=function(editor){return!!editor.dom.getParent(editor.selection.getStart(),"td[data-mce-selected],th[data-mce-selected]",editor.getBody());};varhasSelectedContent=function(editor){return!editor.selection.isCollapsed()||isTableSelection(editor);};varcut=function(editor){returnfunction(evt){if(hasSelectedContent(editor)){setClipboardData(evt,getData(editor),fallback(editor),function(){if(global$a.browser.isChrome()||global$a.browser.isFirefox()){varrng_1=editor.selection.getRng();global$9.setEditorTimeout(editor,function(){editor.selection.setRng(rng_1);editor.execCommand("Delete");},0);}else{editor.execCommand("Delete");}});}};};varcopy=function(editor){returnfunction(evt){if(hasSelectedContent(editor)){setClipboardData(evt,getData(editor),fallback(editor),noop);}};};varregister$1=function(editor){editor.on("cut",cut(editor));editor.on("copy",copy(editor));};varglobal=tinymce.util.Tools.resolve("tinymce.dom.RangeUtils");vargetCaretRangeFromEvent=function(editor,e){returnglobal.getCaretRangeFromPoint(e.clientX,e.clientY,editor.getDoc());};varisPlainTextFileUrl=function(content){varplainTextContent=content["text/plain"];returnplainTextContent?plainTextContent.indexOf("file://")===0:false;};varsetFocusedRange=function(editor,rng){editor.focus();editor.selection.setRng(rng);};varsetup$2=function(editor,clipboard,draggingInternallyState){if(shouldBlockDrop(editor)){editor.on("dragend dragover draggesture dragdrop drop drag",function(e){e.preventDefault();e.stopPropagation();});}if(!shouldPasteDataImages(editor)){editor.on("drop",function(e){vardataTransfer=e.dataTransfer;if(dataTransfer&&dataTransfer.files&&dataTransfer.files.length>0){e.preventDefault();}});}editor.on("drop",function(e){varrng=getCaretRangeFromEvent(editor,e);if(e.isDefaultPrevented()||draggingInternallyState.get()){return;}vardropContent=clipboard.getDataTransferItems(e.dataTransfer);varinternal=clipboard.hasContentType(dropContent,internalHtmlMime());if((!clipboard.hasHtmlOrText(dropContent)||isPlainTextFileUrl(dropContent))&&clipboard.pasteImageData(e,rng)){return;}if(rng&&shouldFilterDrop(editor)){varcontent_1=dropContent["mce-internal"]||dropContent["text/html"]||dropContent["text/plain"];if(content_1){e.prDefault();global$9.setEditorTimeout(editor,function(){editor.undoManager.transact(function(){if(dropContent["mce-internal"]){editor.execCommand("Delete");}setFocusedRange(editor,rng);content_1=trimHtml(content_1);if(!dropContent["text/html"]){clipboard.pasteText(content_1);}else{clipboard.pasteHtml(content_1,internal);}});});}}});editor.on("dragstart",function(_e){draggingInternallyState.set(true);});editor.on("dragover dragend",function(e){if(shouldPasteDataImages(editor)&&draggingInternallyState.get()===false){e.preventDefault();setFocusedRange(editor,getCaretRangeFromEvent(editor,e));}if(e.type==="dragend"){draggingInternallyState.set(false);}});};varsetup$1=function(editor){varplugin=editor.plugins.paste;varpreProcess=getPreProcess(editor);if(preProcess){editor.on("PastePreProcess",function(e){preProcess.call(plugin,plugin,e);});}varpostProcess=getPostProcess(editor);if(postProcess){editor.on("PastePostProcess",function(e){postProcess.call(plugin,plugin,e);});}};varaddPreProcessFilter=function(editor,filterFunc){editor.on("PastePreProcess",function(e){e.content=filterFunc(editor,e.content,e.internal,e.wordContent);});};varaddPostProcessFilter=function(editor,filterFunc){editor.on("PastePostProcess",function(e){filterFunc(editor,e.node);});};varremoveExplorerBrElementsAfterBlocks=function(editor,html){if(!isWordContent(html)){returnhtml;}varblockElements=[];global$6.each(editor.schema.getBlockElements(),function(block,blockName){blockElements.push(blockName);});varexplorerBlocksRegExp=newRegExp("(?:[\\s\\r\\n]+|)*(<\\/?("+blockElements.join("|")+")[^>]*>)(?:[\\s\\r\\n]+|)*","g");html=filter(html,[[explorerBlocksRegExp,"$1"]]);html=filter(html,[[//g," "],[//g," "],[//g," "],]);returnhtml;};varremoveWebKitStyles=function(editor,content,internal,isWordHtml){if(isWordHtml||internal){returncontent;}varwebKitStylesSetting=getWebkitStyles(editor);varwebKitStyles;if(shouldRemoveWebKitStyles(editor)===false||webKitStylesSetting==="all"){returncontent;}if(webKitStylesSetting){webKitStyles=webKitStylesSetting.split(/[, ]/);}if(webKitStyles){vardom_1=editor.dom,node_1=editor.selection.getNode();content=content.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi,function(all,before,value,after){varinputStyles=dom_1.parseStyle(dom_1.decode(value));varoutputStyles={};if(webKitStyles==="none"){returnbefore+after;}for(vari=0;i<webKitStyles.length;i++){varinputValue=inputStyles[webKitStyles[i]],currentValue=dom_1.getStyle(node_1,webKitStyles[i],true);if(/color/.test(webKitStyles[i])){inputValue=dom_1.toHex(inputValue);currentValue=dom_1.toHex(currentValue);}if(currentValue!==inputValue){outputStyles[webKitStyles[i]]=inputValue;}}varoutputStyle=dom_1.serializeStyle(outputStyles,"span");if(outputStyle){returnbefore+' style="'+outputStyle+'"'+after;}returnbefore+after;});}else{content=content.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi,"$1$3");}content=content.replace(/(<[^>]+)>/gi,function(all,before,value,after){returnbefore+' style="'+value+'"'+after;});returncontent;};varremoveUnderlineAndFontInAnchor=function(editor,root){editor.$("a",root).find("font,u").each(function(i,node){editor.dom.remove(node,true);});};varsetup=function(editor){if(global$a.webkit){addPreProcessFilter(editor,removeWebKitStyles);}if(global$a.ie){addPreProcessFilter(editor,removeExplorerBrElementsAfterBlocks);addPostProcessFilter(editor,removeUnderlineAndFontInAnchor);}};varmakeSetupHandler=function(editor,clipboard){returnfunction(api){api.setActive(clipboard.pasteFormat.get()==="text");varpastePlainTextToggleHandler=function(e){returnapi.setActive(e.state);};editor.on("PastePlainTextToggle",pastePlainTextToggleHandler);returnfunction(){returneditor.off("PastePlainTextToggle",pastePlainTextToggleHandler);};};};varregister=function(editor,clipboard){varonAction=function(){returneditor.execCommand("mceTogglePlainTextPaste");};editor.ui.registry.addToggleButton("pastetext",{active:false,icon:"paste-text",tooltip:"Paste as text",onAction:onAction,onSetup:makeSetupHandler(editor,clipboard),});editor.ui.registry.addToggleMenuItem("pastetext",{text:"Paste as text",icon:"paste-text",onAction:onAction,onSetup:makeSetupHandler(editor,clipboard),});};functionPlugin(){global$b.add("paste",function(editor){if(hasProPlugin(editor)===false){vardraggingInternallyState=Cell(false);varpasteFormat=Cell(isPasteAsTextEnabled(editor)?"text":"html");varclipboard=Clipboard(editor,pasteFormat);setup(editor);register(editor,clipboard);register$2(editor,clipboard);setup$1(editor);register$1(editor);setup$2(editor,clipboard,draggingInternallyState);returnget(clipboard);}});}Plugin();})();

番外

由于tinymce版本的问题,粘贴上去的图片是没有办法直接拉伸的.需要在init的时候加一下配置

object_resizing:true,//图片拉伸

最终效果

版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/3/28 1:07:38

05:springboot

一&#xff1a;springboot概述二&#xff1a;springboot快速入门三&#xff1a;springboot起步依赖原理分析四&#xff1a;springboot配置五&#xff1a;springboot整合其他框架

作者头像 李华
网站建设 2026/3/28 9:42:26

蜂驰型和正常云服务器有什么区别

蜂驰型多是腾讯云推出的高性价比服务器机型&#xff0c;和正常云服务器&#xff08;以标准CVM、普通轻量服务器为代表&#xff09;的核心区别集中在性能、价格、配置灵活性等方面&#xff0c;具体如下 &#xff1a;1. 性能表现&#xff1a;蜂驰型采用AMD Milan CPU&#xff0c;…

作者头像 李华
网站建设 2026/3/27 13:52:44

Java 是值传递:深入理解参数传递机制

目录 一、什么是“值传递”与“引用传递”&#xff1f; 值传递&#xff08;Pass-by-Value&#xff09; 引用传递&#xff08;Pass-by-Reference&#xff09; 二、Java 的真相&#xff1a;一切都是值传递 关键理解&#xff1a; 三、代码演示&#xff1a;为什么说 Java 是值…

作者头像 李华
网站建设 2026/3/16 15:21:17

迈迪工具集V6.0.0.0:如何让SolidWorks设计效率提升300%?

想要摆脱SolidWorks繁琐的操作步骤&#xff0c;实现真正的设计自由吗&#xff1f;迈迪工具集V6.0.0.0正是为追求极致效率的机械设计师量身打造的终极解决方案。这款强大的SolidWorks插件通过智能化的功能集成&#xff0c;让复杂的三维建模变得简单直观&#xff0c;彻底改变你的…

作者头像 李华
网站建设 2026/3/14 22:11:24

26、打印、新闻、搜索和数据库服务器全解析

打印、新闻、搜索和数据库服务器全解析 在当今数字化的时代,服务器在各种系统中扮演着至关重要的角色。本文将详细介绍打印服务器、新闻服务器以及数据库服务器的相关知识,包括它们的工作原理、配置方法和使用技巧。 1. 打印服务器:CUPS 在Linux系统中,打印服务器已经成…

作者头像 李华
网站建设 2026/3/29 21:10:23

从蓝图到现实:四大咨询核心框架落地案例剖析

一、 麦肯锡&#xff1a;“三层面增长”模型麦肯锡的“三层面增长”模型是一个旨在平衡短期、中期和长期增长的战略框架。 它将企业的增长计划分为三个层面&#xff1a;层面核心理念资源分配建议第一层面&#xff1a;巩固核心业务专注于现有核心业务的优化与防卫&#xff0c;以…

作者头像 李华