1/** 2 * created by WEVEN on 2020-03-02 3 * ìëì ìì¤ë WEVENì ì ìê¶ì´ ìì¼ë¯ë¡ ë¬´ë¨ ì¬ì© ë° ì¬ ë°°í¬ë¥¼ ê¸í©ëë¤. 4 */ 5var ToolText = function(){ 6 7 8 this.targetImage = null; 9 this.prevTargetElement = null; 10 this.eventTargetListforImage = []; 11 this.elementType = 'text'; 12 13 this.hideBtnList = ['ToolBtnTextFont', 'ToolBtnTextLetterSpacing']; 14 15 this.quickEdit = function( data ){ 16 if( this.status ){ 17 18 switch ( data ){ 19 case "image" : 20 $(this.toolBtnList[ "ToolBtnTextImage" ].btnList[data]).trigger( "click" ); 21 break; 22 case "source" : 23 $(this.toolBtnList[ "ToolBtnSource" ].btnList[data]).trigger( "click" ); 24 break; 25 } 26 } 27 } 28 29} 30 31bm.extend( ToolBase , ToolText ); 32 33 34ToolText.prototype.onChangeTarget = function(target, e, toolMode) { 35 this.removeEvent(); 36 this.addEvent(); 37 if(toolMode === 'side' || toolMode === 'expert') { 38 this.isShow = false; 39 this.show(true, this.elementType); 40 }else { 41 if(window.toolMode === 'design') { 42 var type = $(target).attr('data-wv-layout-element-type'); 43 if(type && (type === 'text' || type.indexOf('table') > -1)) { 44 this.show(); 45 this.reposition(); 46 }else { 47 this.hide(); 48 } 49 }else { 50 51 } 52 } 53} 54 55/** 56 * ì¬ì ìí´ì ì¬ì© 57 */ 58ToolText.prototype.addEvent = function () { 59 var _this = this; 60 61 if( this.targetElement ){ 62 $(this.targetElement).off("paste"); 63 $(this.targetElement).on("paste" , function(e){ 64 65 var clipboardData = e.originalEvent && e.originalEvent.clipboardData ? e.originalEvent.clipboardData : window.clipboardData; 66 if( clipboardData.getData( "Text" ) || clipboardData.files.length == 0 ){ 67 return; 68 } 69 70 71 var currentData = clipboardData.items[0]; 72 if( currentData.type.indexOf( "image" ) == -1 ){ 73 return; 74 } 75 76 var imageFile = currentData.getAsFile(); 77 var reader = new FileReader(); 78 reader.readAsDataURL(imageFile); 79 80 81 reader.onload = function(){ 82 var imageSrc = reader.result; 83 var ext = "png"; 84 var fileName = "paste_" + app.uniqueCode(); 85 var o = {"defaultPath" : "clipboardData/" 86 , "isOverride" : 1 87 , "name" : fileName + "." + ext 88 , "type" : "image/jpeg" 89 , "filedata" : imageSrc 90 }; 91 92 93 bm.httpSendJsonPost( WEB_ROOT + "filemanager/" + "uploadSimpleAjaxImage", o , function (result) { 94 if(result.result == true ){ 95 var img = new Image(); 96 img.src = result.data.file.src; 97 98 99 bm.selectionManager.getRange().insertNode( img ); 100 101 return; 102 } 103 }) 104 } 105 106 return false; 107 }) 108 } 109 110} 111 112/** 113 * ì¬ì ì í´ì ì¬ì© 114 */ 115ToolText.prototype.removeEvent = function () { 116 117 if( this.targetElement ) { 118 $(this.targetElement).off("paste"); 119 } 120} 121 122/** 123 * ê²½ì°ì ë°ë¼ ì í´ì§ ë²í¼ë¦¬ì¤í¸ ì¨ê¹ì²ë¦¬ 124 */ 125ToolText.prototype.hideBtn = function () { 126 var _this = bm.toolManager['toolList']['ToolText']; 127 128 for(let i=0; i< _this.hideBtnList.length; i++) { 129 $(_this['toolBtnList'][_this.hideBtnList[i]]['btnList']['mainBtn']).hide(); 130 } 131 132} 133 134/** 135* ë²í¼ë¦¬ì¤í¸ ì¨ê¹ì²ë¦¬í´ì 136*/ 137ToolText.prototype.showBtn = function () { 138 var _this = bm.toolManager['toolList']['ToolText']; 139 140 for(let i=0; i< _this.hideBtnList.length; i++) { 141 $(_this['toolBtnList'][_this.hideBtnList[i]]['btnList']['mainBtn']).show(); 142 } 143 144} 145 146/** 147* ë²í¼ë¦¬ì¤í¸ ë³´ì´ê¸° 컨í¸ë¡¤ 148*/ 149ToolText.prototype.btnShowHideControl = function () { 150 var _this = bm.toolManager['toolList']['ToolText']; 151 152 const currentResponsiveSize = window.parent.wvAdminIFrameBridge._WVAdminTopBar.currentResponsiveSizeVal; 153 154 if ( currentResponsiveSize === '480' || currentResponsiveSize === 'default') { 155 _this.hideBtn();
156 } else { 157 _this.showBtn(); 158 } 159 160 } 161 162ToolText.prototype.reposition = function ( target ) { 163 if( this.targetElement ){ 164 165 const narrowedMenuWidth = 426; 166 var targetElement = this.targetElement; 167 168 if( target ) targetElement = target; 169 170 // ymg ìì ìì - layoutkit ìì ìë¨ì ë¶ë ê²ë¤ê³¼ ìì¹ ê²¹ì¹¨ì í¼í기 ìí¨ 171 if(!this.layoutKit) this.layoutKit = wvAdminIFrameBridge._WVLayoutKit; 172 173 // layoutkit ìì ìë¨ì ë¶ë ê²ë¤ 174 var posTopKitList = [this.layoutKit.blockSpaceCloseBtn, this.layoutKit.resetPosBtn, this.layoutKit.moveBtn, this.layoutKit.wvPosDisplayCon]; 175 176 var verticalOffset = 2; 177 178 // for(var i = 0; i < posTopKitList.length; i++) { 179 // if($(posTopKitList[i]).is(":visible")) { 180 // // kitìì ê°ê°ì ëì´ë¥¼ ê³ì°íì§ ìê³ ììê°ì¼ë¡ ê³ ì 181 // verticalOffset = 25; 182 // break; 183 // } 184 // } 185 186 if(targetElement.length && targetElement.length > 1) { 187 targetElement = targetElement[targetElement.length - 1]; 188 } 189 190 var isTable = false; 191 var isTableCellActive = false; 192 var table = $(targetElement).closest('[data-wv-layout-element="block"]').find('table'); 193 if( table.length > 0 ) { 194 isTable = true; 195 if(table.find('td.active').length > 0 ) isTableCellActive = true; 196 } 197 198 199 var top = $(targetElement).offset().top - this.element.offsetHeight - verticalOffset; 200 // var top = targetElement.getBoundingClientRect()['top'] - this.element.offsetHeight - verticalOffset; 201 var left = $(targetElement).offset().left; 202 var scrollTop = $(this.innerWindow.document).scrollTop(); 203 204 if(isTableCellActive) { 205 top += (targetElement.offsetHeight + this.element.offsetHeight); 206 } 207 208 if( top < 0 || top < scrollTop ) { 209 top = $(targetElement).offset().top + targetElement.offsetHeight + verticalOffset; 210 //ê·¸ëë topì´ ììë©´ ê°ì ë¡ 0ì¼ë¡ ì¸í íë¤ 211 if(top < 0) { 212 top = 0; 213 } 214 } 215 216 // íë©´ì ë²ì´ëë ê²½ì° 217 if(window["wvAdminIFrameBridge"] && window["wvAdminIFrameBridge"].contentSizeCon.width() - $(this.element)[0].offsetWidth < left){ 218 left = $(targetElement).offset().left + targetElement.offsetWidth - $(this.element)[0].offsetWidth; 219 } 220 221 // íë©´ì´ ë©ë´ë³´ë¤ ìì ê²½ì° 222 // ì´ë¯¸ ê³ ì ë ë©ë´width를 ì¨ì¼í¨ 223 const viewWidth = wvAdminIFrameBridge._WVContentArea.$contentBody.width(); 224 if(viewWidth < $(this.element)[0].offsetWidth || viewWidth < 500) { 225 left = viewWidth / 2 - narrowedMenuWidth / 2; 226 } 227 228 $(this.element).css( { "top" : top , "left" : left }); 229 if(isTable) { 230 if(isTableCellActive) { 231 $(this.element).css('visibility',''); 232 } else { 233 $(this.element).css('visibility','hidden'); 234 } 235 } 236 237 // ToolText.prototype.btnShowHideControl(); 238 } 239} 240 241 242 243
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.