From f9775cbe142ae778c176749fb478750e7fb33338 Mon Sep 17 00:00:00 2001 From: James Knight Date: Sat, 18 Jan 2025 11:26:21 -0500 Subject: [PATCH] disable use of inline images in v2 editor Recent changes to Confluence's v2 editor restricted inlined images to a line-height. This is undesired for a default configuration. To avoid this, v2 images will no longer be configured with an inline hint. Signed-off-by: James Knight --- sphinxcontrib/confluencebuilder/__init__.py | 2 ++ sphinxcontrib/confluencebuilder/storage/translator.py | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/sphinxcontrib/confluencebuilder/__init__.py b/sphinxcontrib/confluencebuilder/__init__.py index 0e2a2d03..b28c06f5 100644 --- a/sphinxcontrib/confluencebuilder/__init__.py +++ b/sphinxcontrib/confluencebuilder/__init__.py @@ -266,6 +266,8 @@ def setup(app): cm.add_conf_bool('confluence_adv_embedded_certs') # List of node types to ignore if no translator support exists. cm.add_conf('confluence_adv_ignore_nodes') + # Add the inline attribute for images (v2 editor) + cm.add_conf_bool('confluence_adv_inlined_images') # Unknown node handler dictionary for advanced integrations. cm.add_conf('confluence_adv_node_handler') # Permit any string value to be provided as the editor. diff --git a/sphinxcontrib/confluencebuilder/storage/translator.py b/sphinxcontrib/confluencebuilder/storage/translator.py index bc3dea7f..10970168 100644 --- a/sphinxcontrib/confluencebuilder/storage/translator.py +++ b/sphinxcontrib/confluencebuilder/storage/translator.py @@ -1855,7 +1855,11 @@ def _visit_image(self, node, opts): if alignment == 'right': attribs['ac:style'] = 'float: right;' elif self.v2: - attribs['ac:inline'] = 'true' + # ideally, images will be inlined but recent v2 editor will + # restrict sizing to the line; restrict the feature using a + # configuration option for now + if self.builder.config.confluence_adv_inlined_images: + attribs['ac:inline'] = 'true' if 'alt' in node: alt = node['alt']