Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The MiniPaint integration #817

Merged
merged 31 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
ea978d3
Prepare minipaint controllers
markus-moser Dec 10, 2024
8409657
Apply php-cs-fixer changes
markus-moser Dec 10, 2024
a0843a7
Automatic frontend build
markus-moser Dec 10, 2024
0bbe74b
Prepare minipaint twig template
markus-moser Dec 10, 2024
b5d9dfd
Merge remote-tracking branch 'origin/minipaint' into minipaint
markus-moser Dec 10, 2024
340474b
Automatic frontend build
markus-moser Dec 10, 2024
45c1faa
resolved conflicts
ValeriaMaltseva Dec 10, 2024
2661336
updated the MiniPaint service
ValeriaMaltseva Dec 10, 2024
a03ae61
Automatic frontend build
ValeriaMaltseva Dec 11, 2024
d7a55b1
merged changes from the main branch
ValeriaMaltseva Dec 17, 2024
dfad5ba
added the Minipaint bundle to the public dir
ValeriaMaltseva Dec 17, 2024
b935b23
added note regarding the translation investigation
ValeriaMaltseva Dec 18, 2024
a2ad250
updated the get-asset endpoint usage
ValeriaMaltseva Jan 3, 2025
4df58e2
merged changes from the main branch
ValeriaMaltseva Jan 8, 2025
61e484f
merged changes from the main branch
ValeriaMaltseva Jan 8, 2025
8d1678c
merged changes from the parent branch
ValeriaMaltseva Jan 8, 2025
a3484c9
implemented the save functionality
ValeriaMaltseva Jan 8, 2025
ceeeb75
added the title tag into the template
ValeriaMaltseva Jan 8, 2025
0844b78
reverted changes
ValeriaMaltseva Jan 8, 2025
30eb987
updated styles
ValeriaMaltseva Jan 8, 2025
bd75e9e
deleted unused code
ValeriaMaltseva Jan 8, 2025
aa4a7ee
updated the endpoint for converting the image into the png format
ValeriaMaltseva Jan 9, 2025
77ca655
added the getTranslation method to fetch the translations
ValeriaMaltseva Jan 10, 2025
799f10b
moved the MiniPaint component to the lib dir
ValeriaMaltseva Jan 10, 2025
8e1710e
Apply php-cs-fixer changes
ValeriaMaltseva Jan 10, 2025
7bdf3a0
Automatic frontend build
ValeriaMaltseva Jan 10, 2025
f7ac5f1
refactoring
ValeriaMaltseva Jan 10, 2025
ef45dae
added the alt to the img
ValeriaMaltseva Jan 10, 2025
fcdd074
added the alt to the img
ValeriaMaltseva Jan 10, 2025
6776111
update the translation request body by getting it by key
ValeriaMaltseva Jan 14, 2025
e9d6659
Automatic frontend build
ValeriaMaltseva Jan 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions assets/js/src/core/lib/mini-paint/mini-paint.styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* Pimcore
*
* This source file is available under two different licenses:
* - Pimcore Open Core License (POCL)
* - Pimcore Commercial License (PCL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org)
* @license https://github.com/pimcore/studio-ui-bundle/blob/1.x/LICENSE.md POCL and PCL
*/

import { createStyles } from 'antd-style'

interface StylesProps {
isLoaded: boolean
}

export const useStyle = createStyles(({ css }, props: StylesProps) => {
return {
imageIframeContainer: css`
width: 100%;
height: 100%;
`,

imageIframe: css`
width: 100%;
height: 100%;
display: ${props.isLoaded ? 'block' : 'none'};
`
}
})
50 changes: 50 additions & 0 deletions assets/js/src/core/lib/mini-paint/mini-paint.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/**
* Pimcore
*
* This source file is available under two different licenses:
* - Pimcore Open Core License (POCL)
* - Pimcore Commercial License (PCL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org)
* @license https://github.com/pimcore/studio-ui-bundle/blob/1.x/LICENSE.md POCL and PCL
*/

import React, { useState } from 'react'
import { useElementContext } from '@Pimcore/modules/element/hooks/use-element-context'
import { Spin } from '@Pimcore/components/spin/spin'
import { Flex } from '@Pimcore/components/flex/flex'
import { useStyle } from './mini-paint.styles'

export const MiniPaint = (): React.JSX.Element => {
const { id } = useElementContext()

const [isLoaded, setIsLoaded] = useState(false)
const { styles } = useStyle({ isLoaded })

const iframeSrc = `/pimcore-studio/api/image-editor?id=${id}`

const handleIframeLoad = (): void => { setIsLoaded(true) }

return (
<Flex
align="center"
className={ styles.imageIframeContainer }
justify="center"
>
{!isLoaded && (
<Spin
asContainer
tip='Loading'
/>
)}
<iframe
className={ styles.imageIframe }
onLoad={ handleIframeLoad }
src={ iframeSrc }
title="Image Editor"
/>
</Flex>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,14 @@
* @license https://github.com/pimcore/studio-ui-bundle/blob/1.x/LICENSE.md POCL and PCL
*/

import { Content } from '@Pimcore/components/content/content'
import { Header } from '@Pimcore/components/header/header'
import React from 'react'
import { Content } from '@Pimcore/components/content/content'
import { MiniPaint } from '@Pimcore/lib/mini-paint/mini-paint'

export const EditTabContainer = (): React.JSX.Element => {
return (
<Content padded>
<Header
title={ 'Edit' }
/>
<Content>
<MiniPaint />
</Content>

)
}
3 changes: 1 addition & 2 deletions assets/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
"outDir": "./dist/build/types",
"composite": true
},

"include": [
"./js/**/*"
],
]
}
7 changes: 6 additions & 1 deletion config/pimcore/routing.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
pimcore_studio_ui:
resource: "@PimcoreStudioUiBundle/src/Controller/"
resource: "@PimcoreStudioUiBundle/src/Controller/DefaultController.php"
type: annotation
prefix: '%pimcore_studio_ui.url_path%'

pimcore_studio_ui_backend:
resource: "@PimcoreStudioUiBundle/src/Controller/ImageEditorController.php"
type: annotation
prefix: '%pimcore_studio_backend.url_prefix%'

Large diffs are not rendered by default.

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions public/build/23b2086b-21d1-414d-949c-8218dcfe349b/entrypoints.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"entrypoints": {
"core-dll": {
"css": [
"/bundles/pimcorestudioui/build/23b2086b-21d1-414d-949c-8218dcfe349b/core-dll.css"
],
"js": [
"/bundles/pimcorestudioui/build/23b2086b-21d1-414d-949c-8218dcfe349b/core-dll.js"
]
}
}
}

Large diffs are not rendered by default.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"entrypoints": {
"main": {
"js": [
"/bundles/pimcorestudioui/build/9d539d85-7607-4385-931c-769d0dc02691/main.js"
]
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"bundles/pimcorestudioui/build/9d539d85-7607-4385-931c-769d0dc02691/main.js": "/bundles/pimcorestudioui/build/9d539d85-7607-4385-931c-769d0dc02691/main.js"
}
12 changes: 0 additions & 12 deletions public/build/c3109702-c3cc-40bd-98a3-89c446db2c7c/entrypoints.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"entrypoints": {
"vendor": {
"js": [
"/bundles/pimcorestudioui/build/c48f2b95-ec12-4512-b8cc-453248237a1f/vendor.js"
]
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"bundles/pimcorestudioui/build/c48f2b95-ec12-4512-b8cc-453248237a1f/vendor.js": "/bundles/pimcorestudioui/build/c48f2b95-ec12-4512-b8cc-453248237a1f/vendor.js"
}

This file was deleted.

This file was deleted.

21 changes: 21 additions & 0 deletions public/js/lib/minipaint/MIT-LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Copyright (c) ViliusL
https://github.com/viliusle

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2 changes: 2 additions & 0 deletions public/js/lib/minipaint/dist/bundle.js

Large diffs are not rendered by default.

47 changes: 47 additions & 0 deletions public/js/lib/minipaint/dist/bundle.js.LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
object-assign
(c) Sindre Sorhus
@license MIT
*/

/*!

pica
https://github.com/nodeca/pica

*/

/*!
* Block below copied from Protovis: http://mbostock.github.com/protovis/
* Copyright 2010 Stanford Visualization Group
* Licensed under the BSD License: http://www.opensource.org/licenses/bsd-license.php
* @license
*/

/*!
* jQuery JavaScript Library v3.7.1
* https://jquery.com/
*
* Copyright OpenJS Foundation and other contributors
* Released under the MIT license
* https://jquery.org/license
*
* Date: 2023-08-28T13:37Z
*/

/*!
* quantize.js Copyright 2008 Nick Rabinowitz.
* Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
* @license
*/

/*! alertifyjs - v1.13.1 - Mohammad Younes <[email protected]> (http://alertifyjs.com) */

/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */

/**
* hermite-resize - Canvas image resize/resample using Hermite filter with JavaScript.
* @version v2.2.10
* @link https://github.com/viliusle/miniPaint
* @license MIT
*/
1 change: 1 addition & 0 deletions public/js/lib/minipaint/dist/bundle.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added public/js/lib/minipaint/images/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions public/js/lib/minipaint/images/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/js/lib/minipaint/images/grid.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions public/js/lib/minipaint/images/icons/animation.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions public/js/lib/minipaint/images/icons/arrow-down.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions public/js/lib/minipaint/images/icons/blur.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions public/js/lib/minipaint/images/icons/bold.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions public/js/lib/minipaint/images/icons/brush.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions public/js/lib/minipaint/images/icons/bulge_pinch.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading