U
    {®Þh;  ã                   @   sH   d Z ddlmZ ddlmZ ddlmZ G dd„ dƒZe de¡gZ	dS )	z4
editor-html conversion for contenteditable editors
é    )Úeditor_html)Úformat)ÚEmbedExceptionc                   @   s(   e Zd ZdZedd„ ƒZedd„ ƒZdS )ÚMediaEmbedHandlera
  
    MediaEmbedHandler will be invoked whenever we encounter an element in HTML content
    with an attribute of data-embedtype="media". The resulting element in the database
    representation will be:
    <embed embedtype="media" url="http://vimeo.com/XXXXX">
    c                 C   s   d| d iS )zÚ
        Given a tag that we've identified as a media embed (because it has a
        data-embedtype="media" attribute), return a dict of the attributes we should
        have on the resulting <embed> element.
        Úurlzdata-url© )Útagr   r   úl/var/www/dating/data/www/fatepal.com/env/lib/python3.8/site-packages/wagtail/embeds/rich_text/editor_html.pyÚget_db_attributes   s     ÿz#MediaEmbedHandler.get_db_attributesc                 C   s,   zt  | d ¡W S  tk
r&   Y dS X dS )z‰
        Given a dict of attributes from the <embed> tag, return the real HTML
        representation for use within the editor.
        r   Ú N)r   Zembed_to_editor_htmlr   )Úattrsr   r   r	   Úexpand_db_attributes   s    z&MediaEmbedHandler.expand_db_attributesN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ústaticmethodr
   r   r   r   r   r	   r   	   s
   

r   ZmediaN)
r   Z"wagtail.admin.rich_text.convertersr   Zwagtail.embedsr   Zwagtail.embeds.exceptionsr   r   ZEmbedTypeRuleZEditorHTMLEmbedConversionRuler   r   r   r	   Ú<module>   s
    