PluginProbe
Elementor Website Builder – more than just a page builder / 3.19.4
Elementor Website Builder – more than just a page builder v3.19.4
4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 4.0.7 All 451 releases
← All changes | includes/widgets/text-editor.php +22 -205 4.2.33.19.4 View file →
@@ -90,36 +90,8 @@
90 90 return [ 'text', 'editor' ];
91 91 }
92 92
93 93 /**
94 - * Get style dependencies.
95 - *
96 - * Retrieve the list of style dependencies the widget requires.
97 - *
98 - * The 'widget-text-editor' style is required only when the drop cap is used.
99 - * Therefor, style should not be loaded on the widget level, rather only on
100 - * control level when the drop cap is active.
101 - *
102 - * Only in the Editor, these style should be loaded on the widget level.
103 - *
104 - * @since 3.24.0
105 - * @access public
106 - *
107 - * @return array Widget style dependencies.
108 - */
109 - public function get_style_depends(): array {
110 - $style_dependencies = Plugin::$instance->editor->is_edit_mode() || Plugin::$instance->preview->is_preview_mode()
111 - ? [ 'widget-text-editor' ]
112 - : [];
113 -
114 - return $style_dependencies;
115 - }
116 -
117 - public function has_widget_inner_wrapper(): bool {
118 - return ! Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
119 - }
120 -
121 - /**
122 94 * Register text editor widget controls.
123 95 *
124 96 * Adds different input fields to allow the user to change and customize the widget settings.
125 97 *
@@ -150,28 +122,15 @@
150 122 'label_off' => esc_html__( 'Off', 'elementor' ),
151 123 'label_on' => esc_html__( 'On', 'elementor' ),
152 124 'prefix_class' => 'elementor-drop-cap-',
153 125 'frontend_available' => true,
154 - 'assets' => [
155 - 'styles' => [
156 - [
157 - 'name' => 'widget-text-editor',
158 - 'conditions' => [
159 - 'terms' => [
160 - [
161 - 'name' => 'drop_cap',
162 - 'operator' => '===',
163 - 'value' => 'yes',
164 - ],
165 - ],
166 - ],
167 - ],
168 - ],
169 -
170 - ],
171 126 ]
172 127 );
173 128
129 + $text_columns = range( 1, 10 );
130 + $text_columns = array_combine( $text_columns, $text_columns );
131 + $text_columns[''] = esc_html__( 'Default', 'elementor' );
132 +
174 133 $this->add_responsive_control(
175 134 'text_columns',
176 135 [
177 136 'label' => esc_html__( 'Columns', 'elementor' ),
@@ -176,21 +135,9 @@
176 135 [
177 136 'label' => esc_html__( 'Columns', 'elementor' ),
178 137 'type' => Controls_Manager::SELECT,
179 138 'separator' => 'before',
180 - 'options' => [
181 - '' => esc_html__( 'Default', 'elementor' ),
182 - '1' => esc_html__( '1', 'elementor' ),
183 - '2' => esc_html__( '2', 'elementor' ),
184 - '3' => esc_html__( '3', 'elementor' ),
185 - '4' => esc_html__( '4', 'elementor' ),
186 - '5' => esc_html__( '5', 'elementor' ),
187 - '6' => esc_html__( '6', 'elementor' ),
188 - '7' => esc_html__( '7', 'elementor' ),
189 - '8' => esc_html__( '8', 'elementor' ),
190 - '9' => esc_html__( '9', 'elementor' ),
191 - '10' => esc_html__( '10', 'elementor' ),
192 - ],
139 + 'options' => $text_columns,
193 140 'selectors' => [
194 141 '{{WRAPPER}}' => 'columns: {{VALUE}};',
195 142 ],
196 143 ]
@@ -223,23 +170,8 @@
223 170 ],
224 171 'selectors' => [
225 172 '{{WRAPPER}}' => 'column-gap: {{SIZE}}{{UNIT}};',
226 173 ],
227 - 'conditions' => [
228 - 'relation' => 'or',
229 - 'terms' => [
230 - [
231 - 'name' => 'text_columns',
232 - 'operator' => '>',
233 - 'value' => 1,
234 - ],
235 - [
236 - 'name' => 'text_columns',
237 - 'operator' => '===',
238 - 'value' => '',
239 - ],
240 - ],
241 - ],
242 174 ]
243 175 );
244 176
245 177 $this->end_controls_section();
@@ -257,10 +189,10 @@
257 189 [
258 190 'label' => esc_html__( 'Alignment', 'elementor' ),
259 191 'type' => Controls_Manager::CHOOSE,
260 192 'options' => [
261 - 'start' => [
262 - 'title' => esc_html__( 'Start', 'elementor' ),
193 + 'left' => [
194 + 'title' => esc_html__( 'Left', 'elementor' ),
263 195 'icon' => 'eicon-text-align-left',
264 196 ],
265 197 'center' => [
266 198 'title' => esc_html__( 'Center', 'elementor' ),
@@ -265,10 +197,10 @@
265 197 'center' => [
266 198 'title' => esc_html__( 'Center', 'elementor' ),
267 199 'icon' => 'eicon-text-align-center',
268 200 ],
269 - 'end' => [
270 - 'title' => esc_html__( 'End', 'elementor' ),
201 + 'right' => [
202 + 'title' => esc_html__( 'Right', 'elementor' ),
271 203 'icon' => 'eicon-text-align-right',
272 204 ],
273 205 'justify' => [
274 206 'title' => esc_html__( 'Justified', 'elementor' ),
@@ -274,76 +206,15 @@
274 206 'title' => esc_html__( 'Justified', 'elementor' ),
275 207 'icon' => 'eicon-text-align-justify',
276 208 ],
277 209 ],
278 - 'classes' => 'elementor-control-start-end',
279 - 'selectors_dictionary' => [
280 - 'left' => is_rtl() ? 'end' : 'start',
281 - 'right' => is_rtl() ? 'start' : 'end',
282 - ],
283 210 'selectors' => [
284 211 '{{WRAPPER}}' => 'text-align: {{VALUE}};',
285 212 ],
286 - 'separator' => 'after',
287 213 ]
288 214 );
289 215
290 - $this->add_group_control(
291 - Group_Control_Typography::get_type(),
292 - [
293 - 'name' => 'typography',
294 - 'global' => [
295 - 'default' => Global_Typography::TYPOGRAPHY_TEXT,
296 - ],
297 - ]
298 - );
299 -
300 - $this->add_group_control(
301 - Group_Control_Text_Shadow::get_type(),
302 - [
303 - 'name' => 'text_shadow',
304 - 'selector' => '{{WRAPPER}}',
305 - ]
306 - );
307 -
308 - $this->add_responsive_control(
309 - 'paragraph_spacing',
310 - [
311 - 'label' => esc_html__( 'Paragraph Spacing', 'elementor' ),
312 - 'type' => Controls_Manager::SLIDER,
313 - 'size_units' => [ 'px', 'em', 'rem', 'vh', 'custom' ],
314 - 'range' => [
315 - 'px' => [
316 - 'max' => 100,
317 - ],
318 - 'em' => [
319 - 'min' => 0.1,
320 - 'max' => 20,
321 - ],
322 - ],
323 - 'selectors' => [
324 - '{{WRAPPER}} p' => 'margin-block-end: {{SIZE}}{{UNIT}}',
325 - ],
326 - ]
327 - );
328 -
329 216 $this->add_control(
330 - 'separator',
331 - [
332 - 'type' => Controls_Manager::DIVIDER,
333 - ]
334 - );
335 -
336 - $this->start_controls_tabs( 'link_colors' );
337 -
338 - $this->start_controls_tab(
339 - 'colors_normal',
340 - [
341 - 'label' => esc_html__( 'Normal', 'elementor' ),
342 - ]
343 - );
344 -
345 - $this->add_control(
346 217 'text_color',
347 218 [
348 219 'label' => esc_html__( 'Text Color', 'elementor' ),
349 220 'type' => Controls_Manager::COLOR,
@@ -356,58 +227,26 @@
356 227 ],
357 228 ]
358 229 );
359 230
360 - $this->add_control(
361 - 'link_color',
231 + $this->add_group_control(
232 + Group_Control_Typography::get_type(),
362 233 [
363 - 'label' => esc_html__( 'Link Color', 'elementor' ),
364 - 'type' => Controls_Manager::COLOR,
365 - 'selectors' => [
366 - '{{WRAPPER}} a' => 'color: {{VALUE}};',
234 + 'name' => 'typography',
235 + 'global' => [
236 + 'default' => Global_Typography::TYPOGRAPHY_TEXT,
367 237 ],
368 238 ]
369 239 );
370 240
371 - $this->end_controls_tab();
372 -
373 - $this->start_controls_tab(
374 - 'colors_hover',
241 + $this->add_group_control(
242 + Group_Control_Text_Shadow::get_type(),
375 243 [
376 - 'label' => esc_html__( 'Hover', 'elementor' ),
244 + 'name' => 'text_shadow',
245 + 'selector' => '{{WRAPPER}}',
377 246 ]
378 247 );
379 248
380 - $this->add_control(
381 - 'link_hover_color',
382 - [
383 - 'label' => esc_html__( 'Link Color', 'elementor' ),
384 - 'type' => Controls_Manager::COLOR,
385 - 'selectors' => [
386 - '{{WRAPPER}} a:hover, {{WRAPPER}} a:focus' => 'color: {{VALUE}};',
387 - ],
388 - ]
389 - );
390 -
391 - $this->add_control(
392 - 'link_hover_color_transition_duration',
393 - [
394 - 'label' => esc_html__( 'Transition Duration', 'elementor' ),
395 - 'type' => Controls_Manager::SLIDER,
396 - 'size_units' => [ 's', 'ms', 'custom' ],
397 - 'default' => [
398 - 'unit' => 's',
399 - ],
400 - 'selectors' => [
401 - '{{WRAPPER}} a' => 'transition-duration: {{SIZE}}{{UNIT}};',
402 - ],
403 - ]
404 - );
405 -
406 - $this->end_controls_tab();
407 -
408 - $this->end_controls_tabs();
409 -
410 249 $this->end_controls_section();
411 250
412 251 $this->start_controls_section(
413 252 'section_drop_cap',
@@ -522,9 +361,10 @@
522 361 'max' => 5,
523 362 ],
524 363 ],
525 364 'selectors' => [
526 - '{{WRAPPER}} .elementor-drop-cap' => 'margin-inline-end: {{SIZE}}{{UNIT}};',
365 + 'body:not(.rtl) {{WRAPPER}} .elementor-drop-cap' => 'margin-right: {{SIZE}}{{UNIT}};',
366 + 'body.rtl {{WRAPPER}} .elementor-drop-cap' => 'margin-left: {{SIZE}}{{UNIT}};',
527 367 ],
528 368 ]
529 369 );
530 370
@@ -544,11 +384,8 @@
544 384 ],
545 385 'selectors' => [
546 386 '{{WRAPPER}} .elementor-drop-cap' => 'border-radius: {{SIZE}}{{UNIT}};',
547 387 ],
548 - 'condition' => [
549 - 'drop_cap_view!' => 'default',
550 - ],
551 388 ]
552 389 );
553 390
554 391 $this->add_control(
@@ -592,12 +429,8 @@
592 429
593 430 $editor_content = $this->get_settings_for_display( 'editor' );
594 431 $editor_content = $this->parse_text_editor( $editor_content );
595 432
596 - if ( empty( $editor_content ) ) {
597 - return;
598 - }
599 -
600 433 if ( $should_render_inline_editing ) {
601 434 $this->add_render_attribute( 'editor', 'class', [ 'elementor-text-editor', 'elementor-clearfix' ] );
602 435 }
603 436
@@ -605,11 +438,10 @@
605 438 ?>
606 439 <?php if ( $should_render_inline_editing ) { ?>
607 440 <div <?php $this->print_render_attribute_string( 'editor' ); ?>>
608 441 <?php } ?>
609 - <?php // PHPCS - DO NOT REMOVE THIS ECHO - THE MAIN TEXT OF A WIDGET SHOULD NOT BE ESCAPED!
610 - echo $editor_content; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
611 - ?>
442 + <?php // PHPCS - the main text of a widget should not be escaped.
443 + echo $editor_content; // phpcs:ignore WordPress.Security.EscapeOutput ?>
612 444 <?php if ( $should_render_inline_editing ) { ?>
613 445 </div>
614 446 <?php } ?>
615 447 <?php
@@ -635,26 +467,11 @@
635 467 *
636 468 * @since 2.9.0
637 469 * @access protected
638 470 */
639 - public function render_markdown(): string {
640 - $editor_content = $this->get_settings_for_display( 'editor' );
641 - $editor_content = $this->parse_text_editor( $editor_content );
642 -
643 - if ( empty( $editor_content ) ) {
644 - return '';
645 - }
646 -
647 - return \Elementor\Modules\MarkdownRender\Html_To_Markdown::convert( $editor_content );
648 - }
649 -
650 471 protected function content_template() {
651 472 ?>
652 473 <#
653 - if ( '' === settings.editor ) {
654 - return;
655 - }
656 -
657 474 const shouldRenderInlineEditing = elementorFrontend.isEditMode();
658 475
659 476 if ( shouldRenderInlineEditing ) {
660 477 view.addRenderAttribute( 'editor', 'class', [ 'elementor-text-editor', 'elementor-clearfix' ] );