PluginProbe
Elementor Website Builder – more than just a page builder / 3.0.7
Elementor Website Builder – more than just a page builder v3.0.7
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 +55 -293 4.2.03.0.7 View file →
@@ -42,9 +42,9 @@
42 42 *
43 43 * @return string Widget title.
44 44 */
45 45 public function get_title() {
46 - return esc_html__( 'Text Editor', 'elementor' );
46 + return __( 'Text Editor', 'elementor' );
47 47 }
48 48
49 49 /**
50 50 * Get widget icon.
@@ -90,48 +90,20 @@
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 *
126 - * @since 3.1.0
98 + * @since 1.0.0
127 99 * @access protected
128 100 */
129 - protected function register_controls() {
101 + protected function _register_controls() {
130 102 $this->start_controls_section(
131 103 'section_editor',
132 104 [
133 - 'label' => esc_html__( 'Text Editor', 'elementor' ),
105 + 'label' => __( 'Text Editor', 'elementor' ),
134 106 ]
135 107 );
136 108
137 109 $this->add_control(
@@ -138,61 +110,36 @@
138 110 'editor',
139 111 [
140 112 'label' => '',
141 113 'type' => Controls_Manager::WYSIWYG,
142 - 'default' => '<p>' . esc_html__( 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.', 'elementor' ) . '</p>',
114 + 'default' => '<p>' . __( 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.', 'elementor' ) . '</p>',
143 115 ]
144 116 );
145 117
146 118 $this->add_control(
147 119 'drop_cap', [
148 - 'label' => esc_html__( 'Drop Cap', 'elementor' ),
120 + 'label' => __( 'Drop Cap', 'elementor' ),
149 121 'type' => Controls_Manager::SWITCHER,
150 - 'label_off' => esc_html__( 'Off', 'elementor' ),
151 - 'label_on' => esc_html__( 'On', 'elementor' ),
122 + 'label_off' => __( 'Off', 'elementor' ),
123 + 'label_on' => __( '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[''] = __( 'Default', 'elementor' );
132 +
174 133 $this->add_responsive_control(
175 134 'text_columns',
176 135 [
177 - 'label' => esc_html__( 'Columns', 'elementor' ),
136 + 'label' => __( '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 - '{{WRAPPER}}' => 'columns: {{VALUE}};',
141 + '{{WRAPPER}} .elementor-text-editor' => 'columns: {{VALUE}};',
195 142 ],
196 143 ]
197 144 );
198 145
@@ -198,11 +145,11 @@
198 145
199 146 $this->add_responsive_control(
200 147 'column_gap',
201 148 [
202 - 'label' => esc_html__( 'Columns Gap', 'elementor' ),
149 + 'label' => __( 'Columns Gap', 'elementor' ),
203 150 'type' => Controls_Manager::SLIDER,
204 - 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ],
151 + 'size_units' => [ 'px', '%', 'em', 'vw' ],
205 152 'range' => [
206 153 'px' => [
207 154 'max' => 100,
208 155 ],
@@ -215,31 +162,14 @@
215 162 'step' => 0.1,
216 163 ],
217 164 'em' => [
218 165 'max' => 10,
166 + 'step' => 0.1,
219 167 ],
220 - 'rem' => [
221 - 'max' => 10,
222 - ],
223 168 ],
224 169 'selectors' => [
225 - '{{WRAPPER}}' => 'column-gap: {{SIZE}}{{UNIT}};',
170 + '{{WRAPPER}} .elementor-text-editor' => 'column-gap: {{SIZE}}{{UNIT}};',
226 171 ],
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 172 ]
243 173 );
244 174
245 175 $this->end_controls_section();
@@ -246,9 +176,9 @@
246 176
247 177 $this->start_controls_section(
248 178 'section_style',
249 179 [
250 - 'label' => esc_html__( 'Text Editor', 'elementor' ),
180 + 'label' => __( 'Text Editor', 'elementor' ),
251 181 'tab' => Controls_Manager::TAB_STYLE,
252 182 ]
253 183 );
254 184
@@ -254,99 +184,38 @@
254 184
255 185 $this->add_responsive_control(
256 186 'align',
257 187 [
258 - 'label' => esc_html__( 'Alignment', 'elementor' ),
188 + 'label' => __( 'Alignment', 'elementor' ),
259 189 'type' => Controls_Manager::CHOOSE,
260 190 'options' => [
261 - 'start' => [
262 - 'title' => esc_html__( 'Start', 'elementor' ),
191 + 'left' => [
192 + 'title' => __( 'Left', 'elementor' ),
263 193 'icon' => 'eicon-text-align-left',
264 194 ],
265 195 'center' => [
266 - 'title' => esc_html__( 'Center', 'elementor' ),
196 + 'title' => __( 'Center', 'elementor' ),
267 197 'icon' => 'eicon-text-align-center',
268 198 ],
269 - 'end' => [
270 - 'title' => esc_html__( 'End', 'elementor' ),
199 + 'right' => [
200 + 'title' => __( 'Right', 'elementor' ),
271 201 'icon' => 'eicon-text-align-right',
272 202 ],
273 203 'justify' => [
274 - 'title' => esc_html__( 'Justified', 'elementor' ),
204 + 'title' => __( 'Justified', 'elementor' ),
275 205 'icon' => 'eicon-text-align-justify',
276 206 ],
277 207 ],
278 - 'classes' => 'elementor-control-start-end',
279 - 'selectors_dictionary' => [
280 - 'left' => is_rtl() ? 'end' : 'start',
281 - 'right' => is_rtl() ? 'start' : 'end',
282 - ],
283 208 'selectors' => [
284 - '{{WRAPPER}}' => 'text-align: {{VALUE}};',
209 + '{{WRAPPER}} .elementor-text-editor' => 'text-align: {{VALUE}};',
285 210 ],
286 - 'separator' => 'after',
287 211 ]
288 212 );
289 213
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 214 $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 215 'text_color',
347 216 [
348 - 'label' => esc_html__( 'Text Color', 'elementor' ),
217 + 'label' => __( 'Text Color', 'elementor' ),
349 218 'type' => Controls_Manager::COLOR,
350 219 'default' => '',
351 220 'selectors' => [
352 221 '{{WRAPPER}}' => 'color: {{VALUE}};',
@@ -356,64 +225,24 @@
356 225 ],
357 226 ]
358 227 );
359 228
360 - $this->add_control(
361 - 'link_color',
229 + $this->add_group_control(
230 + Group_Control_Typography::get_type(),
362 231 [
363 - 'label' => esc_html__( 'Link Color', 'elementor' ),
364 - 'type' => Controls_Manager::COLOR,
365 - 'selectors' => [
366 - '{{WRAPPER}} a' => 'color: {{VALUE}};',
232 + 'name' => 'typography',
233 + 'global' => [
234 + 'default' => Global_Typography::TYPOGRAPHY_TEXT,
367 235 ],
368 236 ]
369 237 );
370 238
371 - $this->end_controls_tab();
372 -
373 - $this->start_controls_tab(
374 - 'colors_hover',
375 - [
376 - 'label' => esc_html__( 'Hover', 'elementor' ),
377 - ]
378 - );
379 -
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 239 $this->end_controls_section();
411 240
412 241 $this->start_controls_section(
413 242 'section_drop_cap',
414 243 [
415 - 'label' => esc_html__( 'Drop Cap', 'elementor' ),
244 + 'label' => __( 'Drop Cap', 'elementor' ),
416 245 'tab' => Controls_Manager::TAB_STYLE,
417 246 'condition' => [
418 247 'drop_cap' => 'yes',
419 248 ],
@@ -422,14 +251,14 @@
422 251
423 252 $this->add_control(
424 253 'drop_cap_view',
425 254 [
426 - 'label' => esc_html__( 'View', 'elementor' ),
255 + 'label' => __( 'View', 'elementor' ),
427 256 'type' => Controls_Manager::SELECT,
428 257 'options' => [
429 - 'default' => esc_html__( 'Default', 'elementor' ),
430 - 'stacked' => esc_html__( 'Stacked', 'elementor' ),
431 - 'framed' => esc_html__( 'Framed', 'elementor' ),
258 + 'default' => __( 'Default', 'elementor' ),
259 + 'stacked' => __( 'Stacked', 'elementor' ),
260 + 'framed' => __( 'Framed', 'elementor' ),
432 261 ],
433 262 'default' => 'default',
434 263 'prefix_class' => 'elementor-drop-cap-view-',
435 264 ]
@@ -437,9 +266,9 @@
437 266
438 267 $this->add_control(
439 268 'drop_cap_primary_color',
440 269 [
441 - 'label' => esc_html__( 'Primary Color', 'elementor' ),
270 + 'label' => __( 'Primary Color', 'elementor' ),
442 271 'type' => Controls_Manager::COLOR,
443 272 'selectors' => [
444 273 '{{WRAPPER}}.elementor-drop-cap-view-stacked .elementor-drop-cap' => 'background-color: {{VALUE}};',
445 274 '{{WRAPPER}}.elementor-drop-cap-view-framed .elementor-drop-cap, {{WRAPPER}}.elementor-drop-cap-view-default .elementor-drop-cap' => 'color: {{VALUE}}; border-color: {{VALUE}};',
@@ -452,9 +281,9 @@
452 281
453 282 $this->add_control(
454 283 'drop_cap_secondary_color',
455 284 [
456 - 'label' => esc_html__( 'Secondary Color', 'elementor' ),
285 + 'label' => __( 'Secondary Color', 'elementor' ),
457 286 'type' => Controls_Manager::COLOR,
458 287 'selectors' => [
459 288 '{{WRAPPER}}.elementor-drop-cap-view-framed .elementor-drop-cap' => 'background-color: {{VALUE}};',
460 289 '{{WRAPPER}}.elementor-drop-cap-view-stacked .elementor-drop-cap' => 'color: {{VALUE}};',
@@ -464,22 +293,13 @@
464 293 ],
465 294 ]
466 295 );
467 296
468 - $this->add_group_control(
469 - Group_Control_Text_Shadow::get_type(),
470 - [
471 - 'name' => 'drop_cap_shadow',
472 - 'selector' => '{{WRAPPER}} .elementor-drop-cap',
473 - ]
474 - );
475 -
476 297 $this->add_control(
477 298 'drop_cap_size',
478 299 [
479 - 'label' => esc_html__( 'Size', 'elementor' ),
300 + 'label' => __( 'Size', 'elementor' ),
480 301 'type' => Controls_Manager::SLIDER,
481 - 'size_units' => [ 'px', 'em', 'rem', 'custom' ],
482 302 'default' => [
483 303 'size' => 5,
484 304 ],
485 305 'range' => [
@@ -485,14 +305,8 @@
485 305 'range' => [
486 306 'px' => [
487 307 'max' => 30,
488 308 ],
489 - 'em' => [
490 - 'max' => 3,
491 - ],
492 - 'rem' => [
493 - 'max' => 3,
494 - ],
495 309 ],
496 310 'selectors' => [
497 311 '{{WRAPPER}} .elementor-drop-cap' => 'padding: {{SIZE}}{{UNIT}};',
498 312 ],
@@ -504,11 +318,10 @@
504 318
505 319 $this->add_control(
506 320 'drop_cap_space',
507 321 [
508 - 'label' => esc_html__( 'Space', 'elementor' ),
322 + 'label' => __( 'Space', 'elementor' ),
509 323 'type' => Controls_Manager::SLIDER,
510 - 'size_units' => [ 'px', 'em', 'rem', 'custom' ],
511 324 'default' => [
512 325 'size' => 10,
513 326 ],
514 327 'range' => [
@@ -514,17 +327,12 @@
514 327 'range' => [
515 328 'px' => [
516 329 'max' => 50,
517 330 ],
518 - 'em' => [
519 - 'max' => 5,
520 - ],
521 - 'rem' => [
522 - 'max' => 5,
523 - ],
524 331 ],
525 332 'selectors' => [
526 - '{{WRAPPER}} .elementor-drop-cap' => 'margin-inline-end: {{SIZE}}{{UNIT}};',
333 + 'body:not(.rtl) {{WRAPPER}} .elementor-drop-cap' => 'margin-right: {{SIZE}}{{UNIT}};',
334 + 'body.rtl {{WRAPPER}} .elementor-drop-cap' => 'margin-left: {{SIZE}}{{UNIT}};',
527 335 ],
528 336 ]
529 337 );
530 338
@@ -530,11 +338,11 @@
530 338
531 339 $this->add_control(
532 340 'drop_cap_border_radius',
533 341 [
534 - 'label' => esc_html__( 'Border Radius', 'elementor' ),
342 + 'label' => __( 'Border Radius', 'elementor' ),
535 343 'type' => Controls_Manager::SLIDER,
536 - 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
344 + 'size_units' => [ '%', 'px' ],
537 345 'default' => [
538 346 'unit' => '%',
539 347 ],
540 348 'range' => [
@@ -544,19 +352,15 @@
544 352 ],
545 353 'selectors' => [
546 354 '{{WRAPPER}} .elementor-drop-cap' => 'border-radius: {{SIZE}}{{UNIT}};',
547 355 ],
548 - 'condition' => [
549 - 'drop_cap_view!' => 'default',
550 - ],
551 356 ]
552 357 );
553 358
554 359 $this->add_control(
555 360 'drop_cap_border_width', [
556 - 'label' => esc_html__( 'Border Width', 'elementor' ),
361 + 'label' => __( 'Border Width', 'elementor' ),
557 362 'type' => Controls_Manager::DIMENSIONS,
558 - 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ],
559 363 'selectors' => [
560 364 '{{WRAPPER}} .elementor-drop-cap' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
561 365 ],
562 366 'condition' => [
@@ -587,32 +391,17 @@
587 391 * @since 1.0.0
588 392 * @access protected
589 393 */
590 394 protected function render() {
591 - $should_render_inline_editing = Plugin::$instance->editor->is_edit_mode();
395 + $editor_content = $this->get_settings_for_display( 'editor' );
592 396
593 - $editor_content = $this->get_settings_for_display( 'editor' );
594 397 $editor_content = $this->parse_text_editor( $editor_content );
595 398
596 - if ( empty( $editor_content ) ) {
597 - return;
598 - }
399 + $this->add_render_attribute( 'editor', 'class', [ 'elementor-text-editor', 'elementor-clearfix' ] );
599 400
600 - if ( $should_render_inline_editing ) {
601 - $this->add_render_attribute( 'editor', 'class', [ 'elementor-text-editor', 'elementor-clearfix' ] );
602 - }
603 -
604 401 $this->add_inline_editing_attributes( 'editor', 'advanced' );
605 402 ?>
606 - <?php if ( $should_render_inline_editing ) { ?>
607 - <div <?php $this->print_render_attribute_string( 'editor' ); ?>>
608 - <?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 - ?>
612 - <?php if ( $should_render_inline_editing ) { ?>
613 - </div>
614 - <?php } ?>
403 + <div <?php echo $this->get_render_attribute_string( 'editor' ); ?>><?php echo $editor_content; ?></div>
615 404 <?php
616 405 }
617 406
618 407 /**
@@ -624,9 +413,9 @@
624 413 * @access public
625 414 */
626 415 public function render_plain_content() {
627 416 // In plain mode, render without shortcode
628 - $this->print_unescaped_setting( 'editor' );
417 + echo $this->get_settings( 'editor' );
629 418 }
630 419
631 420 /**
632 421 * Render text editor widget output in the editor.
@@ -635,42 +424,15 @@
635 424 *
636 425 * @since 2.9.0
637 426 * @access protected
638 427 */
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 428 protected function content_template() {
651 429 ?>
652 430 <#
653 - if ( '' === settings.editor ) {
654 - return;
655 - }
431 + view.addRenderAttribute( 'editor', 'class', [ 'elementor-text-editor', 'elementor-clearfix' ] );
656 432
657 - const shouldRenderInlineEditing = elementorFrontend.isEditMode();
658 -
659 - if ( shouldRenderInlineEditing ) {
660 - view.addRenderAttribute( 'editor', 'class', [ 'elementor-text-editor', 'elementor-clearfix' ] );
661 - }
662 -
663 433 view.addInlineEditingAttributes( 'editor', 'advanced' );
664 -
665 - if ( shouldRenderInlineEditing ) { #>
666 - <div {{{ view.getRenderAttributeString( 'editor' ) }}}>
667 - <# } #>
668 -
669 - {{{ settings.editor }}}
670 -
671 - <# if ( shouldRenderInlineEditing ) { #>
672 - </div>
673 - <# } #>
434 + #>
435 + <div {{{ view.getRenderAttributeString( 'editor' ) }}}>{{{ settings.editor }}}</div>
674 436 <?php
675 437 }
676 438 }