mirror of
https://github.com/flarum/framework.git
synced 2025-05-23 07:09:57 +08:00
Patch Mithril with a bidi attribute
Enables quick bidirectional bindings. So instead of this: <input value={prop()} oninput={m.withAttr('value', prop)}/> ... we can do this: <input bidi={prop}/>
This commit is contained in:
@ -10,6 +10,7 @@ gulp({
|
|||||||
bowerDir + '/es6-micro-loader/dist/system-polyfill.js',
|
bowerDir + '/es6-micro-loader/dist/system-polyfill.js',
|
||||||
|
|
||||||
bowerDir + '/mithril/mithril.js',
|
bowerDir + '/mithril/mithril.js',
|
||||||
|
bowerDir + '/m.attrs.bidi/bidi.js',
|
||||||
bowerDir + '/jquery/dist/jquery.js',
|
bowerDir + '/jquery/dist/jquery.js',
|
||||||
bowerDir + '/moment/moment.js',
|
bowerDir + '/moment/moment.js',
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
"mithril": "lhorie/mithril.js#next",
|
"mithril": "lhorie/mithril.js#next",
|
||||||
"es6-micro-loader": "caridy/es6-micro-loader#v0.2.1",
|
"es6-micro-loader": "caridy/es6-micro-loader#v0.2.1",
|
||||||
"fastclick": "~1.0.6",
|
"fastclick": "~1.0.6",
|
||||||
"autolink": "*"
|
"autolink": "*",
|
||||||
|
"m.attrs.bidi": "tobscure/m.attrs.bidi"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ gulp({
|
|||||||
bowerDir + '/es6-micro-loader/dist/system-polyfill.js',
|
bowerDir + '/es6-micro-loader/dist/system-polyfill.js',
|
||||||
|
|
||||||
bowerDir + '/mithril/mithril.js',
|
bowerDir + '/mithril/mithril.js',
|
||||||
|
bowerDir + '/m.attrs.bidi/bidi.js',
|
||||||
bowerDir + '/jquery/dist/jquery.js',
|
bowerDir + '/jquery/dist/jquery.js',
|
||||||
bowerDir + '/jquery.hotkeys/jquery.hotkeys.js',
|
bowerDir + '/jquery.hotkeys/jquery.hotkeys.js',
|
||||||
bowerDir + '/color-thief/js/color-thief.js',
|
bowerDir + '/color-thief/js/color-thief.js',
|
||||||
|
@ -8,9 +8,15 @@ export default function patchMithril(global) {
|
|||||||
return comp.component(...args);
|
return comp.component(...args);
|
||||||
}
|
}
|
||||||
|
|
||||||
return mo.apply(this, arguments);
|
const node = mo.apply(this, arguments);
|
||||||
|
|
||||||
|
if (node.attrs.bidi) {
|
||||||
|
m.bidi(node, node.attrs.bidi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return node;
|
||||||
|
};
|
||||||
|
|
||||||
Object.keys(mo).forEach(key => m[key] = mo[key]);
|
Object.keys(mo).forEach(key => m[key] = mo[key]);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user