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

feat: support disabling image tool #6320

Merged
merged 7 commits into from
Nov 14, 2023
Merged

Conversation

dwelle
Copy link
Member

@dwelle dwelle commented Mar 5, 2023

fix #4831

Disables image tool/image insertion when props.UIOptions.tools.image = false.

Non-goals:

  • doesn't affect tool keyboard shortcuts -> if image tool is disabled, there'll be a hole in the numeric shortcuts:

    image

  • does not disable importing .excalidraw files that contain images. We may add support for disabling later after we decide on API and what should happen.

@vercel
Copy link

vercel bot commented Mar 5, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
excalidraw ✅ Ready (Inspect) Visit Preview Nov 14, 2023 6:48am
excalidraw-package-example ✅ Ready (Inspect) Visit Preview Nov 14, 2023 6:48am
1 Ignored Deployment
Name Status Preview Updated (UTC)
docs ⬜️ Ignored (Inspect) Visit Preview Nov 14, 2023 6:48am

@p2gdeveloper
Copy link

I had a quick look at the Preview. Works as expected except that the icon is still visible in the toolbar with no obvious indicator that it is disabled. I would take it as is but just thought I should flag that as I think it would be better.

@eMerzh
Copy link

eMerzh commented Mar 24, 2023

awesome @dwelle ... really hope thid can be merged, but as p2gdeveloper the preview seems to have the image button visible .. but it seems you can't add one via this... but if i drag &drop an image, it seems to accept it

@dwelle
Copy link
Member Author

dwelle commented Mar 26, 2023

@eMerzh this PR doesn't disable the image tool (since we don't want to disable by default), so it will work in the preview. But I've pushed debug commit we'll remove before merge so we can test: https://excalidraw-ev2ennbl1-excalidraw.vercel.app/

As for when this PR can be merged, there are some things left to be figured out (namely importing files / links that already contain images, and what should we do in those cases).

I've contacted the creator of the original PR to discuss our next steps: #5133 (comment)

@mstelz
Copy link

mstelz commented Aug 25, 2023

What are thoughts on this feature? Would love to see this capability

@eMerzh
Copy link

eMerzh commented Oct 20, 2023

i don't want to do much noise, but is there something new on this front?
can i hope have some sort of support for this or it's a nogo ?

@dwelle
Copy link
Member Author

dwelle commented Oct 20, 2023

sorry, will take a look

@eMerzh
Copy link

eMerzh commented Oct 20, 2023

sorry, will take a look

Ahah no need to apologize 😅...but I will be happy if this get merged of course 😊

@dwelle dwelle force-pushed the dwelle/support-disabling-image-tool branch from 564c662 to 999bbfb Compare November 13, 2023 14:37
Copy link

github-actions bot commented Nov 13, 2023

Coverage Report

Status Category Percentage Covered / Total
🟢 Lines 73.61% / 70% 44821 / 60888
🟢 Statements 73.61% / 70% 44821 / 60888
🟢 Functions 69.83% / 68% 1431 / 2049
🟢 Branches 81.08% / 70% 5636 / 6951
File Coverage
File Stmts % Branch % Funcs % Lines Uncovered Lines
Changed Files
src/constants.ts 99.42% 42.85% 100% 99.42% 11-12
src/errors.ts 50% 100% 33.33% 50% 5-11, 25-34
src/types.ts 100% 100% 100% 100%
src/components/Actions.tsx 94.1% 92.18% 37.5% 94.1% 168-172, 242-243, 265-268, 274-277, 398-406
src/components/App.tsx 73.25% 76.12% 73.49% 73.25% 419-420, 603-604, 630-690, 693-699, 702-705, 708-780, 783-802, 810-822, 827-828, 832-834, 853-955, 1015-1016, 1047-1052, 1057-1101, 1106, 1130, 1140, 1147-1150, 1185-1186, 1264-1270, 1362-1367, 1370-1400, 1403-1443, 1489-1490, 1508-1509, 1546-1547, 1551-1552, 1568-1575, 1580-1593, 1599-1600, 1605-1613, 1615-1623, 1635, 1675-1676, 1698-1699, 1706, 1767-1769, 1772-1777, 1782-1783, 1818-1826, 1903-1905, 1966-1967, 1980-1983, 1986, 1988-1989, 1996-1997, 2003-2004, 2012-2013, 2016-2017, 2020-2023, 2026-2029, 2040-2048, 2053-2054, 2110-2111, 2125-2131, 2137-2145, 2149-2157, 2161-2162, 2165-2202, 2205-2217, 2228-2229, 2240-2241, 2259-2263, 2267-2270, 2277-2279, 2297-2304, 2307, 2309-2314, 2318-2320, 2336-2337, 2339-2348, 2374, 2380, 2419-2420, 2437-2439, 2461-2462, 2468-2471, 2477-2552, 2624-2625, 2630-2633, 2696, 2706-2724, 2727-2733, 2736-2737, 2743-2756, 2842-2843, 2845-2846, 2851-2853, 2878-2892, 2897-2916, 2939-2940, 2973-2975, 3000, 3019-3023, 3034-3035, 3038-3042, 3044-3045, 3047-3050, 3075-3076, 3085-3087, 3089, 3164-3167, 3189-3191, 3201-3202, 3204-3224, 3227-3233, 3250-3253, 3259-3262, 3272-3279, 3283-3284, 3289, 3317-3321, 3325, 3330-3331, 3336-3340, 3372-3373, 3376-3377, 3385-3389, 3393-3403, 3408-3435, 3440-3451, 3510, 3536-3537, 3628, 3805-3806, 3809-3810, 3818, 3830, 3832-3833, 3874-3878, 3929-3935, 3941-4004, 4046, 4095, 4153, 4201-4204, 4207-4213, 4215-4218, 4233-4242, 4245-4246, 4327-4328, 4331, 4333-4334, 4340-4342, 4344, 4353, 4375-4380, 4382-4385, 4389-4390, 4400-4487, 4490-4491, 4505-4506, 4557-4558, 4585-4586, 4616-4642, 4649-4650, 4673-4674, 4694, 4696-4697, 4713-4714, 4720-4721, 4725-4728, 4731-4732, 4747-4774, 4782, 4784, 4786-4790, 4849-4854, 4856-4858, 4874, 4876-4887, 4912-4915, 4974-4975, 4977-5000, 5015-5016, 5128-5157, 5222-5226, 5249-5250, 5270-5271, 5364, 5370-5371, 5394-5413, 5428, 5561, 5584-5635, 5650, 5659, 5693-5699, 5714-5716, 5857-5861, 5885-5913, 5949, 5951-5958, 5965-5968, 5981, 6004-6005, 6008-6009, 6014-6016, 6019-6020, 6045-6046, 6074-6075, 6157-6158, 6207-6220, 6280-6283, 6309-6310, 6355, 6373-6379, 6386-6389, 6412-6417, 6488-6491, 6497, 6512-6519, 6522-6529, 6585, 6659-6660, 6680-6682, 6685, 6699-6723, 6829-6848, 6858-6897, 6910-6911, 6920-6927, 6941-6953, 6966-6971, 7023-7051, 7053-7054, 7128-7132, 7139, 7141-7177, 7206, 7256, 7275-7277, 7302-7307, 7309-7310, 7315-7346, 7349-7373, 7387-7388, 7394-7403, 7408, 7412-7416, 7425-7426, 7429-7434, 7438-7445, 7475, 7477-7481, 7483-7493, 7509-7511, 7522-7530, 7534-7570, 7573-7644, 7652, 7670-7677, 7679-7695, 7710-7732, 7751-7753, 7798-7799, 7829-7830, 7846, 7923-7926, 7928-7944, 7946-7950, 7962-7963, 7973-7989, 8023-8024, 8028-8040, 8050, 8052-8055, 8057-8058, 8098, 8119-8120, 8146, 8149, 8189, 8200-8207, 8223-8224, 8256-8259, 8328-8338, 8340-8350, 8381-8388, 8414-8415, 8456-8510, 8554-8555, 8564-8567, 8572-8573, 8594-8596, 8598-8602, 8640
src/components/LayerUI.tsx 81.67% 84.44% 46.15% 81.67% 300, 339-344, 388-433, 436-440, 447-455, 498-506, 512-515, 539-548, 555-569
src/components/MobileMenu.tsx 83.01% 40% 50% 83.01% 135-140, 161-169, 181-189, 194-205
src/data/blob.ts 58.71% 62.31% 67.85% 58.71% 26-34, 37, 57-65, 76-80, 82, 86, 94-99, 102-105, 108-110, 133-140, 153, 168-174, 192-193, 203-204, 222-223, 226-232, 236-237, 244-255, 270-280, 283-329, 332-335, 338-360, 375-385, 413, 415-416, 442-453, 460-461, 469-470, 476-477
src/packages/excalidraw/index.tsx 78.51% 88.88% 75% 78.51% 80-84, 138-187
Generated in workflow #999

Copy link

github-actions bot commented Nov 13, 2023

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
dist/excalidraw.production.min.js 314.63 KB (+0.16% 🔺) 6.3 s (+0.16% 🔺) 999 ms (-6.9% 🔽) 7.3 s
dist/excalidraw-assets/locales 280.73 KB (0%) 5.7 s (0%) 233 ms (+8.81% 🔺) 5.9 s
dist/excalidraw-assets/vendor*.js 826.02 KB (0%) 16.6 s (0%) 2.3 s (+53.62% 🔺) 18.8 s

Copy link
Member

@ad1992 ad1992 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you also add a button in the excalidraw package example to disable image tool ?

src/components/App.tsx Outdated Show resolved Hide resolved
@@ -19,6 +19,8 @@ Please add the latest change on the top under the correct section.

#### BREAKING CHANGE

- Added support for disabling `image` tool (also disabling image insertion in general, though keeps support for importing from `.excalidraw` files) [#6320](https://github.com/excalidraw/excalidraw/pull/6320).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Breaking change isn't a separate type but a subtype and this is interfering with continuity of the feature excalidraw API breaking change.
This should be added under feature and then breaking change as a subtype under it similar to excalidrawAPI

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved to feature as filing under breaking change was a mistake. There's no breaking change with this API.

That said, we should be structuring our breaking changes differently, and if nothing else, list them first and that's the most important thing for host apps when reading a changelog.

Copy link
Member

@ad1992 ad1992 Nov 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That said, we should be structuring our breaking changes differently, and if nothing else, list them first and that's the most important thing for host apps when reading a changelog.

When breaking change is as result of some feature / fix then it should be a sub heading so its clear why it was introduced and how to deal with it instead of separating features/fixes and breaking change separately. Even when its a subheading its going to catch the attention as well and also explain the context better due to main heading.

EDIT: Thinking again since we have been pushed breaking changes to make the API better in that case its not good to split it across multiple headings so I will club into one heading "Breaking Changes" instead so all breaking changes are at one place

Co-authored-by: Aakansha Doshi <aakansha1216@gmail.com>
@ad1992 ad1992 mentioned this pull request Nov 14, 2023
11 tasks
@dwelle dwelle merged commit 9c42522 into master Nov 14, 2023
9 checks passed
@dwelle dwelle deleted the dwelle/support-disabling-image-tool branch November 14, 2023 09:25
ad1992 added a commit that referenced this pull request Nov 14, 2023
Co-authored-by: Aakansha Doshi <aakansha1216@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

support to disable image upload
5 participants