textbox.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. // 文字
  2. import tools from '@/views/components/PictureEditor/mixin/edit/module/tools'
  3. import linethrough from '@/views/components/PictureEditor/mixin/edit/images/linethrough.svg'
  4. import underline from '@/views/components/PictureEditor/mixin/edit/images/underline.svg'
  5. import textalignCenter from '@/views/components/PictureEditor/mixin/edit/images/textalign-center.svg'
  6. import textalignLeft from '@/views/components/PictureEditor/mixin/edit/images/textalign-left.svg'
  7. import textalignLR from '@/views/components/PictureEditor/mixin/edit/images/textalign-lr.svg'
  8. import textalignRight from '@/views/components/PictureEditor/mixin/edit/images/textalign-right.svg'
  9. const textbox = () => {
  10. return `
  11. <div class="edit-wrap">
  12. <div class="title step-label"><span class="step-row_color">文字编辑</span></div>
  13. <div class="pad-10">
  14. <!-- 文字内容输入 -->
  15. <div>
  16. <div class="title_two">文字内容</div>
  17. <el-input
  18. type="textarea"
  19. :model-value="editLayer.text"
  20. @input="(val) => setLayerAttr('text', val)"
  21. :autosize="{ minRows: 2, maxRows: 8}"
  22. placeholder="请输入文字内容"
  23. class="mar-top-5"
  24. resize="none"
  25. />
  26. </div>
  27. <!-- 字体设置 -->
  28. <div class="mar-top-15">
  29. <div class="title_two">字体样式</div>
  30. <div class="">
  31. <div class="flex left mar-top-10" style="align-items: center; margin-right: 15px;">
  32. <span class="label-text">字体:</span>
  33. <el-select
  34. v-model="fontFamilyStyle"
  35. :clearable="false"
  36. style="width: 140px"
  37. class="mar-left-5"
  38. placeholder="请选择"
  39. @change="setFontFamily"
  40. size="small"
  41. >
  42. <el-option
  43. v-for="item in options"
  44. :key="item.name"
  45. :label="item.name"
  46. :value="item.name">
  47. <img :src="item.thumbnail" style="max-width: 80%; height: 24px;">
  48. </el-option>
  49. </el-select>
  50. </div>
  51. <div class="flex left mar-top-10" style="align-items: center;">
  52. <span class="label-text">大小:</span>
  53. <el-select
  54. :model-value="layerState.fontSize"
  55. @update:model-value="val=>setLayerAttr('fontSize', val)"
  56. :clearable="false"
  57. style="width: 60px"
  58. class="mar-left-5"
  59. size="small"
  60. >
  61. <el-option v-for="item,index in TextboxConfig.fontSize" :key="index" :value="item">{{item}}</el-option>
  62. </el-select>
  63. <span class="mar-left-10 c-999 fs-12">px</span>
  64. </div>
  65. </div>
  66. </div>
  67. <!-- 颜色和排版 -->
  68. <div class="mar-top-15">
  69. <div class="title_two">颜色与排版</div>
  70. <div class=" ">
  71. <div class="flex left " style="align-items: center; margin-right: 15px;">
  72. <span class="label-text">颜色:</span>
  73. <el-color-picker
  74. :model-value="layerState.fill"
  75. @change="(val)=>setLayerAttr('fill', val)"
  76. size="small"
  77. class="mar-left-5"
  78. />
  79. </div>
  80. <div class="mar-top-10 flex left">
  81. <div class="flex left" >
  82. <span class="label-text">行高:</span>
  83. <el-input-number
  84. v-model="layerState.lineHeight"
  85. controls-position="right"
  86. :precision="2"
  87. :step="0.01"
  88. size="small"
  89. style="width: 100px"
  90. class="mar-left-5"
  91. @change="(val)=>setLayerAttr('lineHeight',val)"
  92. :min="0.01"
  93. :max="10"
  94. />
  95. </div>
  96. </div>
  97. <div class="mar-top-10 flex left">
  98. <div class="flex left" style="align-items: center;">
  99. <span class="label-text">字距:</span>
  100. <el-input-number
  101. v-model="layerState.charSpacing"
  102. style="width: 100px"
  103. class="mar-left-5"
  104. size="small"
  105. controls-position="right"
  106. :precision="1"
  107. :step="1"
  108. @change="(val)=>setLayerAttr('charSpacing',val)"
  109. />
  110. </div>
  111. </div>
  112. </div>
  113. </div>
  114. <!-- 文字装饰 -->
  115. <div class="mar-top-15">
  116. <div class="title_two">文字装饰</div>
  117. <div class="flex left mar-top-10">
  118. <el-button
  119. size="small"
  120. :type="editLayer.underline ? 'primary' : 'default'"
  121. @click="editObj({label:'underline',value:!editLayer.underline})"
  122. class="mar-right-5"
  123. >
  124. <el-tooltip effect="dark" content="下划线" placement="top">
  125. <img src="${underline}" style="height: 10px">
  126. </el-tooltip>
  127. </el-button>
  128. <el-button
  129. size="small"
  130. :type="editLayer.linethrough ? 'primary' : 'default'"
  131. @click="editObj({label:'linethrough',value:!editLayer.linethrough})"
  132. >
  133. <el-tooltip effect="dark" content="删除线" placement="top">
  134. <img src="${linethrough}" style="height: 10px">
  135. </el-tooltip>
  136. </el-button>
  137. </div>
  138. </div>
  139. <!-- 对齐方式 -->
  140. <div class="mar-top-15">
  141. <div class="title_two">对齐方式</div>
  142. <div class="flex left mar-top-10">
  143. <el-button
  144. size="small"
  145. :type="editLayer.textAlign === 'left' ? 'primary' : 'default'"
  146. @click="editObj({label:'textAlign',value:'left'})"
  147. class="mar-right-5"
  148. >
  149. <el-tooltip effect="dark" content="左对齐" placement="top">
  150. <img src="${textalignLeft}" style="height: 12px">
  151. </el-tooltip>
  152. </el-button>
  153. <el-button
  154. size="small"
  155. :type="editLayer.textAlign === 'center' ? 'primary' : 'default'"
  156. @click="editObj({label:'textAlign',value:'center'})"
  157. class="mar-right-5"
  158. >
  159. <el-tooltip effect="dark" content="居中对齐" placement="top">
  160. <img src="${textalignCenter}" style="height: 12px">
  161. </el-tooltip>
  162. </el-button>
  163. <el-button
  164. size="small"
  165. :type="editLayer.textAlign === 'right' ? 'primary' : 'default'"
  166. @click="editObj({label:'textAlign',value:'right'})"
  167. class="mar-right-5"
  168. >
  169. <el-tooltip effect="dark" content="右对齐" placement="top">
  170. <img src="${textalignRight}" style="height: 12px">
  171. </el-tooltip>
  172. </el-button>
  173. <el-button
  174. size="small"
  175. :type="editLayer.textAlign === 'justify' ? 'primary' : 'default'"
  176. @click="editObj({label:'textAlign',value:'justify'})"
  177. >
  178. <el-tooltip effect="dark" content="两端对齐" placement="top">
  179. <img src="${textalignLR}" style="height: 12px">
  180. </el-tooltip>
  181. </el-button>
  182. </div>
  183. </div>
  184. <!-- 其他工具 -->
  185. <div class="mar-top-15">
  186. <div class="title_two">其他工具</div>
  187. <div>
  188. ${tools.flip()}
  189. ${tools.straw()}
  190. ${tools.opacity()}
  191. </div>
  192. </div>
  193. <!--
  194. <div class="title_two">描边</div>
  195. <div class="flex left" style="padding-left: 10px">
  196. <el-slider
  197. :value="editLayer.strokeWidth"
  198. style="width:60%"
  199. :step="0.1"
  200. @input="(val)=>editObj({label:'strokeWidth',value:val} )"
  201. :min="0"
  202. :max="5"
  203. ></el-slider>
  204. <el-color-picker class="mar-left-10" size="mini" :value="editLayer.stroke" @change="(val)=>editObj({label:'stroke',value:val})"></el-color-picker>
  205. </div>
  206. <div class="title_two">阴影</div>
  207. <div>
  208. <div class="flex left">
  209. <div class="flex left flex-item">
  210. x轴:
  211. <el-input-number
  212. v-model="shadowText.x"
  213. style="width:90px; margin-left: 5px;"
  214. size="small"
  215. controls-position="right"
  216. :step="1"
  217. @change="(val)=>editObj({label:'shadow',value:shadow})"/>
  218. </div>
  219. <div class="flex left flex-item mar-left-10">
  220. y轴:
  221. <el-input-number
  222. v-model="shadowText.y"
  223. style="width:90px; margin-left: 5px;"
  224. size="small"
  225. controls-position="right"
  226. :step="1"
  227. @change="(val)=>editObj({label:'shadow',value:shadow})"/>
  228. </div>
  229. </div>
  230. <div class="flex left mar-top-10">
  231. <div class="flex left flex-item">
  232. 模糊:
  233. <el-input-number
  234. v-model="shadowText.vague"
  235. style="width:90px; margin-left: 5px;"
  236. size="small"
  237. controls-position="right"
  238. :step="1"
  239. @change="(val)=>editObj({label:'shadow',value:shadow})"/>
  240. </div>
  241. <div class="flex left flex-item mar-left-10">
  242. 颜色:
  243. <el-color-picker
  244. size="small" class="mar-left-10" v-model="shadowText.color" @change="(val)=>editObj({label:'shadow',value:shadow})"></el-color-picker>
  245. </div>
  246. </div>
  247. </div>-->
  248. </div>
  249. </div>
  250. `
  251. }
  252. export default textbox