Skip to content

Commit

Permalink
fix: editor image
Browse files Browse the repository at this point in the history
  • Loading branch information
lovefields committed Oct 11, 2024
1 parent 426d3bb commit d864c81
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dragon-editor",
"version": "3.4.1",
"version": "3.4.2",
"description": "Javascript WYSIWYG editor in Nuxt3!",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/components/DragonEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ function getContentData(): DEContentData {
}
function setContentData(data: DEContentData) {
_setContentData(data, editorStore);
_setContentData(data, editorStore, props.imageHostURL);
}
function moveBlock(type: "up" | "down") {
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/utils/block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export function _createListItemBlock(child: DEListItem = { textContent: "", clas
}

// 이미지 블럭 생성
export function _createImageBlock(data: DEImageBlock): HTMLDivElement {
export function _createImageBlock(data: DEImageBlock, imageHostURL: string): HTMLDivElement {
const $wrap = document.createElement("div") as HTMLDivElement;
const $div = document.createElement("div") as HTMLDivElement;
const $leftBtn = document.createElement("button") as HTMLButtonElement;
Expand All @@ -117,7 +117,7 @@ export function _createImageBlock(data: DEImageBlock): HTMLDivElement {
$div.dataset["maxwidth"] = String(data.maxWidth);
}

$image.src = data.src;
$image.src = imageHostURL + data.src;
$image.width = data.width;
$image.height = data.height;
$image.draggable = false;
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/utils/convertor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export function _getContentData($content: HTMLDivElement, imageHostURL: string):
}

// 데이터를 화면으로 변환
export function _setContentData(data: DEContentData, store: any) {
export function _setContentData(data: DEContentData, store: any, imageHostURL: string) {
const childList: HTMLElement[] = [];

data.forEach((item) => {
Expand All @@ -52,7 +52,7 @@ export function _setContentData(data: DEContentData, store: any) {
childList.push(_createListBlock(item));
break;
case "image":
childList.push(_createImageBlock(item));
childList.push(_createImageBlock(item,imageHostURL));
break;
case "code":
childList.push(_createCodeBlock(item));
Expand Down

0 comments on commit d864c81

Please sign in to comment.