| @@ -89,19 +89,17 @@ | ||
| 89 | 89 | public function get_keywords() { |
| 90 | 90 | return [ 'text', 'editor' ]; |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | + protected function is_dynamic_content(): bool { | |
| 94 | + return false; | |
| 95 | + } | |
| 96 | + | |
| 93 | 97 | /** |
| 94 | 98 | * Get style dependencies. |
| 95 | 99 | * |
| 96 | 100 | * Retrieve the list of style dependencies the widget requires. |
| 97 | 101 | * |
| 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 | 102 | * @since 3.24.0 |
| 105 | 103 | * @access public |
| 106 | 104 | * |
| 107 | 105 | * @return array Widget style dependencies. |
| @@ -106,13 +104,9 @@ | ||
| 106 | 104 | * |
| 107 | 105 | * @return array Widget style dependencies. |
| 108 | 106 | */ |
| 109 | 107 | 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; | |
| 108 | + return [ 'widget-text-editor' ]; | |
| 115 | 109 | } |
| 116 | 110 | |
| 117 | 111 | public function has_widget_inner_wrapper(): bool { |
| 118 | 112 | return ! Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' ); |
| @@ -150,25 +144,8 @@ | ||
| 150 | 144 | 'label_off' => esc_html__( 'Off', 'elementor' ), |
| 151 | 145 | 'label_on' => esc_html__( 'On', 'elementor' ), |
| 152 | 146 | 'prefix_class' => 'elementor-drop-cap-', |
| 153 | 147 | '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 | 148 | ] |
| 172 | 149 | ); |
| 173 | 150 | |
| 174 | 151 | $this->add_responsive_control( |
| @@ -257,10 +234,10 @@ | ||
| 257 | 234 | [ |
| 258 | 235 | 'label' => esc_html__( 'Alignment', 'elementor' ), |
| 259 | 236 | 'type' => Controls_Manager::CHOOSE, |
| 260 | 237 | 'options' => [ |
| 261 | - 'start' => [ | |
| 262 | - 'title' => esc_html__( 'Start', 'elementor' ), | |
| 238 | + 'left' => [ | |
| 239 | + 'title' => esc_html__( 'Left', 'elementor' ), | |
| 263 | 240 | 'icon' => 'eicon-text-align-left', |
| 264 | 241 | ], |
| 265 | 242 | 'center' => [ |
| 266 | 243 | 'title' => esc_html__( 'Center', 'elementor' ), |
| @@ -265,10 +242,10 @@ | ||
| 265 | 242 | 'center' => [ |
| 266 | 243 | 'title' => esc_html__( 'Center', 'elementor' ), |
| 267 | 244 | 'icon' => 'eicon-text-align-center', |
| 268 | 245 | ], |
| 269 | - 'end' => [ | |
| 270 | - 'title' => esc_html__( 'End', 'elementor' ), | |
| 246 | + 'right' => [ | |
| 247 | + 'title' => esc_html__( 'Right', 'elementor' ), | |
| 271 | 248 | 'icon' => 'eicon-text-align-right', |
| 272 | 249 | ], |
| 273 | 250 | 'justify' => [ |
| 274 | 251 | 'title' => esc_html__( 'Justified', 'elementor' ), |
| @@ -274,17 +251,26 @@ | ||
| 274 | 251 | 'title' => esc_html__( 'Justified', 'elementor' ), |
| 275 | 252 | 'icon' => 'eicon-text-align-justify', |
| 276 | 253 | ], |
| 277 | 254 | ], |
| 278 | - 'classes' => 'elementor-control-start-end', | |
| 279 | - 'selectors_dictionary' => [ | |
| 280 | - 'left' => is_rtl() ? 'end' : 'start', | |
| 281 | - 'right' => is_rtl() ? 'start' : 'end', | |
| 255 | + 'selectors' => [ | |
| 256 | + '{{WRAPPER}}' => 'text-align: {{VALUE}};', | |
| 282 | 257 | ], |
| 258 | + ] | |
| 259 | + ); | |
| 260 | + | |
| 261 | + $this->add_control( | |
| 262 | + 'text_color', | |
| 263 | + [ | |
| 264 | + 'label' => esc_html__( 'Text Color', 'elementor' ), | |
| 265 | + 'type' => Controls_Manager::COLOR, | |
| 266 | + 'default' => '', | |
| 283 | 267 | 'selectors' => [ |
| 284 | - '{{WRAPPER}}' => 'text-align: {{VALUE}};', | |
| 268 | + '{{WRAPPER}}' => 'color: {{VALUE}};', | |
| 285 | 269 | ], |
| 286 | - 'separator' => 'after', | |
| 270 | + 'global' => [ | |
| 271 | + 'default' => Global_Colors::COLOR_TEXT, | |
| 272 | + ], | |
| 287 | 273 | ] |
| 288 | 274 | ); |
| 289 | 275 | |
| 290 | 276 | $this->add_group_control( |
| @@ -320,94 +306,13 @@ | ||
| 320 | 306 | 'max' => 20, |
| 321 | 307 | ], |
| 322 | 308 | ], |
| 323 | 309 | 'selectors' => [ |
| 324 | - '{{WRAPPER}} p' => 'margin-block-end: {{SIZE}}{{UNIT}}', | |
| 310 | + '{{WRAPPER}} p' => 'margin-bottom: {{SIZE}}{{UNIT}}', | |
| 325 | 311 | ], |
| 326 | 312 | ] |
| 327 | 313 | ); |
| 328 | 314 | |
| 329 | - $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 | - 'text_color', | |
| 347 | - [ | |
| 348 | - 'label' => esc_html__( 'Text Color', 'elementor' ), | |
| 349 | - 'type' => Controls_Manager::COLOR, | |
| 350 | - 'default' => '', | |
| 351 | - 'selectors' => [ | |
| 352 | - '{{WRAPPER}}' => 'color: {{VALUE}};', | |
| 353 | - ], | |
| 354 | - 'global' => [ | |
| 355 | - 'default' => Global_Colors::COLOR_TEXT, | |
| 356 | - ], | |
| 357 | - ] | |
| 358 | - ); | |
| 359 | - | |
| 360 | - $this->add_control( | |
| 361 | - 'link_color', | |
| 362 | - [ | |
| 363 | - 'label' => esc_html__( 'Link Color', 'elementor' ), | |
| 364 | - 'type' => Controls_Manager::COLOR, | |
| 365 | - 'selectors' => [ | |
| 366 | - '{{WRAPPER}} a' => 'color: {{VALUE}};', | |
| 367 | - ], | |
| 368 | - ] | |
| 369 | - ); | |
| 370 | - | |
| 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 | 315 | $this->end_controls_section(); |
| 411 | 316 | |
| 412 | 317 | $this->start_controls_section( |
| 413 | 318 | 'section_drop_cap', |
| @@ -522,9 +427,10 @@ | ||
| 522 | 427 | 'max' => 5, |
| 523 | 428 | ], |
| 524 | 429 | ], |
| 525 | 430 | 'selectors' => [ |
| 526 | - '{{WRAPPER}} .elementor-drop-cap' => 'margin-inline-end: {{SIZE}}{{UNIT}};', | |
| 431 | + 'body:not(.rtl) {{WRAPPER}} .elementor-drop-cap' => 'margin-right: {{SIZE}}{{UNIT}};', | |
| 432 | + 'body.rtl {{WRAPPER}} .elementor-drop-cap' => 'margin-left: {{SIZE}}{{UNIT}};', | |
| 527 | 433 | ], |
| 528 | 434 | ] |
| 529 | 435 | ); |
| 530 | 436 | |
| @@ -605,11 +511,10 @@ | ||
| 605 | 511 | ?> |
| 606 | 512 | <?php if ( $should_render_inline_editing ) { ?> |
| 607 | 513 | <div <?php $this->print_render_attribute_string( 'editor' ); ?>> |
| 608 | 514 | <?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 | - ?> | |
| 515 | + <?php // PHPCS - the main text of a widget should not be escaped. | |
| 516 | + echo $editor_content; // phpcs:ignore WordPress.Security.EscapeOutput ?> | |
| 612 | 517 | <?php if ( $should_render_inline_editing ) { ?> |
| 613 | 518 | </div> |
| 614 | 519 | <?php } ?> |
| 615 | 520 | <?php |
| @@ -635,19 +540,8 @@ | ||
| 635 | 540 | * |
| 636 | 541 | * @since 2.9.0 |
| 637 | 542 | * @access protected |
| 638 | 543 | */ |
| 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 | 544 | protected function content_template() { |
| 651 | 545 | ?> |
| 652 | 546 | <# |
| 653 | 547 | if ( '' === settings.editor ) { |