Skip to content

Commit fe3b30b

Browse files
committed
Added showUrlInput config for asset manager model.
Added src option in component setting for images.
1 parent 48c9e3f commit fe3b30b

File tree

4 files changed

+27
-2
lines changed

4 files changed

+27
-2
lines changed

src/App/Editor/AssetRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class AssetRepository
1010
public function getAllMediaLinks()
1111
{
1212
$allStoredMedia = Media::all()->map(function($media){
13-
return route('media.show', $media);
13+
return $media->getFullUrl();
1414
});
1515

1616
return $allStoredMedia->toArray();

src/App/Editor/EditorAssetManager.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ class EditorAssetManager
1414
public int $dropzone = 1;
1515
public int $openAssetsOnDrop = 0;
1616
public string $modalTitle = 'Upload Images';
17+
public bool $showUrlInput = false;
1718

1819
function __construct($save_url = null)
1920
{

src/public/vendor/grapesjs/editor.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/resources/js/gjs/gjs.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,30 @@ editor.DomComponents.addType("iframe", {
320320
}
321321
});
322322

323+
editor.DomComponents.addType('image', {
324+
isComponent: el => el.tagName == 'IMG',
325+
model: {
326+
defaults: {
327+
traits: [
328+
{
329+
name: 'src',
330+
placeholder: 'Insert image url here.',
331+
},
332+
{
333+
type: 'button',
334+
text: 'Choose Image',
335+
full: true, // Full width button
336+
command: function(editor){
337+
editor.getSelected().trigger('active')
338+
},
339+
340+
},
341+
'alt',
342+
],
343+
},
344+
},
345+
});
346+
323347
if (config.templatesUrl) {
324348
fetch(config.templatesUrl)
325349
.then(resp => resp.json())

0 commit comments

Comments
 (0)