Merge branch 'fix/re7' into 'develop'
fix: fix display images on content #96, some eslint errors, DynamicPageHelper error #92, error on image deletion wysiwyg #94 See merge request ldc-web/projets/ldc!133
This commit is contained in:
commit
ddd5849edc
7 changed files with 103 additions and 16 deletions
|
|
@ -151,7 +151,7 @@ class DynamicPageHelper
|
|||
? ''
|
||||
: data_get($newContent, $key, '');
|
||||
if ($old) {
|
||||
FileHelper::removeOldModelFilesFromHtml($new, $old);
|
||||
FileHelper::removeOldModelFilesFromHtml($new ?? '', $old);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,23 @@
|
|||
.image-border_bottom {
|
||||
top: auto;
|
||||
}
|
||||
.textblock__container_swap > .image-content-size img {
|
||||
width: 100% !important;
|
||||
height: 545px !important;
|
||||
object-fit: cover !important;
|
||||
}
|
||||
|
||||
.textblock__container_row > .image-content-size img {
|
||||
width: 100% !important;
|
||||
height: 300px !important;
|
||||
object-fit: cover !important;
|
||||
}
|
||||
|
||||
.textblock__container_side > .image-content-size img {
|
||||
width: 100% !important;
|
||||
height: 545px !important;
|
||||
object-fit: cover !important;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 1600px) {
|
||||
.wrapper {
|
||||
|
|
@ -88,6 +105,11 @@
|
|||
.textblock__container_swap .textblock__image {
|
||||
margin-left: 70px;
|
||||
}
|
||||
.textblock__container_row > .image-content-size img {
|
||||
width: 100% !important;
|
||||
height: 300px !important;
|
||||
object-fit: cover !important;
|
||||
}
|
||||
.breadcrumbs {
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
|
@ -246,10 +268,35 @@
|
|||
width: 310px;
|
||||
margin: 0px 11px 35px;
|
||||
}
|
||||
|
||||
.image-border-wrap {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin-bottom: 25px;
|
||||
}
|
||||
|
||||
.textblock__container_side > .image-content-size img {
|
||||
width: 100% !important;
|
||||
height: 425px !important;
|
||||
object-fit: cover !important;
|
||||
}
|
||||
.textblock__container_swap_left > .image-content-size img {
|
||||
width: 100% !important;
|
||||
height: 425px !important;
|
||||
object-fit: cover !important;
|
||||
}
|
||||
|
||||
.textblock__container_row > .image-content-size {
|
||||
width: 100% !important;
|
||||
max-width: 100% !important;
|
||||
}
|
||||
|
||||
.textblock__container_row > .image-content-size img {
|
||||
height: 210px !important;
|
||||
object-fit: cover !important;
|
||||
}
|
||||
|
||||
|
||||
.values {
|
||||
padding-bottom: 55px;
|
||||
}
|
||||
|
|
@ -918,7 +965,7 @@
|
|||
font-size: 34px;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
|
||||
.engagements__wrapper {
|
||||
text-align: center;
|
||||
}
|
||||
|
|
@ -979,8 +1026,30 @@
|
|||
border: 1px solid #a0a0a0;
|
||||
}
|
||||
.image-border-wrap {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.textblock__container_swap > .image-content-size img {
|
||||
width: 100% !important;
|
||||
height: auto !important;
|
||||
object-fit: cover !important;
|
||||
}
|
||||
.textblock__container_side > .image-content-size img {
|
||||
width: 100% !important;
|
||||
height: auto !important;
|
||||
object-fit: cover !important;
|
||||
}
|
||||
.textblock__container_row > .image-content-size {
|
||||
width: 100% !important;
|
||||
max-width: 100% !important;
|
||||
height: 210px !important;
|
||||
}
|
||||
|
||||
.image-content-size img {
|
||||
height: 100% !important;
|
||||
object-fit: cover !important;
|
||||
}
|
||||
.list-item__title {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,13 @@ import ImageNodeView, {
|
|||
} from "@/back/Components/Inputs/Wysiwyg/Extensions/Image/ImageNodeView";
|
||||
import { imageDetails } from "@/back/Components/Inputs/Wysiwyg/Extensions/Image/ImageUtils";
|
||||
|
||||
interface AttrsType {
|
||||
src: string;
|
||||
caption?: string;
|
||||
float?: string;
|
||||
style?: string;
|
||||
}
|
||||
|
||||
const Image = TiptapImage.extend({
|
||||
// Define attributes we need.
|
||||
addAttributes() {
|
||||
|
|
@ -18,9 +25,9 @@ const Image = TiptapImage.extend({
|
|||
alt: null,
|
||||
caption: null,
|
||||
style: null,
|
||||
float: null,
|
||||
};
|
||||
},
|
||||
|
||||
// Rules for each tag.
|
||||
// Set all attributes if matching on simple image or figure structure.
|
||||
// Use for render html in @tiptap editor.
|
||||
|
|
@ -34,7 +41,6 @@ const Image = TiptapImage.extend({
|
|||
"img",
|
||||
) as HTMLImageElement;
|
||||
const figcaption = element.querySelector("figcaption");
|
||||
|
||||
return {
|
||||
src: img.src,
|
||||
alt: img.getAttribute("alt"),
|
||||
|
|
@ -60,7 +66,10 @@ const Image = TiptapImage.extend({
|
|||
// Define the structure of the render.
|
||||
// Use for render html in front files.
|
||||
renderHTML({ node, HTMLAttributes }) {
|
||||
const attrsCopy = { ...HTMLAttributes };
|
||||
const attrsCopy: AttrsType = {
|
||||
...HTMLAttributes,
|
||||
src: HTMLAttributes.src.replace(/^https?:\/\/[^/]+/, ""),
|
||||
};
|
||||
|
||||
delete attrsCopy.caption;
|
||||
delete attrsCopy.float;
|
||||
|
|
|
|||
|
|
@ -40,6 +40,8 @@ import useTrans from "@/hooks/use-translations";
|
|||
import str from "@/hooks/use-string";
|
||||
import { cn, GetTranslation } from "@/lib/utils";
|
||||
import { parseStyleString } from "@/hooks/use-inline-style";
|
||||
import { AppEnv } from "@/back/types/global";
|
||||
import { usePage } from "@inertiajs/react";
|
||||
|
||||
export type AllowedAligns = "left" | "center" | "right";
|
||||
|
||||
|
|
@ -91,8 +93,8 @@ type ImageAttrs = {
|
|||
|
||||
export default function ImageNodeView(props: NodeViewProps) {
|
||||
const { node, updateAttributes, editor, selected } = props;
|
||||
const { url } = usePage().props.appEnv as AppEnv;
|
||||
const attrs = node.attrs as ImageAttrs;
|
||||
|
||||
const imgRef = useRef<HTMLImageElement>(null);
|
||||
const resizeState = useRef<{
|
||||
startX: number;
|
||||
|
|
@ -419,7 +421,7 @@ export default function ImageNodeView(props: NodeViewProps) {
|
|||
)}
|
||||
<img
|
||||
ref={imgRef}
|
||||
src={attrs.src}
|
||||
src={attrs.src.replace(url, "")}
|
||||
alt={attrs.alt}
|
||||
width={attrs.width}
|
||||
height={attrs.height}
|
||||
|
|
|
|||
|
|
@ -102,7 +102,9 @@ export default function DataTable<TData, TValue>({
|
|||
<ModelActions
|
||||
actions={actions}
|
||||
modelRoute={modelRoute}
|
||||
model={row.original as DefaultModel}
|
||||
model={
|
||||
row.original as DefaultModel
|
||||
}
|
||||
inDialog
|
||||
/>
|
||||
</TableCell>
|
||||
|
|
|
|||
|
|
@ -197,9 +197,13 @@ export default function Form({
|
|||
choice: 1,
|
||||
})}
|
||||
pathField={data.slug}
|
||||
additionalGroupPath={useTrans("models.classes.news", {
|
||||
choice: 1,
|
||||
})}
|
||||
additionalGroupPath={str(
|
||||
useTrans(`models.classes.${modelName}`, {
|
||||
choice: 2,
|
||||
}),
|
||||
)
|
||||
.slug()
|
||||
.value()}
|
||||
isAvailable={
|
||||
model?.status === enumNewsStatus.published.value
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,9 +12,7 @@
|
|||
])>
|
||||
<div class="textblock__wrapper wrapper">
|
||||
@if (!empty($textBlock['title']) || !empty($textBlock['subtitle']['text']))
|
||||
<x-front.sections.title :title="isset($textBlock['title']) ? $textBlock['title'] : ''"
|
||||
:subtitle="isset($textBlock['subtitle']['text']) ? $textBlock['subtitle']['text'] : ''"
|
||||
/>
|
||||
<x-front.sections.title :title="isset($textBlock['title']) ? $textBlock['title'] : ''" :subtitle="isset($textBlock['subtitle']['text']) ? $textBlock['subtitle']['text'] : ''" />
|
||||
@endif
|
||||
@if (!empty($textBlock['description']) || !empty($textBlock['description']['text']))
|
||||
<div class="textblock__container">
|
||||
|
|
@ -43,9 +41,12 @@
|
|||
'textblock__container_row' => $l['in_row'] == 1,
|
||||
'textblock__container_floated' => $l['floated'] == 1,
|
||||
'textblock__container_ac' => $l['align_center'] == 1,
|
||||
'textblock__container_side' =>
|
||||
$l['swap_position'] != 1 &&
|
||||
$l['in_row'] != 1
|
||||
])>
|
||||
@if (!empty($l['image']) || !empty($l['video']))
|
||||
<div class="textblock__image textblock__block">
|
||||
<div class="textblock__image textblock__block image-content-size">
|
||||
@if (!empty($l['video']))
|
||||
<x-front.sections.video :video="[
|
||||
'type_video' => $l['video']['type_video'],
|
||||
|
|
@ -54,7 +55,7 @@
|
|||
@endif
|
||||
@if (!empty($l['image']))
|
||||
@foreach ($l['image'] as $i)
|
||||
<div class="image-border-wrap">
|
||||
<div class="image-border-wrap ">
|
||||
@php
|
||||
$borders['desktop'] = $l['borders_desktop'];
|
||||
$borders['mobile'] = $l['borders_mobile'];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue