+ scroll
This commit is contained in:
parent
7e9e7613ba
commit
bba5fe093c
6 changed files with 74 additions and 75 deletions
34
src/PostIt/PostIt.Tests/MD/le-chant-1.md
Normal file
34
src/PostIt/PostIt.Tests/MD/le-chant-1.md
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
|
||||||
|
Loin vers l'infini s'étendent
|
||||||
|
Les grands prés marécageux .
|
||||||
|
Pas un seul oiseau ne chante
|
||||||
|
Sur les arbres secs et creux !
|
||||||
|
|
||||||
|
*(Refrain)*
|
||||||
|
|
||||||
|
Ô terre de détresse,
|
||||||
|
Où nous devons sans cesse,
|
||||||
|
Piocher, piocher .
|
||||||
|
|
||||||
|
Dans ce camp morne et sauvage
|
||||||
|
Entouré de murs de fer,
|
||||||
|
Il nous semble vivre en cage
|
||||||
|
Au milieu d'un grand désert .
|
||||||
|
|
||||||
|
Bruit des pas et bruit des armes,
|
||||||
|
Sentinelles jours et nuits,
|
||||||
|
Et du sang, et des cris, des larmes,
|
||||||
|
La mort pour celui qui fuit .
|
||||||
|
|
||||||
|
Mais un jour dans notre vie,
|
||||||
|
Le printemps refleurira .
|
||||||
|
Liberté, liberté chérie
|
||||||
|
Je dirai : « Tu es à moi ! »
|
||||||
|
|
||||||
|
*(Dernier refrain)*
|
||||||
|
|
||||||
|
Ô terre d'allégresse,
|
||||||
|
Où nous pourrons sans cesse,
|
||||||
|
Aimer, aimer !
|
||||||
|
|
||||||
|
[audio : Mario Hacquard - Youtube](https://www.youtube.com/watch?v=ogw_mgk1pFs)
|
||||||
|
|
@ -7,26 +7,35 @@
|
||||||
x:Name="Root"
|
x:Name="Root"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
VerticalAlignment="Stretch">
|
VerticalAlignment="Stretch">
|
||||||
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" MinHeight="260">
|
||||||
<Border
|
<Border
|
||||||
BorderBrush="LightGray"
|
BorderBrush="LightGray"
|
||||||
BorderThickness="1"
|
BorderThickness="1"
|
||||||
CornerRadius="5"
|
CornerRadius="5"
|
||||||
IsVisible="{Binding !IsPreviewVisible, ElementName=Root}"
|
IsVisible="{Binding !IsPreviewVisible, ElementName=Root}"
|
||||||
Padding="0">
|
Padding="0"
|
||||||
<AvaloniaEdit:TextEditor
|
MinHeight="260">
|
||||||
x:Name="SourceEditor"
|
<ScrollViewer
|
||||||
Document="{Binding Document, ElementName=Root, Mode=TwoWay}"
|
BringIntoViewOnFocusChange="False"
|
||||||
FontFamily="Cascadia Code,Consolas,Menlo,Monospace"
|
|
||||||
ShowLineNumbers="True"
|
|
||||||
WordWrap="True"
|
|
||||||
BorderThickness="0"
|
|
||||||
Padding="5,5,5,15"
|
|
||||||
HorizontalAlignment="Stretch"
|
|
||||||
VerticalAlignment="Stretch"
|
|
||||||
HorizontalScrollBarVisibility="Disabled"
|
HorizontalScrollBarVisibility="Disabled"
|
||||||
TextInputOptions.Multiline="True"
|
VerticalScrollBarVisibility="Auto"
|
||||||
TextInputOptions.ReturnKeyType="Default" />
|
HorizontalAlignment="Stretch"
|
||||||
|
VerticalAlignment="Stretch">
|
||||||
|
<AvaloniaEdit:TextEditor
|
||||||
|
x:Name="SourceEditor"
|
||||||
|
Document="{Binding Document, ElementName=Root, Mode=TwoWay}"
|
||||||
|
FontFamily="Cascadia Code,Consolas,Menlo,Monospace"
|
||||||
|
ShowLineNumbers="True"
|
||||||
|
WordWrap="True"
|
||||||
|
BorderThickness="0"
|
||||||
|
Padding="5,5,5,15"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
VerticalAlignment="Stretch"
|
||||||
|
HorizontalScrollBarVisibility="Disabled"
|
||||||
|
VerticalScrollBarVisibility="Auto"
|
||||||
|
TextInputOptions.Multiline="True"
|
||||||
|
TextInputOptions.ReturnKeyType="Default" />
|
||||||
|
</ScrollViewer>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<Border
|
<Border
|
||||||
|
|
@ -34,7 +43,8 @@
|
||||||
BorderThickness="1"
|
BorderThickness="1"
|
||||||
CornerRadius="5"
|
CornerRadius="5"
|
||||||
IsVisible="{Binding IsPreviewVisible, ElementName=Root}"
|
IsVisible="{Binding IsPreviewVisible, ElementName=Root}"
|
||||||
Padding="8">
|
Padding="8"
|
||||||
|
MinHeight="260">
|
||||||
<ScrollViewer
|
<ScrollViewer
|
||||||
BringIntoViewOnFocusChange="False"
|
BringIntoViewOnFocusChange="False"
|
||||||
HorizontalScrollBarVisibility="Disabled"
|
HorizontalScrollBarVisibility="Disabled"
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,14 @@
|
||||||
<Design.DataContext>
|
<Design.DataContext>
|
||||||
<vm:BlogsViewModel />
|
<vm:BlogsViewModel />
|
||||||
</Design.DataContext>
|
</Design.DataContext>
|
||||||
<StackPanel Margin="5,5,10,5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
<ScrollViewer
|
||||||
|
Margin="5,5,10,5"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
VerticalAlignment="Stretch"
|
||||||
|
HorizontalScrollBarVisibility="Disabled"
|
||||||
|
VerticalScrollBarVisibility="Auto"
|
||||||
|
BringIntoViewOnFocusChange="False">
|
||||||
|
<StackPanel HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
||||||
|
|
||||||
<WrapPanel x:Name="BlogsHeaderPanel"
|
<WrapPanel x:Name="BlogsHeaderPanel"
|
||||||
Margin="5"
|
Margin="5"
|
||||||
|
|
@ -100,7 +107,7 @@
|
||||||
</CommandBar.PrimaryCommands>
|
</CommandBar.PrimaryCommands>
|
||||||
</CommandBar>
|
</CommandBar>
|
||||||
|
|
||||||
<Grid Margin="12" RowSpacing="12" x:Name="MainGrid">
|
<Grid Margin="12" RowSpacing="12" x:Name="MainGrid" MinHeight="500">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
|
|
@ -191,4 +198,5 @@
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
</ScrollViewer>
|
||||||
</ContentPage>
|
</ContentPage>
|
||||||
|
|
|
||||||
|
|
@ -4,69 +4,16 @@ using Avalonia.Controls;
|
||||||
using Avalonia.Platform.Storage;
|
using Avalonia.Platform.Storage;
|
||||||
using Avalonia.Controls.Primitives;
|
using Avalonia.Controls.Primitives;
|
||||||
using Avalonia.Interactivity;
|
using Avalonia.Interactivity;
|
||||||
using Avalonia.Controls.Platform;
|
|
||||||
|
|
||||||
namespace PostIt.Views.Blogs;
|
namespace PostIt.Views.Blogs;
|
||||||
|
|
||||||
public partial class BlogsPage : ContentPage
|
public partial class BlogsPage : ContentPage
|
||||||
{
|
{
|
||||||
private IInputPane? _inputPane;
|
|
||||||
|
|
||||||
public BlogsPage()
|
public BlogsPage()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnLoaded(RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
base.OnLoaded(e);
|
|
||||||
|
|
||||||
// Récupère l'accès au TopLevel de la fenêtre/application
|
|
||||||
var topLevel = TopLevel.GetTopLevel(this);
|
|
||||||
if (topLevel != null)
|
|
||||||
{
|
|
||||||
_inputPane = topLevel!.InputPane;
|
|
||||||
if (_inputPane != null)
|
|
||||||
{
|
|
||||||
// S'abonne aux changements d'état du clavier virtuel
|
|
||||||
_inputPane.StateChanged += OnInputPaneStateChanged;
|
|
||||||
|
|
||||||
// Applique la configuration initiale si le clavier est déjà présent
|
|
||||||
UpdateLayoutForKeyboard(_inputPane.OccludedRect.Height);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnUnloaded(RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
if (_inputPane != null)
|
|
||||||
{
|
|
||||||
_inputPane.StateChanged -= OnInputPaneStateChanged;
|
|
||||||
}
|
|
||||||
base.OnUnloaded(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void UpdateLayoutForKeyboard(double keyboardHeight)
|
|
||||||
{
|
|
||||||
double visibleHeight = this.Bounds.Height - keyboardHeight;
|
|
||||||
if (keyboardHeight > 0)
|
|
||||||
{
|
|
||||||
DraftArticleTextEditor.MaxHeight = visibleHeight;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
DraftArticleTextEditor.MaxHeight = double.PositiveInfinity;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnInputPaneStateChanged(object? sender, InputPaneStateEventArgs e)
|
|
||||||
{
|
|
||||||
// e.EndRect contient le rectangle final du clavier virtuel
|
|
||||||
// e.EndRect.Height vous donne sa hauteur exacte en pixels indépendants du périphérique (pixels logiques)
|
|
||||||
UpdateLayoutForKeyboard(e.EndRect.Height);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
|
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
|
||||||
{
|
{
|
||||||
base.OnApplyTemplate(e);
|
base.OnApplyTemplate(e);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1 @@
|
||||||
.user-icon {
|
.user-icon{max-width:1.5em;max-height:1.5em}.card{padding:.5em}
|
||||||
max-width: 1.5em;
|
|
||||||
max-height: 1.5em;
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,7 @@
|
||||||
user-icon {
|
.user-icon {
|
||||||
max-width: 1.5em;
|
max-width: 1.5em;
|
||||||
max-height: 1.5em;
|
max-height: 1.5em;
|
||||||
}
|
}
|
||||||
|
.card {
|
||||||
|
padding: .5em;
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue