Skip to content

Commit 8219d8c

Browse files
committed
Updated the library to allow manhattan image editor support to be namespaced preventing conflicts with frontend use of the library
1 parent b27384b commit 8219d8c

File tree

5 files changed

+16
-6
lines changed

5 files changed

+16
-6
lines changed

module/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,10 @@ export function init(baseURL='/', baseFlowURL='/', baseParams={}) {
171171
// Initialize the page flow manager
172172
flowMgr.init('[data-cf-flow]', new FlowAPI(baseFlowURL, baseParams))
173173

174+
// Create an element in which manhattan specific UI elements should be
175+
// rooted.
176+
document.body.appendChild($.create('div', {'data-mh-content-ui': ''}))
177+
174178
// Configure save behaviour for flows and global content
175179

176180
// Flows

module/tools/imagery.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,10 @@ class ImageTool extends ContentTools.Tool {
6868
} else {
6969

7070
// Make the upload URL configurable
71-
const imageUploader = new ImageUploader(ImageTool.uploadURL)
71+
const imageUploader = new ImageUploader(
72+
ImageTool.uploadURL,
73+
$.one('[data-mh-content-ui]')
74+
)
7275
imageUploader.init()
7376
imageUploader.show()
7477

@@ -174,7 +177,8 @@ class ImageTool extends ContentTools.Tool {
174177
imageURL,
175178
cropRatio,
176179
fixCropRatio,
177-
[600, 600]
180+
[600, 600],
181+
$.one('[data-mh-content-ui]')
178182
)
179183
imageEditor.init()
180184
imageEditor.show()

module/ui/imagery.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import {Uploader} from 'manhattan-assets/module/ui/uploader'
1111
*/
1212
export class ImageUploader extends Overlay {
1313

14-
constructor(uploadURL) {
15-
super()
14+
constructor(uploadURL, container=null) {
15+
super(container)
1616

1717
// The URL images should be uploaded to
1818
this._uploadURL = uploadURL

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "manhattan-content",
3-
"version": "1.0.0-beta.2",
3+
"version": "1.0.0-beta.3",
44
"description": "Content editing for the manhattan web framework",
55
"engines": {
66
"node": ">=8.9.4"

scss/content.scss

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11

2-
@import 'ui/image-uploader';
2+
[data-mh-content-ui] {
3+
@import 'ui/image-uploader';
4+
}

0 commit comments

Comments
 (0)