Skip to content

Commit 8ff1df0

Browse files
authored
Merge pull request #6035 from WoltLab/fancybox
New image viewer
2 parents 1209e1c + 4b4d266 commit 8ff1df0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+258
-1893
lines changed

.github/workflows/javascript.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,6 @@ jobs:
6868
- name: "Check '@ckeditor/ckeditor5-inspector'"
6969
run: |
7070
diff -wu wcfsetup/install/files/js/3rdParty/ckeditor/ckeditor5-inspector/inspector.js node_modules/@ckeditor/ckeditor5-inspector/build/inspector.js
71+
- name: "Check '@fancyapps/ui'"
72+
run: |
73+
diff -wu wcfsetup/install/files/js/3rdParty/fancybox/fancybox.umd.js node_modules/@fancyapps/ui/dist/fancybox/fancybox.umd.js

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
WoltLab Suite Core is a free CMS and web-framework, designed for awesome websites and communities.
44
Cutting-edge technologies and strict object-oriented programming makes it the ideal choice for developers and communities, and is actively maintained and improved by WoltLab.
55

6-
# About CKEditor 5
6+
## About CKEditor 5
77

88
CKEditor 5 is a WYISWYG editor created by CKSource Holding sp. z o.o, Copyright (c) 2003-2023.
99

@@ -12,6 +12,15 @@ You may use this instance of CKEditor 5 with any plugin or app built on top of W
1212

1313
If you would like to use CKEditor 5 yourself and are not building on top of WoltLab Suite Core then please visit https://ckeditor.com/pricing/ to learn more.
1414

15+
## About Fancybox
16+
17+
Fancybox is a lightbox alternative created by Jānis Skarnelis.
18+
19+
This repository includes a build artifact of Fancybox that is comerically licensed to WoltLab GmbH.
20+
You may use this instance of Fancybox with any plugin or app built on top of WoltLab Suite Core only.
21+
22+
If you would like to use Fancybox yourself and are not building on top of WoltLab Suite Core then please visit https://fancyapps.com/pricing/ to learn more.
23+
1524
## License
1625

1726
This library is free software; you can redistribute it and/or

com.woltlab.wcf/acpTemplateDelete.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,5 +154,6 @@
154154
<template>__audioAttachmentBBCode</template>
155155
<template>__multiPageCondition</template>
156156
<template>__multilineItemListFormField</template>
157+
<template>imageViewer</template>
157158
</delete>
158159
</data>

com.woltlab.wcf/fileDelete.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1291,6 +1291,7 @@
12911291
<file>js/WCF.Comment.min.js</file>
12921292
<file>js/WCF.Core.min.js</file>
12931293
<file>js/WCF.ImageViewer.min.js</file>
1294+
<file>js/WCF.ImageViewer.js</file>
12941295
<file>js/WCF.Label.min.js</file>
12951296
<file>js/WCF.Like.js</file>
12961297
<file>js/WCF.Like.min.js</file>

com.woltlab.wcf/templateDelete.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,5 +116,6 @@
116116
<template>__multiPageCondition</template>
117117
<template>__multilineItemListFormField</template>
118118
<template>email_notification_userRegistration</template>
119+
<template>imageViewer</template>
119120
</delete>
120121
</data>

com.woltlab.wcf/templates/attachments.tpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
{content}
88
{foreach from=$attachmentList->getGroupedObjects($objectID) item=attachment}
99
{if $attachment->showAsImage() && !$attachment->isEmbedded()}
10-
<li class="attachmentThumbnail" data-attachment-id="{@$attachment->attachmentID}">
11-
<a href="{$attachment->getLink()}"{if $attachment->canDownload()} class="jsImageViewer jsTooltip" title="{lang}wcf.attachment.image.title{/lang}"{/if}>
10+
<li class="attachmentThumbnail" data-attachment-id="{$attachment->attachmentID}">
11+
<a href="{$attachment->getLink()}"{if $attachment->canDownload()} data-fancybox="message-{$attachmentList->getObjectTypeName()}-{$objectID}" data-caption="{$attachment->filename}" aria-title="{lang}wcf.attachment.image.title{/lang}"{/if}>
1212
<div class="attachmentThumbnailContainer">
1313
<span class="attachmentThumbnailImage">
1414
{if $attachment->hasThumbnail()}
@@ -44,7 +44,7 @@
4444
<ul class="attachmentMetaData inlineList">
4545
<li>
4646
{icon name='file-lines'}
47-
{@$attachment->filesize|filesize}
47+
{$attachment->filesize|filesize}
4848
</li>
4949
<li>
5050
{icon name='up-right-and-down-left-from-center'}

com.woltlab.wcf/templates/headIncludeJavaScript.tpl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ window.addEventListener('pageshow', function(event) {
138138
</script>
139139

140140
{js application='wcf' file='WCF.ColorPicker' bundle='WCF.Combined' hasTiny=true}
141-
{js application='wcf' file='WCF.ImageViewer' bundle='WCF.Combined' hasTiny=true}
142141
{js application='wcf' file='WCF.Label' bundle='WCF.Combined' hasTiny=true}
143142
{js application='wcf' file='WCF.Location' bundle='WCF.Combined' hasTiny=true}
144143
{js application='wcf' file='WCF.Message' bundle='WCF.Combined' hasTiny=true}
@@ -181,5 +180,5 @@ window.addEventListener('pageshow', function(event) {
181180
});
182181
</script>
183182

184-
{include file='imageViewer'}
183+
{include file='shared_imageViewer'}
185184
{include file='headIncludeJsonLd'}

com.woltlab.wcf/templates/imageViewer.tpl

Lines changed: 0 additions & 21 deletions
This file was deleted.

com.woltlab.wcf/templates/shared_bbcode_wsm.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
{if $media->isImage}
55
{if $thumbnailSize != 'original'}
66
{if !$removeLinks}
7-
<a href="{$mediaLink}" class="embeddedAttachmentLink jsImageViewer">
7+
<a href="{$mediaLink}" data-caption="{$media->title}" class="embeddedAttachmentLink" data-fancybox="message-{$activeMessageObjectType}-{$activeMessageID}">
88
{/if}
99
<img src="{$thumbnailLink}" alt="{$media->altText}" title="{$media->title}" width="{@$media->getThumbnailWidth($thumbnailSize)}" height="{@$media->getThumbnailHeight($thumbnailSize)}" loading="lazy">
1010
{if !$removeLinks}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{if !$__imageViewerLoaded|isset}
2+
<script data-eager="true">
3+
{
4+
let stylesheet = document.getElementById("fancybox-stylesheet");
5+
if (stylesheet === null) {
6+
stylesheet = document.createElement("link");
7+
stylesheet.rel = "stylesheet";
8+
stylesheet.type = "text/css";
9+
stylesheet.href = "{$__wcf->getPath()}style/fancybox.css";
10+
stylesheet.id = "fancybox-stylesheet";
11+
12+
document.querySelector('link[rel="stylesheet"]').before(stylesheet);
13+
}
14+
}
15+
</script>
16+
17+
{assign var=__imageViewerLoaded value=true}
18+
{/if}

0 commit comments

Comments
 (0)