textbox.js 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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="flex left mar-top-10">
  14. 字体
  15. <el-select
  16. v-model="fontFamilyStyle"
  17. :clearable="false"
  18. style="width: 120px"
  19. class="mar-left-10"
  20. placeholder="请选择"
  21. @change="setFontFamily"
  22. >
  23. <el-option
  24. v-for="item in options"
  25. :key="item.name"
  26. :label="item.name"
  27. :value="item.name">
  28. <img :src="item.thumbnail" style="max-width: 80%; height: 32px;">
  29. </el-option>
  30. </el-select>
  31. </div>
  32. <div class="flex left mar-top-10">
  33. <div class="edit-font-size flex left position-r" style="margin-right: 10px">
  34. <el-select
  35. :model-value="layerState.fontSize"
  36. @update:model-value="val=>setLayerAttr('fontSize', val)"
  37. :clearable="false"
  38. style="width: 80px"
  39. >
  40. <el-option v-for="item,index in TextboxConfig.fontSize" :key="index" :value="item">{{item}}</el-option>
  41. </el-select>
  42. <div class="bq fs-14 c-999">px</div>
  43. </div>
  44. <el-color-picker
  45. class="mar-left-10"
  46. :model-value="layerState.fill"
  47. @change="(val)=>setLayerAttr('fill', val)"
  48. ></el-color-picker>
  49. </div>
  50. <div class="flex left">
  51. <div class="label title_two">行高</div>
  52. <el-input-number
  53. v-model="layerState.lineHeight"
  54. controls-position="right"
  55. :precision="2"
  56. :step="0.01"
  57. class="mar-left-10"
  58. style="width: 100px"
  59. @change="(val)=>setLayerAttr('lineHeight',val)"
  60. :min="0.01"
  61. :max="100"/>
  62. </div>
  63. <div class="flex left">
  64. <div class="label title_two">字距</div>
  65. <el-input-number
  66. v-model="layerState.charSpacing"
  67. style="width: 100px"
  68. class="mar-left-10"
  69. controls-position="right"
  70. :precision="1"
  71. :step="1"
  72. @change="(val)=>setLayerAttr('charSpacing',val)"/>
  73. </div>
  74. <div class="flex line-20 mar-top-10">
  75. <el-button size="small" class="flex-item" @click="editObj({label:'underline',value:!editLayer.underline})">
  76. <el-tooltip effect="dark" content="下划线" placement="top"><img src="${underline}" style="height: 12px"></el-tooltip>
  77. </el-button>
  78. <el-button size="small" class="flex-item" @click="editObj({label:'linethrough',value:!editLayer.linethrough})">
  79. <el-tooltip effect="dark" content="删除线" placement="top"><img src="${linethrough}" style="height: 12px"></el-tooltip>
  80. </el-button>
  81. </div>
  82. <div class="title_two">对齐方式</div>
  83. <div class="flex left line-20">
  84. <el-button size="small" style="padding: 15px 10px !important;" @click="editObj({label:'textAlign',value:'left'})">
  85. <el-tooltip effect="dark" content="左对齐" placement="top"><img src="${textalignLeft}" style="height: 12px"></el-tooltip>
  86. </el-button>
  87. <el-button size="small" style="padding: 15px 10px !important" @click="editObj({label:'textAlign',value:'center'})">
  88. <el-tooltip effect="dark" content="居中对齐" placement="top"><img src="${textalignCenter}" style="height: 12px"></el-tooltip>
  89. </el-button>
  90. <el-button size="small" style="padding: 15px 10px !important" @click="editObj({label:'textAlign',value:'right'})">
  91. <el-tooltip effect="dark" content="右对齐" placement="top"><img src="${textalignRight}" style="height: 12px"></el-tooltip>
  92. </el-button>
  93. <el-button size="small" style="padding: 15px 10px !important" @click="editObj({label:'textAlign',value:'justify'})">
  94. <el-tooltip effect="dark" content="两端对齐" placement="top"><img src="${textalignLR}" style="height: 12px"></el-tooltip>
  95. </el-button>
  96. </div>
  97. ${tools.flip()}
  98. ${tools.straw()}
  99. ${tools.opacity()}
  100. <!--
  101. <div class="title_two">描边</div>
  102. <div class="flex left" style="padding-left: 10px">
  103. <el-slider
  104. :value="editLayer.strokeWidth"
  105. style="width:60%"
  106. :step="0.1"
  107. @input="(val)=>editObj({label:'strokeWidth',value:val} )"
  108. :min="0"
  109. :max="5"
  110. ></el-slider>
  111. <el-color-picker class="mar-left-10" size="mini" :value="editLayer.stroke" @change="(val)=>editObj({label:'stroke',value:val})"></el-color-picker>
  112. </div>
  113. <div class="title_two">阴影</div>
  114. <div>
  115. <div class="flex left">
  116. <div class="flex left flex-item">
  117. x轴:
  118. <el-input-number
  119. v-model="shadowText.x"
  120. style="width:90px; margin-left: 5px;"
  121. size="small"
  122. controls-position="right"
  123. :step="1"
  124. @change="(val)=>editObj({label:'shadow',value:shadow})"/>
  125. </div>
  126. <div class="flex left flex-item mar-left-10">
  127. y轴:
  128. <el-input-number
  129. v-model="shadowText.y"
  130. style="width:90px; margin-left: 5px;"
  131. size="small"
  132. controls-position="right"
  133. :step="1"
  134. @change="(val)=>editObj({label:'shadow',value:shadow})"/>
  135. </div>
  136. </div>
  137. <div class="flex left mar-top-10">
  138. <div class="flex left flex-item">
  139. 模糊:
  140. <el-input-number
  141. v-model="shadowText.vague"
  142. style="width:90px; margin-left: 5px;"
  143. size="small"
  144. controls-position="right"
  145. :step="1"
  146. @change="(val)=>editObj({label:'shadow',value:shadow})"/>
  147. </div>
  148. <div class="flex left flex-item mar-left-10">
  149. 颜色:
  150. <el-color-picker
  151. size="small" class="mar-left-10" v-model="shadowText.color" @change="(val)=>editObj({label:'shadow',value:shadow})"></el-color-picker>
  152. </div>
  153. </div>
  154. </div>-->
  155. </div>
  156. `
  157. }
  158. export default textbox