<wxs src="../common/utils.wxs" module="_" />
<wxs src="../paragraph/paragraph.wxs" module="_this" />

<import src="../paragraph/ellipsis.wxml" />

<view
  class="{{className}} {{prefix}}-class {{_this.wrapperClass(classPrefix, ellipsis)}}"
  style="{{ellipsis ? '' : 'display:inline;'}}{{_._style([style, customStyle])}}{{ellipsis ? '' : _this.markStyle(mark)}}"
>
  <view
    wx:if="{{ellipsis}}"
    class="{{classPrefix}}__ellipsis-content {{_this.decorClass(classPrefix, strong, underline, delete, code, mark, keyboard, italic)}}"
    style="{{_this.ellipsisStyle(ellipsis, isExpanded)}}{{_this.markStyle(mark)}}"
  >
    <text wx:if="{{content}}">{{content}}</text>
    <slot wx:else />
  </view>
  <block wx:else>
    <view
      class="{{_this.decorClass(classPrefix, strong, underline, delete, code, mark, keyboard, italic)}}"
      style="display: inline"
    >
      <text wx:if="{{content}}">{{content}}</text>
      <slot wx:else />
    </view>
  </block>

  <!-- 展开/收起按钮 -->
  <template
    is="ellipsis-toggle"
    data="{{ellipsis, isExpanded, classPrefix, extraStyle: copyable ? 'margin-right:16rpx;' : ''}}"
  />

  <!-- 复制按钮 -->
  <view wx:if="{{copyable}}" class="{{classPrefix}}__copy {{prefix}}-class-copy" bind:tap="onCopy">
    <block wx:if="{{isCopied}}">
      <t-icon name="check" />
    </block>
    <block wx:elif="{{copyable.suffix}}">
      <slot name="suffix" />
    </block>
    <block wx:else>
      <t-icon name="file-copy" />
    </block>
  </view>
</view>
