Comments (7)
Hi @AdamOstrove ,
that's a very interesting approach. I will look forward of any progress on this.
Tomorrow I will play with your branch to see how it works
thanks!
from dante.
+1 Any idea when this is coming to the main branch?
from dante.
Hi @AdamOstrove.
Please check branch modular-tooltip
I've came up with the following solution based on your concept design. I've decoupled the Tooltip view in widgets (image , extract & embed) which are inherited from a Dante.View.TooltipWidget object.
So now you can inherit from the new Dante.View.TooltipWidget. and create new instances of tooltip button with a custom behavior.
window.MyCustomTooltip = Dante.View.TooltipWidget.extend({
initialize: function(opts) {
if (opts == null) {
opts = {};
}
this.icon = opts.icon || "icon-video";
this.title = opts.title || "Add a Custom Thing!";
this.action = opts.action || "custom-embed-simple";
return this.current_editor = opts.current_editor;
},
handleClick: function(ev) {
return alert("This is custom button with extend style");
}
});
Then just add it as an option with the new extra_tooltip_widgets initialization attribute. It will accept an array of tooltip button objects, so you can add as many as you want without the register hassle, it will just work.
var btn1 = new window.MyCustomTooltip
editor = new Dante.Editor(
{
el: "#editor",
upload_url: "/uploads/new.json",
debug: true ,
extra_tooltip_widgets: [btn1, ...]
}
)
editor.start()
I think this solution is very neat , what do you think about it ? maybe you could take this as an starting point in order to improve this solution
Best
from dante.
I really like this idea! It is very neat, and certainly a step in the right direction. My main concern with it is a small legacy connection between the base widgets (embeds and extracts specifically) and the Dante Core.
#embeds or extracts
if parent.hasClass("is-embedable")
@embed_widget.getEmbedFromNode($(anchor_node))
else if parent.hasClass("is-extractable")
@embed_extract_widget.getExtractFromNode($(anchor_node))
This check is made in Dante, so turning embeds or extracts from placeholders into realized structures and what to do with those structures is still controlled by the Dante core. As far as I can tell, this makes it impossible to make a new widget with similar behavior to the first three (placeholder followed by a complete structure) without modifying Dante code directly. Have you given any thought to removing that last legacy tie somehow?
Thanks
from dante.
Hi @AdamOstrove , I've noted that too.
I guess we could call each embed object for specific function so when program executes handleKeyDown (checking keycode 13) , Dante core will call each embed handleKeyDown() like you have done it in your prototype. that way we will ensure that core embeds and custom embeds will be handle that events too.
how it that sounds ?
from dante.
That sounds good to me. I cant really think of a much better way of doing it.
from dante.
Hi @AdamOstrove , it's finally merged and released as version 0.0.11
best!
from dante.
Related Issues (20)
- How to multi-column? HOT 4
- how can i compile it to plain vanillaJS? HOT 1
- prosemirror-state package constructor issue HOT 2
- "Cannot load such file -- coffee_script" for Rails 7 HOT 1
- Cannot Start a New Line When Uploading Images & Image Gets Deleted When Pressed Enter [Video Included] HOT 2
- prosemirrorState Error HOT 37
- cannot build dante3 HOT 2
- running Dante locally with errors... HOT 1
- where can I find "Clear Format" ? HOT 3
- prosemirrorState.PluginKey is not a constructor HOT 7
- Dante3 not working with vite HOT 7
- RangeError: Adding different instances of a keyed plugin (plugin$) HOT 4
- Is that possible? Add JS dynamic charts. HOT 13
- How would I get the "raw" html for image block?
- TypeError: Cannot read properties of undefined (reading 'Extension') HOT 3
- How can I use Dante with JQuery?
- Dante 3 Nextjs page to Nextjs app HOT 9
- Dante3 doesn't work with Vite HOT 1
- Need help in fixing Dante-3 issues HOT 1
- Uncaught TypeError: styled.div is not a function HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dante.