Skip to content

Commit

Permalink
rename MAX_IMAGE_SIZE to MAX_URL_SIZE
Browse files Browse the repository at this point in the history
  • Loading branch information
Wattenberger committed Jan 13, 2023
1 parent 6bb9433 commit b627255
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions blocks/file-blocks/markdown-edit/extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export function makeExtensions({
EditorView.domEventHandlers({
paste(e, view) {
const value = e.clipboardData?.items[0];
const MAX_IMAGE_SIZE = 5000000;
const MAX_URL_SIZE = 5000000;
// handle images pasted from the web
if (value && value.type === "text/html") {
value.getAsString((str) => {
Expand All @@ -142,7 +142,7 @@ export function makeExtensions({
from: view.state.selection.main.from,
to: view.state.selection.main.to,
insert: images
.filter((image) => image && image.length < MAX_IMAGE_SIZE)
.filter((image) => image && image.length < MAX_URL_SIZE)
.map((image) => `![${image}](${image})`)
.join("\n"),
},
Expand All @@ -158,7 +158,7 @@ export function makeExtensions({
const reader = new FileReader();
reader.onload = (e) => {
const image = e.target?.result as string;
if (image && image.length < MAX_IMAGE_SIZE) {
if (image && image.length < MAX_URL_SIZE) {
view.dispatch({
changes: {
from: view.state.selection.main.from,
Expand Down

0 comments on commit b627255

Please sign in to comment.