Comments (7)
If I understand you correctly you are missing the #fragments
fields inside the Text Editor
/ CKeditor
links? Because outside of it via single_media_selection I would go this way via 2 fields:
<property name="document" type="single_media_selection" colspan="9">
<meta>
<title lang="en">Document</title>
</meta>
</property>
<property name="documentPage" type="number">
<meta>
<title lang="en">Page</title>
<info_text lang="en">Optional page of a selected PDF</info_text>
</meta>
<params>
<param name="step" value="1"/>
<param name="multiple_of" value="1"/>
</params>
</property>
{% set mediaUrl = sulu_get_media_url(content.document, 'inline') %}
{% if content.documentPage %}
{% set mediaUrl ~= '#' ~ content.documentPage %}
{% endif %}
<a href="{{ mediaUrl }}">Download</a>
from sulu.
Hey, thanks for your solution for single_media_selection
types. That could be helpful in other contexts.
Here I mean both a link
content-type and the links within the Text Editor
.
The link
content-type already has a enable_anchor
option, but that only applies to internal links, not external links (that do not need it) nor media links. At that point, I just want the other link types have that input field for the anchor. (I call that fragment as the anchor describes the target and not the part of the URI, which I mean here.)
Inside the Text Editor
a link to media also just has inputs for the file, a link-target-attribute and an alt-text in that case, which the link
content-type does not have.
In both cases, it would be great to have that "anchor" field from the internal link type.
from sulu.
Btw. the fact, that I cannot link to media with inline=1
from a media link within a text editor, is even more cumbersome than the missing fragments. So now, all our linked PDF files are downloaded instead of being shown in the browser. That raises the question for me: Why are those already existing fields disabled on purpose for media links in the first place? The inline-query-parameter is a core functionality of Sulu and fragments are also valid parts of an URI of media resources.
from sulu.
@spackmat you can make inline=1
the default for your installation see the documentation about inline links here: https://docs.sulu.io/en/2.5/reference/twig-extensions/functions/sulu_get_media_url.html. There is no purpose behind it I think just nobody yet had the usecase yet to modify media urls or link inside pdfs, even I was not aware that fragments exists inside pdf links.
from sulu.
That helps, indeed. Thanks.
Would a PR to enable fragments and query strings for media links be appreciated?
from sulu.
Hey, I bump that topic as that problem arises again for us. If I provide a PR enabling the anchor field for internal media links, would that stand a chance to be accepted?
from sulu.
We have some (quite large) PDF files with regulatory content and thus an official published state (as in we cannot change the requirements) where we heavily (as in hundreds of links) rely on that #page=x
URL fragment. At the moment we link to those files via the external link type, but that is a cumbersome workaround as it also works around the whole media system of Sulu. So you could make us very happy, if my little PR could be accepted.
from sulu.
Related Issues (20)
- URL Fields has fixed prefixes but no optional empty option. HOT 1
- Exceptions in ResettingController:sendEmailAction HOT 1
- Using as recipe in Symfony 7 HOT 3
- CKEditor + plugin source editing HTML is replaced HOT 1
- Authored date for shadow pages not used in smart content sorting. HOT 1
- Filtering Tags by Changer and/or Creator returns no results HOT 1
- Access to pages is granted regardless of role permissions HOT 5
- Removing a FileVersionMeta entity also removes the FileVersion HOT 5
- Debug Command for Sulu Admin Views
- doctrine/orm 2.18.0 causing exception with old file versions HOT 1
- Route generation for articles stopped working after upgrading to Sulu 2.5.12 HOT 3
- Issues with admin JS build after update to 2.5.12 HOT 4
- Webspace manager uses request context params instead of request context service
- Disablecondition not working for rows in block HOT 1
- Clearing selection in single select HOT 1
- Hide shadow articles in Sitemap + Canonical Link Tag HOT 1
- preg_split(): Argument #2 ($subject) must be of type string, null given HOT 1
- Add visibleCondition to block-setting icons
- Cannot publish Shadowpages with automation bundle
- CDN url for storage providers HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sulu.