Debian Codegraph @

addons/html_editor/static/src/main/link/link_popover.xml

raw
1 <templates id="template" xml:space="preserve">
2
3 <t t-name="html_editor.linkPopover">
4 <div class="o-we-linkpopover d-flex bg-light overflow-auto shadow" t-on-keydown="onKeydown" role="dialog" aria-modal="true" aria-label="Link Popover">
5 <div t-if="state.editing" class="container-fluid d-flex vertical-center p-2" t-ref="editing-wrapper">
6 <div t-if="state.isImage" class="col p-2 o_link_popover_container">
7 <div class="input-group mb-1">
8 <input name="o_linkpopover_url_img" t-ref="url" class="o_we_href_input_link border-dark-subtle form-control form-control-sm" t-model="state.url" title="URL" placeholder="Type your URL"
9 t-on-keydown="onKeydownEnter"/>
10 <button class="o_we_apply_link btn btn-sm btn-primary" t-att-class="{'mx-1': state.type === ''}" t-on-click="onClickApply">Apply</button>
11 </div>
12 </div>
13 <div t-else="" class="d-flex">
14 <t t-if="state.showAdvancedOptions">
15 <div class="o_advance_option_panel">
16 <div class="o_advance_options_grid" style="width: 200px;">
17 <button t-if="state.showAdvancedOptions" class="fa fa-angle-left btn btn-secondary border-10" t-on-click="toggleAdvancedOptions"/>
18 <t t-foreach="Object.values(state.relAttributeOptions)" t-as="opt" t-key="opt.label">
19 <t t-if="opt.label !== 'noopener'">
20 <div class="o_seo_option_row d-flex justify-content-between align-items-center py-1 gap-2">
21 <span t-att-title="opt.description"><t t-out="opt.label"/></span>
22 <CheckBox
23 value="opt.isChecked"
24 onChange="toggleRelAttr.bind(this, opt.label)"/>
25 </div>
26 </t>
27 </t>
28 <div class="o_seo_option_row d-flex justify-content-between align-items-center py-1 gap-2">
29 <span>Open in new tab</span>
30 <CheckBox
31 value="state.linkTarget === '_blank'"
32 onChange="onClickNewWindow.bind(this)"
33 className="'target-blank-option'"/>
34 </div>
35 <t t-if="state.linkTarget === '_blank'">
36 <div class="o_seo_option_row o_seo_option_child d-flex justify-content-between align-items-center py-1 gap-2 ps-4">
37 <span>noopener</span>
38 <CheckBox
39 value="state.relAttributeOptions.noopener.isChecked"
40 onChange="toggleRelAttr.bind(this, 'noopener')"/>
41 </div>
42 </t>
43 </div>
44 </div>
45 </t>
46 <t t-else="">
47 <div class="col p-2 o_link_popover_container">
48 <div class="input-group mb-2" t-att-class="{'d-none': !state.showLabel}">
49 <input t-ref="label"
50 class="o_we_label_link border-dark-subtle form-control form-control-sm"
51 t-model="state.label"
52 title="Label"
53 placeholder="Add a label for your link"
54 t-on-input="onChange"/>
55 </div>
56 <div class="input-group mb-2">
57 <input t-ref="url"
58 name="o_linkpopover_url"
59 class="o_we_href_input_link border-dark-subtle form-control form-control-sm"
60 t-model="state.url"
61 title="URL"
62 placeholder="e.g. https://www.odoo.com"
63 t-on-keydown="onKeydownEnter"
64 t-on-input="this.onChange"/>
65 <span class="ms-1" t-if="props.canUpload and !state.url">
66 or <button class="btn btn-light btn-sm" t-on-click="uploadFile"><i class="fa fa-upload"/></button>
67 </span>
68
69 </div>
70 <div class="input-group">
71 <select name="link_type" class="form-select form-select-sm border-dark-subtle w-100 mb-1" t-model="state.type" t-on-change="onChange">
72 <t t-foreach="this.colorsData" t-as="colorData" t-key="colorData.type">
73 <t t-if="props.allowCustomStyle or colorData.type !== 'custom'">
74 <option t-att-value="colorData.type" t-att-selected="state.type === colorData.type" t-attf-class="o_btn_preview" t-out="colorData.label"/>
75 </t>
76 </t>
77 </select>
78 </div>
79 <div t-if="state.type" class="input-group">
80 <select name="link_style_size" class="form-select form-select-sm border-dark-subtle mb-1" t-model="state.buttonSize" t-on-change="onChange" aria-label="Select button size">
81 <option t-foreach="this.buttonSizesData" t-as="buttonSizesData" t-key="buttonSizesData.size" t-att-value="buttonSizesData.size" t-att-selected="state.buttonSize === buttonSizesData.size" t-out="buttonSizesData.label"/>
82 </select>
83 <select name="link_style_shape" class="form-select form-select-sm link-style border-dark-subtle mb-1" t-model="state.buttonShape" t-on-change="onChange" aria-label="Select button shape">
84 <option t-foreach="this.buttonShapeData" t-as="buttonShapeData" t-key="buttonShapeData.shape" t-att-value="buttonShapeData.shape" t-att-selected="state.buttonShape === buttonShapeData.shape" t-out="buttonShapeData.label"/>
85 </select>
86 </div>
87
88 <t t-if="state.type === 'custom'">
89 <div class="d-flex mb-1 custom-text-color">
90 <label>Text Color</label>
91 <button class="o_we_color_preview custom-text-picker me-3" t-att-data-color="this.customTextColorState.selectedColor" t-ref="customTextColorButton"
92 t-attf-style="background-color: {{this.props.formatColor(this.customTextColorState.selectedColor)}}"/>
93 <label>Fill Color</label>
94 <button class="o_we_color_preview custom-fill-picker" t-att-data-color="this.customFillColorState.selectedColor" t-ref="customFillColorButton"
95 t-attf-style="{{this.customFillColorState.selectedColor?.includes('gradient') ? 'background-image' : 'background-color'}}: {{this.props.formatColor(this.customFillColorState.selectedColor)}}" />
96 </div>
97 <div class="d-flex mb-1 custom-border align-items-center">
98 <label class="flex-shrink-0">Border</label>
99 <div class="input-group me-1">
100 <input type="number" min="0"
101 class="form-control form-control-sm custom-border-size flex-grow-0" t-model="state.customBorderSize"
102 placeholder="Border Size" t-on-keydown="onKeydownEnter" t-on-input="onInput"/>
103 <span class="input-group-text">px</span>
104 </div>
105 <div class="d-flex align-items-center" t-if="state.customBorderSize > 0">
106 <select name="link_style_border" class="form-select form-select-sm custom-border-style me-1" t-model="state.customBorderStyle" t-on-change="onChange">
107 <t t-foreach="this.borderData" t-as="borderData" t-key="borderData.style">
108 <option t-att-value="borderData.style" t-att-selected="state.customBorderStyle === borderData.style">
109 <span t-esc="borderData.label"/>
110 </option>
111 </t>
112 </select>
113 <button class="o_we_color_preview custom-border-picker" t-att-data-color="this.customBorderColorState.selectedColor" t-ref="customBorderColorButton"
114 t-attf-style="background-color: {{this.props.formatColor(this.customBorderColorState.selectedColor)}}" />
115 </div>
116 </div>
117 </t>
118 <t t-if="props.allowTargetBlank">
119 <t t-if="state.isDocument">
120 <CheckBox
121 value="state.directDownload"
122 onChange="onClickDirectDownload.bind(this)"
123 className="'direct-download-option'">
124 Direct download
125 </CheckBox>
126 </t>
127 </t>
128 <t t-if="props.allowStripDomain and isAbsoluteURLInCurrentDomain()">
129 <CheckBox
130 value="state.stripDomain"
131 onChange="onClickStripDomain.bind(this)"
132 className="'strip-domain-option'">
133 Autoconvert to relative link
134 </CheckBox>
135 </t>
136 <div class="d-flex justify-content-between align-items-center mt-1">
137 <div>
138 <button class="o_we_apply_link btn btn-sm btn-primary" t-att-disabled="!state.url" t-on-click="onClickApply">Apply</button>
139 <button class="o_we_discard_link btn btn-sm btn-secondary ms-1" t-on-click="props.onDiscard">Discard</button>
140 </div>
141 <div class="d-flex align-items-center gap-1">
142 <a t-if="props.canRemove and state.url" href="#" class="o_we_remove_link text-dark d-flex me-1" t-on-click.prevent="onClickRemove" title="Remove Link">
143 <i class="fa fa-chain-broken"></i>
144 </a>
145 <button class="btn btn-sm btn-secondary" title="Advanced mode" t-att-disabled="!state.url" t-on-click="toggleAdvancedOptions">
146 <i class="fa fa-gear"/>
147 </button>
148 </div>
149 </div>
150 </div>
151 </t>
152 </div>
153 </div>
154 <div t-else="" style="width: 274px;" data-prevent-closing-overlay="true">
155 <div class="d-flex flex-column p-2">
156 <div class="d-flex">
157 <span class="o_we_preview_favicon" style="width: 16px; height: 32px">
158 <img t-if="state.previewIcon.type === 'imgSrc'" t-att-src="state.previewIcon.value" class="align-content-center"/>
159 <span t-elif="state.previewIcon.type === 'mimetype'" class="o_image" t-att-data-mimetype="state.previewIcon.value"/>
160 <i t-else="" t-attf-class="fa fa-fw {{state.previewIcon.value}}"></i>
161 </span>
162 <div class="ms-1 w-100">
163 <div class="d-flex">
164 <a href="#" target="_blank" t-attf-href="{{state.url}}" class="o_we_url_link fw-bold flex-grow-1 text-truncate" style="max-width: 160px;" t-attf-title="{{state.urlTitle}}">
165 <t t-esc="state.urlTitle"/>
166 </a>
167 <div class="flex-grow-1 d-flex justify-content-end align-items-center gap-1">
168 <a href="#" class="mx-1 o_we_replace_title_btn text-dark"
169 t-if="!state.isImage and state.urlTitle and state.label === '' and !state.showReplaceTitleBanner"
170 t-on-click="onClickReplaceTitle"
171 title="Replace URL with its title"
172 >
173 <i class="fa fa-magic"></i>
174 </a>
175 <t t-if="props.canEdit">
176 <a href="#" class="o_we_edit_link btn btn-sm btn-secondary" t-on-click="onClickEdit" title="Edit Link">Edit</a>
177 </t>
178 </div>
179 </div>
180 <div t-if="state.urlTitle and state.url and state.urlTitle !== state.url" class="text-truncate" style="max-width: 200px; font-size: 12px;">
181 <span t-attf-class="o_we_full_url text-muted o_we_webkit_box" t-attf-title="{{state.url}}">
182 <t t-if="state.url" t-esc="state.url"/>
183 <t t-else="">No URL specified</t>
184 </span>
185 </div>
186 </div>
187 </div>
188 <div t-if="state.imgSrc" class="o_extra_info_card" style="align-self: center; max-width: 235px">
189 <a href="#" target="_blank" t-attf-href="{{state.url}}" title="Open in a new tab">
190 <img t-att-src="state.imgSrc" class="img-fluid mb-1" style="max-width: 230; max-height: 100%;"/>
191 </a>
192 </div>
193 <div t-if="state.urlDescription" class="d-flex">
194 <i class="fa fa-align-right align-content-center"></i>
195 <span class="ms-1 o_we_description_link_preview" style="display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-size: 12px;color: gray; overflow: hidden;" t-attf-title="{{state.urlDescription}}">
196 <t t-esc="state.urlDescription"/>
197 </span>
198 </div>
199 </div>
200 <div t-if="!state.isImage and state.urlTitle and state.label === '' and state.showReplaceTitleBanner" class="d-flex align-items-baseline" style="background-color: var(--primary);">
201 <i class="fa fa-magic fa-fw m-1" style="color: var(--o-cc1-btn-primary-text);"></i>
202 <span class="me-2 flex-grow-1" style="color: var(--o-cc1-btn-primary-text);font-size: smaller;">Replace URL with its title?</span>
203 <button class=" btn btn-sm btn-primary o_we_replace_title_btn" style="margin: 1px;font-size: smaller;" t-on-click="onClickReplaceTitle">Yes</button>
204 </div>
205 </div>
206 </div>
207 </t>
208
209 </templates>