makes the height adjustment more clean
(no more sleep(100))
This commit is contained in:
@ -126,6 +126,8 @@ WriteLiteral(@">
|
||||
['clean'] // remove formatting button
|
||||
];
|
||||
|
||||
|
||||
$(document).ready(function () {
|
||||
var quill = new Quill('#bubble-container', {
|
||||
modules: {
|
||||
toolbar: toolbarOptions
|
||||
@ -137,13 +139,11 @@ WriteLiteral(@">
|
||||
function getMD() {
|
||||
return markdownize($('#bubble-container div.ql-editor').html())
|
||||
}
|
||||
quill.on('text-change', function (delta, oldDelta, source)
|
||||
{
|
||||
quill.on('text-change', function (delta, oldDelta, source) {
|
||||
if (source === ""user"") {
|
||||
invokeCSharpAction(getMD());
|
||||
}
|
||||
});
|
||||
$(document).ready(function () {
|
||||
// TODO implement a dedicated injection
|
||||
invokeCSharpAction(getMD());
|
||||
});
|
||||
|
@ -46,6 +46,8 @@
|
||||
['clean'] // remove formatting button
|
||||
];
|
||||
|
||||
|
||||
$(document).ready(function () {
|
||||
var quill = new Quill('#bubble-container', {
|
||||
modules: {
|
||||
toolbar: toolbarOptions
|
||||
@ -57,13 +59,11 @@
|
||||
function getMD() {
|
||||
return markdownize($('#bubble-container div.ql-editor').html())
|
||||
}
|
||||
quill.on('text-change', function (delta, oldDelta, source)
|
||||
{
|
||||
quill.on('text-change', function (delta, oldDelta, source) {
|
||||
if (source === "user") {
|
||||
invokeCSharpAction(getMD());
|
||||
}
|
||||
});
|
||||
$(document).ready(function () {
|
||||
// TODO implement a dedicated injection
|
||||
invokeCSharpAction(getMD());
|
||||
});
|
||||
|
@ -29,7 +29,7 @@ namespace BookAStar.Droid
|
||||
if (hybridWebViewRenderer != null && hybridWebViewRenderer.TryGetTarget(out hybridRenderer))
|
||||
{
|
||||
hybridRenderer.Element.Markdown = data;
|
||||
MarkdownViewRenderer.ProperOnPageFinished(hybridRenderer.Element,
|
||||
MarkdownViewRenderer.AdjustHeightRequest(hybridRenderer.Element,
|
||||
hybridRenderer.EditorView);
|
||||
}
|
||||
}
|
||||
@ -58,8 +58,10 @@ namespace BookAStar.Droid
|
||||
/// <param name="view"></param>
|
||||
public static async void AdjustHeightRequest(MarkdownView xview, WebView view)
|
||||
{
|
||||
|
||||
xview.BatchBegin();
|
||||
xview.HeightRequest = view.ContentHeight;
|
||||
var vch = view.ContentHeight; // FIXME why not 3?
|
||||
xview.HeightRequest = vch > xview.MinimumHeightRequest ? vch : xview.MinimumHeightRequest;
|
||||
xview.BatchCommit();
|
||||
}
|
||||
|
||||
@ -69,7 +71,6 @@ namespace BookAStar.Droid
|
||||
var html = editorTemplate.GenerateString();
|
||||
EditorView.LoadDataWithBaseURL("file:///android_asset/",
|
||||
html, "text/html", "utf-8", null);
|
||||
OnPageFinished(Element, editorView);
|
||||
}
|
||||
|
||||
protected override void OnElementChanged(ElementChangedEventArgs<MarkdownView> e)
|
||||
@ -78,6 +79,7 @@ namespace BookAStar.Droid
|
||||
if (Control == null)
|
||||
{
|
||||
SetNativeControl(CreateNativeControl());
|
||||
InjectJS(JavaScriptFunction);
|
||||
}
|
||||
if (e.OldElement != null)
|
||||
{
|
||||
@ -91,7 +93,6 @@ namespace BookAStar.Droid
|
||||
EditorView.SetWebViewClient(viewclient);
|
||||
Control.AddJavascriptInterface(new JsBridgeMarkdown(this), "jsBridge");
|
||||
SetMDEditorText(e.NewElement.Markdown);
|
||||
InjectJS(JavaScriptFunction);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user