← All changes
|
modules/atomic-widgets/elements/atomic-paragraph/atomic-paragraph.php
+9
-31
4.3.0-beta3
→
4.0.0-dev3
View file →
| @@ -6,12 +6,11 @@ | ||
| 6 | 6 | use Elementor\Modules\AtomicWidgets\Controls\Section; |
| 7 | 7 | use Elementor\Modules\AtomicWidgets\Controls\Types\Link_Control; |
| 8 | 8 | use Elementor\Modules\AtomicWidgets\Controls\Types\Select_Control; |
| 9 | 9 | use Elementor\Modules\AtomicWidgets\Elements\Base\Has_Template; |
| 10 | -use Elementor\Modules\AtomicWidgets\Elements\Base\Html_Tag_Computer; | |
| 11 | 10 | use Elementor\Modules\AtomicWidgets\PropTypes\Classes_Prop_Type; |
| 12 | 11 | use Elementor\Modules\AtomicWidgets\PropTypes\Attributes_Prop_Type; |
| 13 | -use Elementor\Modules\AtomicWidgets\PropTypes\Escaped_Html_Prop_Type; | |
| 12 | +use Elementor\Modules\AtomicWidgets\PropTypes\Html_V3_Prop_Type; | |
| 14 | 13 | use Elementor\Modules\AtomicWidgets\PropTypes\Link_Prop_Type; |
| 15 | 14 | use Elementor\Modules\AtomicWidgets\PropTypes\Primitives\String_Prop_Type; |
| 16 | 15 | use Elementor\Modules\AtomicWidgets\PropTypes\Size_Prop_Type; |
| 17 | 16 | use Elementor\Modules\AtomicWidgets\Styles\Style_Definition; |
| @@ -39,9 +38,9 @@ | ||
| 39 | 38 | return esc_html__( 'Paragraph', 'elementor' ); |
| 40 | 39 | } |
| 41 | 40 | |
| 42 | 41 | public function get_keywords() { |
| 43 | - return [ 'ato', 'atom', 'atoms', 'atomic', 'paragraph', 'text', 'content' ]; | |
| 42 | + return [ 'ato', 'atom', 'atoms', 'atomic' ]; | |
| 44 | 43 | } |
| 45 | 44 | |
| 46 | 45 | public function get_icon() { |
| 47 | 46 | return 'eicon-paragraph'; |
| @@ -46,32 +45,23 @@ | ||
| 46 | 45 | public function get_icon() { |
| 47 | 46 | return 'eicon-paragraph'; |
| 48 | 47 | } |
| 49 | 48 | |
| 50 | - public static function html_tag_follows_link(): bool { | |
| 51 | - return false; | |
| 52 | - } | |
| 53 | - | |
| 54 | - public static function get_computed_html_tag( array $settings ): string { | |
| 55 | - return Html_Tag_Computer::compute( $settings, 'p', [ | |
| 56 | - Html_Tag_Computer::FOLLOW_LINK_OPTION => static::html_tag_follows_link(), | |
| 57 | - ] ); | |
| 58 | - } | |
| 59 | - | |
| 60 | 49 | protected static function define_props_schema(): array { |
| 61 | 50 | return [ |
| 62 | 51 | 'classes' => Classes_Prop_Type::make() |
| 63 | 52 | ->default( [] ), |
| 64 | 53 | |
| 65 | - 'paragraph' => Escaped_Html_Prop_Type::make() | |
| 66 | - ->default( __( 'Type your paragraph here', 'elementor' ) ) | |
| 67 | - ->description( 'The text content of the paragraph.' ) | |
| 68 | - ->alias( 'text', 'content' ), | |
| 54 | + 'paragraph' => Html_V3_Prop_Type::make() | |
| 55 | + ->default( [ | |
| 56 | + 'content' => String_Prop_Type::generate( __( 'Type your paragraph here', 'elementor' ) ), | |
| 57 | + 'children' => [], | |
| 58 | + ] ) | |
| 59 | + ->description( 'The text content of the paragraph.' ), | |
| 69 | 60 | |
| 70 | 61 | 'tag' => String_Prop_Type::make() |
| 71 | 62 | ->enum( [ 'p', 'span' ] ) |
| 72 | - ->default( 'p' ) | |
| 73 | - ->description( 'The HTML tag for the paragraph element. One of: p or span. Do not use heading or div tags.' ), | |
| 63 | + ->default( 'p' ), | |
| 74 | 64 | |
| 75 | 65 | 'link' => Link_Prop_Type::make(), |
| 76 | 66 | |
| 77 | 67 | 'attributes' => Attributes_Prop_Type::make()->meta( Overridable_Prop_Type::ignore() ), |
| @@ -81,9 +71,8 @@ | ||
| 81 | 71 | protected function define_atomic_controls(): array { |
| 82 | 72 | return [ |
| 83 | 73 | Section::make() |
| 84 | 74 | ->set_label( __( 'Content', 'elementor' ) ) |
| 85 | - ->set_id( 'content' ) | |
| 86 | 75 | ->set_items( [ |
| 87 | 76 | Inline_Editing_Control::bind_to( 'paragraph' ) |
| 88 | 77 | ->set_placeholder( __( 'Type your paragraph here', 'elementor' ) ) |
| 89 | 78 | ->set_label( __( 'Paragraph', 'elementor' ) ), |
| @@ -145,17 +134,6 @@ | ||
| 145 | 134 | protected function get_templates(): array { |
| 146 | 135 | return [ |
| 147 | 136 | 'elementor/elements/atomic-paragraph' => __DIR__ . '/atomic-paragraph.html.twig', |
| 148 | 137 | ]; |
| 149 | - } | |
| 150 | - | |
| 151 | - public function render_markdown(): string { | |
| 152 | - $settings = $this->get_atomic_settings(); | |
| 153 | - $content = $settings['paragraph'] ?? ''; | |
| 154 | - | |
| 155 | - if ( empty( $content ) ) { | |
| 156 | - return ''; | |
| 157 | - } | |
| 158 | - | |
| 159 | - return \Elementor\Modules\MarkdownRender\Html_To_Markdown::convert( $content ); | |
| 160 | 138 | } |
| 161 | 139 | } |